[PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs

Quan, Evan Evan.Quan at amd.com
Mon Jan 24 03:50:32 UTC 2022


[AMD Official Use Only]



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Saturday, January 22, 2022 4:22 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: [PATCH 4/5] drm/amdgpu: handle BACO synchronization with
> secondary funcs
> 
> Extend secondary function handling for runtime pm beyond audio
> to USB and UCSI.
> 
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 30 +++++++++++++++------
> ----
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 89c3578bc818..119a5798623e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1968,19 +1968,25 @@ static bool
> amdgpu_is_fw_framebuffer(resource_size_t base,
>  	return found;
>  }
> 
> -static void amdgpu_get_audio_func(struct amdgpu_device *adev)
> +static void amdgpu_get_secondary_funcs(struct amdgpu_device *adev)
>  {
>  	struct pci_dev *p = NULL;
> +	int i;
> 
> -	p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev-
> >bus),
> -			adev->pdev->bus->number, 1);
> -	if (p) {
> -		pm_runtime_get_sync(&p->dev);
> -
> -		pm_runtime_mark_last_busy(&p->dev);
> -		pm_runtime_put_autosuspend(&p->dev);
> -
> -		pci_dev_put(p);
> +	/* 0 - GPU
> +	 * 1 - audio
> +	 * 2 - USB
> +	 * 3 - UCSI
> +	 */
> +	for (i = 1; i < 4; i++) {
> +		p = pci_get_domain_bus_and_slot(pci_domain_nr(adev-
> >pdev->bus),
> +						adev->pdev->bus->number,
> i);
> +		if (p) {
> +			pm_runtime_get_sync(&p->dev);
> +			pm_runtime_mark_last_busy(&p->dev);
> +			pm_runtime_put_autosuspend(&p->dev);
> +			pci_dev_put(p);
> +		}
>  	}
>  }
[Quan, Evan] Although PMFW does not care the status of those functions except audio. Logically this seems more reasonable and should be harmless.
Patch 3 & 4 are reviewed-by: Evan Quan <evan.quan at amd.com>
Patch 1, 2, 5 are acked-by: Evan Quan <evan.quan at amd.com>
> 
> @@ -2148,14 +2154,14 @@ static int amdgpu_pci_probe(struct pci_dev
> *pdev,
>  		 * be no PMFW-aware D-state transition(D0->D3) on runpm
>  		 * suspend. Thus the BACO will be not correctly kicked in.
>  		 *
> -		 * Via amdgpu_get_audio_func(), the audio dev is put
> +		 * Via amdgpu_get_secondary_funcs(), the audio dev is put
>  		 * into D0 state. Then there will be a PMFW-aware D-state
>  		 * transition(D0->D3) on runpm suspend.
>  		 */
>  		if (amdgpu_device_supports_baco(ddev) &&
>  		    !(adev->flags & AMD_IS_APU) &&
>  		    (adev->asic_type >= CHIP_NAVI10))
> -			amdgpu_get_audio_func(adev);
> +			amdgpu_get_secondary_funcs(adev);
>  	}
> 
>  	return 0;
> --
> 2.34.1


More information about the amd-gfx mailing list