* [dpdk-dev] [PATCH] igb_uio: fix build error with kernel < 3.2
@ 2017-04-03 16:49 Ferruh Yigit
2017-04-03 17:48 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Ferruh Yigit @ 2017-04-03 16:49 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Ferruh Yigit
Recently added "dma_zalloc_coherent()" call is causing build error
for Linux kernels < 3.2.
compile error:
.../build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:
In function ‘igbuio_pci_probe’:
.../build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:434:2:
error: implicit declaration of function ‘dma_zalloc_coherent’
[-Werror=implicit-function-declaration]
map_addr = dma_zalloc_coherent(&dev->dev, 1024,
^
dma_zalloc_coherent() introduced with Linux kernel 3.2, with commit
Linux: 842fa69f3e0c ("include/linux/dma-mapping.h: add dma_zalloc_coherent()")
Since it does not exist for older kernels, causing a build error.
Swithched to dma_alloc_coherent() API to prevent build error.
Fixes: d287e4d41be0 ("igb_uio: map dummy DMA forcing IOMMU domain attachment")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index 41bf6ea..192bd4a 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -431,8 +431,10 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
* the iommu identity mapping if kernel boots with iommu=pt.
* Note this is not a problem if no IOMMU at all.
*/
- map_addr = dma_zalloc_coherent(&dev->dev, 1024,
- &map_dma_addr, GFP_KERNEL);
+ map_addr = dma_alloc_coherent(&dev->dev, 1024, &map_dma_addr,
+ GFP_KERNEL);
+ if (map_addr)
+ memset(map_addr, 0, 1024);
if (!map_addr)
dev_info(&dev->dev, "dma mapping failed\n");
--
2.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] igb_uio: fix build error with kernel < 3.2
2017-04-03 16:49 [dpdk-dev] [PATCH] igb_uio: fix build error with kernel < 3.2 Ferruh Yigit
@ 2017-04-03 17:48 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-04-03 17:48 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev
2017-04-03 17:49, Ferruh Yigit:
> Recently added "dma_zalloc_coherent()" call is causing build error
> for Linux kernels < 3.2.
>
> compile error:
> .../build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:
> In function ‘igbuio_pci_probe’:
> .../build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:434:2:
> error: implicit declaration of function ‘dma_zalloc_coherent’
> [-Werror=implicit-function-declaration]
> map_addr = dma_zalloc_coherent(&dev->dev, 1024,
> ^
>
> dma_zalloc_coherent() introduced with Linux kernel 3.2, with commit
> Linux: 842fa69f3e0c ("include/linux/dma-mapping.h: add dma_zalloc_coherent()")
> Since it does not exist for older kernels, causing a build error.
>
> Swithched to dma_alloc_coherent() API to prevent build error.
>
> Fixes: d287e4d41be0 ("igb_uio: map dummy DMA forcing IOMMU domain attachment")
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-03 17:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03 16:49 [dpdk-dev] [PATCH] igb_uio: fix build error with kernel < 3.2 Ferruh Yigit
2017-04-03 17:48 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).