Skip to contentSkip to conversation

drm/amdgpu: enable renoir discovery for gc info retrieved

PATCH In review Prike.Liang 2 participants 5 messages May 29, 2020 – Jun 2, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: enable renoir discovery for gc info retrieved

Use ip discovery GC table instead of gpu info firmware for exporting gpu info to inquire interface.As Renoir discovery has same version with Navi1x therefore just enable it same way as Navi1x.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +20 -3
index 2f0e8da..bff740ccd 100644
@@ -1528,7 +1528,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 {
 	const char *chip_name;
 	char fw_name[30];
-	int err;
+	int err, r;
 	const struct gpu_info_firmware_header_v1_0 *hdr;
 
 	adev->firmware.gpu_info_fw = NULL;
@@ -1578,6 +1578,23 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 		chip_name = "arcturus";
 		break;
 	case CHIP_RENOIR:
+		if (amdgpu_discovery) {
+		/**
+		 * For RENOIR series seems needn't reinitialize the reg base again as it already set during
+		 * early init,if any concern here will need export amdgpu_discovery_init() for this case.
+		 */
+		r = amdgpu_discovery_reg_base_init(adev);
+			if (r) {
+				DRM_WARN("failed to get ip discovery table, "
+					"fallback to get gpu info in legacy method\n");
+				goto legacy_gpuinfo;
+			}
+
+			amdgpu_discovery_get_gfx_info(adev);
+
+			return 0;
+		}
+legacy_gpuinfo:
 		chip_name = "renoir";
 		break;
 	case CHIP_NAVI10:
@@ -1617,7 +1634,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 			(const struct gpu_info_firmware_v1_0 *)(adev->firmware.gpu_info_fw->data +
 								le32_to_cpu(hdr->header.ucode_array_offset_bytes));
 
-		if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) {
+		if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR && !r) {
 			amdgpu_discovery_get_gfx_info(adev);
 			goto parse_soc_bounding_box;
 		}
@@ -3364,7 +3381,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 	sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);
 	if (IS_ENABLED(CONFIG_PERF_EVENTS))
 		amdgpu_pmu_fini(adev);
-	if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
+	if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR)
 		amdgpu_discovery_fini(adev);
 }
 
Signature · 6 lines
2.7.4

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

[AMD Official Use Only - Internal Distribution Only]

Ping...

Thanks,

Quoted 85 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, May 29, 2020 11:28 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amdgpu: enable renoir discovery for gc info retrieved

Use ip discovery GC table instead of gpu info firmware for exporting gpu info to inquire interface.As Renoir discovery has same version with Navi1x therefore just enable it same way as Navi1x.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23
++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -1
index 2f0e8da..bff740ccd 100644
@@ -1528,7 +1528,7 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)  {
 const char *chip_name;
 char fw_name[30];
-int err;
+int err, r;
 const struct gpu_info_firmware_header_v1_0 *hdr;
 
 adev->firmware.gpu_info_fw = NULL;
@@ -1578,6 +1578,23 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 chip_name = "arcturus";
 break;
 case CHIP_RENOIR:
+if (amdgpu_discovery) {
+/**
+ * For RENOIR series seems needn't reinitialize the reg base

again as it already set during
+ * early init,if any concern here will need export amdgpu_discovery_init() for this case.
+ */

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+r = amdgpu_discovery_reg_base_init(adev);
+if (r) {
+DRM_WARN("failed to get ip discovery table,

"
+"fallback to get gpu info in legacy
method\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
+goto legacy_gpuinfo;
+}
+
+amdgpu_discovery_get_gfx_info(adev);
+
+return 0;
+}
+legacy_gpuinfo:
 chip_name = "renoir";
 break;
 case CHIP_NAVI10:
@@ -1617,7 +1634,7 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 (const struct gpu_info_firmware_v1_0 *)(adev-
Quoted 1 line

firmware.gpu_info_fw->data +

le32_to_cpu(hdr->header.ucode_array_offset_bytes));

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) {
+if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR

&& !r) {
amdgpu_discovery_get_gfx_info(adev);
goto parse_soc_bounding_box;
}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -2
@@ -3364,7 +3381,7 @@ void amdgpu_device_fini(struct amdgpu_device
 *adev)
 sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);
 if (IS_ENABLED(CONFIG_PERF_EVENTS))
 amdgpu_pmu_fini(adev);
-if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
+if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR)
 amdgpu_discovery_fini(adev);
 }
 
--
Quoted 1 line

2.7.4

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

#2 lore raw
Quoted 4 lines · Prike

[AMD Official Use Only - Internal Distribution Only]

Ping...

Already enabled:
https://cgit.freedesktop.org/~agd5f/linux/commit/?h=amd-staging-drm-next&id=e467ab869f5783cf93d4cf24c6ac647cc29d1fb5

Alex

Quoted 86 lines

Thanks,

Quoted 84 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, May 29, 2020 11:28 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amdgpu: enable renoir discovery for gc info retrieved

