x86 ioport fixes
cover x86 ioport fixes
Here is a patchset for little cleanups and a fix on newly introduced pci ioport api.
The last patch fixes a regression reported by Mauricio V. [1].
[1]: http://dpdk.org/ml/archives/dev/2016-February/033922.html
Signature · 13 lines
David Marchand David Marchand (4): pci: explicitly call ioport handlers for uio_pci_generic pci: align ioport unmap error handling to ioport map pci: align ioport special case for x86 in read/write/unmap pci: fix ioport support for uio_pci_generic on x86 lib/librte_eal/linuxapp/eal/eal_pci.c | 36 +++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) -- 1.9.1
PATCH 1/4 pci: explicitly call ioport handlers for uio_pci_generic
Prepare for fixes on x86 by separating igb_uio and uio_pci_generic cases.
--- lib/librte_eal/linuxapp/eal/eal_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/librte_eal/linuxapp/eal/eal_pci.c +8 -0
@@ -617,6 +617,8 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar,break ;#endif case RTE_KDRV_IGB_UIO : + ret =pci_uio_ioport_map (dev, bar, p); +break ;case RTE_KDRV_UIO_GENERIC : ret =pci_uio_ioport_map (dev, bar, p);break ;
@@ -646,6 +648,8 @@ rte_eal_pci_ioport_read(struct rte_pci_ioport *p,break ;#endif case RTE_KDRV_IGB_UIO : +pci_uio_ioport_read (p, data, len, offset); +break ;case RTE_KDRV_UIO_GENERIC :pci_uio_ioport_read (p, data, len, offset);break ;
@@ -669,6 +673,8 @@ rte_eal_pci_ioport_write(struct rte_pci_ioport *p,break ;#endif case RTE_KDRV_IGB_UIO : +pci_uio_ioport_write (p, data, len, offset); +break ;case RTE_KDRV_UIO_GENERIC :pci_uio_ioport_write (p, data, len, offset);break ;
@@ -695,6 +701,8 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)break ;#endif case RTE_KDRV_IGB_UIO : + ret =pci_uio_ioport_unmap (p); +break ;case RTE_KDRV_UIO_GENERIC : ret =pci_uio_ioport_unmap (p);break ;
Signature · 1 line
1.9.1
PATCH 2/4 pci: align ioport unmap error handling to ioport map
In reply to David MarchandSame idea as commit bd80d4730aca ("pci: rework ioport map error handling").
--- lib/librte_eal/linuxapp/eal/eal_pci.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
lib/librte_eal/linuxapp/eal/eal_pci.c +1 -4
@@ -690,12 +690,11 @@ rte_eal_pci_ioport_write(struct rte_pci_ioport *p,int rte_eal_pci_ioport_unmap (struct rte_pci_ioport *p) { -int ret; +int ret =-1 ;switch (p->dev->kdrv) {#ifdef VFIO_PRESENT case RTE_KDRV_VFIO : - ret =-1 ;if (pci_vfio_is_enabled ()) ret =pci_vfio_ioport_unmap (p);break ;
@@ -710,8 +709,6 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)#if defined(RTE_ARCH_X86 )/* special case for x86 ... nothing to do */ ret =0 ; -#else - ret =-1 ;#endif break ; }
Signature · 1 line
1.9.1
PATCH 3/4 pci: align ioport special case for x86 in read/write/unmap
In reply to David MarchandCommit b8eb345378bd ("pci: ignore devices already managed in Linux when mapping x86 ioport") did not update other parts of the ioport api.
The application is not supposed to call these read/write/unmap ioport functions if map call failed but I prefer aligning the code for the sake of consistency.
--- lib/librte_eal/linuxapp/eal/eal_pci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
lib/librte_eal/linuxapp/eal/eal_pci.c +9 -6
@@ -653,12 +653,13 @@ rte_eal_pci_ioport_read(struct rte_pci_ioport *p,case RTE_KDRV_UIO_GENERIC :pci_uio_ioport_read (p, data, len, offset);break ; -default : +case RTE_KDRV_NONE :#if defined(RTE_ARCH_X86 ) -/* special case for x86 ... */ pci_uio_ioport_read (p, data, len, offset);#endif break ; +default : +break ; } }
@@ -678,12 +679,13 @@ rte_eal_pci_ioport_write(struct rte_pci_ioport *p,case RTE_KDRV_UIO_GENERIC :pci_uio_ioport_write (p, data, len, offset);break ; -default : +case RTE_KDRV_NONE :#if defined(RTE_ARCH_X86 ) -/* special case for x86 ... */ pci_uio_ioport_write (p, data, len, offset);#endif break ; +default : +break ; } }
@@ -705,12 +707,13 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p)case RTE_KDRV_UIO_GENERIC : ret =pci_uio_ioport_unmap (p);break ; -default : +case RTE_KDRV_NONE :#if defined(RTE_ARCH_X86 ) -/* special case for x86 ... nothing to do */ ret =0 ;#endif break ; +default : +break ; }return ret;
Signature · 1 line
1.9.1
PATCH 4/4 pci: fix ioport support for uio_pci_generic on x86
In reply to David Marchanduio_pci_generic does not offer the same sysfs helpers as igb_uio. In this case, ioport number can only be retrieved by parsing /proc/ioports.
--- lib/librte_eal/linuxapp/eal/eal_pci.c | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/librte_eal/linuxapp/eal/eal_pci.c +8 -0
@@ -620,7 +620,11 @@ rte_eal_pci_ioport_map(struct rte_pci_device *dev, int bar, ret =pci_uio_ioport_map (dev, bar, p);break ;case RTE_KDRV_UIO_GENERIC : +#if defined(RTE_ARCH_X86 ) + ret =pci_ioport_map (dev, bar, p); +#else ret =pci_uio_ioport_map (dev, bar, p); +#endif break ;case RTE_KDRV_NONE :#if defined(RTE_ARCH_X86 )
@@ -705,7 +709,11 @@ rte_eal_pci_ioport_unmap(struct rte_pci_ioport *p) ret =pci_uio_ioport_unmap (p);break ;case RTE_KDRV_UIO_GENERIC : +#if defined(RTE_ARCH_X86 ) + ret =0 ; +#else ret =pci_uio_ioport_unmap (p); +#endif break ;case RTE_KDRV_NONE :#if defined(RTE_ARCH_X86 )
Signature · 1 line
1.9.1
Thomas Monjalon
Applied2016-03-15 07:29, David Marchand:
Quoted 5 lines
Here is a patchset for little cleanups and a fix on newly introduced pci ioport api.
The last patch fixes a regression reported by Mauricio V. [1].[1]: http://dpdk.org/ml/archives/dev/2016-February/033922.html
Applied, thanks