All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings
@ 2016-09-29 10:02 Niklas Söderlund
  2016-09-29 10:02   ` Niklas Söderlund
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Niklas Söderlund @ 2016-09-29 10:02 UTC (permalink / raw)
  To: vinod.koul, linux-renesas-soc, dmaengine, iommu
  Cc: robin.murphy, arnd, Niklas Söderlund

From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Hi Vindo,

This small series fixes the build error and warnings for ia64 and m32r 
which kbuild test robot found and where introduced in the series 
'[PATCHv9 0/6] dmaengine: rcar-dmac: add iommu support for slave 
transfers'.

It is based ontop of:

git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/slave-dma.git next

The fixes are only compile tested for the ia64 and m32r architecture to 
show that the error and warnings are fixed. It is tested on ARM to prove 
that the intended functionality still works.

Kbuild test robot found one more class of warnings for the patch series 
mentioned above for the balackfin arch.

   include/linux/dma-mapping.h: In function 'dma_map_resource':
>> include/asm-generic/page.h:90:32: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
    #define pfn_valid(pfn)  ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
                                   ^

These warnings are not addressed in this series since they are not new 
or unique to original patch. They come from how pfn_valid() is 
implemented in include/asm-generic/page.h, if ARCH_PFN_OFFSET is 0 the 
warning is triggered. On the kbuild blackfin build it is defined as 
'(0x0 >> 12)' so any invocation of pfn_valid() will trigger it.

I tried to fix it but was unable to find a good solution. There is a 
MIPS specific fix for this in commit 95486e4 (MIPS: Fix flood of 
warnings about comparsion being always true.), but a similar fix for 
asm-generic seems to tricky for me to attempt since the macro needs to 
be turned into a static inline function and that might be harmful.  I 
also toyed with the solution of '#if ARCH_PFN_OFFSET == 0' to provided 
an alternative pfn_valid() macro, but since ARCH_PFN_OFFSET is defined 
as an expression and not a constant that wont work. If you can think of 
another way I be happy to try that out and see if I can make it work.

Niklas Söderlund (2):
  dma-mapping: fix ia64 build, use PHYS_PFN
  dma-mapping: fix m32r build warning

 include/linux/dma-mapping.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] dma-mapping: fix ia64 build, use PHYS_PFN
@ 2016-09-29 10:02   ` Niklas Söderlund
  0 siblings, 0 replies; 8+ messages in thread
From: Niklas Söderlund @ 2016-09-29 10:02 UTC (permalink / raw)
  To: vinod.koul, linux-renesas-soc, dmaengine, iommu
  Cc: robin.murphy, arnd, Niklas Söderlund

From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

kbuild test robot reports:

   In file included from include/linux/skbuff.h:34:0,
                    from include/linux/tcp.h:21,
                    from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:119:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
>> include/linux/dma-mapping.h:274:22: error: implicit declaration of function '__phys_to_pfn' [-Werror=implicit-function-declaration]
     unsigned long pfn = __phys_to_pfn(phys_addr);
                         ^~~~~~~~~~~~~

