* [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm @ 2016-01-21 10:26 Santosh Shukla 2016-01-21 10:26 ` [dpdk-dev] [PATCH v6 05/11] eal: pci: vfio: add rd/wr func for pci bar space Santosh Shukla 2016-01-21 10:28 ` [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm David Marchand 0 siblings, 2 replies; 4+ messages in thread From: Santosh Shukla @ 2016-01-21 10:26 UTC (permalink / raw) To: dev iopl() syscall not supported in linux-arm/arm64 so always return 0 value. Signed-off-by: Santosh Shukla <sshukla@mvista.com> Acked-by: Jan Viktorin <viktorin@rehivetech.com> Suggested-by: Stephen Hemminger <stephen@networkplumber.org> --- v5 --> v5: - Renamed patch titled from "linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()" to current, Suggested by David. v5 patch was this[1] [1] http://dpdk.org/dev/patchwork/patch/9978/ lib/librte_eal/linuxapp/eal/eal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 635ec36..a2a3485 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -715,6 +715,8 @@ rte_eal_iopl_init(void) if (iopl(3) != 0) return -1; return 0; +#elif defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64) + return 0; /* iopl syscall not supported for ARM/ARM64 */ #else return -1; #endif -- 1.7.9.5 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH v6 05/11] eal: pci: vfio: add rd/wr func for pci bar space 2016-01-21 10:26 [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm Santosh Shukla @ 2016-01-21 10:26 ` Santosh Shukla 2016-01-27 17:42 ` Santosh Shukla 2016-01-21 10:28 ` [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm David Marchand 1 sibling, 1 reply; 4+ messages in thread From: Santosh Shukla @ 2016-01-21 10:26 UTC (permalink / raw) To: dev Introducing below api for pci bar space rd/wr. Currently used for pci iobar rd/wr. Api's are: - rte_eal_pci_read_bar - rte_eal_pci_write_bar virtio when used for vfio-mode then virtio driver will use these api to do rd/wr operation on ioport pci bar. Signed-off-by: Santosh Shukla <sshukla@mvista.com> --- v5-->v6: - included dummy implementation for rte_eal_pci_read/write_bar() api in bsdapp. - Added api entry in rte_eal_version.map lib/librte_eal/bsdapp/eal/eal_pci.c | 19 ++++++++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 3 ++ lib/librte_eal/common/include/rte_pci.h | 38 +++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci.c | 34 ++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci_init.h | 6 ++++ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 28 +++++++++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 ++ 7 files changed, 131 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index 95c32c1..2e535ea 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -479,6 +479,25 @@ int rte_eal_pci_write_config(const struct rte_pci_device *dev, return -1; } +int rte_eal_pci_read_bar(const struct rte_pci_device *device __rte_unused, + void *buf __rte_unused, size_t len __rte_unused, + off_t offset __rte_unused, + int bar_idx __rte_unused) + +{ + /* NA */ + return 1; +} + +int rte_eal_pci_write_bar(const struct rte_pci_device *device __rte_unused, + const void *buf __rte_unused, size_t len __rte_unused, + off_t offset __rte_unused, + int bar_idx __rte_unused) +{ + /* NA */ + return 1; +} + /* Init the PCI EAL subsystem */ int rte_eal_pci_init(void) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 1b28170..7c7dcf0 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -141,4 +141,7 @@ DPDK_2.3 { rte_eal_pci_map_device; rte_eal_pci_unmap_device; + rte_eal_pci_read_bar; + rte_eal_pci_write_bar; + } DPDK_2.2; diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index 2224109..0c667ff 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -471,6 +471,44 @@ int rte_eal_pci_read_config(const struct rte_pci_device *device, void *buf, size_t len, off_t offset); /** + * Read PCI bar space. + * + * @param device + * A pointer to a rte_pci_device structure describing the device + * to use + * @param buf + * A data buffer where the bytes should be read into + * @param len + * The length of the data buffer. + * @param offset + * The offset into PCI bar space + * @param bar_idx + * The pci bar index (valid range is 0..5) + */ +int rte_eal_pci_read_bar(const struct rte_pci_device *device, + void *buf, size_t len, off_t offset, int bar_idx); + +/** + * Write PCI bar space. + * + * @param device + * A pointer to a rte_pci_device structure describing the device + * to use + * @param buf + * A data buffer containing the bytes should be written + * @param len + * The length of the data buffer. + * @param offset + * The offset into PCI config space + * @param bar_idx + * The pci bar index (valid range is 0..5) +*/ +int rte_eal_pci_write_bar(const struct rte_pci_device *device, + const void *buf, size_t len, off_t offset, + int bar_idx); + + +/** * Write PCI config space. * * @param device diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index db947da..eb503f0 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -621,6 +621,40 @@ int rte_eal_pci_write_config(const struct rte_pci_device *device, } } +int rte_eal_pci_read_bar(const struct rte_pci_device *device, + void *buf, size_t len, off_t offset, + int bar_idx) + +{ + const struct rte_intr_handle *intr_handle = &device->intr_handle; + + switch (device->kdrv) { + case RTE_KDRV_VFIO: + return pci_vfio_read_bar(intr_handle, buf, len, + offset, bar_idx); + default: + RTE_LOG(ERR, EAL, "write bar not supported by driver\n"); + return -1; + } +} + +int rte_eal_pci_write_bar(const struct rte_pci_device *device, + const void *buf, size_t len, off_t offset, + int bar_idx) +{ + + const struct rte_intr_handle *intr_handle = &device->intr_handle; + + switch (device->kdrv) { + case RTE_KDRV_VFIO: + return pci_vfio_write_bar(intr_handle, buf, len, + offset, bar_idx); + default: + RTE_LOG(ERR, EAL, "write bar not supported by driver\n"); + return -1; + } +} + /* Init the PCI EAL subsystem */ int rte_eal_pci_init(void) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_init.h b/lib/librte_eal/linuxapp/eal/eal_pci_init.h index a17c708..3bc592b 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_init.h +++ b/lib/librte_eal/linuxapp/eal/eal_pci_init.h @@ -68,6 +68,12 @@ int pci_vfio_read_config(const struct rte_intr_handle *intr_handle, int pci_vfio_write_config(const struct rte_intr_handle *intr_handle, const void *buf, size_t len, off_t offs); +int pci_vfio_read_bar(const struct rte_intr_handle *intr_handle, + void *buf, size_t len, off_t offs, int bar_idx); + +int pci_vfio_write_bar(const struct rte_intr_handle *intr_handle, + const void *buf, size_t len, off_t offs, int bar_idx); + /* map VFIO resource prototype */ int pci_vfio_map_resource(struct rte_pci_device *dev); int pci_vfio_get_group_fd(int iommu_group_fd); diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index abde779..df407ef 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -93,6 +93,34 @@ pci_vfio_write_config(const struct rte_intr_handle *intr_handle, VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) + offs); } +int +pci_vfio_read_bar(const struct rte_intr_handle *intr_handle, + void *buf, size_t len, off_t offs, int bar_idx) +{ + if (bar_idx < VFIO_PCI_BAR0_REGION_INDEX + || bar_idx > VFIO_PCI_BAR5_REGION_INDEX) { + RTE_LOG(ERR, EAL, "invalid bar_idx!\n"); + return -1; + } + + return pread64(intr_handle->vfio_dev_fd, buf, len, + VFIO_GET_REGION_ADDR(bar_idx) + offs); +} + +int +pci_vfio_write_bar(const struct rte_intr_handle *intr_handle, + const void *buf, size_t len, off_t offs, int bar_idx) +{ + if (bar_idx < VFIO_PCI_BAR0_REGION_INDEX + || bar_idx > VFIO_PCI_BAR5_REGION_INDEX) { + RTE_LOG(ERR, EAL, "invalid bar_idx!\n"); + return -1; + } + + return pwrite64(intr_handle->vfio_dev_fd, buf, len, + VFIO_GET_REGION_ADDR(bar_idx) + offs); +} + /* get PCI BAR number where MSI-X interrupts are */ static int pci_vfio_get_msix_bar(int fd, int *msix_bar, uint32_t *msix_table_offset, diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index b9937c4..371b6c1 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -144,4 +144,7 @@ DPDK_2.3 { rte_eal_pci_map_device; rte_eal_pci_unmap_device; + rte_eal_pci_read_bar; + rte_eal_pci_write_bar; + } DPDK_2.2; -- 1.7.9.5 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v6 05/11] eal: pci: vfio: add rd/wr func for pci bar space 2016-01-21 10:26 ` [dpdk-dev] [PATCH v6 05/11] eal: pci: vfio: add rd/wr func for pci bar space Santosh Shukla @ 2016-01-27 17:42 ` Santosh Shukla 0 siblings, 0 replies; 4+ messages in thread From: Santosh Shukla @ 2016-01-27 17:42 UTC (permalink / raw) To: dev On Thu, Jan 21, 2016 at 3:56 PM, Santosh Shukla <sshukla@mvista.com> wrote: > Introducing below api for pci bar space rd/wr. Currently used for > pci iobar rd/wr. > > Api's are: > - rte_eal_pci_read_bar > - rte_eal_pci_write_bar > > virtio when used for vfio-mode then virtio driver will use these api > to do rd/wr operation on ioport pci bar. > > Signed-off-by: Santosh Shukla <sshukla@mvista.com> > --- > v5-->v6: > - included dummy implementation for rte_eal_pci_read/write_bar() api in bsdapp. > - Added api entry in rte_eal_version.map > Ping for v6? > lib/librte_eal/bsdapp/eal/eal_pci.c | 19 ++++++++++++ > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 3 ++ > lib/librte_eal/common/include/rte_pci.h | 38 +++++++++++++++++++++++ > lib/librte_eal/linuxapp/eal/eal_pci.c | 34 ++++++++++++++++++++ > lib/librte_eal/linuxapp/eal/eal_pci_init.h | 6 ++++ > lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 28 +++++++++++++++++ > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 ++ > 7 files changed, 131 insertions(+) > > diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c > index 95c32c1..2e535ea 100644 > --- a/lib/librte_eal/bsdapp/eal/eal_pci.c > +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c > @@ -479,6 +479,25 @@ int rte_eal_pci_write_config(const struct rte_pci_device *dev, > return -1; > } > > +int rte_eal_pci_read_bar(const struct rte_pci_device *device __rte_unused, > + void *buf __rte_unused, size_t len __rte_unused, > + off_t offset __rte_unused, > + int bar_idx __rte_unused) > + > +{ > + /* NA */ > + return 1; > +} > + > +int rte_eal_pci_write_bar(const struct rte_pci_device *device __rte_unused, > + const void *buf __rte_unused, size_t len __rte_unused, > + off_t offset __rte_unused, > + int bar_idx __rte_unused) > +{ > + /* NA */ > + return 1; > +} > + > /* Init the PCI EAL subsystem */ > int > rte_eal_pci_init(void) > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > index 1b28170..7c7dcf0 100644 > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map > @@ -141,4 +141,7 @@ DPDK_2.3 { > > rte_eal_pci_map_device; > rte_eal_pci_unmap_device; > + rte_eal_pci_read_bar; > + rte_eal_pci_write_bar; > + > } DPDK_2.2; > diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h > index 2224109..0c667ff 100644 > --- a/lib/librte_eal/common/include/rte_pci.h > +++ b/lib/librte_eal/common/include/rte_pci.h > @@ -471,6 +471,44 @@ int rte_eal_pci_read_config(const struct rte_pci_device *device, > void *buf, size_t len, off_t offset); > > /** > + * Read PCI bar space. > + * > + * @param device > + * A pointer to a rte_pci_device structure describing the device > + * to use > + * @param buf > + * A data buffer where the bytes should be read into > + * @param len > + * The length of the data buffer. > + * @param offset > + * The offset into PCI bar space > + * @param bar_idx > + * The pci bar index (valid range is 0..5) > + */ > +int rte_eal_pci_read_bar(const struct rte_pci_device *device, > + void *buf, size_t len, off_t offset, int bar_idx); > + > +/** > + * Write PCI bar space. > + * > + * @param device > + * A pointer to a rte_pci_device structure describing the device > + * to use > + * @param buf > + * A data buffer containing the bytes should be written > + * @param len > + * The length of the data buffer. > + * @param offset > + * The offset into PCI config space > + * @param bar_idx > + * The pci bar index (valid range is 0..5) > +*/ > +int rte_eal_pci_write_bar(const struct rte_pci_device *device, > + const void *buf, size_t len, off_t offset, > + int bar_idx); > + > + > +/** > * Write PCI config space. > * > * @param device > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c > index db947da..eb503f0 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -621,6 +621,40 @@ int rte_eal_pci_write_config(const struct rte_pci_device *device, > } > } > > +int rte_eal_pci_read_bar(const struct rte_pci_device *device, > + void *buf, size_t len, off_t offset, > + int bar_idx) > + > +{ > + const struct rte_intr_handle *intr_handle = &device->intr_handle; > + > + switch (device->kdrv) { > + case RTE_KDRV_VFIO: > + return pci_vfio_read_bar(intr_handle, buf, len, > + offset, bar_idx); > + default: > + RTE_LOG(ERR, EAL, "write bar not supported by driver\n"); > + return -1; > + } > +} > + > +int rte_eal_pci_write_bar(const struct rte_pci_device *device, > + const void *buf, size_t len, off_t offset, > + int bar_idx) > +{ > + > + const struct rte_intr_handle *intr_handle = &device->intr_handle; > + > + switch (device->kdrv) { > + case RTE_KDRV_VFIO: > + return pci_vfio_write_bar(intr_handle, buf, len, > + offset, bar_idx); > + default: > + RTE_LOG(ERR, EAL, "write bar not supported by driver\n"); > + return -1; > + } > +} > + > /* Init the PCI EAL subsystem */ > int > rte_eal_pci_init(void) > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_init.h b/lib/librte_eal/linuxapp/eal/eal_pci_init.h > index a17c708..3bc592b 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_init.h > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_init.h > @@ -68,6 +68,12 @@ int pci_vfio_read_config(const struct rte_intr_handle *intr_handle, > int pci_vfio_write_config(const struct rte_intr_handle *intr_handle, > const void *buf, size_t len, off_t offs); > > +int pci_vfio_read_bar(const struct rte_intr_handle *intr_handle, > + void *buf, size_t len, off_t offs, int bar_idx); > + > +int pci_vfio_write_bar(const struct rte_intr_handle *intr_handle, > + const void *buf, size_t len, off_t offs, int bar_idx); > + > /* map VFIO resource prototype */ > int pci_vfio_map_resource(struct rte_pci_device *dev); > int pci_vfio_get_group_fd(int iommu_group_fd); > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > index abde779..df407ef 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > @@ -93,6 +93,34 @@ pci_vfio_write_config(const struct rte_intr_handle *intr_handle, > VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) + offs); > } > > +int > +pci_vfio_read_bar(const struct rte_intr_handle *intr_handle, > + void *buf, size_t len, off_t offs, int bar_idx) > +{ > + if (bar_idx < VFIO_PCI_BAR0_REGION_INDEX > + || bar_idx > VFIO_PCI_BAR5_REGION_INDEX) { > + RTE_LOG(ERR, EAL, "invalid bar_idx!\n"); > + return -1; > + } > + > + return pread64(intr_handle->vfio_dev_fd, buf, len, > + VFIO_GET_REGION_ADDR(bar_idx) + offs); > +} > + > +int > +pci_vfio_write_bar(const struct rte_intr_handle *intr_handle, > + const void *buf, size_t len, off_t offs, int bar_idx) > +{ > + if (bar_idx < VFIO_PCI_BAR0_REGION_INDEX > + || bar_idx > VFIO_PCI_BAR5_REGION_INDEX) { > + RTE_LOG(ERR, EAL, "invalid bar_idx!\n"); > + return -1; > + } > + > + return pwrite64(intr_handle->vfio_dev_fd, buf, len, > + VFIO_GET_REGION_ADDR(bar_idx) + offs); > +} > + > /* get PCI BAR number where MSI-X interrupts are */ > static int > pci_vfio_get_msix_bar(int fd, int *msix_bar, uint32_t *msix_table_offset, > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > index b9937c4..371b6c1 100644 > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map > @@ -144,4 +144,7 @@ DPDK_2.3 { > > rte_eal_pci_map_device; > rte_eal_pci_unmap_device; > + rte_eal_pci_read_bar; > + rte_eal_pci_write_bar; > + > } DPDK_2.2; > -- > 1.7.9.5 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm 2016-01-21 10:26 [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm Santosh Shukla 2016-01-21 10:26 ` [dpdk-dev] [PATCH v6 05/11] eal: pci: vfio: add rd/wr func for pci bar space Santosh Shukla @ 2016-01-21 10:28 ` David Marchand 1 sibling, 0 replies; 4+ messages in thread From: David Marchand @ 2016-01-21 10:28 UTC (permalink / raw) To: Santosh Shukla; +Cc: dev On Thu, Jan 21, 2016 at 11:26 AM, Santosh Shukla <sshukla@mvista.com> wrote: > iopl() syscall not supported in linux-arm/arm64 so always return 0 value. > > Signed-off-by: Santosh Shukla <sshukla@mvista.com> > Acked-by: Jan Viktorin <viktorin@rehivetech.com> > Suggested-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: David Marchand <david.marchand@6wind.com> -- David Marchand ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-27 17:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-01-21 10:26 [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm Santosh Shukla 2016-01-21 10:26 ` [dpdk-dev] [PATCH v6 05/11] eal: pci: vfio: add rd/wr func for pci bar space Santosh Shukla 2016-01-27 17:42 ` Santosh Shukla 2016-01-21 10:28 ` [dpdk-dev] [PATCH v6 02/11] eal/linux: never check iopl for arm David Marchand
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).