[dpdk-kmod] linux/igb_uio: fix build with kernel 5.18

Message ID 20221216115732.3552650-1-ferruh.yigit@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [dpdk-kmod] linux/igb_uio: fix build with kernel 5.18 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation warning apply patch failure
ci/Intel-compilation warning apply issues
ci/iol-testing warning apply patch failure

Commit Message

Ferruh Yigit Dec. 16, 2022, 11:57 a.m. UTC
  In Linux kernel v5.18, "pci-dma-compat.h" wrapper file is removed [1].

Some APIs in that wrapper file were used by igb_uio kernel module and
kernel module build fails after mentioned commit.

Fixed build for v5.18 by replacing APIs in igb_uio.

Replaced APIs are available in Linux v4.4 (minimum Linux kernel version
supported by DPDK), so no Linux version check is needed.

[1]
Commit 7968778914e5 ("PCI: Remove the deprecated "pci-dma-compat.h" API")

Bugzilla ID: 1142

Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
Cc: Daxue Gao <daxuex.gao@intel.com>

Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
This also needs to be backported to v19.11 LTS
---
 linux/igb_uio/igb_uio.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
  

Comments

Stephen Hemminger Dec. 16, 2022, 5:33 p.m. UTC | #1
On Fri, 16 Dec 2022 11:57:32 +0000
Ferruh Yigit <ferruh.yigit@amd.com> wrote:

> In Linux kernel v5.18, "pci-dma-compat.h" wrapper file is removed [1].
> 
> Some APIs in that wrapper file were used by igb_uio kernel module and
> kernel module build fails after mentioned commit.
> 
> Fixed build for v5.18 by replacing APIs in igb_uio.
> 
> Replaced APIs are available in Linux v4.4 (minimum Linux kernel version
> supported by DPDK), so no Linux version check is needed.
> 

Makes sense, but lets put the correct versions in the commit description.
DPDK should not be trying to support unsupported kernel versions.

5.18 is End of Life now and so the one that matters is really 6.0.

Current DPDK 22 should be supporting last supported LTS which
in January will be 4.14
  
Ferruh Yigit Dec. 18, 2022, 2:26 p.m. UTC | #2
On 12/16/2022 5:33 PM, Stephen Hemminger wrote:
> On Fri, 16 Dec 2022 11:57:32 +0000
> Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> 
>> In Linux kernel v5.18, "pci-dma-compat.h" wrapper file is removed [1].
>>
>> Some APIs in that wrapper file were used by igb_uio kernel module and
>> kernel module build fails after mentioned commit.
>>
>> Fixed build for v5.18 by replacing APIs in igb_uio.
>>
>> Replaced APIs are available in Linux v4.4 (minimum Linux kernel version
>> supported by DPDK), so no Linux version check is needed.
>>
> 
> Makes sense, but lets put the correct versions in the commit description.
> DPDK should not be trying to support unsupported kernel versions.
> 
> 5.18 is End of Life now and so the one that matters is really 6.0.
> 
> Current DPDK 22 should be supporting last supported LTS which
> in January will be 4.14

Agree on this, but officially in documents it still says 4.4, when doc
updated I can update commit log too.
  
Luca Boccassi Dec. 22, 2022, 3:35 p.m. UTC | #3
On Fri, 16 Dec 2022 at 12:57, Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>
> In Linux kernel v5.18, "pci-dma-compat.h" wrapper file is removed [1].
>
> Some APIs in that wrapper file were used by igb_uio kernel module and
> kernel module build fails after mentioned commit.
>
> Fixed build for v5.18 by replacing APIs in igb_uio.
>
> Replaced APIs are available in Linux v4.4 (minimum Linux kernel version
> supported by DPDK), so no Linux version check is needed.
>
> [1]
> Commit 7968778914e5 ("PCI: Remove the deprecated "pci-dma-compat.h" API")
>
> Bugzilla ID: 1142
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
> ---
> Cc: Daxue Gao <daxuex.gao@intel.com>
>
> Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> This also needs to be backported to v19.11 LTS
> ---
>  linux/igb_uio/igb_uio.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Tested-by: Luca Boccassi <bluca@debian.org>
  
Thomas Monjalon Feb. 5, 2023, 5:41 p.m. UTC | #4
16/12/2022 12:57, Ferruh Yigit:
> In Linux kernel v5.18, "pci-dma-compat.h" wrapper file is removed [1].
> 
> Some APIs in that wrapper file were used by igb_uio kernel module and
> kernel module build fails after mentioned commit.
> 
> Fixed build for v5.18 by replacing APIs in igb_uio.
> 
> Replaced APIs are available in Linux v4.4 (minimum Linux kernel version
> supported by DPDK), so no Linux version check is needed.
> 
> [1]
> Commit 7968778914e5 ("PCI: Remove the deprecated "pci-dma-compat.h" API")
> 
> Bugzilla ID: 1142
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>

The patch from Georg is doing the same and was sent earlier:
https://patches.dpdk.org/project/dpdk/patch/20221006185136.1634218-1-georgmueller@gmx.net/
  

Patch

diff --git a/linux/igb_uio/igb_uio.c b/linux/igb_uio/igb_uio.c
index 33e0e0286b69..0045e0fb737a 100644
--- a/linux/igb_uio/igb_uio.c
+++ b/linux/igb_uio/igb_uio.c
@@ -512,18 +512,12 @@  igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		goto fail_release_iomem;
 
 	/* set 64-bit DMA mask */
-	err = pci_set_dma_mask(dev,  DMA_BIT_MASK(64));
+	err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64));
 	if (err != 0) {
 		dev_err(&dev->dev, "Cannot set DMA mask\n");
 		goto fail_release_iomem;
 	}
 
-	err = pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64));
-	if (err != 0) {
-		dev_err(&dev->dev, "Cannot set consistent DMA mask\n");
-		goto fail_release_iomem;
-	}
-
 	/* fill uio infos */
 	udev->info.name = "igb_uio";
 	udev->info.version = "0.1";