[PATCH] drm/amdgpu: Fix the runtime pm mode error
Lazar, Lijo
lijo.lazar at amd.com
Wed Mar 20 13:38:30 UTC 2024
On 3/20/2024 6:54 PM, Alex Deucher wrote:
> On Wed, Mar 20, 2024 at 6:17 AM Ma Jun <Jun.Ma2 at amd.com> wrote:
>>
>> Because of the logic error, Arcturus and vega20 currently
>> use the AMDGPU_RUNPM_NONE for runtime pm even though they
>> support BACO. So, the code is optimized to fix this error.
>>
>> Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 ++++++++++++-------------
>> 1 file changed, 27 insertions(+), 29 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> index 1f92fb1e7421..70cf2d0c7683 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> @@ -150,42 +150,40 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
>> }
>>
>> adev->pm.rpm_mode = AMDGPU_RUNPM_NONE;
>> - if (amdgpu_device_supports_px(dev) &&
>> - (amdgpu_runtime_pm != 0)) { /* enable PX as runtime mode */
>> - adev->pm.rpm_mode = AMDGPU_RUNPM_PX;
>> - dev_info(adev->dev, "Using ATPX for runtime pm\n");
>> - } else if (amdgpu_device_supports_boco(dev) &&
>> - (amdgpu_runtime_pm != 0)) { /* enable boco as runtime mode */
>> - adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO;
>> - dev_info(adev->dev, "Using BOCO for runtime pm\n");
>> - } else if (amdgpu_device_supports_baco(dev) &&
>> - (amdgpu_runtime_pm != 0)) {
>> - switch (adev->asic_type) {
>> - case CHIP_VEGA20:
>> - case CHIP_ARCTURUS:
>> - /* enable BACO as runpm mode if runpm=1 */
>> - if (amdgpu_runtime_pm > 0)
>> - adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
>> - break;
>> - case CHIP_VEGA10:
>> - /* enable BACO as runpm mode if noretry=0 */
>> - if (!adev->gmc.noretry)
>> + if (amdgpu_runtime_pm > 0) {
>> + adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
>> + dev_info(adev->dev, "Forcing BACO for runtime pm\n");
>
> Does this need special handling for BAMACO? Setting
> amdgpu_runtime_pm=2 is supposed to set BAMACO and 1 is supposed to
> force BACO.
>
Also, based on the comment it appears as if runpm is not intended to be
enabled by default on Vega20/Arcturus (unless forced by module parameter).
Thanks,
Lijo
> Alex
>
>> + } else if (amdgpu_runtime_pm != 0) {
>> + if (amdgpu_device_supports_px(dev)) { /* enable PX as runtime mode */
>> + adev->pm.rpm_mode = AMDGPU_RUNPM_PX;
>> + dev_info(adev->dev, "Using ATPX for runtime pm\n");
>> + } else if (amdgpu_device_supports_boco(dev)) { /* enable boco as runtime mode */
>> + adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO;
>> + dev_info(adev->dev, "Using BOCO for runtime pm\n");
>> + } else if (amdgpu_device_supports_baco(dev)) {
>> + switch (adev->asic_type) {
>> + case CHIP_VEGA10:
>> + /* enable BACO as runpm mode if noretry=0 */
>> + if (!adev->gmc.noretry)
>> + adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
>> + break;
>> + default:
>> + /* enable BACO as runpm mode on CI+ */
>> adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
>> - break;
>> - default:
>> - /* enable BACO as runpm mode on CI+ */
>> - adev->pm.rpm_mode = AMDGPU_RUNPM_BACO;
>> - break;
>> - }
>> + break;
>> + }
>>
>> - if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO)
>> - dev_info(adev->dev, "Using BACO for runtime pm\n");
>> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_BACO)
>> + dev_info(adev->dev, "Using BACO for runtime pm\n");
>> + }
>> }
>>
>> + if (adev->pm.rpm_mode == AMDGPU_RUNPM_NONE)
>> + dev_info(adev->dev, "No PM mode for runtime pm\n");
>> +
>> /* Call ACPI methods: require modeset init
>> * but failure is not fatal
>> */
>> -
>> acpi_status = amdgpu_acpi_init(adev);
>> if (acpi_status)
>> dev_dbg(dev->dev, "Error during ACPI methods call\n");
>> --
>> 2.34.1
>>
More information about the amd-gfx
mailing list