Skip to contentSkip to conversation

iommu: omap: Fix pointer cast -Wpointer-to-int-cast warnings on 64 bit

PATCH Superseded Krzysztof Kozlowski 3 participants 10 messages Dec 30, 2019 – Jan 3, 2020 IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 iommu: omap: Fix pointer cast -Wpointer-to-int-cast warnings on 64 bit

pointers should be casted to unsigned long to avoid -Wpointer-to-int-cast warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

    drivers/iommu/omap-iommu.c: In function ‘omap2_iommu_enable’:
    drivers/iommu/omap-iommu.c:170:25: warning:
        cast from pointer to integer of different size [-Wpointer-to-int-cast]
      if (!obj->iopgd || !IS_ALIGNED((u32)obj->iopgd,  SZ_16K))
                             ^
---
 drivers/iommu/omap-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/omap-iommu.c +1 -1
index be551cc34be4..50e8acf88ec4 100644
@@ -167,7 +167,7 @@ static int omap2_iommu_enable(struct omap_iommu *obj)
 {
 	u32 l, pa;
 
-	if (!obj->iopgd || !IS_ALIGNED((u32)obj->iopgd,  SZ_16K))
+	if (!obj->iopgd || !IS_ALIGNED((unsigned long)obj->iopgd,  SZ_16K))
 		return -EINVAL;
 
 	pa = virt_to_phys(obj->iopgd);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/3 iommu: omap: Fix printing format for size_t on 64-bit

Print size_t as %zu or %zx to fix -Wformat warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/iommu/omap-iommu.c: In function ‘flush_iotlb_page’:
drivers/iommu/omap-iommu.c:437:47: warning:
format ‘%x’ expects argument of type ‘unsigned int’,
but argument 7 has type ‘size_t {aka long unsigned int}’ [-Wformat=]

---
 drivers/iommu/omap-iommu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iommu/omap-iommu.c +4 -4
index 50e8acf88ec4..887fefcb03b4 100644
@@ -434,7 +434,7 @@ static void flush_iotlb_page(struct omap_iommu *obj, u32 da)
 		bytes = iopgsz_to_bytes(cr.cam & 3);
 
 		if ((start <= da) && (da < start + bytes)) {
-			dev_dbg(obj->dev, "%s: %08x<=%08x(%x)\n",
+			dev_dbg(obj->dev, "%s: %08x<=%08x(%zx)\n",
 				__func__, start, da, bytes);
 			iotlb_load_cr(obj, &cr);
 			iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
@@ -1352,11 +1352,11 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
 
 	omap_pgsz = bytes_to_iopgsz(bytes);
 	if (omap_pgsz < 0) {
-		dev_err(dev, "invalid size to map: %d\n", bytes);
+		dev_err(dev, "invalid size to map: %zu\n", bytes);
 		return -EINVAL;
 	}
 
-	dev_dbg(dev, "mapping da 0x%lx to pa %pa size 0x%x\n", da, &pa, bytes);
+	dev_dbg(dev, "mapping da 0x%lx to pa %pa size 0x%zx\n", da, &pa, bytes);
 
 	iotlb_init_entry(&e, da, pa, omap_pgsz);
 
@@ -1393,7 +1393,7 @@ static size_t omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
 	size_t bytes = 0;
 	int i;
 
-	dev_dbg(dev, "unmapping da 0x%lx size %u\n", da, size);
+	dev_dbg(dev, "unmapping da 0x%lx size %zu\n", da, size);
 
 	iommu = omap_domain->iommus;
 	for (i = 0; i < omap_domain->num_iommus; i++, iommu++) {
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] iommu: omap: Fix printing format for size_t on 64-bit

Quoted 9 lines · Krzysztof Kozlowski

Print size_t as %zu or %zx to fix -Wformat warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):

drivers/iommu/omap-iommu.c: In function ‘flush_iotlb_page’:
drivers/iommu/omap-iommu.c:437:47: warning:
format ‘%x’ expects argument of type ‘unsigned int’,
but argument 7 has type ‘size_t {aka long unsigned int}’ [-Wformat=]

With "iommu/omap: ..." on the subject-line as per the current convention,

regards
Suman

Quoted 41 lines
---
 drivers/iommu/omap-iommu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iommu/omap-iommu.c +4 -4
index 50e8acf88ec4..887fefcb03b4 100644
@@ -434,7 +434,7 @@ static void flush_iotlb_page(struct omap_iommu *obj, u32 da)
 		bytes = iopgsz_to_bytes(cr.cam & 3);
 
 		if ((start <= da) && (da < start + bytes)) {
-			dev_dbg(obj->dev, "%s: %08x<=%08x(%x)\n",
+			dev_dbg(obj->dev, "%s: %08x<=%08x(%zx)\n",
 				__func__, start, da, bytes);
 			iotlb_load_cr(obj, &cr);
 			iommu_write_reg(obj, 1, MMU_FLUSH_ENTRY);
@@ -1352,11 +1352,11 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
 
 	omap_pgsz = bytes_to_iopgsz(bytes);
 	if (omap_pgsz < 0) {
-		dev_err(dev, "invalid size to map: %d\n", bytes);
+		dev_err(dev, "invalid size to map: %zu\n", bytes);
 		return -EINVAL;
 	}
 
-	dev_dbg(dev, "mapping da 0x%lx to pa %pa size 0x%x\n", da, &pa, bytes);
+	dev_dbg(dev, "mapping da 0x%lx to pa %pa size 0x%zx\n", da, &pa, bytes);
 
 	iotlb_init_entry(&e, da, pa, omap_pgsz);
 
@@ -1393,7 +1393,7 @@ static size_t omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
 	size_t bytes = 0;
 	int i;
 
-	dev_dbg(dev, "unmapping da 0x%lx size %u\n", da, size);
+	dev_dbg(dev, "unmapping da 0x%lx size %zu\n", da, size);
 
 	iommu = omap_domain->iommus;
 	for (i = 0; i < omap_domain->num_iommus; i++, iommu++) {
#3 lore raw

PATCH 3/3 iommu: Enable compile testing for some of drivers

In reply to Krzysztof Kozlowski

Some of the IOMMU drivers can be compile tested to increase build coverage. The OMAP, Rockchip and Exynos drivers use device.dev_archdata.iommu field which does not exist on all platforms. The sPAPR TCE and ARM SMMU have also restrictions where they can be built.

---
 drivers/iommu/Kconfig | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/iommu/Kconfig +8 -8
index 0b9d78a0f3ac..fa27192ad166 100644
@@ -260,7 +260,7 @@ config IRQ_REMAP
 # OMAP IOMMU support
 config OMAP_IOMMU
 	bool "OMAP IOMMU Support"
-	depends on ARM && MMU
+	depends on ARM && MMU || (COMPILE_TEST && (ARM || ARM64 || IA64 || SPARC))
 	depends on ARCH_OMAP2PLUS || COMPILE_TEST
 	select IOMMU_API
 	---help---
@@ -278,7 +278,7 @@ config OMAP_IOMMU_DEBUG
 
 config ROCKCHIP_IOMMU
 	bool "Rockchip IOMMU Support"
-	depends on ARM || ARM64
+	depends on ARM || ARM64 || (COMPILE_TEST && (ARM64 || IA64 || SPARC))
 	depends on ARCH_ROCKCHIP || COMPILE_TEST
 	select IOMMU_API
 	select ARM_DMA_USE_IOMMU
@@ -312,7 +312,7 @@ config TEGRA_IOMMU_SMMU
 
 config EXYNOS_IOMMU
 	bool "Exynos IOMMU Support"
-	depends on ARCH_EXYNOS && MMU
+	depends on ARCH_EXYNOS && MMU || (COMPILE_TEST && (ARM || ARM64 || IA64 || SPARC))
 	depends on !CPU_BIG_ENDIAN # revisit driver if we can enable big-endian ptes
 	select IOMMU_API
 	select ARM_DMA_USE_IOMMU
@@ -348,7 +348,7 @@ config IPMMU_VMSA
 
 config SPAPR_TCE_IOMMU
 	bool "sPAPR TCE IOMMU Support"
-	depends on PPC_POWERNV || PPC_PSERIES
+	depends on PPC_POWERNV || PPC_PSERIES || (PPC && COMPILE_TEST)
 	select IOMMU_API
 	help
 	  Enables bits of IOMMU API required by VFIO. The iommu_ops
@@ -357,7 +357,7 @@ config SPAPR_TCE_IOMMU
 # ARM IOMMU support
 config ARM_SMMU
 	bool "ARM Ltd. System MMU (SMMU) Support"
-	depends on (ARM64 || ARM) && MMU
+	depends on (ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)) && MMU
 	select IOMMU_API
 	select IOMMU_IO_PGTABLE_LPAE
 	select ARM_DMA_USE_IOMMU if ARM
@@ -415,7 +415,7 @@ config S390_IOMMU
 
 config S390_CCW_IOMMU
 	bool "S390 CCW IOMMU Support"
-	depends on S390 && CCW
+	depends on S390 && CCW || COMPILE_TEST
 	select IOMMU_API
 	help
 	  Enables bits of IOMMU API required by VFIO. The iommu_ops
@@ -423,7 +423,7 @@ config S390_CCW_IOMMU
 
 config S390_AP_IOMMU
 	bool "S390 AP IOMMU Support"
-	depends on S390 && ZCRYPT
+	depends on S390 && ZCRYPT || COMPILE_TEST
 	select IOMMU_API
 	help
 	  Enables bits of IOMMU API required by VFIO. The iommu_ops
@@ -431,7 +431,7 @@ config S390_AP_IOMMU
 
 config MTK_IOMMU
 	bool "MTK IOMMU Support"
-	depends on ARM || ARM64
+	depends on ARM || ARM64 || COMPILE_TEST
 	depends on ARCH_MEDIATEK || COMPILE_TEST
 	select ARM_DMA_USE_IOMMU
 	select IOMMU_API
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
#4 lore raw

Re: [PATCH 3/3] iommu: Enable compile testing for some of drivers

I love your patch! Yet something to improve:

Hi Krzysztof,

I love your patch! Yet something to improve:

[auto build test ERROR on iommu/next]
[also build test ERROR on v5.5-rc4 next-20191219]
[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/Krzysztof-Kozlowski/iommu-omap-Fix-pointer-cast-Wpointer-to-int-cast-warnings-on-64-bit/20191231-022212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-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=sparc64

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

drivers/gpu/drm/rockchip/rockchip_drm_gem.c: In function 'rockchip_gem_alloc_iommu':

>> drivers/gpu/drm/rockchip/rockchip_drm_gem.c:134:20: error: implicit declaration of function 'vmap'; did you mean 'bmap'? [-Werror=implicit-function-declaration]
      rk_obj->kvaddr = vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
                       ^~~~
                       bmap
>> drivers/gpu/drm/rockchip/rockchip_drm_gem.c:134:59: error: 'VM_MAP' undeclared (first use in this function); did you mean 'VM_MPX'?
      rk_obj->kvaddr = vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
                                                              ^~~~~~
                                                              VM_MPX
   drivers/gpu/drm/rockchip/rockchip_drm_gem.c:134:59: note: each undeclared identifier is reported only once for each function it appears in
   drivers/gpu/drm/rockchip/rockchip_drm_gem.c: In function 'rockchip_gem_free_iommu':
>> drivers/gpu/drm/rockchip/rockchip_drm_gem.c:190:2: error: implicit declaration of function 'vunmap'; did you mean 'iounmap'? [-Werror=implicit-function-declaration]
     vunmap(rk_obj->kvaddr);
     ^~~~~~
     iounmap
   drivers/gpu/drm/rockchip/rockchip_drm_gem.c: In function 'rockchip_gem_prime_vmap':
   drivers/gpu/drm/rockchip/rockchip_drm_gem.c:547:49: error: 'VM_MAP' undeclared (first use in this function); did you mean 'VM_MPX'?
      return vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
                                                    ^~~~~~
                                                    VM_MPX

cc1: some warnings being treated as errors

vim +134 drivers/gpu/drm/rockchip/rockchip_drm_gem.c

38f993b7c59e26 Tomasz Figa         2016-06-24  119  
38f993b7c59e26 Tomasz Figa         2016-06-24  120  static int rockchip_gem_alloc_iommu(struct rockchip_gem_object *rk_obj,
38f993b7c59e26 Tomasz Figa         2016-06-24  121  				    bool alloc_kmap)
38f993b7c59e26 Tomasz Figa         2016-06-24  122  {
38f993b7c59e26 Tomasz Figa         2016-06-24  123  	int ret;
38f993b7c59e26 Tomasz Figa         2016-06-24  124  
38f993b7c59e26 Tomasz Figa         2016-06-24  125  	ret = rockchip_gem_get_pages(rk_obj);
38f993b7c59e26 Tomasz Figa         2016-06-24  126  	if (ret < 0)
38f993b7c59e26 Tomasz Figa         2016-06-24  127  		return ret;
38f993b7c59e26 Tomasz Figa         2016-06-24  128  
38f993b7c59e26 Tomasz Figa         2016-06-24  129  	ret = rockchip_gem_iommu_map(rk_obj);
38f993b7c59e26 Tomasz Figa         2016-06-24  130  	if (ret < 0)
38f993b7c59e26 Tomasz Figa         2016-06-24  131  		goto err_free;
38f993b7c59e26 Tomasz Figa         2016-06-24  132  
38f993b7c59e26 Tomasz Figa         2016-06-24  133  	if (alloc_kmap) {
38f993b7c59e26 Tomasz Figa         2016-06-24 @134  		rk_obj->kvaddr = vmap(rk_obj->pages, rk_obj->num_pages, VM_MAP,
38f993b7c59e26 Tomasz Figa         2016-06-24  135  				      pgprot_writecombine(PAGE_KERNEL));
38f993b7c59e26 Tomasz Figa         2016-06-24  136  		if (!rk_obj->kvaddr) {
38f993b7c59e26 Tomasz Figa         2016-06-24  137  			DRM_ERROR("failed to vmap() buffer\n");
38f993b7c59e26 Tomasz Figa         2016-06-24  138  			ret = -ENOMEM;
38f993b7c59e26 Tomasz Figa         2016-06-24  139  			goto err_unmap;
38f993b7c59e26 Tomasz Figa         2016-06-24  140  		}
38f993b7c59e26 Tomasz Figa         2016-06-24  141  	}
38f993b7c59e26 Tomasz Figa         2016-06-24  142  
38f993b7c59e26 Tomasz Figa         2016-06-24  143  	return 0;
38f993b7c59e26 Tomasz Figa         2016-06-24  144  
38f993b7c59e26 Tomasz Figa         2016-06-24  145  err_unmap:
38f993b7c59e26 Tomasz Figa         2016-06-24  146  	rockchip_gem_iommu_unmap(rk_obj);
38f993b7c59e26 Tomasz Figa         2016-06-24  147  err_free:
38f993b7c59e26 Tomasz Figa         2016-06-24  148  	rockchip_gem_put_pages(rk_obj);
38f993b7c59e26 Tomasz Figa         2016-06-24  149  
38f993b7c59e26 Tomasz Figa         2016-06-24  150  	return ret;
38f993b7c59e26 Tomasz Figa         2016-06-24  151  }
38f993b7c59e26 Tomasz Figa         2016-06-24  152  
38f993b7c59e26 Tomasz Figa         2016-06-24  153  static int rockchip_gem_alloc_dma(struct rockchip_gem_object *rk_obj,
f76c83b580043d Daniel Kurtz        2015-01-12  154  				  bool alloc_kmap)
2048e3286f347d Mark Yao            2014-08-22  155  {
2048e3286f347d Mark Yao            2014-08-22  156  	struct drm_gem_object *obj = &rk_obj->base;
2048e3286f347d Mark Yao            2014-08-22  157  	struct drm_device *drm = obj->dev;
2048e3286f347d Mark Yao            2014-08-22  158  
00085f1efa387a Krzysztof Kozlowski 2016-08-03  159  	rk_obj->dma_attrs = DMA_ATTR_WRITE_COMBINE;
2048e3286f347d Mark Yao            2014-08-22  160  
f76c83b580043d Daniel Kurtz        2015-01-12  161  	if (!alloc_kmap)
00085f1efa387a Krzysztof Kozlowski 2016-08-03  162  		rk_obj->dma_attrs |= DMA_ATTR_NO_KERNEL_MAPPING;
f76c83b580043d Daniel Kurtz        2015-01-12  163  
2048e3286f347d Mark Yao            2014-08-22  164  	rk_obj->kvaddr = dma_alloc_attrs(drm->dev, obj->size,
2048e3286f347d Mark Yao            2014-08-22  165  					 &rk_obj->dma_addr, GFP_KERNEL,
00085f1efa387a Krzysztof Kozlowski 2016-08-03  166  					 rk_obj->dma_attrs);
4b9a90c0b374f8 Daniel Kurtz        2015-01-07  167  	if (!rk_obj->kvaddr) {
913bb40a45f18f Brian Norris        2016-06-09  168  		DRM_ERROR("failed to allocate %zu byte dma buffer", obj->size);
4b9a90c0b374f8 Daniel Kurtz        2015-01-07  169  		return -ENOMEM;
2048e3286f347d Mark Yao            2014-08-22  170  	}
2048e3286f347d Mark Yao            2014-08-22  171  
2048e3286f347d Mark Yao            2014-08-22  172  	return 0;
2048e3286f347d Mark Yao            2014-08-22  173  }
2048e3286f347d Mark Yao            2014-08-22  174  
38f993b7c59e26 Tomasz Figa         2016-06-24  175  static int rockchip_gem_alloc_buf(struct rockchip_gem_object *rk_obj,
38f993b7c59e26 Tomasz Figa         2016-06-24  176  				  bool alloc_kmap)
38f993b7c59e26 Tomasz Figa         2016-06-24  177  {
38f993b7c59e26 Tomasz Figa         2016-06-24  178  	struct drm_gem_object *obj = &rk_obj->base;
38f993b7c59e26 Tomasz Figa         2016-06-24  179  	struct drm_device *drm = obj->dev;
38f993b7c59e26 Tomasz Figa         2016-06-24  180  	struct rockchip_drm_private *private = drm->dev_private;
38f993b7c59e26 Tomasz Figa         2016-06-24  181  
38f993b7c59e26 Tomasz Figa         2016-06-24  182  	if (private->domain)
38f993b7c59e26 Tomasz Figa         2016-06-24  183  		return rockchip_gem_alloc_iommu(rk_obj, alloc_kmap);
38f993b7c59e26 Tomasz Figa         2016-06-24  184  	else
38f993b7c59e26 Tomasz Figa         2016-06-24  185  		return rockchip_gem_alloc_dma(rk_obj, alloc_kmap);
38f993b7c59e26 Tomasz Figa         2016-06-24  186  }
38f993b7c59e26 Tomasz Figa         2016-06-24  187  
38f993b7c59e26 Tomasz Figa         2016-06-24  188  static void rockchip_gem_free_iommu(struct rockchip_gem_object *rk_obj)
38f993b7c59e26 Tomasz Figa         2016-06-24  189  {
38f993b7c59e26 Tomasz Figa         2016-06-24 @190  	vunmap(rk_obj->kvaddr);
38f993b7c59e26 Tomasz Figa         2016-06-24  191  	rockchip_gem_iommu_unmap(rk_obj);
38f993b7c59e26 Tomasz Figa         2016-06-24  192  	rockchip_gem_put_pages(rk_obj);
38f993b7c59e26 Tomasz Figa         2016-06-24  193  }
38f993b7c59e26 Tomasz Figa         2016-06-24  194  

:::::: The code at line 134 was first introduced by commit
:::::: 38f993b7c59e261b8ff7deb66c96c7dff4017f7b drm/rockchip: Do not use DMA mapping API if attached to IOMMU domain

:::::: TO: Tomasz Figa <[email protected]>
:::::: CC: Mark Yao <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#5 lore raw

Re: [PATCH 3/3] iommu: Enable compile testing for some of drivers

Quoted 14 lines · kbuild test robot

Hi Krzysztof,

I love your patch! Yet something to improve:

[auto build test ERROR on iommu/next]
[also build test ERROR on v5.5-rc4 next-20191219]
[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/Krzysztof-Kozlowski/iommu-omap-Fix-pointer-cast-Wpointer-to-int-cast-warnings-on-64-bit/20191231-022212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.5.0
Quoted 8 lines

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=sparc64

If you fix the issue, kindly add following tag

Thanks, kbuild!

I sent a fix:
https://lore.kernel.org/linux-arm-kernel/1577779956-7612-1-git-send-email-krzk(a)kernel.org/

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 3/3] iommu: Enable compile testing for some of drivers

In reply to Krzysztof Kozlowski
I love your patch! Perhaps something to improve:

Hi Krzysztof,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on v5.5-rc4]
[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/Krzysztof-Kozlowski/iommu-omap-Fix-pointer-cast-Wpointer-to-int-cast-warnings-on-64-bit/20191231-022212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-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=ia64

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

In file included from drivers/iommu/omap-iommu.c:33:0:
drivers/iommu/omap-iommu.c: In function 'omap_iommu_iova_to_phys':

>> drivers/iommu/omap-iopgtable.h:44:21: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOPTE_MASK  (~(IOPTE_SIZE - 1))
                        ^
>> drivers/iommu/omap-iommu.c:1641:41: note: in expansion of macro 'IOPTE_MASK'
       ret = omap_iommu_translate(*pte, da, IOPTE_MASK);
                                            ^~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:51:23: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOLARGE_MASK  (~(IOLARGE_SIZE - 1))
                          ^
>> drivers/iommu/omap-iommu.c:1643:41: note: in expansion of macro 'IOLARGE_MASK'
       ret = omap_iommu_translate(*pte, da, IOLARGE_MASK);
                                            ^~~~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:27:25: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOSECTION_MASK  (~(IOSECTION_SIZE - 1))
                            ^
>> drivers/iommu/omap-iommu.c:1649:41: note: in expansion of macro 'IOSECTION_MASK'
       ret = omap_iommu_translate(*pgd, da, IOSECTION_MASK);
                                            ^~~~~~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:34:23: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOSUPER_MASK  (~(IOSUPER_SIZE - 1))
                          ^
>> drivers/iommu/omap-iommu.c:1651:41: note: in expansion of macro 'IOSUPER_MASK'
       ret = omap_iommu_translate(*pgd, da, IOSUPER_MASK);
                                            ^~~~~~~~~~~~

vim +44 drivers/iommu/omap-iopgtable.h

97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  38  
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  39  /*
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  40   * "small page" address mask and size definitions.
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  41   */
a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26  42  #define IOPTE_SHIFT		12
5ff98fa68c88d7 drivers/iommu/omap-iopgtable.h Suman Anna   2015-07-20  43  #define IOPTE_SIZE		BIT(IOPTE_SHIFT)

a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26 @44 #define IOPTE_MASK (~(IOPTE_SIZE - 1))
a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26 45

:::::: The code at line 44 was first introduced by commit
:::::: a9dcad5e375800fcb07f7617dba23b3aade8f09d omap iommu: tlb and pagetable primitives

:::::: TO: Hiroshi DOYU <[email protected]>
:::::: CC: Hiroshi DOYU <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#7 lore raw

Re: [PATCH 3/3] iommu: Enable compile testing for some of drivers

Quoted 14 lines · kbuild test robot

Hi Krzysztof,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on v5.5-rc4]
[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/Krzysztof-Kozlowski/iommu-omap-Fix-pointer-cast-Wpointer-to-int-cast-warnings-on-64-bit/20191231-022212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.5.0
Quoted 8 lines

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=ia64

If you fix the issue, kindly add following tag

I saw it already while compile testing my patch. I must admit that I could not find easy/fast fix for it. Probably the omap_iommu_translate() helper should be made 64-bit friendly but this obfuscates the code. The driver and hardware supports only 32-bit addresses.

Best regards,
Krzysztof

Quoted 50 lines

All warnings (new ones prefixed by >>):

In file included from drivers/iommu/omap-iommu.c:33:0:
drivers/iommu/omap-iommu.c: In function 'omap_iommu_iova_to_phys':

Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iopgtable.h:44:21: warning: large integer implicitly truncated to unsigned type [-Woverflow]

    #define IOPTE_MASK  (~(IOPTE_SIZE - 1))
                        ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1641:41: note: in expansion of macro 'IOPTE_MASK'

       ret = omap_iommu_translate(*pte, da, IOPTE_MASK);
                                            ^~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:51:23: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOLARGE_MASK  (~(IOLARGE_SIZE - 1))
                          ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1643:41: note: in expansion of macro 'IOLARGE_MASK'

       ret = omap_iommu_translate(*pte, da, IOLARGE_MASK);
                                            ^~~~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:27:25: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOSECTION_MASK  (~(IOSECTION_SIZE - 1))
                            ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1649:41: note: in expansion of macro 'IOSECTION_MASK'

       ret = omap_iommu_translate(*pgd, da, IOSECTION_MASK);
                                            ^~~~~~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:34:23: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOSUPER_MASK  (~(IOSUPER_SIZE - 1))
                          ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1651:41: note: in expansion of macro 'IOSUPER_MASK'

       ret = omap_iommu_translate(*pgd, da, IOSUPER_MASK);
                                            ^~~~~~~~~~~~

vim +44 drivers/iommu/omap-iopgtable.h

97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  38  
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  39  /*
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  40   * "small page" address mask and size definitions.
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  41   */
a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26  42  #define IOPTE_SHIFT		12
5ff98fa68c88d7 drivers/iommu/omap-iopgtable.h Suman Anna   2015-07-20  43  #define IOPTE_SIZE		BIT(IOPTE_SHIFT)

a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26 @44 #define IOPTE_MASK (~(IOPTE_SIZE - 1))
a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26 45

:::::: The code at line 44 was first introduced by commit
:::::: a9dcad5e375800fcb07f7617dba23b3aade8f09d omap iommu: tlb and pagetable primitives

:::::: TO: Hiroshi DOYU <[email protected]>
:::::: CC: Hiroshi DOYU <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#8 lore raw

Re: [PATCH 3/3] iommu: Enable compile testing for some of drivers

Hi Krzysztof,

Quoted 24 lines · Krzysztof Kozlowski
Quoted 14 lines · kbuild test robot

Hi Krzysztof,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on v5.5-rc4]
[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/Krzysztof-Kozlowski/iommu-omap-Fix-pointer-cast-Wpointer-to-int-cast-warnings-on-64-bit/20191231-022212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.5.0
Quoted 8 lines

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=ia64

If you fix the issue, kindly add following tag

Quoted 6 lines

I saw it already while compile testing my patch. I must admit that I could not find easy/fast fix for it. Probably the omap_iommu_translate() helper should be made 64-bit friendly but this obfuscates the code.

The driver and hardware supports only 32-bit addresses.

Yeah, is there a reason why you are trying to enable the build for the OMAP IOMMU driver on 64-bit platforms or other architectures - the IP and driver is only ever used on ARMv7 platforms, and it should already be available for COMPILE_TEST on those.

regards
Suman

Quoted 57 lines

Best regards,
Krzysztof

Quoted 50 lines

All warnings (new ones prefixed by >>):

In file included from drivers/iommu/omap-iommu.c:33:0:
drivers/iommu/omap-iommu.c: In function 'omap_iommu_iova_to_phys':

Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iopgtable.h:44:21: warning: large integer implicitly truncated to unsigned type [-Woverflow]

    #define IOPTE_MASK  (~(IOPTE_SIZE - 1))
                        ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1641:41: note: in expansion of macro 'IOPTE_MASK'

       ret = omap_iommu_translate(*pte, da, IOPTE_MASK);
                                            ^~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:51:23: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOLARGE_MASK  (~(IOLARGE_SIZE - 1))
                          ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1643:41: note: in expansion of macro 'IOLARGE_MASK'

       ret = omap_iommu_translate(*pte, da, IOLARGE_MASK);
                                            ^~~~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:27:25: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOSECTION_MASK  (~(IOSECTION_SIZE - 1))
                            ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1649:41: note: in expansion of macro 'IOSECTION_MASK'

       ret = omap_iommu_translate(*pgd, da, IOSECTION_MASK);
                                            ^~~~~~~~~~~~~~
   drivers/iommu/omap-iopgtable.h:34:23: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    #define IOSUPER_MASK  (~(IOSUPER_SIZE - 1))
                          ^
Quoted 1 line
Quoted 1 line

drivers/iommu/omap-iommu.c:1651:41: note: in expansion of macro 'IOSUPER_MASK'

       ret = omap_iommu_translate(*pgd, da, IOSUPER_MASK);
                                            ^~~~~~~~~~~~

vim +44 drivers/iommu/omap-iopgtable.h

97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  38  
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  39  /*
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  40   * "small page" address mask and size definitions.
97ec7d585b33bb arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2010-02-15  41   */
a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26  42  #define IOPTE_SHIFT		12
5ff98fa68c88d7 drivers/iommu/omap-iopgtable.h Suman Anna   2015-07-20  43  #define IOPTE_SIZE		BIT(IOPTE_SHIFT)

a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26 @44 #define IOPTE_MASK (~(IOPTE_SIZE - 1))
a9dcad5e375800 arch/arm/plat-omap/iopgtable.h Hiroshi DOYU 2009-01-26 45

:::::: The code at line 44 was first introduced by commit
:::::: a9dcad5e375800fcb07f7617dba23b3aade8f09d omap iommu: tlb and pagetable primitives

:::::: TO: Hiroshi DOYU <[email protected]>
:::::: CC: Hiroshi DOYU <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#9 lore raw

Re: [PATCH 3/3] iommu: Enable compile testing for some of drivers

Quoted 32 lines · Suman Anna

Hi Krzysztof,

Quoted 28 lines · Krzysztof Kozlowski
Quoted 14 lines · kbuild test robot

Hi Krzysztof,

I love your patch! Perhaps something to improve:

[auto build test WARNING on iommu/next]
[also build test WARNING on v5.5-rc4]
[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/Krzysztof-Kozlowski/iommu-omap-Fix-pointer-cast-Wpointer-to-int-cast-warnings-on-64-bit/20191231-022212
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.5.0
Quoted 8 lines

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=ia64

If you fix the issue, kindly add following tag

I saw it already while compile testing my patch. I must admit that I could not find easy/fast fix for it. Probably the omap_iommu_translate() helper should be made 64-bit friendly but this obfuscates the code.

Quoted 6 lines
Quoted 1 line

The driver and hardware supports only 32-bit addresses.

Yeah, is there a reason why you are trying to enable the build for the OMAP IOMMU driver on 64-bit platforms or other architectures - the IP and driver is only ever used on ARMv7 platforms, and it should already be available for COMPILE_TEST on those.

It's the same reason we enable compile testing on all other drivers which will never be used outside original platforms. There are many of such examples because we want to increase the build coverage to as many different configurations as possible. There could be also another benefit - easier code reusability - although it is purely theoretical in this case, I think.

Best regards,
Krzysztof