Re: [PATCH 1/2] drm/amdkfd: remove unneeded unmap single queue option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Am 2022-02-11 um 12:15 schrieb Jonathan Kim:
The KFD only unmaps all queues, all dynamics queues or all process queues
since RUN_LIST is mapped with all KFD queues.

There's no need to provide a single type unmap so remove this option.

You should also remove KFD_UNMAP_QUEUES_FILTER_SINGLE_QUEUE from the enum.

Other than that, this patch is

Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>



Signed-off-by: Jonathan Kim <jonathan.kim@xxxxxxx>
---
  .../drm/amd/amdkfd/kfd_device_queue_manager.c |  3 +-
  .../gpu/drm/amd/amdkfd/kfd_packet_manager.c   |  8 ++--
  .../drm/amd/amdkfd/kfd_packet_manager_v9.c    | 40 +++----------------
  .../drm/amd/amdkfd/kfd_packet_manager_vi.c    | 26 ++----------
  drivers/gpu/drm/amd/amdkfd/kfd_priv.h         |  9 ++---
  5 files changed, 16 insertions(+), 70 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index 7f6f1a842b0b..c8201638fca5 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -1554,8 +1554,7 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm,
  	if (!dqm->active_runlist)
  		return retval;
- retval = pm_send_unmap_queue(&dqm->packet_mgr, KFD_QUEUE_TYPE_COMPUTE,
-			filter, filter_param, reset, 0);
+	retval = pm_send_unmap_queue(&dqm->packet_mgr, filter, filter_param, reset);
  	if (retval)
  		return retval;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
index 1439420925a0..9a44b34abaed 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c
@@ -368,10 +368,9 @@ int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address,
  	return retval;
  }