Use ip discovery GC table instead of gpu info firmware for exporting gpu info to inquire interface.As Renoir discovery has same version with Navi1x therefore just enable it same way as Navi1x.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23
++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -1
index 2f0e8da..bff740ccd 100644
@@ -1528,7 +1528,7 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)  {
 const char *chip_name;
 char fw_name[30];
-int err;
+int err, r;
 const struct gpu_info_firmware_header_v1_0 *hdr;
 
 adev->firmware.gpu_info_fw = NULL;
@@ -1578,6 +1578,23 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 chip_name = "arcturus";
 break;
 case CHIP_RENOIR:
+if (amdgpu_discovery) {
+/**
+ * For RENOIR series seems needn't reinitialize the reg base

again as it already set during
+ * early init,if any concern here will need export amdgpu_discovery_init() for this case.
+ */

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+r = amdgpu_discovery_reg_base_init(adev);
+if (r) {
+DRM_WARN("failed to get ip discovery table,

"
+"fallback to get gpu info in legacy
method\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
+goto legacy_gpuinfo;
+}
+
+amdgpu_discovery_get_gfx_info(adev);
+
+return 0;
+}
+legacy_gpuinfo:
 chip_name = "renoir";
 break;
 case CHIP_NAVI10:
@@ -1617,7 +1634,7 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 (const struct gpu_info_firmware_v1_0 *)(adev-
Quoted 1 line

firmware.gpu_info_fw->data +

le32_to_cpu(hdr->header.ucode_array_offset_bytes));

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) {
+if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR

&& !r) {
amdgpu_discovery_get_gfx_info(adev);
goto parse_soc_bounding_box;
}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -3364,7 +3381,7 @@ void amdgpu_device_fini(struct amdgpu_device
 *adev)
 sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);
 if (IS_ENABLED(CONFIG_PERF_EVENTS))
 amdgpu_pmu_fini(adev);
-if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10)
+if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR)
 amdgpu_discovery_fini(adev);
 }
Quoted 7 lines
Quoted 2 lines

--
2.7.4

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

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

#3 lore raw

[AMD Official Use Only - Internal Distribution Only]

Ah not aware the enable patch before. But the already enable patch seems can't fallback to legacy gpuinfo FW load method when not support discovery and also may miss destroy the discovery_bin object when driver shut down.

Thanks,
Prike

Quoted 119 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, June 2, 2020 9:35 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: enable renoir discovery for gc info retrieved

Quoted 4 lines · Prike

[AMD Official Use Only - Internal Distribution Only]

Ping...

Already enabled:
https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.free
desktop.org%2F~agd5f%2Flinux%2Fcommit%2F%3Fh%3Damd-staging-drm- next%26id%3De467ab869f5783cf93d4cf24c6ac647cc29d1fb5&amp;data=02% 7C01%7CPrike.Liang%40amd.com%7C5bcc45116bb042163cec08d806f9bd58 %7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637267016987033 430&amp;sdata=KJ0xmSPXwlZ4LEfhAYoFzAwaWyx3laoLAsQccMM0pcs%3D& amp;reserved=0

Alex

Quoted 67 lines

Thanks,

Quoted 65 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, May 29, 2020 11:28 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amdgpu: enable renoir discovery for gc info retrieved

Use ip discovery GC table instead of gpu info firmware for exporting gpu info to inquire interface.As Renoir discovery has same version with Navi1x therefore just enable it same way as Navi1x.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23
++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 2f0e8da..bff740ccd 100644
@@ -1528,7 +1528,7 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)  {
 const char *chip_name;  char fw_name[30]; -int err;
+int err, r;
 const struct gpu_info_firmware_header_v1_0 *hdr;
 
 adev->firmware.gpu_info_fw = NULL;
@@ -1578,6 +1578,23 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)

chip_name = "arcturus"; break; case CHIP_RENOIR:

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+if (amdgpu_discovery) {
+/**
+ * For RENOIR series seems needn't reinitialize the reg base

again as it already set during
+ * early init,if any concern here will need export amdgpu_discovery_init() for this case.
+ */

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+r = amdgpu_discovery_reg_base_init(adev);
+if (r) {
+DRM_WARN("failed to get ip discovery table,

"
+"fallback to get gpu info in legacy
method\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
+goto legacy_gpuinfo;
+}
+
+amdgpu_discovery_get_gfx_info(adev);
+
+return 0;
+}
+legacy_gpuinfo:
 chip_name = "renoir";
 break;
 case CHIP_NAVI10:
@@ -1617,7 +1634,7 @@ static int

amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev) (const struct gpu_info_firmware_v1_0 *)(adev-

Quoted 1 line

firmware.gpu_info_fw->data +

le32_to_cpu(hdr->header.ucode_array_offset_bytes));

Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_device_fini(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) {
+if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR

&& !r) {
amdgpu_discovery_get_gfx_info(adev);
goto parse_soc_bounding_box;
}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -3364,7 +3381,7 @@ void amdgpu_device_fini(struct

amdgpu_device

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 *adev)
 sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);  if

(IS_ENABLED(CONFIG_PERF_EVENTS)) amdgpu_pmu_fini(adev); -if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) +if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR)
amdgpu_discovery_fini(adev);
}

Quoted 8 lines
Quoted 2 lines

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-

gfx&amp;data=02%7C01%7CPr

