Commit 597364ad authored by Mukul Joshi's avatar Mukul Joshi Committed by Alex Deucher

drm/amdkfd: Fix reserved SDMA queues handling

This patch fixes a regression caused by a bad merge where
the handling of reserved SDMA queues was accidentally removed.
With the fix, the reserved SDMA queues are again correctly
marked as unavailable for allocation.

Fixes: a805889a ("drm/amdkfd: Update SDMA queue management for GFX9.4.3")
Signed-off-by: default avatarMukul Joshi <mukul.joshi@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c1ac2ea8
...@@ -106,20 +106,19 @@ static void kfd_device_info_set_sdma_info(struct kfd_dev *kfd) ...@@ -106,20 +106,19 @@ static void kfd_device_info_set_sdma_info(struct kfd_dev *kfd)
kfd->device_info.num_sdma_queues_per_engine = 8; kfd->device_info.num_sdma_queues_per_engine = 8;
} }
bitmap_zero(kfd->device_info.reserved_sdma_queues_bitmap, KFD_MAX_SDMA_QUEUES);
switch (sdma_version) { switch (sdma_version) {
case IP_VERSION(6, 0, 0): case IP_VERSION(6, 0, 0):
case IP_VERSION(6, 0, 1):
case IP_VERSION(6, 0, 2): case IP_VERSION(6, 0, 2):
case IP_VERSION(6, 0, 3): case IP_VERSION(6, 0, 3):
/* Reserve 1 for paging and 1 for gfx */ /* Reserve 1 for paging and 1 for gfx */
kfd->device_info.num_reserved_sdma_queues_per_engine = 2; kfd->device_info.num_reserved_sdma_queues_per_engine = 2;
/* BIT(0)=engine-0 queue-0; BIT(1)=engine-1 queue-0; BIT(2)=engine-0 queue-1; ... */ /* BIT(0)=engine-0 queue-0; BIT(1)=engine-1 queue-0; BIT(2)=engine-0 queue-1; ... */
kfd->device_info.reserved_sdma_queues_bitmap = 0xFULL; bitmap_set(kfd->device_info.reserved_sdma_queues_bitmap, 0,
break; kfd->adev->sdma.num_instances *
case IP_VERSION(6, 0, 1): kfd->device_info.num_reserved_sdma_queues_per_engine);
/* Reserve 1 for paging and 1 for gfx */
kfd->device_info.num_reserved_sdma_queues_per_engine = 2;
/* BIT(0)=engine-0 queue-0; BIT(1)=engine-0 queue-1; ... */
kfd->device_info.reserved_sdma_queues_bitmap = 0x3ULL;
break; break;
default: default:
break; break;
......
...@@ -123,11 +123,6 @@ unsigned int get_num_xgmi_sdma_queues(struct device_queue_manager *dqm) ...@@ -123,11 +123,6 @@ unsigned int get_num_xgmi_sdma_queues(struct device_queue_manager *dqm)
dqm->dev->kfd->device_info.num_sdma_queues_per_engine; dqm->dev->kfd->device_info.num_sdma_queues_per_engine;
} }
static inline uint64_t get_reserved_sdma_queues_bitmap(struct device_queue_manager *dqm)
{
return dqm->dev->kfd->device_info.reserved_sdma_queues_bitmap;
}
static void init_sdma_bitmaps(struct device_queue_manager *dqm) static void init_sdma_bitmaps(struct device_queue_manager *dqm)
{ {
bitmap_zero(dqm->sdma_bitmap, KFD_MAX_SDMA_QUEUES); bitmap_zero(dqm->sdma_bitmap, KFD_MAX_SDMA_QUEUES);
...@@ -135,6 +130,11 @@ static void init_sdma_bitmaps(struct device_queue_manager *dqm) ...@@ -135,6 +130,11 @@ static void init_sdma_bitmaps(struct device_queue_manager *dqm)
bitmap_zero(dqm->xgmi_sdma_bitmap, KFD_MAX_SDMA_QUEUES); bitmap_zero(dqm->xgmi_sdma_bitmap, KFD_MAX_SDMA_QUEUES);
bitmap_set(dqm->xgmi_sdma_bitmap, 0, get_num_xgmi_sdma_queues(dqm)); bitmap_set(dqm->xgmi_sdma_bitmap, 0, get_num_xgmi_sdma_queues(dqm));
/* Mask out the reserved queues */
bitmap_andnot(dqm->sdma_bitmap, dqm->sdma_bitmap,
dqm->dev->kfd->device_info.reserved_sdma_queues_bitmap,
KFD_MAX_SDMA_QUEUES);
} }
void program_sh_mem_settings(struct device_queue_manager *dqm, void program_sh_mem_settings(struct device_queue_manager *dqm,
......
...@@ -239,7 +239,7 @@ struct kfd_device_info { ...@@ -239,7 +239,7 @@ struct kfd_device_info {
uint32_t no_atomic_fw_version; uint32_t no_atomic_fw_version;
unsigned int num_sdma_queues_per_engine; unsigned int num_sdma_queues_per_engine;
unsigned int num_reserved_sdma_queues_per_engine; unsigned int num_reserved_sdma_queues_per_engine;
uint64_t reserved_sdma_queues_bitmap; DECLARE_BITMAP(reserved_sdma_queues_bitmap, KFD_MAX_SDMA_QUEUES);
}; };
unsigned int kfd_get_num_sdma_engines(struct kfd_node *kdev); unsigned int kfd_get_num_sdma_engines(struct kfd_node *kdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment