[Freedreno] [PATCH 1/3] drm/msm/adreno: load gpu at probe/bind time

Jordan Crouse jcrouse at codeaurora.org
Mon Oct 16 22:00:15 UTC 2017


On Mon, Oct 16, 2017 at 11:27:47AM -0400, Rob Clark wrote:
> Previously, in an effort to defer initializing the gpu until firmware
> was available (ie. rootfs mounted), the gpu was not loaded at when the
> subdevice was bound.  Which resulted that clks/etc were requested in a
> place that devm couldn't really help unwind if something failed.
> 
> Instead move request_firmware() to gpu->hw_init() and construct the gpu
> earlier in adreno_bind().  To avoid the rest of the driver needing to
> be aware of a gpu that hasn't managed to load firmware and hw_init()
> yet, stash the gpu ptr in the adreno device's drvdata, and don't set
> priv->gpu() until hw_init() succeeds.
> 
> Signed-off-by: Rob Clark <robdclark at gmail.com>
> ---
>  drivers/gpu/drm/msm/adreno/a5xx_gpu.c      |  6 +--
>  drivers/gpu/drm/msm/adreno/adreno_device.c | 78 +++++++++++++++---------------
>  drivers/gpu/drm/msm/adreno/adreno_gpu.c    | 45 +++++++++++------
>  drivers/gpu/drm/msm/msm_drv.c              | 10 ----
>  4 files changed, 74 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> index 17c59d839e6f..8df86d83d859 100644
> --- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
> @@ -536,13 +536,13 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
>  		REG_A5XX_RBBM_SECVID_TSB_TRUSTED_BASE_HI, 0x00000000);
>  	gpu_write(gpu, REG_A5XX_RBBM_SECVID_TSB_TRUSTED_SIZE, 0x00000000);
>  
> -	/* Load the GPMU firmware before starting the HW init */
> -	a5xx_gpmu_ucode_init(gpu);
> -
>  	ret = adreno_hw_init(gpu);
>  	if (ret)
>  		return ret;
>  
> +	/* Load the GPMU firmware before starting the HW init */

You can delete this comment since it is no longer accurate.

> +	a5xx_gpmu_ucode_init(gpu);
> +
>  	ret = a5xx_ucode_init(gpu);
>  	if (ret)
>  		return ret;

Jordan

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


More information about the Freedreno mailing list