aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c18
2 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index c26761f0e05e..fc7e8a36df04 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1271,6 +1271,9 @@ struct amdgpu_firmware {
1271 const struct amdgpu_psp_funcs *funcs; 1271 const struct amdgpu_psp_funcs *funcs;
1272 struct amdgpu_bo *rbuf; 1272 struct amdgpu_bo *rbuf;
1273 struct mutex mutex; 1273 struct mutex mutex;
1274
1275 /* gpu info firmware data pointer */
1276 const struct firmware *gpu_info_fw;
1274}; 1277};
1275 1278
1276/* 1279/*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index f5c4e2e5c4ad..875cde414be7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1403,12 +1403,13 @@ static void amdgpu_device_enable_virtual_display(struct amdgpu_device *adev)
1403 1403
1404static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev) 1404static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
1405{ 1405{
1406 const struct firmware *fw;
1407 const char *chip_name; 1406 const char *chip_name;
1408 char fw_name[30]; 1407 char fw_name[30];
1409 int err; 1408 int err;
1410 const struct gpu_info_firmware_header_v1_0 *hdr; 1409 const struct gpu_info_firmware_header_v1_0 *hdr;
1411 1410
1411 adev->firmware.gpu_info_fw = NULL;
1412
1412 switch (adev->asic_type) { 1413 switch (adev->asic_type) {
1413 case CHIP_TOPAZ: 1414 case CHIP_TOPAZ:
1414 case CHIP_TONGA: 1415 case CHIP_TONGA:
@@ -1443,14 +1444,14 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
1443 } 1444 }
1444 1445
1445 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_gpu_info.bin", chip_name); 1446 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_gpu_info.bin", chip_name);
1446 err = request_firmware(&fw, fw_name, adev->dev); 1447 err = request_firmware(&adev->firmware.gpu_info_fw, fw_name, adev->dev);
1447 if (err) { 1448 if (err) {
1448 dev_err(adev->dev, 1449 dev_err(adev->dev,
1449 "Failed to load gpu_info firmware \"%s\"\n", 1450 "Failed to load gpu_info firmware \"%s\"\n",
1450 fw_name); 1451 fw_name);
1451 goto out; 1452 goto out;
1452 } 1453 }
1453 err = amdgpu_ucode_validate(fw); 1454 err = amdgpu_ucode_validate(adev->firmware.gpu_info_fw);
1454 if (err) { 1455 if (err) {
1455 dev_err(adev->dev, 1456 dev_err(adev->dev,
1456 "Failed to validate gpu_info firmware \"%s\"\n", 1457 "Failed to validate gpu_info firmware \"%s\"\n",
@@ -1458,14 +1459,14 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
1458 goto out; 1459 goto out;
1459 } 1460 }
1460 1461
1461 hdr = (const struct gpu_info_firmware_header_v1_0 *)fw->data; 1462 hdr = (const struct gpu_info_firmware_header_v1_0 *)adev->firmware.gpu_info_fw->data;
1462 amdgpu_ucode_print_gpu_info_hdr(&hdr->header); 1463 amdgpu_ucode_print_gpu_info_hdr(&hdr->header);
1463 1464
1464 switch (hdr->version_major) { 1465 switch (hdr->version_major) {
1465 case 1: 1466 case 1:
1466 { 1467 {
1467 const struct gpu_info_firmware_v1_0 *gpu_info_fw = 1468 const struct gpu_info_firmware_v1_0 *gpu_info_fw =
1468 (const struct gpu_info_firmware_v1_0 *)(fw->data + 1469 (const struct gpu_info_firmware_v1_0 *)(adev->firmware.gpu_info_fw->data +
1469 le32_to_cpu(hdr->header.ucode_array_offset_bytes)); 1470 le32_to_cpu(hdr->header.ucode_array_offset_bytes));
1470 1471
1471 adev->gfx.config.max_shader_engines = le32_to_cpu(gpu_info_fw->gc_num_se); 1472 adev->gfx.config.max_shader_engines = le32_to_cpu(gpu_info_fw->gc_num_se);
@@ -1495,9 +1496,6 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
1495 goto out; 1496 goto out;
1496 } 1497 }
1497out: 1498out:
1498 release_firmware(fw);
1499 fw = NULL;
1500
1501 return err; 1499 return err;
1502} 1500}
1503 1501
@@ -2288,6 +2286,10 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
2288 amdgpu_fence_driver_fini(adev); 2286 amdgpu_fence_driver_fini(adev);
2289 amdgpu_fbdev_fini(adev); 2287 amdgpu_fbdev_fini(adev);
2290 r = amdgpu_fini(adev); 2288 r = amdgpu_fini(adev);
2289 if (adev->firmware.gpu_info_fw) {
2290 release_firmware(adev->firmware.gpu_info_fw);
2291 adev->firmware.gpu_info_fw = NULL;
2292 }
2291 adev->accel_working = false; 2293 adev->accel_working = false;
2292 cancel_delayed_work_sync(&adev->late_init_work); 2294 cancel_delayed_work_sync(&adev->late_init_work);
2293 /* free i2c buses */ 2295 /* free i2c buses */