Quoted 1 line
Quoted 8 lines

ike.Liang%40amd.com%7C5bcc45116bb042163cec08d806f9bd58%7C3dd896 1fe4884

Quoted 1 line

e608e11a82d994e183d%7C0%7C0%7C637267016987033430&amp;sdata=R% 2F%2BY%2B

Quoted 1 line

z%2BKHh09WazkQqS%2FbwH%2BeBM97%2Fx5hvqWAjUYEtM%3D&amp;res erved=0

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

#4 lore raw
Quoted 5 lines · Prike

[AMD Official Use Only - Internal Distribution Only]

Ah not aware the enable patch before. But the already enable patch seems can't fallback to legacy gpuinfo FW load method when not support discovery and also may miss destroy the discovery_bin object when driver shut down.

I think it's already handled. See these patches:
https://cgit.freedesktop.org/~agd5f/linux/commit/?h=amd-staging-drm-next&id=4d09621cc55bcec9ec0aa038c8ffcffd2017837f
https://cgit.freedesktop.org/~agd5f/linux/commit/?h=amd-staging-drm-next&id=6206aa0f74e7d22ca43975bd8f2979cdfd128b40

Alex

Quoted 129 lines

Thanks,
Prike

Quoted 127 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Tuesday, June 2, 2020 9:35 PM
To: Liang, Prike <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: enable renoir discovery for gc info retrieved

Quoted 4 lines · Prike

[AMD Official Use Only - Internal Distribution Only]

Ping...

Already enabled:
https://nam11.safelinks.protection.outlook.com/?url=https:%2F%2Fcgit.free
desktop.org%2F~agd5f%2Flinux%2Fcommit%2F%3Fh%3Damd-staging-drm- next%26id%3De467ab869f5783cf93d4cf24c6ac647cc29d1fb5&amp;data=02% 7C01%7CPrike.Liang%40amd.com%7C5bcc45116bb042163cec08d806f9bd58 %7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637267016987033 430&amp;sdata=KJ0xmSPXwlZ4LEfhAYoFzAwaWyx3laoLAsQccMM0pcs%3D& amp;reserved=0

Alex

Quoted 67 lines

Thanks,

Quoted 65 lines

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Friday, May 29, 2020 11:28 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amdgpu: enable renoir discovery for gc info retrieved

Use ip discovery GC table instead of gpu info firmware for exporting gpu info to inquire interface.As Renoir discovery has same version with Navi1x therefore just enable it same way as Navi1x.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23
++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 2f0e8da..bff740ccd 100644
@@ -1528,7 +1528,7 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)  {
 const char *chip_name;  char fw_name[30]; -int err;
+int err, r;
 const struct gpu_info_firmware_header_v1_0 *hdr;
 
 adev->firmware.gpu_info_fw = NULL;
@@ -1578,6 +1578,23 @@ static int
 amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)

chip_name = "arcturus"; break; case CHIP_RENOIR:

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+if (amdgpu_discovery) {
+/**
+ * For RENOIR series seems needn't reinitialize the reg base

again as it already set during
+ * early init,if any concern here will need export amdgpu_discovery_init() for this case.
+ */

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+r = amdgpu_discovery_reg_base_init(adev);
+if (r) {
+DRM_WARN("failed to get ip discovery table,

"
+"fallback to get gpu info in legacy
method\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
+goto legacy_gpuinfo;
+}
+
+amdgpu_discovery_get_gfx_info(adev);
+
+return 0;
+}
+legacy_gpuinfo:
 chip_name = "renoir";
 break;
 case CHIP_NAVI10:
@@ -1617,7 +1634,7 @@ static int

amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev) (const struct gpu_info_firmware_v1_0 *)(adev-

Quoted 1 line

firmware.gpu_info_fw->data +

le32_to_cpu(hdr->header.ucode_array_offset_bytes));

Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c void amdgpu_device_fini(struct

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) {
+if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR

&& !r) {
amdgpu_discovery_get_gfx_info(adev);
goto parse_soc_bounding_box;
}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
@@ -3364,7 +3381,7 @@ void amdgpu_device_fini(struct

amdgpu_device

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 *adev)
 sysfs_remove_files(&adev->dev->kobj, amdgpu_dev_attributes);  if

(IS_ENABLED(CONFIG_PERF_EVENTS)) amdgpu_pmu_fini(adev); -if (amdgpu_discovery && adev->asic_type >= CHIP_NAVI10) +if (amdgpu_discovery && adev->asic_type >= CHIP_RENOIR)
amdgpu_discovery_fini(adev);
}

Quoted 8 lines
Quoted 2 lines

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-

gfx&amp;data=02%7C01%7CPr

Quoted 1 line

ike.Liang%40amd.com%7C5bcc45116bb042163cec08d806f9bd58%7C3dd896 1fe4884

Quoted 1 line

e608e11a82d994e183d%7C0%7C0%7C637267016987033430&amp;sdata=R% 2F%2BY%2B

Quoted 1 line

z%2BKHh09WazkQqS%2FbwH%2BeBM97%2Fx5hvqWAjUYEtM%3D&amp;res erved=0

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