Message ID | 20200520110632.30780-1-m.szyprowski@samsung.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | drm/exynos: Fix dma_parms allocation | expand |
Hi Marek,
I love your patch! Perhaps something to improve:
[auto build test WARNING on drm-exynos/exynos-drm-next]
[also build test WARNING on drm-intel/for-linux-next tegra-drm/drm/tegra/for-next v5.7-rc6 next-20200519]
[cannot apply to drm/drm-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/Marek-Szyprowski/drm-exynos-Fix-dma_parms-allocation/20200521-015443
base: https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git exynos-drm-next
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.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
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
drivers/gpu/drm/exynos/exynos_drm_dma.c: In function 'drm_iommu_attach_device':
>> drivers/gpu/drm/exynos/exynos_drm_dma.c:47:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
47 | int ret;
| ^~~
vim +/ret +47 drivers/gpu/drm/exynos/exynos_drm_dma.c
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 33
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 34 /*
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 35 * drm_iommu_attach_device- attach device to iommu mapping
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 36 *
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 37 * @drm_dev: DRM device
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 38 * @subdrv_dev: device to be attach
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 39 *
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 40 * This function should be called by sub drivers to attach it to iommu
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 41 * mapping.
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 42 */
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 43 static int drm_iommu_attach_device(struct drm_device *drm_dev,
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 44 struct device *subdrv_dev, void **dma_priv)
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 45 {
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 46 struct exynos_drm_private *priv = drm_dev->dev_private;
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 @47 int ret;
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 48
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 49 if (get_dma_ops(priv->dma_dev) != get_dma_ops(subdrv_dev)) {
6f83d20838c09936 Inki Dae 2019-04-15 50 DRM_DEV_ERROR(subdrv_dev, "Device %s lacks support for IOMMU\n",
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 51 dev_name(subdrv_dev));
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 52 return -EINVAL;
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 53 }
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 54
1698f69d5f384fad Marek Szyprowski 2020-05-20 55 dma_set_max_seg_size(subdrv_dev, DMA_BIT_MASK(32));
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 56 if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) {
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 57 /*
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 58 * Keep the original DMA mapping of the sub-device and
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 59 * restore it on Exynos DRM detach, otherwise the DMA
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 60 * framework considers it as IOMMU-less during the next
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 61 * probe (in case of deferred probe or modular build)
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 62 */
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 63 *dma_priv = to_dma_iommu_mapping(subdrv_dev);
07dc3678bacc2a75 Marek Szyprowski 2020-03-09 64 if (*dma_priv)
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 65 arm_iommu_detach_device(subdrv_dev);
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 66
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 67 ret = arm_iommu_attach_device(subdrv_dev, priv->mapping);
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 68 } else if (IS_ENABLED(CONFIG_IOMMU_DMA)) {
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 69 ret = iommu_attach_device(priv->mapping, subdrv_dev);
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 70 }
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 71
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 72 return 0;
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 73 }
67fbf3a3ef84436c Andrzej Hajda 2018-10-12 74
:::::: The code at line 47 was first introduced by commit
:::::: 67fbf3a3ef84436c58b5ead53b4b866125ad7ce9 drm/exynos/iommu: merge IOMMU and DMA code
:::::: TO: Andrzej Hajda <a.hajda@samsung.com>
:::::: CC: Inki Dae <inki.dae@samsung.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dma.c b/drivers/gpu/drm/exynos/exynos_drm_dma.c index 619f814..3d59800 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dma.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dma.c @@ -31,23 +31,6 @@ #define EXYNOS_DEV_ADDR_START 0x20000000 #define EXYNOS_DEV_ADDR_SIZE 0x40000000 -static inline int configure_dma_max_seg_size(struct device *dev) -{ - if (!dev->dma_parms) - dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL); - if (!dev->dma_parms) - return -ENOMEM; - - dma_set_max_seg_size(dev, DMA_BIT_MASK(32)); - return 0; -} - -static inline void clear_dma_max_seg_size(struct device *dev) -{ - kfree(dev->dma_parms); - dev->dma_parms = NULL; -} - /* * drm_iommu_attach_device- attach device to iommu mapping * @@ -69,10 +52,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, return -EINVAL; } - ret = configure_dma_max_seg_size(subdrv_dev); - if (ret) - return ret; - + dma_set_max_seg_size(subdrv_dev, DMA_BIT_MASK(32)); if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { /* * Keep the original DMA mapping of the sub-device and @@ -89,9 +69,6 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, ret = iommu_attach_device(priv->mapping, subdrv_dev); } - if (ret) - clear_dma_max_seg_size(subdrv_dev); - return 0; } @@ -114,8 +91,6 @@ static void drm_iommu_detach_device(struct drm_device *drm_dev, arm_iommu_attach_device(subdrv_dev, *dma_priv); } else if (IS_ENABLED(CONFIG_IOMMU_DMA)) iommu_detach_device(priv->mapping, subdrv_dev); - - clear_dma_max_seg_size(subdrv_dev); } int exynos_drm_register_dma(struct drm_device *drm, struct device *dev,
Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms for platform devices") driver core handles allocation of the dma_parms structure for platform device, so there is no need to manually allocate nor free it. Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/gpu/drm/exynos/exynos_drm_dma.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-)