aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEmily Deng <Emily.Deng@amd.com>2019-05-27 22:17:04 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-05-28 15:47:42 -0400
commit394e9a14c63d58e0f45323629a3f9ce1e5bf0215 (patch)
treef87083296c2c93abbc36053cbec3af1bbbab37af /drivers/gpu
parentd55f33da541324c7f41156dd6d045b8b450de230 (diff)
drm/amdgpu: Need to set the baco cap before baco reset
For passthrough, after rebooted the VM, driver will do a baco reset before doing other driver initialization during loading driver. For doing the baco reset, it will first check the baco reset capability. So first need to set the cap from the vbios information or baco reset won't be enabled. Signed-off-by: Emily Deng <Emily.Deng@amd.com> Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c24
-rw-r--r--drivers/gpu/drm/amd/amdgpu/soc15.c3
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c24
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h1
5 files changed, 42 insertions, 14 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index a7ff8d6dbc6c..fe2708295867 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1541,6 +1541,17 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
1541 if (amdgpu_sriov_vf(adev)) 1541 if (amdgpu_sriov_vf(adev))
1542 adev->pm.pp_feature &= ~PP_GFXOFF_MASK; 1542 adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
1543 1543
1544 /* Read BIOS */
1545 if (!amdgpu_get_bios(adev))
1546 return -EINVAL;
1547
1548 r = amdgpu_atombios_init(adev);
1549 if (r) {
1550 dev_err(adev->dev, "amdgpu_atombios_init failed\n");
1551 amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL, 0, 0);
1552 return r;
1553 }
1554
1544 for (i = 0; i < adev->num_ip_blocks; i++) { 1555 for (i = 0; i < adev->num_ip_blocks; i++) {
1545 if ((amdgpu_ip_block_mask & (1 << i)) == 0) { 1556 if ((amdgpu_ip_block_mask & (1 << i)) == 0) {
1546 DRM_ERROR("disabled ip block: %d <%s>\n", 1557 DRM_ERROR("disabled ip block: %d <%s>\n",
@@ -2591,19 +2602,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
2591 goto fence_driver_init; 2602 goto fence_driver_init;
2592 } 2603 }
2593 2604
2594 /* Read BIOS */
2595 if (!amdgpu_get_bios(adev)) {
2596 r = -EINVAL;
2597 goto failed;
2598 }
2599
2600 r = amdgpu_atombios_init(adev);
2601 if (r) {
2602 dev_err(adev->dev, "amdgpu_atombios_init failed\n");
2603 amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL, 0, 0);
2604 goto failed;
2605 }
2606
2607 /* detect if we are with an SRIOV vbios */ 2605 /* detect if we are with an SRIOV vbios */
2608 amdgpu_device_detect_sriov_bios(adev); 2606 amdgpu_device_detect_sriov_bios(adev);
2609 2607
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
index 78bd4fc07bab..d9fdd95fd6e6 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)
764 /* Just return false for soc15 GPUs. Reset does not seem to 764 /* Just return false for soc15 GPUs. Reset does not seem to
765 * be necessary. 765 * be necessary.
766 */ 766 */
767 return false; 767 if (!amdgpu_passthrough(adev))
768 return false;
768 769
769 if (adev->flags & AMD_IS_APU) 770 if (adev->flags & AMD_IS_APU)
770 return false; 771 return false;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
index ce6aeb5a0362..1d9bb29adaef 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c
@@ -5311,8 +5311,12 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = {
5311 5311
5312int vega10_hwmgr_init(struct pp_hwmgr *hwmgr) 5312int vega10_hwmgr_init(struct pp_hwmgr *hwmgr)
5313{ 5313{
5314 struct amdgpu_device *adev = hwmgr->adev;
5315
5314 hwmgr->hwmgr_func = &vega10_hwmgr_funcs; 5316 hwmgr->hwmgr_func = &vega10_hwmgr_funcs;
5315 hwmgr->pptable_func = &vega10_pptable_funcs; 5317 hwmgr->pptable_func = &vega10_pptable_funcs;
5318 if (amdgpu_passthrough(adev))
5319 return vega10_baco_set_cap(hwmgr);
5316 5320
5317 return 0; 5321 return 0;
5318} 5322}
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
index b6767d74dc85..83d22cdeaa29 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
@@ -1371,3 +1371,27 @@ int vega10_get_powerplay_table_entry(struct pp_hwmgr *hwmgr,
1371 1371
1372 return result; 1372 return result;
1373} 1373}
1374
1375int vega10_baco_set_cap(struct pp_hwmgr *hwmgr)
1376{
1377 int result = 0;
1378
1379 const ATOM_Vega10_POWERPLAYTABLE *powerplay_table;
1380
1381 powerplay_table = get_powerplay_table(hwmgr);
1382
1383 PP_ASSERT_WITH_CODE((powerplay_table != NULL),
1384 "Missing PowerPlay Table!", return -1);
1385
1386 result = check_powerplay_tables(hwmgr, powerplay_table);
1387
1388 PP_ASSERT_WITH_CODE((result == 0),
1389 "check_powerplay_tables failed", return result);
1390
1391 set_hw_cap(
1392 hwmgr,
1393 0 != (le32_to_cpu(powerplay_table->ulPlatformCaps) & ATOM_VEGA10_PP_PLATFORM_CAP_BACO),
1394 PHM_PlatformCaps_BACO);
1395 return result;
1396}
1397
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h
index d83ed2af7aa3..da5fbec9b0cd 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h
@@ -59,4 +59,5 @@ extern int vega10_get_number_of_powerplay_table_entries(struct pp_hwmgr *hwmgr);
59extern int vega10_get_powerplay_table_entry(struct pp_hwmgr *hwmgr, uint32_t entry_index, 59extern int vega10_get_powerplay_table_entry(struct pp_hwmgr *hwmgr, uint32_t entry_index,
60 struct pp_power_state *power_state, int (*call_back_func)(struct pp_hwmgr *, void *, 60 struct pp_power_state *power_state, int (*call_back_func)(struct pp_hwmgr *, void *,
61 struct pp_power_state *, void *, uint32_t)); 61 struct pp_power_state *, void *, uint32_t));
62extern int vega10_baco_set_cap(struct pp_hwmgr *hwmgr);
62#endif 63#endif