[PATCH] drm/amdgpu: there is no vbios fb on devices with no display hw (v2)

Quan, Evan Evan.Quan at amd.com
Mon Nov 14 05:57:19 UTC 2022


[AMD Official Use Only - General]

Acked-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Saturday, November 12, 2022 4:54 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: [PATCH] drm/amdgpu: there is no vbios fb on devices with no
> display hw (v2)
> 
> If we enable virtual display functionality on parts with
> no display hardware we can end up trying to check for and
> reserve the vbios FB area on devices where it doesn't exist.
> Check if display hardware is actually present on the hardware
> before trying to reserve the memory.
> 
> v2: move the check into common code
> 
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 41
> ++++++++++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c    |  2 +-
>  3 files changed, 43 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 5a4aaf4d9ed1..1f3a4d596d0d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1298,6 +1298,7 @@ void amdgpu_device_pcie_port_wreg(struct
> amdgpu_device *adev,
>  				u32 reg, u32 v);
>  struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device
> *adev,
>  					    struct dma_fence *gang);
> +bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev);
> 
>  /* atpx handler */
>  #if defined(CONFIG_VGA_SWITCHEROO)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index e039df9fb3dd..148ac2e9f31f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -6045,3 +6045,44 @@ struct dma_fence
> *amdgpu_device_switch_gang(struct amdgpu_device *adev,
>  	dma_fence_put(old);
>  	return NULL;
>  }
> +
> +bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev)
> +{
> +	switch (adev->asic_type) {
> +#ifdef CONFIG_DRM_AMDGPU_SI
> +	case CHIP_HAINAN:
> +#endif
> +	case CHIP_TOPAZ:
> +		/* chips with no display hardware */
> +		return false;
> +#ifdef CONFIG_DRM_AMDGPU_SI
> +	case CHIP_TAHITI:
> +	case CHIP_PITCAIRN:
> +	case CHIP_VERDE:
> +	case CHIP_OLAND:
> +#endif
> +#ifdef CONFIG_DRM_AMDGPU_CIK
> +	case CHIP_BONAIRE:
> +	case CHIP_HAWAII:
> +	case CHIP_KAVERI:
> +	case CHIP_KABINI:
> +	case CHIP_MULLINS:
> +#endif
> +	case CHIP_TONGA:
> +	case CHIP_FIJI:
> +	case CHIP_POLARIS10:
> +	case CHIP_POLARIS11:
> +	case CHIP_POLARIS12:
> +	case CHIP_VEGAM:
> +	case CHIP_CARRIZO:
> +	case CHIP_STONEY:
> +		/* chips with display hardware */
> +		return true;
> +	default:
> +		/* IP discovery */
> +		if (!adev->ip_versions[DCE_HWIP][0] ||
> +		    (adev->harvest_ip_mask &
> AMD_HARVEST_IP_DMU_MASK))
> +			return false;
> +		return true;
> +	}
> +}
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 9c0d9baab4e2..4365ede42855 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -657,7 +657,7 @@ void amdgpu_gmc_get_vbios_allocations(struct
> amdgpu_device *adev)
>  	}
> 
>  	if (amdgpu_sriov_vf(adev) ||
> -	    !amdgpu_device_ip_get_ip_block(adev,
> AMD_IP_BLOCK_TYPE_DCE)) {
> +	    !amdgpu_device_has_display_hardware(adev)) {
>  		size = 0;
>  	} else {
>  		size = amdgpu_gmc_get_vbios_fb_size(adev);
> --
> 2.38.1


More information about the amd-gfx mailing list