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

Prike.Liang Prike.Liang at amd.com
Fri May 29 03:28:07 UTC 2020


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.

Signed-off-by: Prike.Liang <Prike.Liang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 2f0e8da..bff740ccd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -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);
 }
 
-- 
2.7.4



More information about the amd-gfx mailing list