drm/amdgpu: Need to set the baco cap before baco reset
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16 +++++++++++++++ drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 + .../amd/powerplay/hwmgr/vega10_processpptables.c | 24 ++++++++++++++++++++++ .../amd/powerplay/hwmgr/vega10_processpptables.h | 1 + drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 8 files changed, 54 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
@@ -2611,6 +2611,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,* E.g., driver was not cleanly unloaded previously, etc. */ if (!amdgpu_sriov_vf (adev) &&amdgpu_asic_need_reset_on_init (adev)) { +if (amdgpu_passthrough (adev) && adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->set_asic_baco_cap) { + r = adev->powerplay.pp_funcs->set_asic_baco_cap (adev->powerplay.pp_handle); +if (r) { +dev_err (adev->dev,"set baco capability failed\n" ); + goto failed; + } + } + r =amdgpu_asic_reset (adev);if (r) {dev_err (adev->dev,"asic reset on init failed\n" );
drivers/gpu/drm/amd/amdgpu/soc15.c +2 -1
@@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ -return false; +if (!amdgpu_passthrough (adev)) +return false;if (adev->flags &AMD_IS_APU )return false;
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -296,6 +296,7 @@ struct amd_pm_funcs {int (*set_hard_min_fclk_by_freq)(void *handle,uint32_t clock);int (*set_min_deep_sleep_dcefclk)(void *handle,uint32_t clock);int (*get_asic_baco_capability)(void *handle,bool *cap); +int (*set_asic_baco_cap)(void *handle);int (*get_asic_baco_state)(void *handle,int *state);int (*set_asic_baco_state)(void *handle,int state);int (*get_ppfeature_status)(void *handle,char *buf);
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +16 -0
@@ -1404,6 +1404,21 @@ static int pp_set_active_display_count(void *handle, uint32_t count)return ret; } +static int pp_set_asic_baco_cap (void *handle) +{ +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr) +return -EINVAL ; + +if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_cap) +return 0 ; + + hwmgr->hwmgr_func->set_asic_baco_cap (hwmgr); + +return 0 ; +} +static int pp_get_asic_baco_capability (void *handle,bool *cap) {struct pp_hwmgr *hwmgr = handle;
@@ -1546,6 +1561,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .set_hard_min_dcefclk_by_freq = pp_set_hard_min_dcefclk_by_freq, .set_hard_min_fclk_by_freq = pp_set_hard_min_fclk_by_freq, .get_asic_baco_capability = pp_get_asic_baco_capability, + .set_asic_baco_cap = pp_set_asic_baco_cap, .get_asic_baco_state = pp_get_asic_baco_state, .set_asic_baco_state = pp_set_asic_baco_state, .get_ppfeature_status = pp_get_ppfeature_status,
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1 -0
@@ -5302,6 +5302,7 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = { .odn_edit_dpm_table = vega10_odn_edit_dpm_table, .get_performance_level = vega10_get_performance_level, .get_asic_baco_capability = smu9_baco_get_capability, + .set_asic_baco_cap = vega10_baco_set_cap, .get_asic_baco_state = smu9_baco_get_state, .set_asic_baco_state = vega10_baco_set_state, .enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost,
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +24 -0
@@ -1371,3 +1371,27 @@ int vega10_get_powerplay_table_entry(struct pp_hwmgr *hwmgr,return result; } + +int vega10_baco_set_cap (struct pp_hwmgr *hwmgr) +{ +int result =0 ; + +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table; + + powerplay_table =get_powerplay_table (hwmgr); + +PP_ASSERT_WITH_CODE ((powerplay_table !=NULL ), +"Missing PowerPlay Table!" , return -1 ); + + result =check_powerplay_tables (hwmgr, powerplay_table); + +PP_ASSERT_WITH_CODE ((result ==0 ), + "check_powerplay_tables failed", return result); + +set_hw_cap ( + hwmgr, +0 != (le32_to_cpu (powerplay_table->ulPlatformCaps) &ATOM_VEGA10_PP_PLATFORM_CAP_BACO ), + PHM_PlatformCaps_BACO); +return result; +} +
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h +1 -0
@@ -59,4 +59,5 @@ extern int vega10_get_number_of_powerplay_table_entries(struct pp_hwmgr *hwmgr);extern int vega10_get_powerplay_table_entry (struct pp_hwmgr *hwmgr,uint32_t entry_index,struct pp_power_state *power_state,int (*call_back_func)(struct pp_hwmgr *,void *,struct pp_power_state *,void *,uint32_t )); +extern int vega10_baco_set_cap (struct pp_hwmgr *hwmgr);#endif
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
@@ -339,6 +339,7 @@ struct pp_hwmgr_func {int (*set_hard_min_dcefclk_by_freq)(struct pp_hwmgr *hwmgr,uint32_t clock);int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr,uint32_t clock);int (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr,bool *cap); +int (*set_asic_baco_cap)(struct pp_hwmgr *hwmgr);int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr,enum BACO_STATE *state);int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr,enum BACO_STATE state);int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr,char *buf);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1558606921-1537-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org
Quoted 26 lines · Emily Deng
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 <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16 +++++++++++++++ drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 + .../amd/powerplay/hwmgr/vega10_processpptables.c | 24 ++++++++++++++++++++++ .../amd/powerplay/hwmgr/vega10_processpptables.h | 1 + drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 8 files changed, 54 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2611,6 +2611,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,* E.g., driver was not cleanly unloaded previously, etc.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device *adev, · line 2621
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0*/ if (!amdgpu_sriov_vf (adev) &&amdgpu_asic_need_reset_on_init (adev)) { +if (amdgpu_passthrough (adev) && adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->set_asic_baco_cap) { + r = adev->powerplay.pp_funcs->set_asic_baco_cap (adev->powerplay.pp_handle); +if (r) { +dev_err (adev->dev,"set baco capability failed\n" ); + goto failed; + } + } +
I think it would be cleaner to add this to hwmgr_early_init() or something called from early init for powerplay.
Alex
Quoted 132 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0r =amdgpu_asic_reset (adev);if (r) {dev_err (adev->dev,"asic reset on init failed\n" );drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1@@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ -return false; +if (!amdgpu_passthrough (adev)) +return false;if (adev->flags &AMD_IS_APU )return false;drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-0@@ -296,6 +296,7 @@ struct amd_pm_funcs {int (*set_hard_min_fclk_by_freq)(void *handle,uint32_t clock);int (*set_min_deep_sleep_dcefclk)(void *handle,uint32_t clock);int (*get_asic_baco_capability)(void *handle,bool *cap); +int (*set_asic_baco_cap)(void *handle);int (*get_asic_baco_state)(void *handle,int *state);int (*set_asic_baco_state)(void *handle,int state);int (*get_ppfeature_status)(void *handle,char *buf);drivers/gpu/drm/amd/powerplay/amd_powerplay.c +16
-0@@ -1404,6 +1404,21 @@ static int pp_set_active_display_count(void *handle, uint32_t count)return ret; } +static int pp_set_asic_baco_cap (void *handle) +{ +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr) +return -EINVAL ; + +if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_cap) +return 0 ; + + hwmgr->hwmgr_func->set_asic_baco_cap (hwmgr); + +return 0 ; +} +static int pp_get_asic_baco_capability (void *handle,bool *cap) {struct pp_hwmgr *hwmgr = handle;@@ -1546,6 +1561,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .set_hard_min_dcefclk_by_freq = pp_set_hard_min_dcefclk_by_freq, .set_hard_min_fclk_by_freq = pp_set_hard_min_fclk_by_freq, .get_asic_baco_capability = pp_get_asic_baco_capability, + .set_asic_baco_cap = pp_set_asic_baco_cap, .get_asic_baco_state = pp_get_asic_baco_state, .set_asic_baco_state = pp_set_asic_baco_state, .get_ppfeature_status = pp_get_ppfeature_status,drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-0@@ -5302,6 +5302,7 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = { .odn_edit_dpm_table = vega10_odn_edit_dpm_table, .get_performance_level = vega10_get_performance_level, .get_asic_baco_capability = smu9_baco_get_capability, + .set_asic_baco_cap = vega10_baco_set_cap, .get_asic_baco_state = smu9_baco_get_state, .set_asic_baco_state = vega10_baco_set_state, .enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost,drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +24
-0@@ -1371,3 +1371,27 @@ int vega10_get_powerplay_table_entry(struct pp_hwmgr *hwmgr,return result; } + +int vega10_baco_set_cap (struct pp_hwmgr *hwmgr) +{ +int result =0 ; + +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table; + + powerplay_table =get_powerplay_table (hwmgr); + +PP_ASSERT_WITH_CODE ((powerplay_table !=NULL ), +"Missing PowerPlay Table!" , return -1 ); + + result =check_powerplay_tables (hwmgr, powerplay_table); + +PP_ASSERT_WITH_CODE ((result ==0 ), + "check_powerplay_tables failed", return result); + +set_hw_cap ( + hwmgr, +0 != (le32_to_cpu (powerplay_table->ulPlatformCaps) &ATOM_VEGA10_PP_PLATFORM_CAP_BACO ), + PHM_PlatformCaps_BACO); +return result; +} +drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h +1
-0@@ -59,4 +59,5 @@ extern int vega10_get_number_of_powerplay_table_entries(struct pp_hwmgr *hwmgr);extern int vega10_get_powerplay_table_entry (struct pp_hwmgr *hwmgr,uint32_t entry_index,struct pp_power_state *power_state,int (*call_back_func)(struct pp_hwmgr *,void *,struct pp_power_state *,void *,uint32_t )); +extern int vega10_baco_set_cap (struct pp_hwmgr *hwmgr);#endif drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1
-1@@ -339,6 +339,7 @@ struct pp_hwmgr_func {int (*set_hard_min_dcefclk_by_freq)(struct pp_hwmgr *hwmgr,uint32_t clock);int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr,uint32_t clock);int (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr,bool *cap); +int (*set_asic_baco_cap)(struct pp_hwmgr *hwmgr);int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr,enum BACO_STATE *state);int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr,enum BACO_STATE state);int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr,char *buf); --2.7.4
Quoted 4 lines
_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): CADnq5_NhONFSC2C=0npCx4AKGKAphAsWq1Kq7jZhmeY+ODQ6-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 56 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 24, 2019 12:09 AM
To: Deng, Emily <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Need to set the baco cap before baco reset[CAUTION: External Email]
Quoted 7 lines · Emily Deng
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.
Quoted 6 lines
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16+++++++++++++++
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 + .../amd/powerplay/hwmgr/vega10_processpptables.c | 24++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device
Quoted 10 lines
.../amd/powerplay/hwmgr/vega10_processpptables.h | 1 + drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 8 files changed, 54 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2611,6 +2611,14 @@ int amdgpu_device_init(struct amdgpu_device*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device · line 2615
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0* E.g., driver was not cleanly unloaded previously, etc. */ if (!amdgpu_sriov_vf (adev) &&amdgpu_asic_need_reset_on_init (adev)) { + if (amdgpu_passthrough(adev) && adev->powerplay.pp_funcs &&
adev->powerplay.pp_funcs->set_asic_baco_cap) {drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device *adev, · line 2621
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7
-0+ r = adev->powerplay.pp_funcs->set_asic_baco_cap (adev- powerplay.pp_handle); +if (r) { +dev_err (adev->dev,"set baco capability failed\n" ); + goto failed; + } + } +
Quoted 2 lines
I think it would be cleaner to add this to
hwmgr_early_init()or something called from early init for powerplay.
I also preferred to put it in the hwmgr_early_init, but as the function set_asic_baco_cap need to get the vbios info, so need to put the amdgpu_get_bios before early init. If so the code changes too big.
Quoted 143 lines
Alex
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0r =amdgpu_asic_reset (adev);if (r) { dev_err(adev->dev, "asic reset on initfailed\n"); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index 78bd4fc..d9fdd95 100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/powerplay/amd_powerplay.c static int pp_set_active_display_count(void
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ -return false; +if (!amdgpu_passthrough (adev)) +return false;if (adev->flags &AMD_IS_APU )return false;drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-1@@ -296,6 +296,7 @@ struct amd_pm_funcs {int (*set_hard_min_fclk_by_freq)(void *handle,uint32_t clock);int (*set_min_deep_sleep_dcefclk)(void *handle,uint32_t clock);int (*get_asic_baco_capability)(void *handle,bool *cap); +int (*set_asic_baco_cap)(void *handle);int (*get_asic_baco_state)(void *handle,int *state);int (*set_asic_baco_state)(void *handle,int state);int (*get_ppfeature_status)(void *handle,char *buf); diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index bea1587..9856760 100644drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0
-0@@ -1404,6 +1404,21 @@ static int pp_set_active_display_count(void*handle,
uint32_tcount)drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static const struct pp_hwmgr_func
Quoted 33 lines
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +15
-0return ret; } +static int pp_set_asic_baco_cap (void *handle) { +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr) +return -EINVAL ; + +if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_cap) +return 0 ; + + hwmgr->hwmgr_func->set_asic_baco_cap (hwmgr); + +return 0 ; +} +static int pp_get_asic_baco_capability (void *handle,bool *cap) { struct pp_hwmgr *hwmgr = handle; @@ -1546,6 +1561,7 @@ staticconst struct amd_pm_funcs pp_dpm_funcs = { .set_hard_min_dcefclk_by_freq = pp_set_hard_min_dcefclk_by_freq, .set_hard_min_fclk_by_freq = pp_set_hard_min_fclk_by_freq, .get_asic_baco_capability = pp_get_asic_baco_capability, + .set_asic_baco_cap = pp_set_asic_baco_cap, .get_asic_baco_state = pp_get_asic_baco_state, .set_asic_baco_state = pp_set_asic_baco_state, .get_ppfeature_status = pp_get_ppfeature_status, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cindex ce6aeb5..e5bcbc8 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -5302,6 +5302,7 @@ static const struct pp_hwmgr_func
vega10_hwmgr_funcs= {Quoted 27 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-1.odn_edit_dpm_table = vega10_odn_edit_dpm_table, .get_performance_level = vega10_get_performance_level, .get_asic_baco_capability = smu9_baco_get_capability, + .set_asic_baco_cap = vega10_baco_set_cap, .get_asic_baco_state = smu9_baco_get_state, .set_asic_baco_state = vega10_baco_set_state, .enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost, diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cindex b6767d7..83d22cd 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +10
-0@@ -1371,3 +1371,27 @@ int vega10_get_powerplay_table_entry(structpp_hwmgr *hwmgr, return result; } + +int vega10_baco_set_cap (struct pp_hwmgr *hwmgr) { +int result =0 ; + +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table; + + powerplay_table =get_powerplay_table (hwmgr); + +PP_ASSERT_WITH_CODE ((powerplay_table !=NULL ), +"Missing PowerPlay Table!" , return -1 );drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c int vega10_get_powerplay_table_entry(struct
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +10
-0+ + result =check_powerplay_tables (hwmgr, powerplay_table); + +PP_ASSERT_WITH_CODE ((result ==0 ), +"check_powerplay_tables failed" , return + result); + + set_hw_cap( + hwmgr, + 0 != (le32_to_cpu(powerplay_table->ulPlatformCaps) &
ATOM_VEGA10_PP_PLATFORM_CAP_BACO),Quoted 11 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +4
-0+ PHM_PlatformCaps_BACO); +return result; +} +diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hindex d83ed2a..da5fbec 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h +0
-0@@ -59,4 +59,5 @@ extern intQuoted 1 line
vega10_get_number_of_powerplay_table_entries(struct
pp_hwmgr*hwmgr); extern int vega10_get_powerplay_table_entry(struct
pp_hwmgr*hwmgr,uint32_tentry_index,Quoted 1 line
struct
pp_power_state*power_state, int (*call_back_func)(struct
pp_hwmgr*, void *,drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 339
Quoted 11 lines
struct
pp_power_state*, void *,uint32_t));drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h +1
-0+extern int vega10_baco_set_cap (struct pp_hwmgr *hwmgr);#endif drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0@@ -339,6 +339,7 @@ struct pp_hwmgr_func { int (*set_hard_min_dcefclk_by_freq)(struct pp_hwmgr *hwmgr,
uint32_tclock);drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 340
Quoted 1 line
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t
Quoted 17 lines
clock);
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 344
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1
-0int (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr,bool *cap); +int (*set_asic_baco_cap)(struct pp_hwmgr *hwmgr); int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr, enum
BACO_STATE*state);drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 345
Quoted 1 line
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr, enum
BACO_STATEstate);Quoted 9 lines
int (*get_ppfeature_status)(struct
pp_hwmgr*hwmgr, char
*buf);
--
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
A message that is not in the archive (sent off-list or not yet received): MWHPR12MB132625FCE9DF15D24746CFD28F020-Gy0DoCVfaSVaj5rVPFIlogdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Ping ......
Best wishes
Emily Deng
Quoted 234 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Deng, Emily
Sent: Friday, May 24, 2019 10:29 AM
To: Alex Deucher <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Need to set the baco cap before baco reset[CAUTION: External Email]
Quoted 56 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 24, 2019 12:09 AM
To: Deng, Emily <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Need to set the baco cap before baco reset[CAUTION: External Email]
Quoted 7 lines · Emily Deng
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.
Quoted 6 lines
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16+++++++++++++++
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 + .../amd/powerplay/hwmgr/vega10_processpptables.c | 24++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device
Quoted 10 lines
.../amd/powerplay/hwmgr/vega10_processpptables.h | 1 + drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 8 files changed, 54 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2611,6 +2611,14 @@ int amdgpu_device_init(struct amdgpu_device*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device · line 2616
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0* E.g., driver was not cleanly unloaded previously, etc. */ if (!amdgpu_sriov_vf (adev) &&amdgpu_asic_need_reset_on_init (adev)) { + if (amdgpu_passthrough(adev) && + adev->powerplay.pp_funcs &&
adev->powerplay.pp_funcs->set_asic_baco_cap) {drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device *adev, · line 2621
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ r = + adev->powerplay.pp_funcs->set_asic_baco_cap (adev- powerplay.pp_handle); +if (r) { +dev_err (adev->dev,"set baco capability failed\n" ); + goto failed; + } + } +Quoted 2 lines
I think it would be cleaner to add this to
hwmgr_early_init()or something called from early init for powerplay.I also preferred to put it in the
hwmgr_early_init, but as the functionset_asic_baco_capneed to get the vbios info, so need to put theamdgpu_get_biosbefore early init. If so the code changes too big.Quoted 68 lines
Alex
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
r = amdgpu_asic_reset(adev); if (r) { dev_err(adev->dev, "asic reset on initfailed\n"); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index 78bd4fc..d9fdd95 100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/powerplay/amd_powerplay.c static int pp_set_active_display_count(void
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ -return false; +if (!amdgpu_passthrough (adev)) +return false;if (adev->flags &AMD_IS_APU )return false;drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-1@@ -296,6 +296,7 @@ struct amd_pm_funcs {int (*set_hard_min_fclk_by_freq)(void *handle,uint32_t clock);int (*set_min_deep_sleep_dcefclk)(void *handle,uint32_t clock);int (*get_asic_baco_capability)(void *handle,bool *cap); +int (*set_asic_baco_cap)(void *handle);int (*get_asic_baco_state)(void *handle,int *state);int (*set_asic_baco_state)(void *handle,int state);int (*get_ppfeature_status)(void *handle,char *buf); diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index bea1587..9856760 100644drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0
-0@@ -1404,6 +1404,21 @@ static int pp_set_active_display_count(void*handle,
uint32_tcount)Quoted 26 lines
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +15
-0return ret; } +static int pp_set_asic_baco_cap (void *handle) { +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr) +return -EINVAL ; + +if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_cap) +return 0 ; + + hwmgr->hwmgr_func->set_asic_baco_cap (hwmgr); + +return 0 ; +} +static int pp_get_asic_baco_capability (void *handle,bool *cap) { struct pp_hwmgr *hwmgr = handle; @@ -1546,6 +1561,7 @@ staticconst struct amd_pm_funcs pp_dpm_funcs = { .set_hard_min_dcefclk_by_freq = pp_set_hard_min_dcefclk_by_freq, .set_hard_min_fclk_by_freq = pp_set_hard_min_fclk_by_freq, .get_asic_baco_capability = pp_get_asic_baco_capability, + .set_asic_baco_cap = pp_set_asic_baco_cap, .get_asic_baco_state = pp_get_asic_baco_state, .set_asic_baco_state = pp_set_asic_baco_state,Quoted 16 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static const struct pp_hwmgr_func
Quoted 7 lines
.get_ppfeature_status = pp_get_ppfeature_status, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cindex ce6aeb5..e5bcbc8 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -5302,6 +5302,7 @@ static const struct pp_hwmgr_func
vega10_hwmgr_funcs= {Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-1.odn_edit_dpm_table = vega10_odn_edit_dpm_table, .get_performance_level = vega10_get_performance_level, .get_asic_baco_capability = smu9_baco_get_capability, + .set_asic_baco_cap = vega10_baco_set_cap, .get_asic_baco_state = smu9_baco_get_state, .set_asic_baco_state = vega10_baco_set_state, .enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cQuoted 4 lines
Quoted 4 lines
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cindex b6767d7..83d22cd 100644
---a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
+++
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cQuoted 27 lines
Quoted 16 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +11
-0@@ -1371,3 +1371,27 @@ int vega10_get_powerplay_table_entry(structpp_hwmgr *hwmgr, return result; } + +int vega10_baco_set_cap (struct pp_hwmgr *hwmgr) { +int result =0 ; + +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table; + + powerplay_table =get_powerplay_table (hwmgr); + +PP_ASSERT_WITH_CODE ((powerplay_table !=NULL ), +"Missing PowerPlay Table!" , return -1 ); +drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c int vega10_get_powerplay_table_entry(struct
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +10
-0+ result =check_powerplay_tables (hwmgr, powerplay_table); + +PP_ASSERT_WITH_CODE ((result ==0 ), +"check_powerplay_tables failed" , return + result); + + set_hw_cap( + hwmgr, + 0 != + (le32_to_cpu(powerplay_table->ulPlatformCaps) &
ATOM_VEGA10_PP_PLATFORM_CAP_BACO),Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +4
-0+ PHM_PlatformCaps_BACO); +return result; +} +diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hindex d83ed2a..da5fbec 100644
---a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h
+++
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hQuoted 34 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -59,4 +59,5 @@ extern intvega10_get_number_of_powerplay_table_entries(struct
pp_hwmgr*hwmgr); extern int vega10_get_powerplay_table_entry(struct
pp_hwmgr*hwmgr,uint32_tentry_index,Quoted 2 lines
struct
pp_power_state*power_state, int
(*call_back_func)(struct
pp_hwmgr*, void *,drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 339
Quoted 11 lines
struct
pp_power_state*, void *,uint32_t));drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-0+extern int vega10_baco_set_cap (struct pp_hwmgr *hwmgr);#endif drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0@@ -339,6 +339,7 @@ struct pp_hwmgr_func { int (*set_hard_min_dcefclk_by_freq)(struct pp_hwmgr *hwmgr,
uint32_tclock);Quoted 2 lines
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr,
uint32_tclock);
Quoted 4 lines
int (*get_asic_baco_capability)(struct
pp_hwmgr*hwmgr, bool
*cap);
+ int (*set_asic_baco_cap)(structpp_hwmgr*hwmgr);
int (*get_asic_baco_state)(structpp_hwmgr*hwmgr, enum
BACO_STATE*state);Quoted 1 line
int (*set_asic_baco_state)(struct
pp_hwmgr*hwmgr, enum
BACO_STATEstate);Quoted 5 lines
int (*get_ppfeature_status)(struct
pp_hwmgr*hwmgr, char
*buf);
--
2.7.4
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 57 lines · Emily
Quoted 57 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 24, 2019 12:09 AM
To: Deng, Emily <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Need to set the baco cap before baco reset[CAUTION: External Email]
Quoted 7 lines · Emily Deng
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.
Quoted 6 lines
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16+++++++++++++++
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 + .../amd/powerplay/hwmgr/vega10_processpptables.c | 24++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device
Quoted 10 lines
.../amd/powerplay/hwmgr/vega10_processpptables.h | 1 + drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 8 files changed, 54 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2611,6 +2611,14 @@ int amdgpu_device_init(struct amdgpu_device*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct amdgpu_device · line 2615
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0* E.g., driver was not cleanly unloaded previously, etc. */ if (!amdgpu_sriov_vf (adev) &&amdgpu_asic_need_reset_on_init (adev)) { + if (amdgpu_passthrough(adev) && adev->powerplay.pp_funcs &&
adev->powerplay.pp_funcs->set_asic_baco_cap) {Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7
-0+ r = adev->powerplay.pp_funcs->set_asic_baco_cap (adev- powerplay.pp_handle); +if (r) { +dev_err (adev->dev,"set baco capability failed\n" ); + goto failed; + } + } +
Quoted 3 lines
Quoted 2 lines
I think it would be cleaner to add this to
hwmgr_early_init()or something called from early init for powerplay.I also preferred to put it in the
hwmgr_early_init, but as the functionset_asic_baco_capneed to get the vbios info, so need to put theamdgpu_get_biosbefore early init. If so the code changes too big.
I think this change is all you need:
(quoted diff) +0 -0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index bdd1fe73f14b..952f61e28d42 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -6
@@ -2564,6 +2564,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,amdgpu_device_get_pcie_info (adev); +/* Read BIOS */ +if (!amdgpu_get_bios (adev)) { + r = -EINVAL ; + goto failed; + } +/* early init functions */ r =amdgpu_device_ip_early_init (adev);if (r)
@@ -2591,12 +2597,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, goto fence_driver_init; } -/* Read BIOS */ -if (!amdgpu_get_bios (adev)) { - r = -EINVAL ; - goto failed; - } - r =amdgpu_atombios_init (adev);if (r) {dev_err (adev->dev,"amdgpu_atombios_init failed\n" );
I guess that could be a follow up change if you want.
Alex
Quoted 156 lines
Quoted 156 lines
Alex
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0r =amdgpu_asic_reset (adev);if (r) { dev_err(adev->dev, "asic reset on initfailed\n"); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index 78bd4fc..d9fdd95 100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/powerplay/amd_powerplay.c static int pp_set_active_display_count(void
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ -return false; +if (!amdgpu_passthrough (adev)) +return false;if (adev->flags &AMD_IS_APU )return false;drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-1@@ -296,6 +296,7 @@ struct amd_pm_funcs {int (*set_hard_min_fclk_by_freq)(void *handle,uint32_t clock);int (*set_min_deep_sleep_dcefclk)(void *handle,uint32_t clock);int (*get_asic_baco_capability)(void *handle,bool *cap); +int (*set_asic_baco_cap)(void *handle);int (*get_asic_baco_state)(void *handle,int *state);int (*set_asic_baco_state)(void *handle,int state);int (*get_ppfeature_status)(void *handle,char *buf); diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index bea1587..9856760 100644drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0
-0@@ -1404,6 +1404,21 @@ static int pp_set_active_display_count(void*handle,
uint32_tcount)drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static const struct pp_hwmgr_func
Quoted 33 lines
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +15
-0return ret; } +static int pp_set_asic_baco_cap (void *handle) { +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr) +return -EINVAL ; + +if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_cap) +return 0 ; + + hwmgr->hwmgr_func->set_asic_baco_cap (hwmgr); + +return 0 ; +} +static int pp_get_asic_baco_capability (void *handle,bool *cap) { struct pp_hwmgr *hwmgr = handle; @@ -1546,6 +1561,7 @@ staticconst struct amd_pm_funcs pp_dpm_funcs = { .set_hard_min_dcefclk_by_freq = pp_set_hard_min_dcefclk_by_freq, .set_hard_min_fclk_by_freq = pp_set_hard_min_fclk_by_freq, .get_asic_baco_capability = pp_get_asic_baco_capability, + .set_asic_baco_cap = pp_set_asic_baco_cap, .get_asic_baco_state = pp_get_asic_baco_state, .set_asic_baco_state = pp_set_asic_baco_state, .get_ppfeature_status = pp_get_ppfeature_status, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cindex ce6aeb5..e5bcbc8 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -5302,6 +5302,7 @@ static const struct pp_hwmgr_func
vega10_hwmgr_funcs= {Quoted 27 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-1.odn_edit_dpm_table = vega10_odn_edit_dpm_table, .get_performance_level = vega10_get_performance_level, .get_asic_baco_capability = smu9_baco_get_capability, + .set_asic_baco_cap = vega10_baco_set_cap, .get_asic_baco_state = smu9_baco_get_state, .set_asic_baco_state = vega10_baco_set_state, .enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost, diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cindex b6767d7..83d22cd 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +10
-0@@ -1371,3 +1371,27 @@ int vega10_get_powerplay_table_entry(structpp_hwmgr *hwmgr, return result; } + +int vega10_baco_set_cap (struct pp_hwmgr *hwmgr) { +int result =0 ; + +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table; + + powerplay_table =get_powerplay_table (hwmgr); + +PP_ASSERT_WITH_CODE ((powerplay_table !=NULL ), +"Missing PowerPlay Table!" , return -1 );drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c int vega10_get_powerplay_table_entry(struct
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +10
-0+ + result =check_powerplay_tables (hwmgr, powerplay_table); + +PP_ASSERT_WITH_CODE ((result ==0 ), +"check_powerplay_tables failed" , return + result); + + set_hw_cap( + hwmgr, + 0 != (le32_to_cpu(powerplay_table->ulPlatformCaps) &
ATOM_VEGA10_PP_PLATFORM_CAP_BACO),Quoted 11 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.c +4
-0+ PHM_PlatformCaps_BACO); +return result; +} +diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hindex d83ed2a..da5fbec 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h +0
-0@@ -59,4 +59,5 @@ extern intQuoted 1 line
vega10_get_number_of_powerplay_table_entries(struct
pp_hwmgr*hwmgr); extern int vega10_get_powerplay_table_entry(struct
pp_hwmgr*hwmgr,uint32_tentry_index,Quoted 1 line
struct
pp_power_state*power_state, int (*call_back_func)(struct
pp_hwmgr*, void *,drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 339
Quoted 11 lines
struct
pp_power_state*, void *,uint32_t));drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h +1
-0+extern int vega10_baco_set_cap (struct pp_hwmgr *hwmgr);#endif drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0@@ -339,6 +339,7 @@ struct pp_hwmgr_func { int (*set_hard_min_dcefclk_by_freq)(struct pp_hwmgr *hwmgr,
uint32_tclock);drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 340
Quoted 1 line
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_tclock);
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 344
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1
-0int (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr,bool *cap); +int (*set_asic_baco_cap)(struct pp_hwmgr *hwmgr); int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr, enum
BACO_STATE*state);drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 345
Quoted 1 line
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr, enum
BACO_STATEstate);Quoted 5 lines
int (*get_ppfeature_status)(struct
pp_hwmgr*hwmgr, char
*buf);
--
2.7.4
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
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
A message that is not in the archive (sent off-list or not yet received): CADnq5_Of2+kLtG3tRWkJXG3Ghbs9VFu8g4mDbKvdD7cXyuysRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 115 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Saturday, May 25, 2019 12:59 AM
To: Deng, Emily <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Need to set the baco cap before baco reset[CAUTION: External Email]
Quoted 14 lines · Emily
Quoted 14 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 24, 2019 12:09 AM
To: Deng, Emily <[email protected]>
Cc: amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Need to set the baco cap before baco reset[CAUTION: External Email]
On Thu, May 23, 2019 at 6:22 AM Emily Deng <[email protected]>
Quoted 21 lines · wrote:
Quoted 21 lines
Quoted 7 lines
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.
Quoted 6 lines
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 3 ++- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16+++++++++++++++
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 1 + .../amd/powerplay/hwmgr/vega10_processpptables.c | 24++++++++++++++++++++++
Quoted 4 lines
.../amd/powerplay/hwmgr/vega10_processpptables.h | 1 + drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 8 files changed, 54 insertions(+), 1 deletion(-)Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -2611,6 +2611,14 @@ int amdgpu_device_init(struct
amdgpu_deviceQuoted 18 lines
Quoted 18 lines
*adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_init(struct · line 2616
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0* E.g., driver was not cleanly unloaded previously, etc. */ if (!amdgpu_sriov_vf (adev) &&amdgpu_asic_need_reset_on_init (adev)) { + if (amdgpu_passthrough(adev) && + adev->powerplay.pp_funcs &&
adev->powerplay.pp_funcs->set_asic_baco_cap) {Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0+ r = + adev->powerplay.pp_funcs->set_asic_baco_cap (adev- powerplay.pp_handle); +if (r) { +dev_err (adev->dev,"set baco capability failed\n" ); + goto failed; + } + } +Quoted 3 lines
Quoted 2 lines
I think it would be cleaner to add this to
hwmgr_early_init()or something called from early init for powerplay.I also preferred to put it in the
hwmgr_early_init, but as the function
set_asic_baco_capneed to get the vbios info, so need to put theamdgpu_get_biosbefore early init. If so the code changes too big.I think this change is all you need:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-0@@ -2564,6 +2564,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,amdgpu_device_get_pcie_info (adev); +/* Read BIOS */ +if (!amdgpu_get_bios (adev)) { + r = -EINVAL ; + goto failed; + } +/* early init functions */ r =amdgpu_device_ip_early_init (adev);if (r)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-6@@ -2591,12 +2597,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, goto fence_driver_init; } -/* Read BIOS */ -if (!amdgpu_get_bios (adev)) { - r = -EINVAL ; - goto failed; - } - r =amdgpu_atombios_init (adev);if (r) {dev_err(adev->dev, "amdgpu_atombios_init failed\n");
Quoted 3 lines
I guess that could be a follow up change if you want.
Alex
Thanks, will modify the change as your suggestion.
Best wishes
Emily Deng
Quoted 130 lines
Quoted 56 lines
Quoted 56 lines
Alex
drivers/gpu/drm/amd/amdgpu/soc15.c static bool soc15_need_reset_on_init(struct
Quoted 9 lines
r = amdgpu_asic_reset(adev); if (r) { dev_err(adev->dev, "asic reset on initfailed\n"); diff --git
a/drivers/gpu/drm/amd/amdgpu/soc15.cb/drivers/gpu/drm/amd/amdgpu/soc15.c
index 78bd4fc..d9fdd95 100644drivers/gpu/drm/amd/amdgpu/soc15.c +0
-0@@ -764,7 +764,8 @@ static bool soc15_need_reset_on_init(struct
amdgpu_device*adev)drivers/gpu/drm/amd/powerplay/amd_powerplay.c static int pp_set_active_display_count(void
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/soc15.c +2
-1/* Just return false for soc15 GPUs. Reset does not seem to * be necessary. */ -return false; +if (!amdgpu_passthrough (adev)) +return false;if (adev->flags &AMD_IS_APU )return false;drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-1@@ -296,6 +296,7 @@ struct amd_pm_funcs {int (*set_hard_min_fclk_by_freq)(void *handle,uint32_t clock);int (*set_min_deep_sleep_dcefclk)(void *handle,uint32_t clock);int (*get_asic_baco_capability)(void *handle,bool *cap); +int (*set_asic_baco_cap)(void *handle);int (*get_asic_baco_state)(void *handle,int *state);int (*set_asic_baco_state)(void *handle,int state);int (*get_ppfeature_status)(void *handle,char *buf); diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index bea1587..9856760 100644drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0
-0@@ -1404,6 +1404,21 @@ static int pp_set_active_display_count(void*handle,
uint32_tcount)Quoted 13 lines
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +10
-0return ret; } +static int pp_set_asic_baco_cap (void *handle) { +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr) +return -EINVAL ; + +if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_cap) +return 0 ; + + hwmgr->hwmgr_func->set_asic_baco_cap (hwmgr);Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/amd_powerplay.c static int pp_set_active_display_count(void
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +4
-0+ +return 0 ; +} + static int pp_get_asic_baco_capability(void *handle, bool *cap) { struct pp_hwmgr *hwmgr = handle; @@ -1546,6 +1561,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .set_hard_min_dcefclk_by_freq =
pp_set_hard_min_dcefclk_by_freq,Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c static const struct pp_hwmgr_func
Quoted 12 lines
.set_hard_min_fclk_by_freq =
pp_set_hard_min_fclk_by_freq, .get_asic_baco_capability =pp_get_asic_baco_capability,
+ .set_asic_baco_cap =pp_set_asic_baco_cap,
.get_asic_baco_state =pp_get_asic_baco_state, .set_asic_baco_state =pp_set_asic_baco_state, .get_ppfeature_status =pp_get_ppfeature_status, diff --gita/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.cindex ce6aeb5..e5bcbc8 100644drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -5302,6 +5302,7 @@ static const struct pp_hwmgr_func
vega10_hwmgr_funcs= {Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-0.odn_edit_dpm_table = vega10_odn_edit_dpm_table, .get_performance_level = vega10_get_performance_level, .get_asic_baco_capability = smu9_baco_get_capability, + .set_asic_baco_cap = vega10_baco_set_cap,Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-1.get_asic_baco_state = smu9_baco_get_state, .set_asic_baco_state = vega10_baco_set_state, .enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost, diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cindex b6767d7..83d22cd 100644
---
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cQuoted 1 line
Quoted 1 line
Quoted 1 line
+++
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.cQuoted 27 lines
Quoted 27 lines
Quoted 16 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +11
-0@@ -1371,3 +1371,27 @@ int vega10_get_powerplay_table_entry(structpp_hwmgr *hwmgr, return result; } + +int vega10_baco_set_cap (struct pp_hwmgr *hwmgr) { +int result =0 ; + +const ATOM_Vega10_POWERPLAYTABLE *powerplay_table; + + powerplay_table =get_powerplay_table (hwmgr); + +PP_ASSERT_WITH_CODE ((powerplay_table !=NULL ), +"Missing PowerPlay Table!" , return -1 ); +drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c int vega10_get_powerplay_table_entry(struct
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +10
-0+ result =check_powerplay_tables (hwmgr, powerplay_table); + +PP_ASSERT_WITH_CODE ((result ==0 ), +"check_powerplay_tables failed" , return + result); + + set_hw_cap( + hwmgr, + 0 != + (le32_to_cpu(powerplay_table->ulPlatformCaps) &
ATOM_VEGA10_PP_PLATFORM_CAP_BACO),Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +4
-0+ PHM_PlatformCaps_BACO); +return result; +} +diff --git
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hb/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hindex d83ed2a..da5fbec 100644
---
a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.h
Quoted 41 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
+++
b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_processpptables.hQuoted 3 lines
Quoted 3 lines
Quoted 2 lines
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +0
-0@@ -59,4 +59,5 @@ extern intvega10_get_number_of_powerplay_table_entries(struct
pp_hwmgr*hwmgr); extern int vega10_get_powerplay_table_entry(struct
pp_hwmgrQuoted 35 lines
Quoted 35 lines
*hwmgr,
uint32_tentry_index,Quoted 2 lines
struct
pp_power_state*power_state, int
(*call_back_func)(struct
pp_hwmgr*, void *,drivers/gpu/drm/amd/powerplay/inc/hwmgr.h struct pp_hwmgr_func { · line 339
Quoted 11 lines
struct
pp_power_state*, void *,uint32_t));drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +1
-0+extern int vega10_baco_set_cap (struct pp_hwmgr *hwmgr);#endif drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0@@ -339,6 +339,7 @@ struct pp_hwmgr_func { int (*set_hard_min_dcefclk_by_freq)(struct pp_hwmgr *hwmgr,
uint32_tclock);Quoted 2 lines
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0
-0int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr,
uint32_tclock);
Quoted 4 lines
int (*get_asic_baco_capability)(struct
pp_hwmgr*hwmgr,
bool *cap);
+ int (*set_asic_baco_cap)(structpp_hwmgr*hwmgr);
int (*get_asic_baco_state)(structpp_hwmgr*hwmgr, enum
BACO_STATE*state);Quoted 1 line
int (*set_asic_baco_state)(struct
pp_hwmgr*hwmgr, enum
BACO_STATEstate);Quoted 9 lines
int (*get_ppfeature_status)(struct
pp_hwmgr*hwmgr, char
*buf);
--
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