ia64 does not provide __phys_to_pfn(), use the PHYS_PFN() alias.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 include/linux/dma-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 6e00c7f..ff7c87f 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -271,7 +271,7 @@ static inline dma_addr_t dma_map_resource(struct device *dev,
 					  unsigned long attrs)
 {
 	struct dma_map_ops *ops = get_dma_ops(dev);
-	unsigned long pfn = __phys_to_pfn(phys_addr);
+	unsigned long pfn = PHYS_PFN(phys_addr);
 	dma_addr_t addr;
 
 	BUG_ON(!valid_dma_direction(dir));
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/2] dma-mapping: fix ia64 build, use PHYS_PFN
@ 2016-09-29 10:02   ` Niklas Söderlund
  0 siblings, 0 replies; 8+ messages in thread
From: Niklas Söderlund @ 2016-09-29 10:02 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
  Cc: Niklas Söderlund, arnd-r2nGTMty4D4

From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

kbuild test robot reports:

   In file included from include/linux/skbuff.h:34:0,
                    from include/linux/tcp.h:21,
                    from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:119:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
>> include/linux/dma-mapping.h:274:22: error: implicit declaration of function '__phys_to_pfn' [-Werror=implicit-function-declaration]
     unsigned long pfn = __phys_to_pfn(phys_addr);
                         ^~~~~~~~~~~~~

ia64 does not provide __phys_to_pfn(), use the PHYS_PFN() alias.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 include/linux/dma-mapping.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 6e00c7f..ff7c87f 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -271,7 +271,7 @@ static inline dma_addr_t dma_map_resource(struct device *dev,
 					  unsigned long attrs)
 {
 	struct dma_map_ops *ops = get_dma_ops(dev);
-	unsigned long pfn = __phys_to_pfn(phys_addr);
+	unsigned long pfn = PHYS_PFN(phys_addr);
 	dma_addr_t addr;
 
 	BUG_ON(!valid_dma_direction(dir));
-- 
2.9.3

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] dma-mapping: fix m32r build warning
  2016-09-29 10:02 [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings Niklas Söderlund
  2016-09-29 10:02   ` Niklas Söderlund
@ 2016-09-29 10:02 ` Niklas Söderlund
  2016-09-29 12:10   ` Vinod Koul
  2 siblings, 0 replies; 8+ messages in thread
From: Niklas Söderlund @ 2016-09-29 10:02 UTC (permalink / raw)
  To: vinod.koul, linux-renesas-soc, dmaengine, iommu
  Cc: robin.murphy, arnd, Niklas Söderlund

From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

kbuild test robot reports:

   In file included from include/linux/skbuff.h:34:0,
                    from include/linux/icmpv6.h:4,
                    from include/linux/ipv6.h:75,
                    from include/net/ipv6.h:16,
                    from include/linux/sunrpc/clnt.h:27,
                    from include/linux/nfs_fs.h:30,
                    from fs/lockd/clntlock.c:13:
   include/linux/dma-mapping.h: In function 'dma_map_resource':
>> include/linux/dma-mapping.h:274:16: warning: unused variable 'pfn' [-Wunused-variable]
     unsigned long pfn = __phys_to_pfn(phys_addr);
                   ^~~

