From 0fc0a5b526ce999206ee6387c3ad3afa2bde5d22 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Fri, 9 Oct 2015 17:40:54 -0400 Subject: [PATCH] Add support for gfx803 Create new device_info and add device ID. Add helper macros to identify chip families (VI, discrete). For now gfx803 behaves like gfx802. But if necessary we can have gfx802 or gfx803-specific code paths or workarounds in the future. Change-Id: I61b4ffef7dd7796bb34cb01fbff0089bd49507bb --- src/queues.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/queues.c b/src/queues.c index bf0f7e0f1f..9702ccd6ab 100644 --- a/src/queues.c +++ b/src/queues.c @@ -42,9 +42,13 @@ enum asic_family_type { CHIP_KAVERI = 0, CHIP_CARRIZO, - CHIP_TONGA + CHIP_TONGA, + CHIP_FIJI }; +#define IS_VI(chip) ((chip) >= CHIP_CARRIZO && (chip) <= CHIP_FIJI) +#define IS_DGPU(chip) ((chip) >= CHIP_TONGA && (chip) <= CHIP_FIJI) + struct device_info { enum asic_family_type asic_family; @@ -73,6 +77,12 @@ struct device_info tonga_device_info = { .eop_buffer_size = TONGA_PAGE_SIZE, }; +struct device_info fiji_device_info = { + .asic_family = CHIP_FIJI, + .ctx_save_restore_size = TONGA_PAGE_SIZE, + .eop_buffer_size = TONGA_PAGE_SIZE, +}; + struct device_id { uint16_t dev_id; @@ -116,6 +126,7 @@ struct device_id supported_devices[] = { { 0x6930, &tonga_device_info }, { 0x6938, &tonga_device_info }, { 0x6939, &tonga_device_info }, + { 0x7300, &fiji_device_info }, { 0, NULL } }; @@ -215,7 +226,7 @@ void free_exec_aligned_memory_gpu(void *addr, uint32_t size) static void* allocate_exec_aligned_memory(uint32_t size, uint32_t align, enum asic_family_type type) { - if (type == CHIP_TONGA) + if (IS_DGPU(type)) return allocate_exec_aligned_memory_gpu(size, TONGA_PAGE_SIZE); return allocate_exec_aligned_memory_cpu(size, align); } @@ -228,7 +239,7 @@ static void release_exec_aligned_memory_gpu(void *addr, uint32_t size) static void release_exec_aligned_memory(void *addr, uint32_t size, enum asic_family_type type) { - if (type == CHIP_TONGA) + if (IS_DGPU(type)) release_exec_aligned_memory_gpu(addr, TONGA_PAGE_SIZE); else free(addr); @@ -249,7 +260,7 @@ static void free_queue_gpu(struct queue *q) static void free_queue(struct queue *q, enum asic_family_type type) { - if (type == CHIP_TONGA) + if (IS_DGPU(type)) return free_queue_gpu(q); return free_queue_cpu(q); }