diff mbox

[3/5] drm/msm/adreno: Load the firmware before bringing up the hardware

Message ID 20180611182604.30467-4-jcrouse@codeaurora.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jordan Crouse June 11, 2018, 6:26 p.m. UTC
Failure to load firwmare is the primary reason to fail adreno_load_gpu().
Try to load it first before going into the hardware initialization code and
unwinding it. This is important for a6xx because the GMU gets loaded from
the runtime power code and it is more costly to fail in that path because
of missing firmware.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

Comments

kernel test robot June 11, 2018, 9:50 p.m. UTC | #1
Hi Jordan,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on robclark/msm-next]
[also build test ERROR on v4.17 next-20180608]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jordan-Crouse/drm-msm-Add-support-for-Adreno-a6xx/20180612-022828
base:   git://people.freedesktop.org/~robclark/linux msm-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=arm64 

Note: the linux-review/Jordan-Crouse/drm-msm-Add-support-for-Adreno-a6xx/20180612-022828 HEAD 716a0bd2934f1b01e622ac7a6714789861824f8f builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/gpu/drm/msm/adreno/adreno_device.c: In function 'adreno_load_gpu':
>> drivers/gpu/drm/msm/adreno/adreno_device.c:177:8: error: implicit declaration of function 'adreno_load_fw'; did you mean 'adreno_load_gpu'? [-Werror=implicit-function-declaration]
     ret = adreno_load_fw(adreno_gpu);
           ^~~~~~~~~~~~~~
           adreno_load_gpu
   cc1: some warnings being treated as errors

vim +177 drivers/gpu/drm/msm/adreno/adreno_device.c

   152	
   153	struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
   154	{
   155		struct msm_drm_private *priv = dev->dev_private;
   156		struct platform_device *pdev = priv->gpu_pdev;
   157		struct msm_gpu *gpu = NULL;
   158		struct adreno_gpu *adreno_gpu;
   159		int ret;
   160	
   161		if (pdev)
   162			gpu = platform_get_drvdata(pdev);
   163	
   164		if (!gpu) {
   165			dev_err_once(dev->dev, "no GPU device was found\n");
   166			return NULL;
   167		}
   168	
   169		adreno_gpu = to_adreno_gpu(gpu);
   170	
   171		/*
   172		 * The number one reason for HW init to fail is if the firmware isn't
   173		 * loaded yet. Try that first and don't bother continuing on
   174		 * otherwise
   175		 */
   176	
 > 177		ret = adreno_load_fw(adreno_gpu);
   178		if (ret)
   179			return NULL;
   180	
   181		/* Make sure pm runtime is active and reset any previous errors */
   182		pm_runtime_set_active(&pdev->dev);
   183	
   184		ret = pm_runtime_get_sync(&pdev->dev);
   185		if (ret < 0) {
   186			dev_err(dev->dev, "Couldn't power up the GPU: %d\n", ret);
   187			return NULL;
   188		}
   189	
   190		mutex_lock(&dev->struct_mutex);
   191		ret = msm_gpu_hw_init(gpu);
   192		mutex_unlock(&dev->struct_mutex);
   193		pm_runtime_put_autosuspend(&pdev->dev);
   194		if (ret) {
   195			dev_err(dev->dev, "gpu hw init failed: %d\n", ret);
   196			return NULL;
   197		}
   198	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 0c0eaad68065..d70e7d145dae 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -155,6 +155,7 @@  struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
 	struct msm_drm_private *priv = dev->dev_private;
 	struct platform_device *pdev = priv->gpu_pdev;
 	struct msm_gpu *gpu = NULL;
+	struct adreno_gpu *adreno_gpu;
 	int ret;
 
 	if (pdev)
@@ -165,7 +166,27 @@  struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
 		return NULL;
 	}
 
-	pm_runtime_get_sync(&pdev->dev);
+	adreno_gpu = to_adreno_gpu(gpu);
+
+	/*
+	 * The number one reason for HW init to fail is if the firmware isn't
+	 * loaded yet. Try that first and don't bother continuing on
+	 * otherwise
+	 */
+
+	ret = adreno_load_fw(adreno_gpu);
+	if (ret)
+		return NULL;
+
+	/* Make sure pm runtime is active and reset any previous errors */
+	pm_runtime_set_active(&pdev->dev);
+
+	ret = pm_runtime_get_sync(&pdev->dev);
+	if (ret < 0) {
+		dev_err(dev->dev, "Couldn't power up the GPU: %d\n", ret);
+		return NULL;
+	}
+
 	mutex_lock(&dev->struct_mutex);
 	ret = msm_gpu_hw_init(gpu);
 	mutex_unlock(&dev->struct_mutex);