The pfn value is only used once in the call to pfn_valid(), remove the
variable and calculate the pfn when it's needed. Note that the kbuild
report is old and PHYS_PFN() is now used instead of __phys_to_pfn() to
calculate the pfn.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 include/linux/dma-mapping.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ff7c87f..642cb4c 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -271,13 +271,12 @@ static inline dma_addr_t dma_map_resource(struct device *dev,
 					  unsigned long attrs)
 {
 	struct dma_map_ops *ops = get_dma_ops(dev);
-	unsigned long pfn = PHYS_PFN(phys_addr);
 	dma_addr_t addr;
 
 	BUG_ON(!valid_dma_direction(dir));
 
 	/* Don't allow RAM to be mapped */
-	BUG_ON(pfn_valid(pfn));
+	BUG_ON(pfn_valid(PHYS_PFN(phys_addr)));
 
 	addr = phys_addr;
 	if (ops->map_resource)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings
  2016-09-29 10:02 [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings Niklas Söderlund
@ 2016-09-29 12:10   ` Vinod Koul
  2016-09-29 10:02 ` [PATCH 2/2] dma-mapping: fix m32r build warning Niklas Söderlund
  2016-09-29 12:10   ` Vinod Koul
  2 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2016-09-29 12:10 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: linux-renesas-soc, dmaengine, iommu, robin.murphy, arnd,
	Niklas Söderlund

On Thu, Sep 29, 2016 at 12:02:38PM +0200, Niklas S�derlund wrote:
> From: Niklas S�derlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Hi Vindo,

:(

> 
> This small series fixes the build error and warnings for ia64 and m32r 
> which kbuild test robot found and where introduced in the series 
> '[PATCHv9 0/6] dmaengine: rcar-dmac: add iommu support for slave 
> transfers'.

Applied both

Thanks
-- 
~Vinod

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings
@ 2016-09-29 12:10   ` Vinod Koul
  0 siblings, 0 replies; 8+ messages in thread
From: Vinod Koul @ 2016-09-29 12:10 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: linux-renesas-soc, dmaengine, iommu, robin.murphy, arnd,
	Niklas Söderlund

On Thu, Sep 29, 2016 at 12:02:38PM +0200, Niklas Söderlund wrote:
> From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Hi Vindo,

:(

> 
> This small series fixes the build error and warnings for ia64 and m32r 
> which kbuild test robot found and where introduced in the series 
> '[PATCHv9 0/6] dmaengine: rcar-dmac: add iommu support for slave 
> transfers'.

Applied both

Thanks
-- 
~Vinod

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings
  2016-09-29 12:10   ` Vinod Koul
@ 2016-09-29 12:42     ` Niklas Söderlund
  -1 siblings, 0 replies; 8+ messages in thread
From: Niklas Söderlund @ 2016-09-29 12:42 UTC (permalink / raw)
  To: Vinod Koul; +Cc: linux-renesas-soc, dmaengine, iommu, robin.murphy, arnd

On 2016-09-29 17:40:04 +0530, Vinod Koul wrote:
> On Thu, Sep 29, 2016 at 12:02:38PM +0200, Niklas S�derlund wrote:
> > From: Niklas S�derlund <niklas.soderlund+renesas@ragnatech.se>
> > 
> > Hi Vindo,
> 
> :(

I'm sorry, my hands sometimes moves faster then my head.

> 
> > 
> > This small series fixes the build error and warnings for ia64 and m32r 
> > which kbuild test robot found and where introduced in the series 
> > '[PATCHv9 0/6] dmaengine: rcar-dmac: add iommu support for slave 
> > transfers'.
> 
> Applied both

Thanks.

> 
> Thanks
> -- 
> ~Vinod

-- 
Regards,
Niklas S�derlund

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings
@ 2016-09-29 12:42     ` Niklas Söderlund
  0 siblings, 0 replies; 8+ messages in thread
From: Niklas Söderlund @ 2016-09-29 12:42 UTC (permalink / raw)
  To: Vinod Koul
  Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	dmaengine-u79uwXL29TY76Z2rM5mHXA,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	arnd-r2nGTMty4D4

On 2016-09-29 17:40:04 +0530, Vinod Koul wrote:
> On Thu, Sep 29, 2016 at 12:02:38PM +0200, Niklas Söderlund wrote:
> > From: Niklas Söderlund <niklas.soderlund+renesas-1zkq55x86MTxsAP9Fp7wbw@public.gmane.org>
> > 
> > Hi Vindo,
> 
> :(

I'm sorry, my hands sometimes moves faster then my head.

> 
> > 
> > This small series fixes the build error and warnings for ia64 and m32r 
> > which kbuild test robot found and where introduced in the series 
> > '[PATCHv9 0/6] dmaengine: rcar-dmac: add iommu support for slave 
> > transfers'.
> 
> Applied both

Thanks.

> 
> Thanks
> -- 
> ~Vinod

-- 
Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-09-29 12:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 10:02 [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings Niklas Söderlund
2016-09-29 10:02 ` [PATCH 1/2] dma-mapping: fix ia64 build, use PHYS_PFN Niklas Söderlund
2016-09-29 10:02   ` Niklas Söderlund
2016-09-29 10:02 ` [PATCH 2/2] dma-mapping: fix m32r build warning Niklas Söderlund
2016-09-29 12:10 ` [PATCH 0/2] dma-mapping: fix ia64 and m32r build error and warnings Vinod Koul
2016-09-29 12:10   ` Vinod Koul
2016-09-29 12:42   ` Niklas Söderlund
2016-09-29 12:42     ` Niklas Söderlund

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.