Re: [PATCH 02/14] drm/msm/mdp5: Remove direct access of dev->iommu_fwspec

2020-02-28 Thread kbuild test robot
Hi Joerg,

I love your patch! Yet something to improve:

[auto build test ERROR on pm/linux-next]
[also build test ERROR on tegra/for-next linux/master linus/master v5.6-rc3 
next-20200228]
[cannot apply to iommu/next]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:
https://github.com/0day-ci/linux/commits/Joerg-Roedel/iommu-Move-iommu_fwspec-out-of-struct-device/20200229-075740
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git 
linux-next
config: arm-imx_v6_v7_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 7.5.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.5.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c: In function 'mdp5_kms_init':
>> drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c:728:8: error: implicit declaration 
>> of function 'dev_iommu_fwspec_get'; did you mean 'iommu_fwspec_free'? 
>> [-Werror=implicit-function-declaration]
  if (!dev_iommu_fwspec_get(iommu_dev))
   ^~~~
   iommu_fwspec_free
   cc1: some warnings being treated as errors

vim +728 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c

   677  
   678  struct msm_kms *mdp5_kms_init(struct drm_device *dev)
   679  {
   680  struct msm_drm_private *priv = dev->dev_private;
   681  struct platform_device *pdev;
   682  struct mdp5_kms *mdp5_kms;
   683  struct mdp5_cfg *config;
   684  struct msm_kms *kms;
   685  struct msm_gem_address_space *aspace;
   686  int irq, i, ret;
   687  struct device *iommu_dev;
   688  
   689  /* priv->kms would have been populated by the MDP5 driver */
   690  kms = priv->kms;
   691  if (!kms)
   692  return NULL;
   693  
   694  mdp5_kms = to_mdp5_kms(to_mdp_kms(kms));
   695  
   696  mdp_kms_init(&mdp5_kms->base, &kms_funcs);
   697  
   698  pdev = mdp5_kms->pdev;
   699  
   700  irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
   701  if (irq < 0) {
   702  ret = irq;
   703  DRM_DEV_ERROR(&pdev->dev, "failed to get irq: %d\n", 
ret);
   704  goto fail;
   705  }
   706  
   707  kms->irq = irq;
   708  
   709  config = mdp5_cfg_get_config(mdp5_kms->cfg);
   710  
   711  /* make sure things are off before attaching iommu (bootloader 
could
   712   * have left things on, in which case we'll start getting 
faults if
   713   * we don't disable):
   714   */
   715  pm_runtime_get_sync(&pdev->dev);
   716  for (i = 0; i < MDP5_INTF_NUM_MAX; i++) {
   717  if 
(mdp5_cfg_intf_is_virtual(config->hw->intf.connect[i]) ||
   718  !config->hw->intf.base[i])
   719  continue;
   720  mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 
0);
   721  
   722  mdp5_write(mdp5_kms, 
REG_MDP5_INTF_FRAME_LINE_COUNT_EN(i), 0x3);
   723  }
   724  mdelay(16);
   725  
   726  if (config->platform.iommu) {
   727  iommu_dev = &pdev->dev;
 > 728  if (!dev_iommu_fwspec_get(iommu_dev))
   729  iommu_dev = iommu_dev->parent;
   730  
   731  aspace = msm_gem_address_space_create(iommu_dev,
   732  config->platform.iommu, "mdp5");
   733  if (IS_ERR(aspace)) {
   734  ret = PTR_ERR(aspace);
   735  goto fail;
   736  }
   737  
   738  kms->aspace = aspace;
   739  
   740  ret = aspace->mmu->funcs->attach(aspace->mmu);
   741  if (ret) {
   742  DRM_DEV_ERROR(&pdev->dev, "failed to attach 
iommu: %d\n",
   743  ret);
   744  goto fail;
   745  }
   746  } else {
   747  DRM_DEV_INFO(&pdev->dev,
   748   "no iommu, fallback to phys contig buffers for 
scanout\n");
   749  aspace = NULL;
   750  }
   751  
   752  pm_runtime_put_sync(&pdev->dev);
   753  
   754  ret = modeset_init(mdp5_kms);
   755  if (ret) {
   756  DRM_DEV_ERROR(&pdev->dev, "modeset_init failed: %d\n", 
ret);
   757  goto fail;
   758   

[PATCH 02/14] drm/msm/mdp5: Remove direct access of dev->iommu_fwspec

2020-02-28 Thread Joerg Roedel
From: Joerg Roedel 

Use the accessor functions instead of directly dereferencing
dev->iommu_fwspec.

Signed-off-by: Joerg Roedel 
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index e43ecd4be10a..1252e1d76340 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -725,7 +725,7 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
 
if (config->platform.iommu) {
iommu_dev = &pdev->dev;
-   if (!iommu_dev->iommu_fwspec)
+   if (!dev_iommu_fwspec_get(iommu_dev))
iommu_dev = iommu_dev->parent;
 
aspace = msm_gem_address_space_create(iommu_dev,
-- 
2.17.1

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu