[PATCH 6/6] drm/amdgpu: add xgmi perfmons for arcturus

Jonathan Kim jonathan.kim at amd.com
Thu Sep 3 16:21:54 UTC 2020


Add xgmi perfmons for Arcturus.

Signed-off-by: Jonathan Kim <Jonathan.Kim at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c | 32 +++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/df_v3_6.c    |  3 +++
 2 files changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
index eaa44c99d423..420157ee7c25 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
@@ -32,6 +32,7 @@
 #define NUM_FORMATS_DF_VEGA20	3
 #define NUM_EVENTS_DF_VEGA20	8
 #define NUM_EVENTS_XGMI_VEGA20	2
+#define NUM_EVENTS_XGMI_ARCTURUS	6
 
 /* record to keep track of pmu entry per pmu type per device */
 struct amdgpu_pmu_entry {
@@ -58,6 +59,11 @@ static struct attribute_group xgmi_vega20_event_attr_group = {
 	.attrs = NULL
 };
 
+static struct attribute_group xgmi_arcturus_event_attr_group = {
+	.name = "events",
+	.attrs = NULL
+};
+
 const struct attribute_group *df_vega20_attr_groups[] = {
 	&df_vega20_format_attr_group,
 	&df_vega20_event_attr_group,
@@ -70,6 +76,12 @@ const struct attribute_group *xgmi_vega20_attr_groups[] = {
 	NULL
 };
 
+const struct attribute_group *xgmi_arcturus_attr_groups[] = {
+	&df_vega20_format_attr_group,
+	&xgmi_arcturus_event_attr_group,
+	NULL
+};
+
 static const char *df_vega20_formats[NUM_FORMATS_DF_VEGA20][2] = {
 	{ "event", "config:0-7" },
 	{ "instance", "config:8-15" },
@@ -96,6 +108,15 @@ static const char *xgmi_vega20_events[NUM_EVENTS_XGMI_VEGA20][2] = {
 	{ "xgmi_link1_data_outbound", "event=0x7,instance=0x47,umask=0x2" }
 };
 
+static const char *xgmi_arcturus_events[NUM_EVENTS_XGMI_ARCTURUS][2] = {
+	{ "xgmi_link0_data_outbound", "event=0x7,instance=0x4b,umask=0x2" },
+	{ "xgmi_link1_data_outbound", "event=0x7,instance=0x4c,umask=0x2" },
+	{ "xgmi_link2_data_outbound", "event=0x7,instance=0x4d,umask=0x2" },
+	{ "xgmi_link3_data_outbound", "event=0x7,instance=0x4e,umask=0x2" },
+	{ "xgmi_link4_data_outbound", "event=0x7,instance=0x4f,umask=0x2" },
+	{ "xgmi_link5_data_outbound", "event=0x7,instance=0x50,umask=0x2" }
+};
+
 /* initialize perf counter */
 static int amdgpu_perf_event_init(struct perf_event *event)
 {
@@ -387,6 +408,17 @@ int amdgpu_pmu_init(struct amdgpu_device *adev)
 
 		/* other pmu types go here*/
 		break;
+	case CHIP_ARCTURUS:
+		/* init xgmi */
+		ret = init_pmu_by_type(adev, xgmi_arcturus_attr_groups,
+					"XGMI", "amdgpu", PERF_TYPE_AMDGPU_XGMI,
+					df_vega20_formats,
+					&df_vega20_format_attr_group,
+					NUM_FORMATS_DF_VEGA20,
+					xgmi_arcturus_events,
+					&xgmi_arcturus_event_attr_group,
+					NUM_EVENTS_XGMI_ARCTURUS);
+		break;
 	default:
 		return 0;
 	}
diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
index 569c40be6e75..23af431de997 100644
--- a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
+++ b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c
@@ -512,6 +512,7 @@ static int df_v3_6_pmc_start(struct amdgpu_device *adev, uint64_t config,
 
 	switch (adev->asic_type) {
 	case CHIP_VEGA20:
+	case CHIP_ARCTURUS:
 		if (is_add)
 			return df_v3_6_pmc_add_cntr(adev, config);
 
@@ -553,6 +554,7 @@ static int df_v3_6_pmc_stop(struct amdgpu_device *adev, uint64_t config,
 
 	switch (adev->asic_type) {
 	case CHIP_VEGA20:
+	case CHIP_ARCTURUS:
 		ret = df_v3_6_pmc_get_ctrl_settings(adev,
 			config,
 			counter_idx,
@@ -589,6 +591,7 @@ static void df_v3_6_pmc_get_count(struct amdgpu_device *adev,
 
 	switch (adev->asic_type) {
 	case CHIP_VEGA20:
+	case CHIP_ARCTURUS:
 		df_v3_6_pmc_get_read_settings(adev, config, counter_idx,
 						&lo_base_addr, &hi_base_addr);
 
-- 
2.17.1



More information about the amd-gfx mailing list