Skip to contentSkip to conversation

drm/amdkfd: expose num_sdma_queues_per_engine data field to topology node

PATCH Superseded Huang Rui 2 participants 4 messages Dec 16, 2019 – Dec 18, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Huang Rui

author
#0 lore raw

PATCH 1/2 drm/amdkfd: expose num_sdma_queues_per_engine data field to topology node

Thunk driver would like to know the num_sdma_queues_per_engine data, however this data relied on different asic specific. So it's better to get it from kfd driver.

---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 ++++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +4 -0
index 69bd062..cc01ccd 100644
@@ -486,6 +486,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
 			dev->node_props.num_sdma_engines);
 	sysfs_show_32bit_prop(buffer, "num_sdma_xgmi_engines",
 			dev->node_props.num_sdma_xgmi_engines);
+	sysfs_show_32bit_prop(buffer, "num_sdma_queues_per_engine",
+			dev->node_props.num_sdma_queues_per_engine);
 
 	if (dev->gpu) {
 		log_max_watch_addr =
@@ -1309,6 +1311,8 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
 	dev->node_props.num_sdma_engines = gpu->device_info->num_sdma_engines;
 	dev->node_props.num_sdma_xgmi_engines =
 				gpu->device_info->num_xgmi_sdma_engines;
+	dev->node_props.num_sdma_queues_per_engine =
+				gpu->device_info->num_sdma_queues_per_engine;
 	dev->node_props.num_gws = (hws_gws_support &&
 		dev->gpu->dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) ?
 		amdgpu_amdkfd_get_num_gws(dev->gpu->kgd) : 0;
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +2 -1
index 15843e0..9346cc1 100644
@@ -27,7 +27,7 @@
 #include <linux/list.h>
 #include "kfd_crat.h"
 
-#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 32
+#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 28
 
 #define HSA_CAP_HOT_PLUGGABLE			0x00000001
 #define HSA_CAP_ATS_PRESENT			0x00000002
@@ -81,6 +81,7 @@ struct kfd_node_properties {
 	int32_t  drm_render_minor;
 	uint32_t num_sdma_engines;
 	uint32_t num_sdma_xgmi_engines;
+	uint32_t num_sdma_queues_per_engine;
 	char name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
 };
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

PATCH 2/2 drm/amdkfd: expose num_cp_queues data field to topology node

Thunk driver would like to know the num_cp_queues data, however this data relied on different asic specific. So it's better to get it from kfd driver.

---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 +++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +3 -0
index cc01ccd..203c823 100644
@@ -488,6 +488,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
 			dev->node_props.num_sdma_xgmi_engines);
 	sysfs_show_32bit_prop(buffer, "num_sdma_queues_per_engine",
 			dev->node_props.num_sdma_queues_per_engine);
+	sysfs_show_32bit_prop(buffer, "num_cp_queues",
+			dev->node_props.num_cp_queues);
 
 	if (dev->gpu) {
 		log_max_watch_addr =
@@ -1316,6 +1318,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
 	dev->node_props.num_gws = (hws_gws_support &&
 		dev->gpu->dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) ?
 		amdgpu_amdkfd_get_num_gws(dev->gpu->kgd) : 0;
+	dev->node_props.num_cp_queues = get_queues_num(dev->gpu->dqm);
 
 	kfd_fill_mem_clk_max_info(dev);
 	kfd_fill_iolink_non_crat_info(dev);
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +2 -1
index 9346cc1..e447901 100644
@@ -27,7 +27,7 @@
 #include <linux/list.h>
 #include "kfd_crat.h"
 
-#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 28
+#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 24
 
 #define HSA_CAP_HOT_PLUGGABLE			0x00000001
 #define HSA_CAP_ATS_PRESENT			0x00000002
@@ -82,6 +82,7 @@ struct kfd_node_properties {
 	uint32_t num_sdma_engines;
 	uint32_t num_sdma_xgmi_engines;
 	uint32_t num_sdma_queues_per_engine;
+	uint32_t num_cp_queues;
 	char name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
 };
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer
#2 lore raw

Re: [PATCH 2/2] drm/amdkfd: expose num_cp_queues data field to topology node

See comment inline. Other than that, the series looks good to me.

Quoted 35 lines · Huang Rui

Thunk driver would like to know the num_cp_queues data, however this data relied on different asic specific. So it's better to get it from kfd driver.

---
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 +++
  drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 3 ++-
  2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +3 -0
index cc01ccd..203c823 100644
@@ -488,6 +488,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
  			dev->node_props.num_sdma_xgmi_engines);
  	sysfs_show_32bit_prop(buffer, "num_sdma_queues_per_engine",
  			dev->node_props.num_sdma_queues_per_engine);
+	sysfs_show_32bit_prop(buffer, "num_cp_queues",
+			dev->node_props.num_cp_queues);
 
  	if (dev->gpu) {
  		log_max_watch_addr =
@@ -1316,6 +1318,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
  	dev->node_props.num_gws = (hws_gws_support &&
  		dev->gpu->dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) ?
  		amdgpu_amdkfd_get_num_gws(dev->gpu->kgd) : 0;
+	dev->node_props.num_cp_queues = get_queues_num(dev->gpu->dqm);
 
  	kfd_fill_mem_clk_max_info(dev);
  	kfd_fill_iolink_non_crat_info(dev);
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +0 -0
index 9346cc1..e447901 100644

drivers/gpu/drm/amd/amdkfd/kfd_topology.h line 30

Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 -1
@@ -27,7 +27,7 @@
  #include <linux/list.h>
  #include "kfd_crat.h"
 
-#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 28
+#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 24

I don't see why you need to change the name size here. I'm not aware of any requirement that the structure size cannot change. This comment applies to patch 1 as well.

Regards,
  Felix

drivers/gpu/drm/amd/amdkfd/kfd_topology.h struct kfd_node_properties { · line 88

Quoted 11 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 -0
  #define HSA_CAP_HOT_PLUGGABLE			0x00000001
  #define HSA_CAP_ATS_PRESENT			0x00000002
@@ -82,6 +82,7 @@ struct kfd_node_properties {
  	uint32_t num_sdma_engines;
  	uint32_t num_sdma_xgmi_engines;
  	uint32_t num_sdma_queues_per_engine;
+	uint32_t num_cp_queues;
  	char name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
  };
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#3 lore raw

Re: [PATCH 2/2] drm/amdkfd: expose num_cp_queues data field to topology node

[AMD Official Use Only - Internal Distribution Only]

Quoted 41 lines · Felix

See comment inline. Other than that, the series looks good to me.

Quoted 38 lines · Huang Rui

Thunk driver would like to know the num_cp_queues data, however this data relied on different asic specific. So it's better to get it from kfd driver.

---
  drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 3 +++
  drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 3 ++-
  2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +3 -0
index cc01ccd..203c823 100644
@@ -488,6 +488,8 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
  			dev->node_props.num_sdma_xgmi_engines);
  	sysfs_show_32bit_prop(buffer, "num_sdma_queues_per_engine",
  			dev->node_props.num_sdma_queues_per_engine);
+	sysfs_show_32bit_prop(buffer, "num_cp_queues",
+			dev->node_props.num_cp_queues);
 
  	if (dev->gpu) {
  		log_max_watch_addr =
@@ -1316,6 +1318,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
  	dev->node_props.num_gws = (hws_gws_support &&
  		dev->gpu->dqm->sched_policy != KFD_SCHED_POLICY_NO_HWS) ?
  		amdgpu_amdkfd_get_num_gws(dev->gpu->kgd) : 0;
+	dev->node_props.num_cp_queues = get_queues_num(dev->gpu->dqm);
 
  	kfd_fill_mem_clk_max_info(dev);
  	kfd_fill_iolink_non_crat_info(dev);
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +0 -0
index 9346cc1..e447901 100644
@@ -27,7 +27,7 @@
  #include <linux/list.h>
  #include "kfd_crat.h"
 
Quoted 7 lines

drivers/gpu/drm/amd/amdkfd/kfd_topology.h line 30

Quoted 2 lines
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 -1
-#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 28
+#define KFD_TOPOLOGY_PUBLIC_NAME_SIZE 24

I don't see why you need to change the name size here. I'm not aware of any requirement that the structure size cannot change. This comment applies to patch 1 as well.

Oh, sorry, I miss read this field as "reserved", so I kept the struct size. Will updated in V2.

Thanks,
Ray

Quoted 4 lines

Regards,
  Felix

Quoted 1 line
Quoted 10 lines

drivers/gpu/drm/amd/amdkfd/kfd_topology.h struct kfd_node_properties { · line 88

Quoted 10 lines
  #define HSA_CAP_HOT_PLUGGABLE			0x00000001
  #define HSA_CAP_ATS_PRESENT			0x00000002
drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 -0
@@ -82,6 +82,7 @@ struct kfd_node_properties {
  	uint32_t num_sdma_engines;
  	uint32_t num_sdma_xgmi_engines;
  	uint32_t num_sdma_queues_per_engine;
+	uint32_t num_cp_queues;
  	char name[KFD_TOPOLOGY_PUBLIC_NAME_SIZE];
  };
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx