dma-mapping: fix ia64 and m32r build error and warnings
cover dma-mapping: fix ia64 and m32r build error and warnings
From: Niklas Söderlund <[email protected]>
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':
Quoted 1 line
Quoted 1 line
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(-)
Signature · 1 line
2.9.3
A message that is not in the archive (sent off-list or not yet received): 20160929100240.7955-1-niklas.soderlund-1zkq55x86MTxsAP9Fp7wbw@public.gmane.org
PATCH 1/2 dma-mapping: fix ia64 build, use PHYS_PFN
From: Niklas Söderlund <[email protected]>
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':
Quoted 1 line
Quoted 1 line
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.
--- include/linux/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/dma-mapping.h +1 -1
@@ -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));
Signature · 6 lines
2.9.3 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
PATCH 2/2 dma-mapping: fix m32r build warning
In reply to Niklas SöderlundFrom: Niklas Söderlund <[email protected]>
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':
Quoted 1 line
Quoted 1 line
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.
--- include/linux/dma-mapping.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/dma-mapping.h +1 -2
@@ -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)
Signature · 1 line
2.9.3
Quoted 3 lines · Niklas S�derlund
From: Niklas S�derlund <[email protected]>
Hi Vindo,
:(
Quoted 5 lines
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
Signature · 1 line
~Vinod
Quoted 6 lines · Vinod Koul
Quoted 3 lines · Niklas Söderlund
From: Niklas Söderlund <[email protected]>
Hi Vindo,
:(
I'm sorry, my hands sometimes moves faster then my head.
Quoted 8 lines
Quoted 6 lines
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.
Quoted 4 lines
Thanks
Signature · 1 line
~Vinod
Signature · 2 lines
Regards, Niklas Söderlund