-int pm_send_unmap_queue(struct packet_manager *pm, enum kfd_queue_type type,
+int pm_send_unmap_queue(struct packet_manager *pm,
  			enum kfd_unmap_queues_filter filter,
-			uint32_t filter_param, bool reset,
-			unsigned int sdma_engine)
+			uint32_t filter_param, bool reset)
  {
  	uint32_t *buffer, size;
  	int retval = 0;
@@ -386,8 +385,7 @@ int pm_send_unmap_queue(struct packet_manager *pm, enum kfd_queue_type type,
  		goto out;
  	}
- retval = pm->pmf->unmap_queues(pm, buffer, type, filter, filter_param,
-				       reset, sdma_engine);
+	retval = pm->pmf->unmap_queues(pm, buffer, filter, filter_param, reset);
  	if (!retval)
  		kq_submit_packet(pm->priv_queue);
  	else
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
index 7ea3f671b325..ed4f2d3c6dcc 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c
@@ -246,10 +246,8 @@ static int pm_map_queues_v9(struct packet_manager *pm, uint32_t *buffer,
  }
static int pm_unmap_queues_v9(struct packet_manager *pm, uint32_t *buffer,
-			enum kfd_queue_type type,
  			enum kfd_unmap_queues_filter filter,
-			uint32_t filter_param, bool reset,
-			unsigned int sdma_engine)
+			uint32_t filter_param, bool reset)
  {
  	struct pm4_mes_unmap_queues *packet;
@@ -258,31 +256,11 @@ static int pm_unmap_queues_v9(struct packet_manager *pm, uint32_t *buffer, packet->header.u32All = pm_build_pm4_header(IT_UNMAP_QUEUES,
  					sizeof(struct pm4_mes_unmap_queues));
-	switch (type) {
-	case KFD_QUEUE_TYPE_COMPUTE:
-	case KFD_QUEUE_TYPE_DIQ:
-		packet->bitfields2.extended_engine_sel =
-			extended_engine_sel__mes_unmap_queues__legacy_engine_sel;
-		packet->bitfields2.engine_sel =
-			engine_sel__mes_unmap_queues__compute;
-		break;
-	case KFD_QUEUE_TYPE_SDMA:
-	case KFD_QUEUE_TYPE_SDMA_XGMI:
-		if (sdma_engine < 2) {
-			packet->bitfields2.extended_engine_sel =
-				extended_engine_sel__mes_unmap_queues__legacy_engine_sel;
-			packet->bitfields2.engine_sel =
-				engine_sel__mes_unmap_queues__sdma0 + sdma_engine;
-		} else {
-			packet->bitfields2.extended_engine_sel =
-				extended_engine_sel__mes_unmap_queues__sdma0_to_7_sel;
-			packet->bitfields2.engine_sel = sdma_engine;
-		}
-		break;
-	default:
-		WARN(1, "queue type %d", type);
-		return -EINVAL;
-	}
+
+	packet->bitfields2.extended_engine_sel =
+		extended_engine_sel__mes_unmap_queues__legacy_engine_sel;
+	packet->bitfields2.engine_sel =
+		engine_sel__mes_unmap_queues__compute;
if (reset)
  		packet->bitfields2.action =
@@ -292,12 +270,6 @@ static int pm_unmap_queues_v9(struct packet_manager *pm, uint32_t *buffer,
  			action__mes_unmap_queues__preempt_queues;
switch (filter) {
-	case KFD_UNMAP_QUEUES_FILTER_SINGLE_QUEUE:
-		packet->bitfields2.queue_sel =
-			queue_sel__mes_unmap_queues__perform_request_on_specified_queues;
-		packet->bitfields2.num_queues = 1;
-		packet->bitfields3b.doorbell_offset0 = filter_param;
-		break;
  	case KFD_UNMAP_QUEUES_FILTER_BY_PASID:
  		packet->bitfields2.queue_sel =
  			queue_sel__mes_unmap_queues__perform_request_on_pasid_queues;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c
index 3c0658e32e93..131f685acf41 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_vi.c
@@ -197,10 +197,8 @@ static int pm_map_queues_vi(struct packet_manager *pm, uint32_t *buffer,
  }
static int pm_unmap_queues_vi(struct packet_manager *pm, uint32_t *buffer,
-			enum kfd_queue_type type,
  			enum kfd_unmap_queues_filter filter,
-			uint32_t filter_param, bool reset,
-			unsigned int sdma_engine)
+			uint32_t filter_param, bool reset)
  {
  	struct pm4_mes_unmap_queues *packet;
@@ -209,21 +207,9 @@ static int pm_unmap_queues_vi(struct packet_manager *pm, uint32_t *buffer, packet->header.u32All = pm_build_pm4_header(IT_UNMAP_QUEUES,
  					sizeof(struct pm4_mes_unmap_queues));
-	switch (type) {
-	case KFD_QUEUE_TYPE_COMPUTE:
-	case KFD_QUEUE_TYPE_DIQ:
-		packet->bitfields2.engine_sel =
+
+	packet->bitfields2.engine_sel =
  			engine_sel__mes_unmap_queues__compute;
-		break;
-	case KFD_QUEUE_TYPE_SDMA:
-	case KFD_QUEUE_TYPE_SDMA_XGMI:
-		packet->bitfields2.engine_sel =
-			engine_sel__mes_unmap_queues__sdma0 + sdma_engine;
-		break;
-	default:
-		WARN(1, "queue type %d", type);
-		return -EINVAL;
-	}
if (reset)
  		packet->bitfields2.action =
@@ -233,12 +219,6 @@ static int pm_unmap_queues_vi(struct packet_manager *pm, uint32_t *buffer,
  			action__mes_unmap_queues__preempt_queues;
switch (filter) {
-	case KFD_UNMAP_QUEUES_FILTER_SINGLE_QUEUE:
-		packet->bitfields2.queue_sel =
-			queue_sel__mes_unmap_queues__perform_request_on_specified_queues;
-		packet->bitfields2.num_queues = 1;
-		packet->bitfields3b.doorbell_offset0 = filter_param;
-		break;
  	case KFD_UNMAP_QUEUES_FILTER_BY_PASID:
  		packet->bitfields2.queue_sel =
  			queue_sel__mes_unmap_queues__perform_request_on_pasid_queues;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index b6790a637f5c..5989b5df8402 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -1246,10 +1246,8 @@ struct packet_manager_funcs {
  	int (*map_queues)(struct packet_manager *pm, uint32_t *buffer,
  			struct queue *q, bool is_static);
  	int (*unmap_queues)(struct packet_manager *pm, uint32_t *buffer,
-			enum kfd_queue_type type,
  			enum kfd_unmap_queues_filter mode,
-			uint32_t filter_param, bool reset,
-			unsigned int sdma_engine);
+			uint32_t filter_param, bool reset);
  	int (*query_status)(struct packet_manager *pm, uint32_t *buffer,
  			uint64_t fence_address,	uint64_t fence_value);
  	int (*release_mem)(uint64_t gpu_addr, uint32_t *buffer);
@@ -1276,10 +1274,9 @@ int pm_send_runlist(struct packet_manager *pm, struct list_head *dqm_queues);
  int pm_send_query_status(struct packet_manager *pm, uint64_t fence_address,
  				uint64_t fence_value);
-int pm_send_unmap_queue(struct packet_manager *pm, enum kfd_queue_type type,
+int pm_send_unmap_queue(struct packet_manager *pm,
  			enum kfd_unmap_queues_filter mode,
-			uint32_t filter_param, bool reset,
-			unsigned int sdma_engine);
+			uint32_t filter_param, bool reset);
void pm_release_ib(struct packet_manager *pm);



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux