aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2017-06-05 10:11:59 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-06-15 11:50:25 -0400
commitab4fe3e1f910a71aabf0b1c919c482d7ce9fc5c7 (patch)
tree0f4e31ed627a7bd53cae964fe79952b7989f3520
parent4f0955fcc052b556446f6f041ad8c83d70c3b253 (diff)
drm/amdgpu: fix missed gpu info firmware when cache firmware during S3
gpu_info firmware is released after data is used. But when system enters into suspend, upper class driver will cache all firmware names. At that time, gpu_info will be failing to load. It seems an upper class issue, that we should not release gpu_info firmware until device finished. [ 903.236589] cache_firmware: amdgpu/vega10_sdma1.bin [ 903.236590] fw_set_page_data: fw-amdgpu/vega10_sdma1.bin buf=ffff88041eee10c0 data=ffffc90002561000 size=17408 [ 903.236591] cache_firmware: amdgpu/vega10_sdma1.bin ret=0 [ 903.464160] __allocate_fw_buf: fw-amdgpu/vega10_gpu_info.bin buf=ffff88041eee2c00 [ 903.471815] (NULL device *): loading /lib/firmware/updates/4.11.0-custom/amdgpu/vega10_gpu_info.bin failed with error -2 [ 903.482870] (NULL device *): loading /lib/firmware/updates/amdgpu/vega10_gpu_info.bin failed with error -2 [ 903.492716] (NULL device *): loading /lib/firmware/4.11.0-custom/amdgpu/vega10_gpu_info.bin failed with error -2 [ 903.503156] (NULL device *): direct-loading amdgpu/vega10_gpu_info.bin Signed-off-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-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 */