On 20/06/2023 20:33, Fabio Estevam wrote:
From: Fabio Estevam <feste...@denx.de>

Commit cc943f43ece7 ("drm/msm/adreno: warn if chip revn is verified
before being set") exposes the need of setting the GPU revision fields
prior to using the adreno_is_xxx() functions.

Pass the GPU revision information to avoid run-time warning.

Signed-off-by: Fabio Estevam <feste...@denx.de>

I'll take a glance later. Generic comment, you missed freedreno@, so these patches will not pop up in our patch tracker. Also could you please use git send-email passing all patches to the command, so that they are threaded?

---
Build-tested only.

  drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 21 +++++++++++++++++++++
  1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
index c86b377f6f0d..fc23810d7684 100644
--- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c
@@ -530,6 +530,8 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
        struct msm_gpu *gpu;
        struct msm_drm_private *priv = dev->dev_private;
        struct platform_device *pdev = priv->gpu_pdev;
+       struct adreno_platform_config *config = pdev->dev.platform_data;
+       const struct adreno_info *info;
        struct icc_path *ocmem_icc_path;
        struct icc_path *icc_path;
        int ret;
@@ -558,6 +560,25 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
        if (ret)
                goto fail;
+ /*
+        * We need to know the platform type before calling into adreno_gpu_init
+        * so that the hw_apriv flag can be correctly set. Snoop into the info
+        * and grab the revision number
+        */
+       info = adreno_info(config->rev);
+       if (!info) {
+               ret = -EINVAL;
+               goto fail;
+       }
+
+       /* Assign these early so that we can use the is_aXYZ helpers */
+       /* Numeric revision IDs (e.g. 630) */
+       adreno_gpu->revn = info->revn;
+       /* New-style ADRENO_REV()-only */
+       adreno_gpu->rev = info->rev;
+       /* Quirk data */
+       adreno_gpu->info = info;

This looks like a boilerplate being added to all aYxx drivers (and then these fields are also set in adreno_gpu_init()). Can we remove duplication somehow?

+
        /* if needed, allocate gmem: */
        if (adreno_is_a330(adreno_gpu)) {
                ret = adreno_gpu_ocmem_init(&adreno_gpu->base.pdev->dev,

--
With best wishes
Dmitry

Reply via email to