00/13] Add virtio support in arm/arm64
PATCH v2 1/1 00/13] Add virtio support in arm/arm64
This patch set add basic infrastrucure to run virtio-net-pci pmd driver for arm64/arm. Tested on ThunderX platfrom. Verified for existing dpdk(s) test applications like:
- ovs-dpdk-vhost-user: across the VM's, for the use-cases like guest2guest and Host2Guest
- testpmd application: Tested for max virtio-net-pci interface currently supported in kernel i.e. 31 interface.
Builds successfully for armv7/v8/thunderX and x86_64/i686 platforms. Made sure that patch changes donot break for x86_64 case. Done similar tests for x86_64 too.
Patch History:
v2:
- Removed ifdef arm.. clutter from igb_uio / virtio_ethedev files
- Introduced rte_io.h header file in generic/ and arch specifics i.e.. for armv7 --> rte_io_32.h, for armv8 --> rte_io_64.h.
- Removed RTE_ARCH_X86 ifdef clutter too and added rte_io.h header which nothing but wraps sys/io.h for x86_64 and i686
- Moved all the RTE_ARCH_ARM/64 dependancy for igb_uio case to separate header file named igbuio_ioport_misc.h. Now igb_uio.c will call only three function
- igbuio_iomap
- igbuio_ioport_register
- igbuio_ioport_unregister
- Moved ARM/64 specific definition to include/exec-env/rte_virt_ioport.h header
- Included virtio_ioport.c/h; has all private and public api required to map iopci bar for non-x86 arch. Tested on thunderX and x86_64 both. Private api includes:
- virtio_map_ioport
- virtio_set_ioport_addr
Public api includes:
- virtio_ioport_init
- virtio_ioport_unmap
- Last patch is the miscllanious format specifier fix identifid for 64bit case during regression.
v1:
- First patch adds RTE_VIRTIO_INC_VECTOR config, much needed for archs like arm/arm64 as they don't support vectored implementation, also wont able to build.
- Second patch is in-general fix for i686.
- Third patch is to emulate x86-style of {in,out}[b,w,l] api support for armv7/v8. As virtio-net-pci pmd driver uses those apis for port rd/wr {b,w,l}
- Fourth patch to enable VIRTIO_PMD feature in armv7/v8/thunderX config.
- Fifth patch to disable iopl syscall, As arm/arm64 linux kernel doesn't support them.
- Sixth patch introduces ioport memdevice called /dev/igb_ioport by which virtio pmd driver could able to rd/wr PCI_IOBAR.
{applicable for arm/arm64 only, tested for arm64 as of now}
Santosh Shukla (13):
virtio: Introduce config RTE_VIRTIO_INC_VECTOR
config: i686: set RTE_VIRTIO_INC_VECTOR=n
rte_io: armv7/v8: Introduce api to emulate x86-style of PCI/ISA
ioport access
virtio_pci: use rte_io.h for non-x86 arch
virtio: change io_base datatype from uint32_t to uint64_type
config: armv7/v8: Enable RTE_LIBRTE_VIRTIO_PMD
linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
rte_io: x86: Remove sys/io.h ifdef x86 clutter
igb_uio: ioport: map iopci region for armv7/v8 include/exec-env: ioport: add rte_virt_ioport header file
virtio_ioport: armv7/v8: mmap virtio iopci bar region
virtio_ethdev: use virtio_ioport api at device init/close virtio_ethdev : fix format specifier error for 64bit addr case
config/common_linuxapp | 1 + config/defconfig_arm-armv7a-linuxapp-gcc | 6 +- config/defconfig_arm64-armv8a-linuxapp-gcc | 6 +- config/defconfig_i686-native-linuxapp-gcc | 1 + config/defconfig_i686-native-linuxapp-icc | 1 + drivers/net/virtio/Makefile | 3 +- drivers/net/virtio/virtio_ethdev.c | 10 +- drivers/net/virtio/virtio_ioport.c | 163 ++++++++++++++++++++ drivers/net/virtio/virtio_ioport.h | 42 +++++ drivers/net/virtio/virtio_pci.h | 6 +- drivers/net/virtio/virtio_rxtx.c | 7 + lib/librte_eal/common/Makefile | 1 + lib/librte_eal/common/include/arch/arm/rte_io.h | 60 +++++++ lib/librte_eal/common/include/arch/arm/rte_io_32.h | 155 +++++++++++++++++++ lib/librte_eal/common/include/arch/arm/rte_io_64.h | 155 +++++++++++++++++++ lib/librte_eal/common/include/arch/x86/rte_io.h | 42 +++++ lib/librte_eal/common/include/generic/rte_io.h | 81 ++++++++++ lib/librte_eal/linuxapp/eal/Makefile | 2 +- lib/librte_eal/linuxapp/eal/eal.c | 7 +- .../eal/include/exec-env/rte_virt_ioport.h | 81 ++++++++++ lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 8 +- .../linuxapp/igb_uio/igbuio_ioport_misc.h | 133 ++++++++++++++++ 22 files changed, 957 insertions(+), 14 deletions(-) create mode 100644 drivers/net/virtio/virtio_ioport.c create mode 100644 drivers/net/virtio/virtio_ioport.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_32.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_64.h create mode 100644 lib/librte_eal/common/include/arch/x86/rte_io.h create mode 100644 lib/librte_eal/common/include/generic/rte_io.h create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h create mode 100644 lib/librte_eal/linuxapp/igb_uio/igbuio_ioport_misc.h
Signature · 1 line
1.7.9.5
PATCH v2 1/1 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
virtio_recv_pkts_vec and other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).
So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
--- config/common_linuxapp | 1 + drivers/net/virtio/Makefile | 2 +- drivers/net/virtio/virtio_rxtx.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-)
config/common_linuxapp +1 -0
@@ -273,6 +273,7 @@ CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_RX=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_TX=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DUMP=n +CONFIG_RTE_VIRTIO_INC_VECTOR=y # # Compile burst-oriented VMXNET3 PMD driver
drivers/net/virtio/Makefile +1 -1
@@ -50,7 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c -SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_simple.c +SRCS-$(CONFIG_RTE_VIRTIO_INC_VECTOR) += virtio_rxtx_simple.c # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether
drivers/net/virtio/virtio_rxtx.c +7 -0
@@ -438,7 +438,9 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev, dev->data->rx_queues[queue_idx] = vq; +#ifdef RTE_VIRTIO_INC_VECTOR virtio_rxq_vec_setup (vq); +#endif return 0 ; }
@@ -464,7 +466,10 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) {uint8_t vtpci_queue_idx =2 * queue_idx +VTNET_SQ_TQ_QUEUE_IDX ; + +#ifdef RTE_VIRTIO_INC_VECTOR struct virtio_hw *hw = dev->data->dev_private; +#endif struct virtqueue *vq;uint16_t tx_free_thresh;int ret;
@@ -477,6 +482,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,return -EINVAL ; } +#ifdef RTE_VIRTIO_INC_VECTOR /* Use simple rx/tx func if single segment and no offloads */ if ((tx_conf->txq_flags &VIRTIO_SIMPLE_FLAGS ) ==VIRTIO_SIMPLE_FLAGS && !vtpci_with_feature (hw,VIRTIO_NET_F_MRG_RXBUF )) {
@@ -485,6 +491,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, dev->rx_pkt_burst = virtio_recv_pkts_vec; use_simple_rxtx = 1; } +#endif ret =virtio_dev_queue_setup (dev,VTNET_TQ , queue_idx, vtpci_queue_idx, nb_desc, socket_id, &vq);
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
Quoted 10 lines · Santosh Shukla
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
any review / comment on this patch much appreciated. Thanks
Quoted 74 lines
config/common_linuxapp | 1 + drivers/net/virtio/Makefile | 2 +- drivers/net/virtio/virtio_rxtx.c | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-)config/common_linuxapp +1
-0@@ -273,6 +273,7 @@ CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_RX=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_TX=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_VIRTIO_DEBUG_DUMP=n +CONFIG_RTE_VIRTIO_INC_VECTOR=y # # Compile burst-oriented VMXNET3 PMD driverdrivers/net/virtio/Makefile +1
-1@@ -50,7 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c -SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx_simple.c +SRCS-$(CONFIG_RTE_VIRTIO_INC_VECTOR) += virtio_rxtx_simple.c # this lib depends upon: DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_etherdrivers/net/virtio/virtio_rxtx.c +7
-1@@ -438,7 +438,9 @@ virtio_dev_rx_queue_setup(struct rte_eth_dev *dev, dev->data->rx_queues[queue_idx] = vq; +#ifdef RTE_VIRTIO_INC_VECTOR virtio_rxq_vec_setup (vq); +#endif return 0 ; }@@ -464,7 +466,10 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) {uint8_t vtpci_queue_idx =2 * queue_idx +VTNET_SQ_TQ_QUEUE_IDX ; + +#ifdef RTE_VIRTIO_INC_VECTOR struct virtio_hw *hw = dev->data->dev_private; +#endif struct virtqueue *vq;uint16_t tx_free_thresh;int ret;@@ -477,6 +482,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev,return -EINVAL ; } +#ifdef RTE_VIRTIO_INC_VECTOR /* Use simple rx/tx func if single segment and no offloads */ if ((tx_conf->txq_flags &VIRTIO_SIMPLE_FLAGS ) ==VIRTIO_SIMPLE_FLAGS && !vtpci_with_feature (hw,VIRTIO_NET_F_MRG_RXBUF )) {@@ -485,6 +491,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, dev->rx_pkt_burst = virtio_recv_pkts_vec; use_simple_rxtx = 1; } +#endif ret =virtio_dev_queue_setup (dev,VTNET_TQ , queue_idx, vtpci_queue_idx, nb_desc, socket_id, &vq); --1.7.9.5
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
2015-12-17 17:32, Santosh Shukla:
Quoted 9 lines · Santosh Shukla
Quoted 8 lines
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
any review / comment on this patch much appreciated. Thanks
Why not check for SSE/AVX support instead of adding yet another config option?
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
Quoted 10 lines · Thomas Monjalon
2015-12-17 17:32, Santosh Shukla:
Quoted 9 lines · Santosh Shukla
Quoted 8 lines
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
any review / comment on this patch much appreciated. Thanks
Why not check for SSE/AVX support instead of adding yet another config option?
Ok, keeping a check for sse/avx across the patch wont stand true for future virtio vectored implementation lets say for arm/arm64 cases i.e.. sse2neon types. That implies user suppose to keep on appending / adding checks for see2neon for example and so forth.
On other hand, motivation of including INC_VEC config was inspired from IXGBE and other pmd drivers who support vectored sse/avx _rx path and also could work w/o vectored mode. Current virtio is missing such support and arm dont have vectored sse2neon types implementation right now so its a blocker for arm case. Also keeping virtio pmd driver flexible enough to work in non-vectored mode is a requirement/ a feature.
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
In reply to Santosh ShuklaQuoted 9 lines · On Thu, 17 Dec 2015 17:32:38 +0530 Santosh Shukla <[email protected]> wrote:
Quoted 8 lines · Santosh Shukla
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
any review / comment on this patch much appreciated. Thanks
The patches I posted (and were ignored by Intel) to support indirect and any layout should have much bigger performance gain than all this low level SSE bit twiddling.
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
Quoted 12 lines · Stephen Hemminger
Quoted 9 lines · On Thu, 17 Dec 2015 17:32:38 +0530 Santosh Shukla <[email protected]> wrote:
Quoted 8 lines · Santosh Shukla
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
any review / comment on this patch much appreciated. Thanks
The patches I posted (and were ignored by Intel) to support indirect
Sorry, I thought it was reviewed and got applied (and I just started to review patches for virtio recently).
So, would you please send it out again? I will have a review and test ASAP.
--yliu
Quoted 2 lines
and any layout should have much bigger performance gain than all this low level SSE bit twiddling.
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
In reply to Stephen HemmingerQuoted 12 lines · Stephen Hemminger
Quoted 9 lines · On Thu, 17 Dec 2015 17:32:38 +0530 Santosh Shukla <[email protected]> wrote:
Quoted 8 lines · Santosh Shukla
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
any review / comment on this patch much appreciated. Thanks
The patches I posted (and were ignored by Intel) to support indirect and any layout should have much bigger performance gain than all this low level SSE bit twiddling.
Hi Stephen:
We only did SSE twiddling to RX, which almost doubles the performance comparing to normal path in virtio/vhost performance test case. Indirect and any layout feature enabling are mostly for TX. We also did some optimization for single segment and non-offload case in TX, without using SSE, which also gives ~60% performance improvement, in Qian's result. My optimization is mostly for single segment and non-offload case, which i calls simple rx/tx.
I plan to add virtio/vhost performance benchmark so that we could easily measure the performance difference for each patch.
Indirect and any layout features are useful for multiple segment transmitted packet mbufs. I had acked your patch at the first time, and thought it is applied. I don't understand why you say it is ignored by Intel.
Quoted 2 lines
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
2015-12-18 09:52, Xie, Huawei:
Quoted 32 lines · Stephen Hemminger
Quoted 12 lines
Quoted 9 lines · On Thu, 17 Dec 2015 17:32:38 +0530 Santosh Shukla <[email protected]> wrote:
Quoted 8 lines · Santosh Shukla
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
any review / comment on this patch much appreciated. Thanks
The patches I posted (and were ignored by Intel) to support indirect and any layout should have much bigger performance gain than all this low level SSE bit twiddling.
Hi Stephen:
We only did SSE twiddling to RX, which almost doubles the performance comparing to normal path in virtio/vhost performance test case. Indirect and any layout feature enabling are mostly for TX. We also did some optimization for single segment and non-offload case in TX, without using SSE, which also gives ~60% performance improvement, in Qian's result. My optimization is mostly for single segment and non-offload case, which i calls simple rx/tx.
I plan to add virtio/vhost performance benchmark so that we could easily measure the performance difference for each patch.
Quoted 4 lines
Indirect and any layout features are useful for multiple segment transmitted packet mbufs. I had acked your patch at the first time, and thought it is applied. I don't understand why you say it is ignored by Intel.
There was an error and Stephen never replied nor pinged about it:
http://dpdk.org/ml/archives/dev/2015-October/026984.html
It happens.
Reminder: it is the responsibility of the author to get patches reviewed and accepted.
Please let's avoid useless blaming.
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
In reply to Xie, HuaweiQuoted 12 lines · Huawei
Quoted 1 line
low level SSE bit twiddling.
Hi Stephen:
We only did SSE twiddling to RX, which almost doubles the performance comparing to normal path in virtio/vhost performance test case. Indirect and any layout feature enabling are mostly for TX. We also did some optimization for single segment and non-offload case in TX, without using SSE, which also gives ~60% performance improvement, in Qian's result. My optimization is mostly for single segment and non-offload case, which i calls simple rx/tx.
I plan to add virtio/vhost performance benchmark so that we could easily measure the performance difference for each patch.
Quoted 4 lines
Indirect and any layout features are useful for multiple segment transmitted packet mbufs. I had acked your patch at the first time, and thought it is applied. I don't understand why you say it is ignored by Intel.
Sorry, did not mean to blame Intel, ... more that why didn't it get in 2.2?
It turns out any layout/indirect helps all transmits because they can then take a single tx descriptor rather than multiple.
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
2015-12-18 09:33, Stephen Hemminger:
Quoted 14 lines
Quoted 12 lines · Huawei
Quoted 1 line
low level SSE bit twiddling.
Hi Stephen:
We only did SSE twiddling to RX, which almost doubles the performance comparing to normal path in virtio/vhost performance test case. Indirect and any layout feature enabling are mostly for TX. We also did some optimization for single segment and non-offload case in TX, without using SSE, which also gives ~60% performance improvement, in Qian's result. My optimization is mostly for single segment and non-offload case, which i calls simple rx/tx.
I plan to add virtio/vhost performance benchmark so that we could easily measure the performance difference for each patch.
Quoted 6 lines
Quoted 4 lines
Indirect and any layout features are useful for multiple segment transmitted packet mbufs. I had acked your patch at the first time, and thought it is applied. I don't understand why you say it is ignored by Intel.
Sorry, did not mean to blame Intel, ... more that why didn't it get in 2.2?
I've already answered to this question:
http://dpdk.org/ml/archives/dev/2015-December/030540.html
There was a compilation error and you have not followed up.
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
In reply to Stephen HemmingerQuoted 15 lines · Stephen Hemminger
Quoted 12 lines · On Thu, 17 Dec 2015 17:32:38 +0530 Santosh Shukla <[email protected]> wrote:
Quoted 10 lines · Santosh Shukla
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Signed-off-by Santosh Shukla <[email protected]>---
Quoted 8 lines
Quoted 3 lines
Ping?
any review / comment on this patch much appreciated. Thanks
The patches I posted (and were ignored by Intel) to support indirect and any layout should have much bigger performance gain than all this low level SSE bit twiddling.
I little confused - do we care for this patch?
Re: [ [PATCH v2] 01/13] virtio: Introduce config RTE_VIRTIO_INC_VECTOR
Quoted 19 lines · Santosh Shukla
Quoted 17 lines · Stephen Hemminger
Quoted 14 lines · On Thu, 17 Dec 2015 17:32:38 +0530 Santosh Shukla <[email protected]> wrote:
Quoted 10 lines · Santosh Shukla
virtio_recv_pkts_vecand other virtio vector friend apis are written for sse/avx instructions. For arm64 in particular, virtio vector implementation does not exist(todo).So virtio pmd driver wont build for targets like i686, arm64. By making RTE_VIRTIO_INC_VECTOR=n, Driver can build for non-sse/avx targets and will work in non-vectored virtio mode.
Signed-off-by Santosh Shukla <[email protected]>---
Ping?
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
any review / comment on this patch much appreciated. Thanks
The patches I posted (and were ignored by Intel) to support indirect and any layout should have much bigger performance gain than all this low level SSE bit twiddling.
I little confused - do we care for this patch?
Santosh,
As a reviewer that still have a lot of work to do, I don't have the bandwidth to review _all_ your patches carefully __once__. That is to say, I will only comment when I find something should be commented, from time to time when I put more thoughts there. For other patches I've no comment, it could mean that it's okay to me so far, or I'm not quite sure it's okay but I don't find anything obvious wrong. Hence, I put no comments so far. But later, when get time, I will revisit them, think more, and either ACK it, or comment it.
So, you could simply keep those patches unchanged if they received no comments, and fix other comments, and send out a new version at anytime that is proper to you.
--yliu
PATCH v2 1/1 02/13] config: i686: set RTE_VIRTIO_INC_VECTOR=n
In reply to Santosh Shuklai686 target config example:
config/defconfig_i686-native-linuxapp-gcc says "Vectorized PMD is not supported on 32-bit".
So setting RTE_VIRTIO_INC_VECTOR to 'n'.
--- config/defconfig_i686-native-linuxapp-gcc | 1 + config/defconfig_i686-native-linuxapp-icc | 1 + 2 files changed, 2 insertions(+)
config/defconfig_i686-native-linuxapp-gcc +1 -0
@@ -49,3 +49,4 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n +CONFIG_RTE_VIRTIO_INC_VECTOR=n
config/defconfig_i686-native-linuxapp-icc +1 -0
@@ -49,3 +49,4 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n +CONFIG_RTE_VIRTIO_INC_VECTOR=n
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 02/13] config: i686: set RTE_VIRTIO_INC_VECTOR=n
Quoted 8 lines · Santosh Shukla
i686 target config example:
config/defconfig_i686-native-linuxapp-gcc says "Vectorized PMD is not supported on 32-bit".So setting
RTE_VIRTIO_INC_VECTORto 'n'.Signed-off-by Santosh Shukla <[email protected]>---
ping? review comment please.
Quoted 25 lines
config/defconfig_i686-native-linuxapp-gcc | 1 + config/defconfig_i686-native-linuxapp-icc | 1 + 2 files changed, 2 insertions(+)config/defconfig_i686-native-linuxapp-gcc +1
-0@@ -49,3 +49,4 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n +CONFIG_RTE_VIRTIO_INC_VECTOR=nconfig/defconfig_i686-native-linuxapp-icc +1
-1@@ -49,3 +49,4 @@ CONFIG_RTE_LIBRTE_KNI=n # Vectorized PMD is not supported on 32-bit # CONFIG_RTE_IXGBE_INC_VECTOR=n +CONFIG_RTE_VIRTIO_INC_VECTOR=n --1.7.9.5
PATCH v2 1/1 03/13] rte_io: armv7/v8: Introduce api to emulate x86-style of PCI/ISA ioport access
In reply to Santosh ShuklaIntroducing rte_io.h header file to emulate x86-style of ioport rd/wr api example {in,out}[bwl] and {in_p,out_p}[bwl]. Api support added for armv7 and armv8 both.
Current use-case for this api is for virtio_pci module that does x86-style rd/wr.
Tested for armv8/ThunderX platform and build successfully for armv7.
--- lib/librte_eal/common/Makefile | 1 + lib/librte_eal/common/include/arch/arm/rte_io.h | 60 ++++++++ lib/librte_eal/common/include/arch/arm/rte_io_32.h | 155 ++++++++++++++++++++ lib/librte_eal/common/include/arch/arm/rte_io_64.h | 155 ++++++++++++++++++++ lib/librte_eal/common/include/generic/rte_io.h | 81 ++++++++++ 5 files changed, 452 insertions(+) create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_32.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_64.h create mode 100644 lib/librte_eal/common/include/generic/rte_io.h
lib/librte_eal/common/Makefile +1 -0
@@ -48,6 +48,7 @@ endif GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h +GENERIC_INC += rte_io.h # defined in mk/arch/$(RTE_ARCH)/rte.vars.mk ARCH_DIR ?= $(RTE_ARCH) ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))
lib/librte_eal/common/include/arch/arm/rte_io.h new file +60 -0
60 lines not on this page · raw message
lib/librte_eal/common/include/arch/arm/rte_io_32.h new file +155 -0
155 lines not on this page · raw message
lib/librte_eal/common/include/arch/arm/rte_io_64.h new file +155 -0
155 lines not on this page · raw message
lib/librte_eal/common/include/generic/rte_io.h new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 03/13] rte_io: armv7/v8: Introduce api to emulate x86-style of PCI/ISA ioport access
Quoted 146 lines · Santosh Shukla
Introducing
rte_io.hheader file to emulate x86-style of ioport rd/wr api example {in,out}[bwl] and {in_p,out_p}[bwl]. Api support added for armv7 and armv8 both.Current use-case for this api is for
virtio_pcimodule that does x86-style rd/wr.Tested for armv8/ThunderX platform and build successfully for armv7.
Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/common/Makefile | 1 + lib/librte_eal/common/include/arch/arm/rte_io.h | 60 ++++++++ lib/librte_eal/common/include/arch/arm/rte_io_32.h | 155 ++++++++++++++++++++ lib/librte_eal/common/include/arch/arm/rte_io_64.h | 155 ++++++++++++++++++++ lib/librte_eal/common/include/generic/rte_io.h | 81 ++++++++++ 5 files changed, 452 insertions(+) create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_32.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_64.h create mode 100644 lib/librte_eal/common/include/generic/rte_io.hlib/librte_eal/common/Makefile +1
-0@@ -48,6 +48,7 @@ endif GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h +GENERIC_INC += rte_io.h # defined in mk/arch/$(RTE_ARCH)/rte.vars.mk ARCH_DIR ?= $(RTE_ARCH) ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))lib/librte_eal/common/include/arch/arm/rte_io.h new file +60
-0@@ -0,0 +1,60 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* ARM helper api to emulate x86-style of {in , out}[bwl] api used for +* accessing PCI/ISA IO address space. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_ARM_H_ +#define _RTE_IO_ARM_H_ + +/* +* @File +* Use-case: +* Currently virtio pci does IO access in x86-way i.e. IO_RESOURCE_IO way, It +* access the pci address space by port_number. The ARM doesn't have +* instructions for direct IO access. In ARM: IO's are memory mapped. +* +* Below helper api allow virtio_pci pmd driver to access IO's for arm/arm64 +* arch in x86-style of apis example: {in , out}[bwl] and {in_p , out_p}[bwl]. +*/ + +#ifdef RTE_ARCH_64 +#include <rte_io_64.h> +#else +#include <rte_io_32.h> +#endif + +#endif /* _RTE_IO_ARM_H_ */ lib/librte_eal/common/include/arch/arm/rte_io_32.h new file +40
-0@@ -0,0 +1,155 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_ARM32_H_ +#define _RTE_IO_ARM32_H_ + +#ifdef __cplusplus
lib/librte_eal/common/include/arch/arm/rte_io_32.h line 50
Quoted 10 lines
lib/librte_eal/common/include/arch/arm/rte_io_32.h new file +10
-0+extern "C" { +#endif + +#include "generic/rte_io.h" + +/* +* Generic IO read/write api for arm: Refer TRM +*/ +static inline void raw_writeb (uint8_t val,uint32_t addr) +{
armv7 and armv8 instructions looks same for both raw_* implementation. The difference in length of "addr" can be abstracted as uintptr_t to reuse the code.
Use AT&T sytax on inline assembly as mentioned indoc/guides/contributing/coding_style.rst
Inline ASM in C code
~~~~~~~~~~~~~~~~~~~~
The ``asm`` and ``volatile`` keywords do not have underscores. The AT&T syntax should be used.
Input and output operands should be named to avoid confusion, as shown in the following example:
.. code-block:: c
asm volatile("outb %[val], %[port]"
: :
[port] "dN" (port),
[val] "a" (val));Quoted 314 lines
lib/librte_eal/common/include/arch/arm/rte_io_32.h new file +105
-0+ asmvolatile ("strb %0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writew (uint16_t val,uint32_t addr) +{ + asmvolatile ("strh %0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writel (uint32_t val,uint32_t addr) +{ + asmvolatile ("str %0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline uint8_t raw_readb (uint32_t addr) +{ +uint8_t val; + asmvolatile ("ldrb %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint16_t raw_readw (uint32_t addr) +{ +uint16_t val; + asmvolatile ("ldrh %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint32_t raw_readl (uint32_t addr) +{ +uint32_t val; + asmvolatile ("ldr %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +/** +* Emulate x86-style of ioport api implementation for arm/arm64. Included API +* - {in, out}{b, w, l}() +* - {in_p, out_p} {b, w, l} () +*/ + +static inline uint8_t inb (unsigned long addr) +{ +return raw_readb (addr); +} + +static inline uint16_t inw (unsigned long addr) +{ +return raw_readw (addr); +} + +static inline uint32_t inl (unsigned long addr) +{ +return raw_readl (addr); +} + +static inline void outb (uint8_t value,unsigned long addr) +{ +raw_writeb (value, addr); +} + +static inline void outw (uint16_t value,unsigned long addr) +{ +raw_writew (value, addr); +} + +static inline void outl (uint32_t value,unsigned long addr) +{ +raw_writel (value, addr); +} + +static inline uint8_t inb_p (unsigned long addr) +{ +return inb (addr); +} + +static inline uint16_t inw_p (unsigned long addr) +{ +return inw (addr); +} + +static inline uint32_t inl_p (unsigned long addr) +{ +return inl (addr); +} + +static inline void outb_p (uint8_t value,unsigned long addr) +{ +outb (value, addr); +} + +static inline void outw_p (uint16_t value,unsigned long addr) +{ +outw (value, addr); +} + +static inline void outl_p (uint32_t value,unsigned long addr) +{ +outl (value, addr); +} + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_IO_ARM32_H_ */ lib/librte_eal/common/include/arch/arm/rte_io_64.h new file +155
-0@@ -0,0 +1,155 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_ARM64_H_ +#define _RTE_IO_ARM64_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "generic/rte_io.h" + +/* +* Generic IO read/write api for arm64: Refer TRM +*/ +static inline void raw_writeb (uint8_t val,uint64_t addr) +{ + asmvolatile ("strb %w0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writew (uint16_t val,uint64_t addr) +{ + asmvolatile ("strh %w0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writel (uint32_t val,uint64_t addr) +{ + asmvolatile ("str %w0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline uint8_t raw_readb (uint64_t addr) +{ +uint8_t val; + asmvolatile ("ldrb %w0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint16_t raw_readw (uint64_t addr) +{ +uint16_t val; + asmvolatile ("ldrh %w0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint32_t raw_readl (uint64_t addr) +{ +uint32_t val; + asmvolatile ("ldr %w0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +/** +* Emulate x86-style of ioport api implementation for arm/arm64. Included API +* - {in, out}{b, w, l}() +* - {in_p, out_p} {b, w, l} () +*/ + +static inline uint8_t inb (unsigned long addr) +{ +return raw_readb (addr); +} + +static inline uint16_t inw (unsigned long addr) +{ +return raw_readw (addr); +} + +static inline uint32_t inl (unsigned long addr) +{ +return raw_readl (addr); +} + +static inline void outb (uint8_t value,unsigned long addr) +{ +raw_writeb (value, addr); +} + +static inline void outw (uint16_t value,unsigned long addr) +{ +raw_writew (value, addr); +} + +static inline void outl (uint32_t value,unsigned long addr) +{ +raw_writel (value, addr); +} + +static inline uint8_t inb_p (unsigned long addr) +{ +return inb (addr); +} + +static inline uint16_t inw_p (unsigned long addr) +{ +return inw (addr); +} + +static inline uint32_t inl_p (unsigned long addr) +{ +return inl (addr); +} + +static inline void outb_p (uint8_t value,unsigned long addr) +{ +outb (value, addr); +} + +static inline void outw_p (uint16_t value,unsigned long addr) +{ +outw (value, addr); +} + +static inline void outl_p (uint32_t value,unsigned long addr) +{ +outl (value, addr); +} + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_IO_ARM64_H_ */ lib/librte_eal/common/include/generic/rte_io.h new file +42
-0@@ -0,0 +1,81 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_H_ +#define _RTE_IO_H_ + +/** +* @file +*
lib/librte_eal/common/include/generic/rte_io.h line 52
Quoted 10 lines
lib/librte_eal/common/include/generic/rte_io.h new file +10
-0+* IO operations. +* +* This file defines an API for IO rd/wr inline-functions, API's of the style +* {in , out}[bwl] and {in_p, out_p} [bwl]. which are architecture-dependent. +* Used by non-x86 archs. In particular used by arm/arm64 arch. +*/ + +#include <stdint.h> + +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 )
Shouldn't be
#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_X32) ?
Quoted 32 lines
lib/librte_eal/common/include/generic/rte_io.h new file +29
-1+#include <sys/io.h> +#else + +/** +* Emulate x86-style of ioport api implementation for arm/arm64. Included API +* - {in, out}{b, w, l}() +* - {in_p, out_p} {b, w, l} () +*/ + +static inline uint8_t inb (unsigned long addr); +static inline uint16_t inw (unsigned long addr); +static inline uint32_t inl (unsigned long addr); + +static inline void outb (uint8_t value,unsigned long addr); +static inline void outw (uint16_t value,unsigned long addr); +static inline void outl (uint32_t value,unsigned long addr); + +static inline uint8_t inb_p (unsigned long addr); +static inline uint16_t inw_p (unsigned long addr); +static inline uint32_t inl_p (unsigned long addr); + +static inline void outb_p (uint8_t value,unsigned long addr); +static inline void outw_p (uint16_t value,unsigned long addr); +static inline void outl_p (uint32_t value,unsigned long addr); + +#endif + +#endif /* _RTE_IO_H_ */ + --1.7.9.5
Re: [ [PATCH v2] 03/13] rte_io: armv7/v8: Introduce api to emulate x86-style of PCI/ISA ioport access
Quoted 173 lines · Jerin Jacob
Quoted 146 lines · Santosh Shukla
Introducing
rte_io.hheader file to emulate x86-style of ioport rd/wr api example {in,out}[bwl] and {in_p,out_p}[bwl]. Api support added for armv7 and armv8 both.Current use-case for this api is for
virtio_pcimodule that does x86-style rd/wr.Tested for armv8/ThunderX platform and build successfully for armv7.
Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/common/Makefile | 1 + lib/librte_eal/common/include/arch/arm/rte_io.h | 60 ++++++++ lib/librte_eal/common/include/arch/arm/rte_io_32.h | 155 ++++++++++++++++++++ lib/librte_eal/common/include/arch/arm/rte_io_64.h | 155 ++++++++++++++++++++ lib/librte_eal/common/include/generic/rte_io.h | 81 ++++++++++ 5 files changed, 452 insertions(+) create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_32.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_64.h create mode 100644 lib/librte_eal/common/include/generic/rte_io.hlib/librte_eal/common/Makefile +1
-0@@ -48,6 +48,7 @@ endif GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h +GENERIC_INC += rte_io.h # defined in mk/arch/$(RTE_ARCH)/rte.vars.mk ARCH_DIR ?= $(RTE_ARCH) ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))lib/librte_eal/common/include/arch/arm/rte_io.h new file +60
-0@@ -0,0 +1,60 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* ARM helper api to emulate x86-style of {in , out}[bwl] api used for +* accessing PCI/ISA IO address space. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_ARM_H_ +#define _RTE_IO_ARM_H_ + +/* +* @File +* Use-case: +* Currently virtio pci does IO access in x86-way i.e. IO_RESOURCE_IO way, It +* access the pci address space by port_number. The ARM doesn't have +* instructions for direct IO access. In ARM: IO's are memory mapped. +* +* Below helper api allow virtio_pci pmd driver to access IO's for arm/arm64 +* arch in x86-style of apis example: {in , out}[bwl] and {in_p , out_p}[bwl]. +*/ + +#ifdef RTE_ARCH_64 +#include <rte_io_64.h> +#else +#include <rte_io_32.h> +#endif + +#endif /* _RTE_IO_ARM_H_ */ lib/librte_eal/common/include/arch/arm/rte_io_32.h new file +40
-0@@ -0,0 +1,155 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_ARM32_H_ +#define _RTE_IO_ARM32_H_ + +#ifdef __cpluspluslib/librte_eal/common/include/arch/arm/rte_io_32.h line 50
Quoted 10 lines
lib/librte_eal/common/include/arch/arm/rte_io_32.h new file +10
-0+extern "C" { +#endif + +#include "generic/rte_io.h" + +/* +* Generic IO read/write api for arm: Refer TRM +*/ +static inline void raw_writeb (uint8_t val,uint32_t addr) +{armv7 and armv8 instructions looks same for both raw_* implementation. The difference in length of "addr" can be abstracted as
uintptr_tto reuse the code.Use AT&T sytax on inline assembly as mentioned in
doc/guides/contributing/coding_style.rstInline ASM in C code
~~~~~~~~~~~~~~~~~~~~The ``asm`` and ``volatile`` keywords do not have underscores. The AT&T syntax should be used.
Input and output operands should be named to avoid confusion, as shown in the following example:
Quoted 8 lines
.. code-block:: c
asm volatile("outb %[val], %[port]" : : [port] "dN" (port), [val] "a" (val));
Ok.
Quoted 320 lines
Quoted 320 lines
lib/librte_eal/common/include/arch/arm/rte_io_32.h new file +105
-0+ asmvolatile ("strb %0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writew (uint16_t val,uint32_t addr) +{ + asmvolatile ("strh %0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writel (uint32_t val,uint32_t addr) +{ + asmvolatile ("str %0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline uint8_t raw_readb (uint32_t addr) +{ +uint8_t val; + asmvolatile ("ldrb %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint16_t raw_readw (uint32_t addr) +{ +uint16_t val; + asmvolatile ("ldrh %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint32_t raw_readl (uint32_t addr) +{ +uint32_t val; + asmvolatile ("ldr %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +/** +* Emulate x86-style of ioport api implementation for arm/arm64. Included API +* - {in, out}{b, w, l}() +* - {in_p, out_p} {b, w, l} () +*/ + +static inline uint8_t inb (unsigned long addr) +{ +return raw_readb (addr); +} + +static inline uint16_t inw (unsigned long addr) +{ +return raw_readw (addr); +} + +static inline uint32_t inl (unsigned long addr) +{ +return raw_readl (addr); +} + +static inline void outb (uint8_t value,unsigned long addr) +{ +raw_writeb (value, addr); +} + +static inline void outw (uint16_t value,unsigned long addr) +{ +raw_writew (value, addr); +} + +static inline void outl (uint32_t value,unsigned long addr) +{ +raw_writel (value, addr); +} + +static inline uint8_t inb_p (unsigned long addr) +{ +return inb (addr); +} + +static inline uint16_t inw_p (unsigned long addr) +{ +return inw (addr); +} + +static inline uint32_t inl_p (unsigned long addr) +{ +return inl (addr); +} + +static inline void outb_p (uint8_t value,unsigned long addr) +{ +outb (value, addr); +} + +static inline void outw_p (uint16_t value,unsigned long addr) +{ +outw (value, addr); +} + +static inline void outl_p (uint32_t value,unsigned long addr) +{ +outl (value, addr); +} + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_IO_ARM32_H_ */ lib/librte_eal/common/include/arch/arm/rte_io_64.h new file +155
-0@@ -0,0 +1,155 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_ARM64_H_ +#define _RTE_IO_ARM64_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "generic/rte_io.h" + +/* +* Generic IO read/write api for arm64: Refer TRM +*/ +static inline void raw_writeb (uint8_t val,uint64_t addr) +{ + asmvolatile ("strb %w0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writew (uint16_t val,uint64_t addr) +{ + asmvolatile ("strh %w0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline void raw_writel (uint32_t val,uint64_t addr) +{ + asmvolatile ("str %w0, [%1]" : :"r" (val),"r" (addr)); +} + +static inline uint8_t raw_readb (uint64_t addr) +{ +uint8_t val; + asmvolatile ("ldrb %w0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint16_t raw_readw (uint64_t addr) +{ +uint16_t val; + asmvolatile ("ldrh %w0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +static inline uint32_t raw_readl (uint64_t addr) +{ +uint32_t val; + asmvolatile ("ldr %w0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +/** +* Emulate x86-style of ioport api implementation for arm/arm64. Included API +* - {in, out}{b, w, l}() +* - {in_p, out_p} {b, w, l} () +*/ + +static inline uint8_t inb (unsigned long addr) +{ +return raw_readb (addr); +} + +static inline uint16_t inw (unsigned long addr) +{ +return raw_readw (addr); +} + +static inline uint32_t inl (unsigned long addr) +{ +return raw_readl (addr); +} + +static inline void outb (uint8_t value,unsigned long addr) +{ +raw_writeb (value, addr); +} + +static inline void outw (uint16_t value,unsigned long addr) +{ +raw_writew (value, addr); +} + +static inline void outl (uint32_t value,unsigned long addr) +{ +raw_writel (value, addr); +} + +static inline uint8_t inb_p (unsigned long addr) +{ +return inb (addr); +} + +static inline uint16_t inw_p (unsigned long addr) +{ +return inw (addr); +} + +static inline uint32_t inl_p (unsigned long addr) +{ +return inl (addr); +} + +static inline void outb_p (uint8_t value,unsigned long addr) +{ +outb (value, addr); +} + +static inline void outw_p (uint16_t value,unsigned long addr) +{ +outw (value, addr); +} + +static inline void outl_p (uint32_t value,unsigned long addr) +{ +outl (value, addr); +} + +#ifdef __cplusplus +} +#endif + +#endif /* _RTE_IO_ARM64_H_ */ lib/librte_eal/common/include/generic/rte_io.h new file +48
-0@@ -0,0 +1,81 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _RTE_IO_H_ +#define _RTE_IO_H_ + +/** +* @file +* +* IO operations. +* +* This file defines an API for IO rd/wr inline-functions, API's of the style +* {in , out}[bwl] and {in_p, out_p} [bwl]. which are architecture-dependent. +* Used by non-x86 archs. In particular used by arm/arm64 arch. +*/
Quoted 9 lines
lib/librte_eal/common/include/generic/rte_io.h line 52
Quoted 4 lines
lib/librte_eal/common/include/generic/rte_io.h new file +4
-0+ +#include <stdint.h> + +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 )Shouldn't be
#ifdefined(RTE_ARCH_X86_64)||defined(RTE_ARCH_I686)||defined(RTE_ARCH_X86_X32)?
sys/io.h code incident in dpdk using similar ifdef so used, I guess your are right on including X86_X32 as because it is now include/generic/ direcotry. We'll do in v3. Thanks
Quoted 33 lines
Quoted 33 lines
lib/librte_eal/common/include/generic/rte_io.h new file +29
-1+#include <sys/io.h> +#else + +/** +* Emulate x86-style of ioport api implementation for arm/arm64. Included API +* - {in, out}{b, w, l}() +* - {in_p, out_p} {b, w, l} () +*/ + +static inline uint8_t inb (unsigned long addr); +static inline uint16_t inw (unsigned long addr); +static inline uint32_t inl (unsigned long addr); + +static inline void outb (uint8_t value,unsigned long addr); +static inline void outw (uint16_t value,unsigned long addr); +static inline void outl (uint32_t value,unsigned long addr); + +static inline uint8_t inb_p (unsigned long addr); +static inline uint16_t inw_p (unsigned long addr); +static inline uint32_t inl_p (unsigned long addr); + +static inline void outb_p (uint8_t value,unsigned long addr); +static inline void outw_p (uint16_t value,unsigned long addr); +static inline void outl_p (uint32_t value,unsigned long addr); + +#endif + +#endif /* _RTE_IO_H_ */ + --1.7.9.5
PATCH v2 1/1 04/13] virtio_pci: use rte_io.h for non-x86 arch
In reply to Santosh ShuklaUse rte_io.h for non-x86 arch.
--- drivers/net/virtio/virtio_pci.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/virtio/virtio_pci.h +4 -0
@@ -40,7 +40,11 @@#include <sys/types.h> #include <machine/cpufunc.h> #else +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 )#include <sys/io.h> +#else +#include <rte_io.h> +#endif #endif #include <rte_ethdev.h>
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 04/13] virtio_pci: use rte_io.h for non-x86 arch
Quoted 12 lines · Santosh Shukla
Use
rte_io.hfor non-x86 arch.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_pci.h | 4 ++++ 1 file changed, 4 insertions(+)drivers/net/virtio/virtio_pci.h +0
-0
drivers/net/virtio/virtio_pci.h line 46
Quoted 7 lines
drivers/net/virtio/virtio_pci.h +3
-0@@ -40,7 +40,11 @@#include <sys/types.h> #include <machine/cpufunc.h> #else +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 )#include <sys/io.h> +#else +#include <rte_io.h>
I believe this patch can be squashed with patch 08/13
Quoted 7 lines
drivers/net/virtio/virtio_pci.h +1
-0+#endif #endif #include <rte_ethdev.h> Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 04/13] virtio_pci: use rte_io.h for non-x86 arch
Quoted 8 lines · Jerin Jacob
Quoted 7 lines · Santosh Shukla
Use
rte_io.hfor non-x86 arch.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_pci.h | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 15 lines
drivers/net/virtio/virtio_pci.h line 46
Quoted 12 lines
drivers/net/virtio/virtio_pci.h +3
-0@@ -40,7 +40,11 @@#include <sys/types.h> #include <machine/cpufunc.h> #else +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 )#include <sys/io.h> +#else +#include <rte_io.h> I believe this patch can be squashed with patch 08/13
Yes. Thanks.
Quoted 7 lines
Quoted 7 lines
drivers/net/virtio/virtio_pci.h +1
-1+#endif #endif #include <rte_ethdev.h> --1.7.9.5
PATCH v2 1/1 05/13] virtio: change io_base datatype from uint32_t to uint64_type
In reply to Santosh ShuklaIn x86 case io_base to store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changing io_base datatype from 32 to 64.
--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/virtio/virtio_ethdev.c +1 -1
@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ; hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;/* Reset the device although not necessary at startup */ vtpci_reset (hw);
drivers/net/virtio/virtio_pci.h +2 -2
@@ -169,7 +169,7 @@ struct virtqueue;struct virtio_hw {struct virtqueue *cvq; -uint32_t io_base; +uint64_t io_base;uint32_t guest_features;uint32_t max_tx_queues;uint32_t max_rx_queues;
@@ -231,7 +231,7 @@ outl_p(unsigned int data, unsigned int port)#endif #define VIRTIO_PCI_REG_ADDR (hw, reg) \ - (unsigned short)((hw)->io_base + (reg)) + (unsigned long)((hw)->io_base + (reg))#define VIRTIO_READ_REG_1 (hw, reg) \ inb((VIRTIO_PCI_REG_ADDR((hw), (reg))))
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 15 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 5 lines
drivers/net/virtio/virtio_ethdev.c +1
-1@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ; hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;
I'd suggest to move the io_base assignment (and cast) into virtio_ioport_init() so that we could do the correct cast there, say cast it to uint32_t for X86, and uint64_t for others.
--yliu
Quoted 27 lines
drivers/net/virtio/virtio_ethdev.c +0
-0/* Reset the device although not necessary at startup */ vtpci_reset (hw);drivers/net/virtio/virtio_pci.h +2
-2@@ -169,7 +169,7 @@ struct virtqueue;struct virtio_hw {struct virtqueue *cvq; -uint32_t io_base; +uint64_t io_base;uint32_t guest_features;uint32_t max_tx_queues;uint32_t max_rx_queues;@@ -231,7 +231,7 @@ outl_p(unsigned int data, unsigned int port)#endif #define VIRTIO_PCI_REG_ADDR (hw, reg) \ - (unsigned short)((hw)->io_base + (reg)) + (unsigned long)((hw)->io_base + (reg))#define VIRTIO_READ_REG_1 (hw, reg) \ inb((VIRTIO_PCI_REG_ADDR((hw), (reg))))Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 18 lines · Yuanhan Liu
Quoted 17 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ;
Quoted 8 lines
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.c +1
-1hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;I'd suggest to move the
io_baseassignment (and cast) intovirtio_ioport_init()so that we could do the correct cast there, say cast it touint32_tfor X86, anduint64_tfor others.
Ok.
This was deliberately done considering your 1.0 virtio spec patch do care for uint64_t types and in arm64 case, If I plan to use those future patches, IMO it make more sense to me keep it in uint64_t way;
Also in x86 case max address could of type 0x1000-101f and so forth; changing data-type to uint64_t default wont effect such address, right? And hw->io_base by looking at virtio_pci.h function like inb/outb etc.. takes io_base address as unsigned long types which is arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower level rd/wr apis are taking care of data-types accordingly.
Quoted 29 lines
--yliuQuoted 27 lines
drivers/net/virtio/virtio_ethdev.c +0
-0/* Reset the device although not necessary at startup */ vtpci_reset (hw);drivers/net/virtio/virtio_pci.h +2
-3@@ -169,7 +169,7 @@ struct virtqueue;struct virtio_hw {struct virtqueue *cvq; -uint32_t io_base; +uint64_t io_base;uint32_t guest_features;uint32_t max_tx_queues;uint32_t max_rx_queues;@@ -231,7 +231,7 @@ outl_p(unsigned int data, unsigned int port)#endif #define VIRTIO_PCI_REG_ADDR (hw, reg) \ - (unsigned short)((hw)->io_base + (reg)) + (unsigned long)((hw)->io_base + (reg))#define VIRTIO_READ_REG_1 (hw, reg) \ inb((VIRTIO_PCI_REG_ADDR((hw), (reg)))) --1.7.9.5
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 29 lines · Santosh Shukla
Quoted 18 lines · Yuanhan Liu
Quoted 17 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ;Quoted 8 lines
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.c +1
-1hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;I'd suggest to move the
io_baseassignment (and cast) intovirtio_ioport_init()so that we could do the correct cast there, say cast it touint32_tfor X86, anduint64_tfor others.
Quoted 5 lines
Ok.
This was deliberately done considering your 1.0 virtio spec patch do care for
uint64_ttypes and in arm64 case, If I plan to use those future patches, IMO it make more sense to me keep it inuint64_tway;
I did different cast, 32 bit for legacy virtio pci device, and 64 bit for modern virtio pci device.
Quoted 3 lines
Also in x86 case max address could of type 0x1000-101f and so forth; changing data-type to
uint64_tdefault wont effect such address, right?
Right, but what's the harm of doing the right cast? :)
Quoted 4 lines
And
hw->io_baseby looking atvirtio_pci.hfunction like inb/outb etc.. takesio_baseaddress as unsigned long types which is arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower level rd/wr apis are taking care of data-types accordingly.
Didn't get it. inb/outb takes "unsigned short" arguments, but not "unsigned long".
--yliu
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 36 lines · Yuanhan Liu
Quoted 29 lines · Santosh Shukla
Quoted 18 lines · Yuanhan Liu
Quoted 17 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ;Quoted 8 lines
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.c +1
-1hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;I'd suggest to move the
io_baseassignment (and cast) intovirtio_ioport_init()so that we could do the correct cast there, say cast it touint32_tfor X86, anduint64_tfor others.Quoted 5 lines
Ok.
This was deliberately done considering your 1.0 virtio spec patch do care for
uint64_ttypes and in arm64 case, If I plan to use those future patches, IMO it make more sense to me keep it inuint64_tway;
Quoted 9 lines
I did different cast, 32 bit for legacy virtio pci device, and 64 bit for modern virtio pci device.
Quoted 3 lines
Also in x86 case max address could of type 0x1000-101f and so forth; changing data-type to
uint64_tdefault wont effect such address, right?Right, but what's the harm of doing the right cast? :)
Agree.
Quoted 8 lines
Quoted 4 lines
And
hw->io_baseby looking atvirtio_pci.hfunction like inb/outb etc.. takesio_baseaddress as unsigned long types which is arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower level rd/wr apis are taking care of data-types accordingly.Didn't get it. inb/outb takes "unsigned short" arguments, but not "unsigned long".
sys/io.h in x86 case using unsigned short int types..
include/asm-generic/io.h for arm64 using it unsigned long (from linux header files)
In such case keeping
#define VIRTIO_PCI_REG_ADDR(hw, reg) \
(unsigned short)((hw)->io_base + (reg))
would be x86 specific and what I thought and used in this patch is
#define VIRTIO_PCI_REG_ADDR(hw, reg) \
(unsigned long)((hw)->io_base + (reg))
to avoid ifdef ARM or non-x86..clutter, I know data-type is not right fit for x86 sys/io.h but considering possible address inside hw->io_base, wont effect functionality and performance my any mean. That is why at virtio_ethdev_init() i choose to keep it in hw->io_base = (uint64_t) types.
Otherwise I'll have to duplicate VIRTIO_PCI_REG_XXX definition for non-x86 case, Pl. suggest better alternative. Thanks
Quoted 1 line
--yliu
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 73 lines · Santosh Shukla
Quoted 36 lines · Yuanhan Liu
Quoted 29 lines · Santosh Shukla
Quoted 18 lines · Yuanhan Liu
Quoted 17 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ;Quoted 8 lines
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.c +1
-1hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;I'd suggest to move the
io_baseassignment (and cast) intovirtio_ioport_init()so that we could do the correct cast there, say cast it touint32_tfor X86, anduint64_tfor others.Quoted 5 lines
Ok.
This was deliberately done considering your 1.0 virtio spec patch do care for
uint64_ttypes and in arm64 case, If I plan to use those future patches, IMO it make more sense to me keep it inuint64_tway;Quoted 9 lines
I did different cast, 32 bit for legacy virtio pci device, and 64 bit for modern virtio pci device.
Quoted 3 lines
Also in x86 case max address could of type 0x1000-101f and so forth; changing data-type to
uint64_tdefault wont effect such address, right?Right, but what's the harm of doing the right cast? :)
Agree.
Quoted 8 lines
Quoted 4 lines
And
hw->io_baseby looking atvirtio_pci.hfunction like inb/outb etc.. takesio_baseaddress as unsigned long types which is arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower level rd/wr apis are taking care of data-types accordingly.Didn't get it. inb/outb takes "unsigned short" arguments, but not "unsigned long".
sys/io.hin x86 case using unsigned short int types..
include/asm-generic/io.hfor arm64 using it unsigned long (from linux header files)In such case keeping
#defineVIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned short)((hw)->io_base + (reg))would be x86 specific and what I thought and used in this patch is
#define
VIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned long)((hw)->io_base + (reg))
Quoted 8 lines
to avoid ifdef ARM or non-x86..clutter, I know data-type is not right fit for x86
sys/io.hbut considering possible address insidehw->io_base, wont effect functionality and performance my any mean. That is why atvirtio_ethdev_init()i choose to keep it inhw->io_base= (uint64_t) types.Otherwise I'll have to duplicate
VIRTIO_PCI_REG_XXXdefinition for non-x86 case, Pl. suggest better alternative. Thanks
My understanding is that if you have done the right cast in the first time (at the io_base assignment), casting from a short type to a longer type will not matter: the upper bits will be filled with zero.
So, I guess we are fine here. I'm thinking that the extra cast in VIRTIO_PCI_REG_ADDR() is not necessary, as C will do the right cast for different inb(), say cast it to "unsigned short" for x86, and "unsigned long" for your arm implementation. The same to other io helpers.
--yliu
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 88 lines · Yuanhan Liu
Quoted 73 lines · Santosh Shukla
Quoted 36 lines · Yuanhan Liu
Quoted 29 lines · Santosh Shukla
Quoted 18 lines · Yuanhan Liu
Quoted 17 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ;Quoted 8 lines
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.c +1
-1hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;I'd suggest to move the
io_baseassignment (and cast) intovirtio_ioport_init()so that we could do the correct cast there, say cast it touint32_tfor X86, anduint64_tfor others.Quoted 5 lines
Ok.
This was deliberately done considering your 1.0 virtio spec patch do care for
uint64_ttypes and in arm64 case, If I plan to use those future patches, IMO it make more sense to me keep it inuint64_tway;Quoted 9 lines
I did different cast, 32 bit for legacy virtio pci device, and 64 bit for modern virtio pci device.
Quoted 3 lines
Also in x86 case max address could of type 0x1000-101f and so forth; changing data-type to
uint64_tdefault wont effect such address, right?Right, but what's the harm of doing the right cast? :)
Agree.
Quoted 8 lines
Quoted 4 lines
And
hw->io_baseby looking atvirtio_pci.hfunction like inb/outb etc.. takesio_baseaddress as unsigned long types which is arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower level rd/wr apis are taking care of data-types accordingly.Didn't get it. inb/outb takes "unsigned short" arguments, but not "unsigned long".
sys/io.hin x86 case using unsigned short int types..
include/asm-generic/io.hfor arm64 using it unsigned long (from linux header files)In such case keeping
#defineVIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned short)((hw)->io_base + (reg))would be x86 specific and what I thought and used in this patch is
#define
VIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned long)((hw)->io_base + (reg))Quoted 8 lines
to avoid ifdef ARM or non-x86..clutter, I know data-type is not right fit for x86
sys/io.hbut considering possible address insidehw->io_base, wont effect functionality and performance my any mean. That is why atvirtio_ethdev_init()i choose to keep it inhw->io_base= (uint64_t) types.Otherwise I'll have to duplicate
VIRTIO_PCI_REG_XXXdefinition for non-x86 case, Pl. suggest better alternative. ThanksMy understanding is that if you have done the right cast in the first time (at the
io_baseassignment), casting from a short type to a longer type will not matter: the upper bits will be filled with zero.
Quoted 6 lines
So, I guess we are fine here. I'm thinking that the extra cast in
VIRTIO_PCI_REG_ADDR()is not necessary, as C will do the right cast for differentinb(), say cast it to "unsigned short" for x86, and "unsigned long" for your arm implementation. The same to other io helpers.
so to summarize and correct me if i misunderstood,
keep hw->io_base = (uint64_t)
and remove extra cast {i.e.. (unsigned short) for x86 or (unsigned
long) for non-x86/arm64 case} in VIRTIO_PCI_REG_ADDR().
did I got everything alright?
Quoted 1 line
--yliu
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 97 lines · Santosh Shukla
Quoted 88 lines · Yuanhan Liu
Quoted 73 lines · Santosh Shukla
Quoted 36 lines · Yuanhan Liu
Quoted 29 lines · Santosh Shukla
Quoted 18 lines · Yuanhan Liu
Quoted 17 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ;Quoted 8 lines
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.c +1
-1hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;I'd suggest to move the
io_baseassignment (and cast) intovirtio_ioport_init()so that we could do the correct cast there, say cast it touint32_tfor X86, anduint64_tfor others.Quoted 5 lines
Ok.
This was deliberately done considering your 1.0 virtio spec patch do care for
uint64_ttypes and in arm64 case, If I plan to use those future patches, IMO it make more sense to me keep it inuint64_tway;Quoted 9 lines
I did different cast, 32 bit for legacy virtio pci device, and 64 bit for modern virtio pci device.
Quoted 3 lines
Also in x86 case max address could of type 0x1000-101f and so forth; changing data-type to
uint64_tdefault wont effect such address, right?Right, but what's the harm of doing the right cast? :)
Agree.
Quoted 8 lines
Quoted 4 lines
And
hw->io_baseby looking atvirtio_pci.hfunction like inb/outb etc.. takesio_baseaddress as unsigned long types which is arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower level rd/wr apis are taking care of data-types accordingly.Didn't get it. inb/outb takes "unsigned short" arguments, but not "unsigned long".
sys/io.hin x86 case using unsigned short int types..
include/asm-generic/io.hfor arm64 using it unsigned long (from linux header files)In such case keeping
#defineVIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned short)((hw)->io_base + (reg))would be x86 specific and what I thought and used in this patch is
#define
VIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned long)((hw)->io_base + (reg))Quoted 8 lines
to avoid ifdef ARM or non-x86..clutter, I know data-type is not right fit for x86
sys/io.hbut considering possible address insidehw->io_base, wont effect functionality and performance my any mean. That is why atvirtio_ethdev_init()i choose to keep it inhw->io_base= (uint64_t) types.Otherwise I'll have to duplicate
VIRTIO_PCI_REG_XXXdefinition for non-x86 case, Pl. suggest better alternative. ThanksMy understanding is that if you have done the right cast in the first time (at the
io_baseassignment), casting from a short type to a longer type will not matter: the upper bits will be filled with zero.Quoted 6 lines
So, I guess we are fine here. I'm thinking that the extra cast in
VIRTIO_PCI_REG_ADDR()is not necessary, as C will do the right cast for differentinb(), say cast it to "unsigned short" for x86, and "unsigned long" for your arm implementation. The same to other io helpers.
Quoted 2 lines
so to summarize and correct me if i misunderstood, keep
hw->io_base= (uint64_t)
I still want a different explicit cast for x86 and non-x86. And actually, we should cast it to (unsigned short) but not (uint32_t) for x86, don't we?
On the other hand, we may cast it to uint64_t unconditionally, and then have an explicit sanity check for io_base for x86, say
if ((unsigned short)hw->io_base != hw->io_base) {
PMD_INIT_LOG(ERR, "invalid io port: %"PRIx64, ...);
return -1;
}It's better than the (unsigned short) cast, as the later simply hides issue when something went wrong, though it's not rare.
What do you think of that?
Quoted 2 lines
and remove extra cast {i.e.. (unsigned short) for x86 or (unsigned
long) for non-x86/arm64 case} inVIRTIO_PCI_REG_ADDR().
Technically speaking, yes, we don't need this kind of cast.
--yliu
Re: [ [PATCH v2] 05/13] virtio: change io_base datatype from uint32_t to uint64_type
Quoted 113 lines · Yuanhan Liu
Quoted 97 lines · Santosh Shukla
Quoted 88 lines · Yuanhan Liu
Quoted 73 lines · Santosh Shukla
Quoted 36 lines · Yuanhan Liu
Quoted 29 lines · Santosh Shukla
Quoted 18 lines · Yuanhan Liu
Quoted 17 lines · Santosh Shukla
In x86 case
io_baseto store ioport address not more than 65535 ioports. i.e..0 to ffff but in non-x86 case in particular arm64 it need to store more than 32 bit address so changingio_basedatatype from 32 to 64.Signed-off-by Santosh Shukla <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtio_pci.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0@@ -1291,7 +1291,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)return -1 ;Quoted 8 lines
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev) · line 1294
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.c +1
-1hw->use_msix =virtio_has_msix (&pci_dev->addr); - hw->io_base = (uint32_t )(uintptr_t )pci_dev->mem_resource[0 ].addr; + hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;I'd suggest to move the
io_baseassignment (and cast) intovirtio_ioport_init()so that we could do the correct cast there, say cast it touint32_tfor X86, anduint64_tfor others.Quoted 5 lines
Ok.
This was deliberately done considering your 1.0 virtio spec patch do care for
uint64_ttypes and in arm64 case, If I plan to use those future patches, IMO it make more sense to me keep it inuint64_tway;Quoted 9 lines
I did different cast, 32 bit for legacy virtio pci device, and 64 bit for modern virtio pci device.
Quoted 3 lines
Also in x86 case max address could of type 0x1000-101f and so forth; changing data-type to
uint64_tdefault wont effect such address, right?Right, but what's the harm of doing the right cast? :)
Agree.
Quoted 8 lines
Quoted 4 lines
And
hw->io_baseby looking atvirtio_pci.hfunction like inb/outb etc.. takesio_baseaddress as unsigned long types which is arch dependent; i.e.. 4 byte for 32 bit and 8 for 64 bit so the lower level rd/wr apis are taking care of data-types accordingly.Didn't get it. inb/outb takes "unsigned short" arguments, but not "unsigned long".
sys/io.hin x86 case using unsigned short int types..
include/asm-generic/io.hfor arm64 using it unsigned long (from linux header files)In such case keeping
#defineVIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned short)((hw)->io_base + (reg))would be x86 specific and what I thought and used in this patch is
#define
VIRTIO_PCI_REG_ADDR(hw, reg)\
(unsigned long)((hw)->io_base + (reg))Quoted 8 lines
to avoid ifdef ARM or non-x86..clutter, I know data-type is not right fit for x86
sys/io.hbut considering possible address insidehw->io_base, wont effect functionality and performance my any mean. That is why atvirtio_ethdev_init()i choose to keep it inhw->io_base= (uint64_t) types.Otherwise I'll have to duplicate
VIRTIO_PCI_REG_XXXdefinition for non-x86 case, Pl. suggest better alternative. ThanksMy understanding is that if you have done the right cast in the first time (at the
io_baseassignment), casting from a short type to a longer type will not matter: the upper bits will be filled with zero.Quoted 6 lines
So, I guess we are fine here. I'm thinking that the extra cast in
VIRTIO_PCI_REG_ADDR()is not necessary, as C will do the right cast for differentinb(), say cast it to "unsigned short" for x86, and "unsigned long" for your arm implementation. The same to other io helpers.Quoted 2 lines
so to summarize and correct me if i misunderstood, keep
hw->io_base= (uint64_t)I still want a different explicit cast for x86 and non-x86. And actually, we should cast it to (unsigned short) but not (
uint32_t) for x86, don't we?On the other hand, we may cast it to
uint64_tunconditionally, and then have an explicit sanity check forio_basefor x86, sayif ((unsigned short)hw->io_base != hw->io_base) { PMD_INIT_LOG(ERR, "invalid io port: %"PRIx64, ...); return -1; }
Quoted 5 lines
It's better than the (unsigned short) cast, as the later simply hides issue when something went wrong, though it's not rare.
What do you think of that?
Liked the later part which is casting uint64_t unconditionally and keeping a (unsigned short) check for x86 case. We'll do it in v3.
Quoted 5 lines
Quoted 2 lines
and remove extra cast {i.e.. (unsigned short) for x86 or (unsigned
long) for non-x86/arm64 case} inVIRTIO_PCI_REG_ADDR().Technically speaking, yes, we don't need this kind of cast.
Ok.
Quoted 1 line
--yliu
PATCH v2 1/1 06/13] config: armv7/v8: Enable RTE_LIBRTE_VIRTIO_PMD
In reply to Santosh ShuklaEnable RTE_LIBRTE_VIRTIO_PMD for armv7/v8 and setting RTE_VIRTIO_INC_VEC=n. Builds successfully for armv7/v8.
--- config/defconfig_arm-armv7a-linuxapp-gcc | 6 +++++- config/defconfig_arm64-armv8a-linuxapp-gcc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)
config/defconfig_arm-armv7a-linuxapp-gcc +5 -1
@@ -43,6 +43,11 @@ CONFIG_RTE_FORCE_INTRINSICS=y CONFIG_RTE_TOOLCHAIN="gcc" CONFIG_RTE_TOOLCHAIN_GCC=y +# VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y +# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n + # ARM doesn't have support for vmware TSC map CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n
@@ -70,7 +75,6 @@ CONFIG_RTE_LIBRTE_I40E_PMD=n CONFIG_RTE_LIBRTE_IXGBE_PMD=n CONFIG_RTE_LIBRTE_MLX4_PMD=n CONFIG_RTE_LIBRTE_MPIPE_PMD=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_VMXNET3_PMD=n CONFIG_RTE_LIBRTE_PMD_XENVIRT=n CONFIG_RTE_LIBRTE_PMD_BNX2X=n
config/defconfig_arm64-armv8a-linuxapp-gcc +5 -1
@@ -45,8 +45,12 @@ CONFIG_RTE_TOOLCHAIN_GCC=y CONFIG_RTE_CACHE_LINE_SIZE=64 +# Enable VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y +# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n + CONFIG_RTE_IXGBE_INC_VECTOR=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_IVSHMEM=n CONFIG_RTE_LIBRTE_FM10K_PMD=n CONFIG_RTE_LIBRTE_I40E_PMD=n
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 06/13] config: armv7/v8: Enable RTE_LIBRTE_VIRTIO_PMD
Quoted 14 lines · Santosh Shukla
Enable
RTE_LIBRTE_VIRTIO_PMDfor armv7/v8 and setting RTE_VIRTIO_INC_VEC=n. Builds successfully for armv7/v8.Signed-off-by Santosh Shukla <[email protected]>--- config/defconfig_arm-armv7a-linuxapp-gcc | 6 +++++- config/defconfig_arm64-armv8a-linuxapp-gcc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)config/defconfig_arm-armv7a-linuxapp-gcc +0
-0
config/defconfig_arm-armv7a-linuxapp-gcc CONFIG_RTE_FORCE_INTRINSICS=y · line 50
Quoted 8 lines
config/defconfig_arm-armv7a-linuxapp-gcc +5
-0@@ -43,6 +43,11 @@ CONFIG_RTE_FORCE_INTRINSICS=y CONFIG_RTE_TOOLCHAIN="gcc" CONFIG_RTE_TOOLCHAIN_GCC=y +# VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y +# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n +
Enable the config at last in the patch series, so that it won't functionally break for arm/arm64 on this patch.
Quoted 32 lines
config/defconfig_arm-armv7a-linuxapp-gcc +0
-1# ARM doesn't have support for vmware TSC map CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n@@ -70,7 +75,6 @@ CONFIG_RTE_LIBRTE_I40E_PMD=n CONFIG_RTE_LIBRTE_IXGBE_PMD=n CONFIG_RTE_LIBRTE_MLX4_PMD=n CONFIG_RTE_LIBRTE_MPIPE_PMD=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_VMXNET3_PMD=n CONFIG_RTE_LIBRTE_PMD_XENVIRT=n CONFIG_RTE_LIBRTE_PMD_BNX2X=nconfig/defconfig_arm64-armv8a-linuxapp-gcc +5
-1@@ -45,8 +45,12 @@ CONFIG_RTE_TOOLCHAIN_GCC=y CONFIG_RTE_CACHE_LINE_SIZE=64 +# Enable VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y +# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n + CONFIG_RTE_IXGBE_INC_VECTOR=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_IVSHMEM=n CONFIG_RTE_LIBRTE_FM10K_PMD=n CONFIG_RTE_LIBRTE_I40E_PMD=nSignature · 1 line
1.7.9.5
Re: [ [PATCH v2] 06/13] config: armv7/v8: Enable RTE_LIBRTE_VIRTIO_PMD
Quoted 18 lines · Jerin Jacob
Quoted 17 lines · Santosh Shukla
Enable
RTE_LIBRTE_VIRTIO_PMDfor armv7/v8 and setting RTE_VIRTIO_INC_VEC=n. Builds successfully for armv7/v8.Signed-off-by Santosh Shukla <[email protected]>--- config/defconfig_arm-armv7a-linuxapp-gcc | 6 +++++- config/defconfig_arm64-armv8a-linuxapp-gcc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)config/defconfig_arm-armv7a-linuxapp-gcc +0
-0@@ -43,6 +43,11 @@ CONFIG_RTE_FORCE_INTRINSICS=y CONFIG_RTE_TOOLCHAIN="gcc" CONFIG_RTE_TOOLCHAIN_GCC=y
Quoted 9 lines
config/defconfig_arm-armv7a-linuxapp-gcc CONFIG_RTE_FORCE_INTRINSICS=y · line 50
Quoted 5 lines
config/defconfig_arm-armv7a-linuxapp-gcc +5
-0+# VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y +# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n +Enable the config at last in the patch series, so that it won't functionally break for arm/arm64 on this patch.
ok, we'll keep it at top in v3. Thanks
Quoted 32 lines
Quoted 32 lines
config/defconfig_arm-armv7a-linuxapp-gcc +0
-1# ARM doesn't have support for vmware TSC map CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n@@ -70,7 +75,6 @@ CONFIG_RTE_LIBRTE_I40E_PMD=n CONFIG_RTE_LIBRTE_IXGBE_PMD=n CONFIG_RTE_LIBRTE_MLX4_PMD=n CONFIG_RTE_LIBRTE_MPIPE_PMD=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_VMXNET3_PMD=n CONFIG_RTE_LIBRTE_PMD_XENVIRT=n CONFIG_RTE_LIBRTE_PMD_BNX2X=nconfig/defconfig_arm64-armv8a-linuxapp-gcc +5
-2@@ -45,8 +45,12 @@ CONFIG_RTE_TOOLCHAIN_GCC=y CONFIG_RTE_CACHE_LINE_SIZE=64 +# Enable VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y +# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n + CONFIG_RTE_IXGBE_INC_VECTOR=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_IVSHMEM=n CONFIG_RTE_LIBRTE_FM10K_PMD=n CONFIG_RTE_LIBRTE_I40E_PMD=n --1.7.9.5
Re: [ [PATCH v2] 06/13] config: armv7/v8: Enable RTE_LIBRTE_VIRTIO_PMD
In reply to Santosh ShuklaQuoted 14 lines · Santosh Shukla
Enable
RTE_LIBRTE_VIRTIO_PMDfor armv7/v8 and setting RTE_VIRTIO_INC_VEC=n. Builds successfully for armv7/v8.Signed-off-by Santosh Shukla <[email protected]>--- config/defconfig_arm-armv7a-linuxapp-gcc | 6 +++++- config/defconfig_arm64-armv8a-linuxapp-gcc | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-)config/defconfig_arm-armv7a-linuxapp-gcc +0
-0
config/defconfig_arm-armv7a-linuxapp-gcc CONFIG_RTE_FORCE_INTRINSICS=y · line 47
Quoted 5 lines
config/defconfig_arm-armv7a-linuxapp-gcc +2
-0@@ -43,6 +43,11 @@ CONFIG_RTE_FORCE_INTRINSICS=y CONFIG_RTE_TOOLCHAIN="gcc" CONFIG_RTE_TOOLCHAIN_GCC=y +# VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y
I don't think the above line is needed since already enabled in config/common_linuxapp.
Quoted 35 lines
config/defconfig_arm-armv7a-linuxapp-gcc +3
-1+# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n + # ARM doesn't have support for vmware TSC map CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=n@@ -70,7 +75,6 @@ CONFIG_RTE_LIBRTE_I40E_PMD=n CONFIG_RTE_LIBRTE_IXGBE_PMD=n CONFIG_RTE_LIBRTE_MLX4_PMD=n CONFIG_RTE_LIBRTE_MPIPE_PMD=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_VMXNET3_PMD=n CONFIG_RTE_LIBRTE_PMD_XENVIRT=n CONFIG_RTE_LIBRTE_PMD_BNX2X=nconfig/defconfig_arm64-armv8a-linuxapp-gcc +5
-2@@ -45,8 +45,12 @@ CONFIG_RTE_TOOLCHAIN_GCC=y CONFIG_RTE_CACHE_LINE_SIZE=64 +# Enable VIRTIO support for ARM +CONFIG_RTE_LIBRTE_VIRTIO_PMD=y +# Disable VIRTIO VECTOR support +CONFIG_RTE_VIRTIO_INC_VECTOR=n + CONFIG_RTE_IXGBE_INC_VECTOR=n -CONFIG_RTE_LIBRTE_VIRTIO_PMD=n CONFIG_RTE_LIBRTE_IVSHMEM=n CONFIG_RTE_LIBRTE_FM10K_PMD=n CONFIG_RTE_LIBRTE_I40E_PMD=n --1.7.9.5
PATCH v2 1/1 07/13] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
In reply to Santosh Shuklaiopl() syscall not supported in linux-arm/arm64 so always return 0 value.
--- lib/librte_eal/linuxapp/eal/eal.c | 3 +++ 1 file changed, 3 insertions(+)
lib/librte_eal/linuxapp/eal/eal.c +3 -0
@@ -716,6 +716,9 @@ rte_eal_iopl_init(void)return -1 ;return 0 ;#else +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +return 0 ;/* iopl syscall not supported for ARM/ARM64 */ +#endif return -1 ;#endif }
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 07/13] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
I believe, I've already acked this patch. I can see no change here so I assume it's still the same.
Quoted 3 lines · On Mon, 14 Dec 2015 18:30:26 +0530 Santosh Shukla <[email protected]> wrote:
iopl()syscall not supported in linux-arm/arm64 so always return 0 value.Signed-off-by Santosh Shukla <[email protected]>
Re: [ [PATCH v2] 07/13] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
Quoted 11 lines · Jan Viktorin
I believe, I've already acked this patch. I can see no change here so I assume it's still the same.
Quoted 3 lines · On Mon, 14 Dec 2015 18:30:26 +0530 Santosh Shukla <[email protected]> wrote:
iopl()syscall not supported in linux-arm/arm64 so always return 0 value.Signed-off-by Santosh Shukla <[email protected]>Acked-by Jan Viktorin <[email protected]>
Sorry that I missed in v2 patch! Gonna add in next revision. Thanks
Re: [ [PATCH v2] 07/13] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
In reply to Santosh ShuklaQuoted 12 lines · Santosh Shukla
iopl()syscall not supported in linux-arm/arm64 so always return 0 value.Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/linuxapp/eal/eal.c | 3 +++ 1 file changed, 3 insertions(+)lib/librte_eal/linuxapp/eal/eal.c +0
-0
lib/librte_eal/linuxapp/eal/eal.c rte_eal_iopl_init(void) · line 720
Quoted 5 lines
lib/librte_eal/linuxapp/eal/eal.c +2
-0@@ -716,6 +716,9 @@ rte_eal_iopl_init(void)return -1 ;return 0 ;#else +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +return 0 ;/* iopl syscall not supported for ARM/ARM64 */
I guess for other architectures also iopl not supported.I think better to move this function to eal. Else this function will return 'true' for ppc64
or have at least postive logic,
#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) || defined(RTE_ARCH_X86_X32)
Quoted 7 lines
lib/librte_eal/linuxapp/eal/eal.c +1
-1+#endif return -1 ;#endif } --1.7.9.5
Re: [ [PATCH v2] 07/13] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
Quoted 8 lines · Jerin Jacob
Quoted 7 lines · Santosh Shukla
iopl()syscall not supported in linux-arm/arm64 so always return 0 value.Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/linuxapp/eal/eal.c | 3 +++ 1 file changed, 3 insertions(+)
Quoted 15 lines
lib/librte_eal/linuxapp/eal/eal.c rte_eal_iopl_init(void) · line 720
Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal.c +2
-0@@ -716,6 +716,9 @@ rte_eal_iopl_init(void)return -1 ;return 0 ;#else +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +return 0 ;/* iopl syscall not supported for ARM/ARM64 */ I guess for other architectures also iopl not supported.I think better to move this function to eal. Else this function will return 'true' for ppc64
didn't understood. This func is in eal right? and for ppc64, function will return -1 (false). Although i could include ppc64 / tile or invert the logic such a way that non-x86 arch to return default true value.
However iopl() used for virtio and only two arch using x86/ now arm. I am not sure ppc64/tile or other arch has any plan to use virtio pmd thus care for iopl().
Quoted 12 lines
or have at least postive logic,
#ifdefined(RTE_ARCH_X86_64)||defined(RTE_ARCH_I686)||defined(RTE_ARCH_X86_X32)Quoted 7 lines
lib/librte_eal/linuxapp/eal/eal.c +1
-1+#endif return -1 ;#endif } --1.7.9.5
Re: [ [PATCH v2] 07/13] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
Quoted 26 lines · Santosh Shukla
Quoted 8 lines · Jerin Jacob
Quoted 7 lines · Santosh Shukla
iopl()syscall not supported in linux-arm/arm64 so always return 0 value.Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/linuxapp/eal/eal.c | 3 +++ 1 file changed, 3 insertions(+)Quoted 15 lines
lib/librte_eal/linuxapp/eal/eal.c rte_eal_iopl_init(void) · line 720
Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal.c +2
-0@@ -716,6 +716,9 @@ rte_eal_iopl_init(void)return -1 ;return 0 ;#else +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +return 0 ;/* iopl syscall not supported for ARM/ARM64 */ I guess for other architectures also iopl not supported.I think better to move this function to eal. Else this function will return 'true' for ppc64
Quoted 1 line
didn't understood. This func is in eal right? and for ppc64, function
meant to abstract through lib/librte_eal/common/include/arch/ to avoid #ifdef clutter
Quoted 7 lines
will return -1 (false). Although i could include ppc64 / tile or invert the logic such a way that non-x86 arch to return default true value.
However
iopl()used for virtio and only two arch using x86/ now arm. I am not sure ppc64/tile or other arch has any plan to use virtio pmd thus care foriopl().
Why not? With your patch, dpdk-virtio has very minimal dependency on architecture (implementing raw_*) or even we can have generic routine for that
Quoted 13 lines
Quoted 13 lines
or have at least postive logic,
#ifdefined(RTE_ARCH_X86_64)||defined(RTE_ARCH_I686)||defined(RTE_ARCH_X86_X32)Quoted 7 lines
lib/librte_eal/linuxapp/eal/eal.c +1
-1+#endif return -1 ;#endif } --1.7.9.5
Re: [ [PATCH v2] 07/13] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()
Quoted 27 lines · Jerin Jacob
Quoted 26 lines · Santosh Shukla
Quoted 23 lines · Jerin Jacob
Quoted 12 lines · Santosh Shukla
iopl()syscall not supported in linux-arm/arm64 so always return 0 value.Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/linuxapp/eal/eal.c | 3 +++ 1 file changed, 3 insertions(+)lib/librte_eal/linuxapp/eal/eal.c +0
-0lib/librte_eal/linuxapp/eal/eal.c rte_eal_iopl_init(void) · line 720
Quoted 5 lines
lib/librte_eal/linuxapp/eal/eal.c +2
-0@@ -716,6 +716,9 @@ rte_eal_iopl_init(void)return -1 ;return 0 ;#else +#if defined(RTE_ARCH_ARM ) || defined(RTE_ARCH_ARM64 ) +return 0 ;/* iopl syscall not supported for ARM/ARM64 */ I guess for other architectures also iopl not supported.I think better to move this function to eal. Else this function will return 'true' for ppc64
Quoted 5 lines
Quoted 1 line
didn't understood. This func is in eal right? and for ppc64, function
meant to abstract through
lib/librte_eal/common/include/arch/to avoid #ifdef clutter
make sense to me :)
Quoted 11 lines
Quoted 7 lines
will return -1 (false). Although i could include ppc64 / tile or invert the logic such a way that non-x86 arch to return default true value.
However
iopl()used for virtio and only two arch using x86/ now arm. I am not sure ppc64/tile or other arch has any plan to use virtio pmd thus care foriopl().Why not? With your patch, dpdk-virtio has very minimal dependency on architecture (implementing raw_*) or even we can have generic routine for that
Right!
We'll do in v3, Thanks!!
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
or have at least postive logic,
#ifdefined(RTE_ARCH_X86_64)||defined(RTE_ARCH_I686)||defined(RTE_ARCH_X86_X32)Quoted 7 lines
lib/librte_eal/linuxapp/eal/eal.c +1
-1+#endif return -1 ;#endif } --1.7.9.5
PATCH v2 1/1 08/13] rte_io: x86: Remove sys/io.h ifdef x86 clutter
In reply to Santosh ShuklaReplace sys/io.h with rte_io.h, Get rid of ifdef X86 clutter
--- drivers/net/virtio/virtio_pci.h | 4 --- lib/librte_eal/common/include/arch/x86/rte_io.h | 42 +++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 4 +-- 3 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 lib/librte_eal/common/include/arch/x86/rte_io.h
drivers/net/virtio/virtio_pci.h +0 -4
@@ -40,12 +40,8 @@#include <sys/types.h> #include <machine/cpufunc.h> #else -#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 ) -#include <sys/io.h> -#else #include <rte_io.h> #endif -#endif #include <rte_ethdev.h>
lib/librte_eal/common/include/arch/x86/rte_io.h new file +42 -0
42 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal.c +1 -3
@@ -49,9 +49,7 @@#include <errno.h> #include <sys/mman.h> #include <sys/queue.h> -#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 ) -#include <sys/io.h> -#endif +#include <rte_io.h> #include <rte_common.h> #include <rte_debug.h>
Signature · 1 line
1.7.9.5
PATCH v2 1/1 09/13] igb_uio: ioport: map iopci region for armv7/v8
In reply to Santosh ShuklaModule maps iopci region by creating misc device file /dev/igb_ioport. Applicable for non-x86 arch, tested for arm64/ThuderX platform. Including three api to register/unregister ioport misc device
- igbuio_ioport_register
- igbuio_ioport_unregister
- igbuio_iomap
--- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 8 +- .../linuxapp/igb_uio/igbuio_ioport_misc.h | 133 ++++++++++++++++++++ 2 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/linuxapp/igb_uio/igbuio_ioport_misc.h
lib/librte_eal/linuxapp/igb_uio/igb_uio.c +7 -1
@@ -39,6 +39,7 @@#include <rte_pci_dev_features.h> #include "compat.h" +#include "igbuio_ioport_misc.h" #ifdef RTE_PCI_CONFIG #define PCI_SYS_FILE_BUF_SIZE 10
@@ -366,7 +367,7 @@ igbuio_pci_setup_ioport(struct pci_dev *dev, struct uio_info *info,return -EINVAL ; info->port[n].name = name; - info->port[n].start = addr; + info->port[n].start =igbuio_iomap (addr); info->port[n].size = len; info->port[n].porttype =UIO_PORT_X86 ;
@@ -615,6 +616,10 @@ igbuio_pci_init_module(void) {int ret; + ret =igbuio_ioport_register (); +if (ret <0 ) +return ret; + ret =igbuio_config_intr_mode (intr_mode);if (ret <0 )return ret;
@@ -625,6 +630,7 @@ igbuio_pci_init_module(void) static void __exitigbuio_pci_exit_module (void ) { +igbuio_ioport_unregister ();pci_unregister_driver (&igbuio_pci_driver); }
lib/librte_eal/linuxapp/igb_uio/igbuio_ioport_misc.h new file +133 -0
133 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 1/1 10/13] include/exec-env: ioport: add rte_virt_ioport header file
In reply to Santosh Shuklaincluding virtio_ioport header file has iopci bar page_size, bar_len and device filename info.
--- lib/librte_eal/linuxapp/eal/Makefile | 2 +- .../eal/include/exec-env/rte_virt_ioport.h | 81 ++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h
lib/librte_eal/linuxapp/eal/Makefile +1 -1
@@ -115,7 +115,7 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_eal_thread.o += -Wno-return-type endif -INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h +INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h rte_virt_ioport.h SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP)-include/exec-env := \ $(addprefix include/exec-env/,$(INC))
lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 10/13] include/exec-env: ioport: add rte_virt_ioport header file
Quoted 94 lines · Santosh Shukla
including
virtio_ioportheader file has iopci barpage_size,bar_lenand device filename info.Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/linuxapp/eal/Makefile | 2 +- .../eal/include/exec-env/rte_virt_ioport.h | 81 ++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.hlib/librte_eal/linuxapp/eal/Makefile +1
-1@@ -115,7 +115,7 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_eal_thread.o += -Wno-return-type endif -INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h +INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h rte_virt_ioport.h SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP)-include/exec-env := \ $(addprefix include/exec-env/,$(INC))lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h new file +65
-0@@ -0,0 +1,81 @@ +/* +* This file is provided under a dual BSD/LGPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* GNU LESSER GENERAL PUBLIC LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of version 2.1 of the GNU Lesser General Public License +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +* +* Contact Information: +* Cavium Networks +* +* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +#ifndef _RTE_VIRTIO_IOPORT_H_ +#define _RTE_VIRTIO_IOPORT_H_ + +#define VIRT_IOPORT_DEV "/dev/igb_ioport" + +/** +* Keeping pci_virt_ioport_size = 4k.
lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h line 75
Quoted 10 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h new file +10
-0+* So maximum mmaped pci_iobar supported = +* (virt_ioport_size/pci_dev->mem_resource[0].len) +* where, pci_dev->mem_resource[0].len == virtio_pci_iobar_len i.e.. 32 byte +* +* Note: kernel could allow maximum 32 virtio-net-pci interface, that mean +* maximum 32 PCI_IOBAR(s) where each PCI_IOBAR_LEN=0x20, so virtio_map_ioport() +* func by theory gonna support 4k/0x20 ==> 128 PCI_IOBAR(s), more than +* max-virtio-net-pci interface. +*/ +#define PAGE_SIZE 4096
IMO, We can remove this PAGE_SIZE macro and set PCI_VIRT_IOPORT_SIZE as 4096 directly. It will remove the confusion between
kernel page size
Quoted 9 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h new file +6
-0+#define PCI_VIRT_IOPORT_SIZE PAGE_SIZE +#define PCI_VIRT_IOBAR_LEN 32 +#define PCI_VIRT_IOPORT_MAX (PCI_VIRT_IOPORT_SIZE/PCI_VIRT_IOBAR_LEN) +/* 128 max ioport */ + +#endif /* _RTE_VIRTIO_IOPORT_H_ */ Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 10/13] include/exec-env: ioport: add rte_virt_ioport header file
Quoted 101 lines · Jerin Jacob
Quoted 100 lines · Santosh Shukla
including
virtio_ioportheader file has iopci barpage_size,bar_lenand device filename info.Signed-off-by Santosh Shukla <[email protected]>--- lib/librte_eal/linuxapp/eal/Makefile | 2 +- .../eal/include/exec-env/rte_virt_ioport.h | 81 ++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.hlib/librte_eal/linuxapp/eal/Makefile +1
-1@@ -115,7 +115,7 @@ ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y) CFLAGS_eal_thread.o += -Wno-return-type endif -INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h +INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h rte_virt_ioport.h SYMLINK-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP)-include/exec-env := \ $(addprefix include/exec-env/,$(INC))lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h new file +71
-0@@ -0,0 +1,81 @@ +/* +* This file is provided under a dual BSD/LGPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* GNU LESSER GENERAL PUBLIC LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of version 2.1 of the GNU Lesser General Public License +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +* +* Contact Information: +* Cavium Networks +* +* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +#ifndef _RTE_VIRTIO_IOPORT_H_ +#define _RTE_VIRTIO_IOPORT_H_ + +#define VIRT_IOPORT_DEV "/dev/igb_ioport" + +/** +* Keeping pci_virt_ioport_size = 4k. +* So maximum mmaped pci_iobar supported = +* (virt_ioport_size/pci_dev->mem_resource[0].len) +* where, pci_dev->mem_resource[0].len == virtio_pci_iobar_len i.e.. 32 byte +* +* Note: kernel could allow maximum 32 virtio-net-pci interface, that mean +* maximum 32 PCI_IOBAR(s) where each PCI_IOBAR_LEN=0x20, so virtio_map_ioport()
Quoted 9 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h line 75
Quoted 4 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h new file +4
-0+* func by theory gonna support 4k/0x20 ==> 128 PCI_IOBAR(s), more than +* max-virtio-net-pci interface. +*/ +#define PAGE_SIZE 4096IMO, We can remove this
PAGE_SIZEmacro and setPCI_VIRT_IOPORT_SIZEas 4096 directly. It will remove the confusion between
kernel page size
yes.
Quoted 9 lines
Quoted 9 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h new file +6
-1+#define PCI_VIRT_IOPORT_SIZE PAGE_SIZE +#define PCI_VIRT_IOBAR_LEN 32 +#define PCI_VIRT_IOPORT_MAX (PCI_VIRT_IOPORT_SIZE/PCI_VIRT_IOBAR_LEN) +/* 128 max ioport */ + +#endif /* _RTE_VIRTIO_IOPORT_H_ */ --1.7.9.5
PATCH v2 1/1 11/13] virtio_ioport: armv7/v8: mmap virtio iopci bar region
In reply to Santosh ShuklaIntroducing module to mmap iopci bar region. Applicable for linuxapp for non-x86 archs, Tested for arm64/ThunderX platform for linux. For that adding two global api.
- virtio_ioport_init
- virtio_ioport_unmap
--- drivers/net/virtio/Makefile | 1 + drivers/net/virtio/virtio_ioport.c | 163 ++++++++++++++++++++++++++++++++++++ drivers/net/virtio/virtio_ioport.h | 42 ++++++++++ 3 files changed, 206 insertions(+) create mode 100644 drivers/net/virtio/virtio_ioport.c create mode 100644 drivers/net/virtio/virtio_ioport.h
drivers/net/virtio/Makefile +1 -0
@@ -50,6 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ioport.c SRCS-$(CONFIG_RTE_VIRTIO_INC_VECTOR) += virtio_rxtx_simple.c # this lib depends upon:
drivers/net/virtio/virtio_ioport.c new file +163 -0
163 lines not on this page · raw message
drivers/net/virtio/virtio_ioport.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 11/13] virtio_ioport: armv7/v8: mmap virtio iopci bar region
Quoted 76 lines · Santosh Shukla
Introducing module to mmap iopci bar region. Applicable for linuxapp for non-x86 archs, Tested for arm64/ThunderX platform for linux. For that adding two global api.
-virtio_ioport_init
-virtio_ioport_unmapSigned-off-by Santosh Shukla <[email protected]>Signed-off-by Rizwan Ansari <[email protected]>Signed-off-by Rakesh Krishnamurthy <[email protected]>--- drivers/net/virtio/Makefile | 1 + drivers/net/virtio/virtio_ioport.c | 163 ++++++++++++++++++++++++++++++++++++ drivers/net/virtio/virtio_ioport.h | 42 ++++++++++ 3 files changed, 206 insertions(+) create mode 100644 drivers/net/virtio/virtio_ioport.c create mode 100644 drivers/net/virtio/virtio_ioport.hdrivers/net/virtio/Makefile +1
-0@@ -50,6 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ioport.c SRCS-$(CONFIG_RTE_VIRTIO_INC_VECTOR) += virtio_rxtx_simple.c # this lib depends upon:drivers/net/virtio/virtio_ioport.c new file +41
-0@@ -0,0 +1,163 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "virtio_ioport.h" + +#if defined(RTE_EXEC_ENV_LINUXAPP ) && (defined(RTE_ARCH_ARM ) || \ + defined(RTE_ARCH_ARM64 )) + +#include <sys/types.h> +#include <sys/stat.h>
drivers/net/virtio/virtio_ioport.c line 51
Quoted 10 lines
drivers/net/virtio/virtio_ioport.c new file +10
-0+#include <fcntl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/mman.h> +#include <exec-env/rte_virt_ioport.h> + +#include "virtio_logs.h" + +/* start address of first pci_iobar slot (user-space virtual-addres) */ +void *ioport_map;
You still forgot "static"?
drivers/net/virtio/virtio_ioport.c line 54
Quoted 3 lines
drivers/net/virtio/virtio_ioport.c new file +3
-0+/** +* ioport map count, +* Use-case: virtio-net-pci.
How about removing above two lines; it's quite meaningless here, but instead a bit redundant.
drivers/net/virtio/virtio_ioport.c line 67
Quoted 13 lines
drivers/net/virtio/virtio_ioport.c new file +13
-0+* Keeps track of number of virtio-net-pci device mapped/unmapped. Max device +* support by linux kernel is 31, so ioport_map_cnt can not be greater than 31. +*/ +static int ioport_map_cnt; + +static int +virtio_map_ioport (void **resource_addr) +{ +int fd; +int ret =0 ; + +/* avoid -Werror=unused-parameter, keep compiler happy */ + (void )resource_addr;
Using __rte_unused is more elegant.
Quoted 30 lines
drivers/net/virtio/virtio_ioport.c new file +30
-0+ fd =open (VIRT_IOPORT_DEV ,O_RDWR ); +if (fd <0 ) { +PMD_INIT_LOG (ERR ,"device file %s open error: %d\n" , +DEV_NAME , fd); + ret =-1 ; + goto out; + } + + ioport_map =mmap (NULL ,PCI_VIRT_IOPORT_SIZE , +PROT_EXEC |PROT_WRITE |PROT_READ ,MAP_SHARED , fd,0 ); + +if (ioport_map ==MAP_FAILED ) { +PMD_INIT_LOG (ERR ,"mmap: failed to map bar Address=%p\n" , + *resource_addr); + ret = -ENOMEM ; + goto out1; + } + +PMD_INIT_LOG (INFO ,"First pci_iobar mapped at %p\n" , ioport_map); + +out1: +close (fd); +out: +return ret; +} + +static int +virtio_set_ioport_addr (void **resource_addr,unsigned long offset) +{ +int ret =0 ;
drivers/net/virtio/virtio_ioport.c line 107
Quoted 10 lines
drivers/net/virtio/virtio_ioport.c new file +10
-0+ +if (ioport_map_cnt >=PCI_VIRT_IOPORT_MAX ) { + ret =-1 ; +PMD_INIT_LOG (ERR , +"ioport_map_cnt(%d) greater than" +"PCI_VIRT_IOPORT_MAX(%d)\n" , + ioport_map_cnt,PCI_VIRT_IOPORT_MAX ); +return ret; + } + *resource_addr = (void *)((char *)ioport_map + (ioport_map_cnt)*offset);
Redundant (), and the void * cast seems to be unnecessary.
Quoted 25 lines
drivers/net/virtio/virtio_ioport.c new file +25
-0+ ioport_map_cnt++; + +PMD_INIT_LOG (DEBUG ,"pci.resource_addr %p ioport_map_cnt %d\n" , + *resource_addr, ioport_map_cnt); +return ret; +} + +int virtio_ioport_init (struct rte_pci_resource *mem_resource) +{ +int ret =0 ; + +/** +* Map the all IOBAR entry from /proc/ioport to 4k page_size only once. +* Later virtio_set_ioport_addr() func will update correct bar_addr for +* each ioport (i.e..pci_dev->mem_resource[0].addr) +*/ +if (!ioport_map) { + ret =virtio_map_ioport (&mem_resource->addr); +if (ret <0 ) +return ret; +PMD_INIT_LOG (INFO ,"ioport_map %p\n" , ioport_map); + } + + ret =virtio_set_ioport_addr (&mem_resource->addr, mem_resource->len); +if (ret <0 )
drivers/net/virtio/virtio_ioport.c line 142
Quoted 10 lines
drivers/net/virtio/virtio_ioport.c new file +10
-0+return ret; + +PMD_INIT_LOG (INFO ,"resource_addr %p resource_len :%ld\n" , + mem_resource->addr, (unsigned long )mem_resource->len); +return ret; +} + +void virtio_ioport_unmap (void ) +{ +/* unmap ioport memory */
Redundant comment.
drivers/net/virtio/virtio_ioport.c line 154
Quoted 12 lines
drivers/net/virtio/virtio_ioport.c new file +12
-0+ ioport_map_cnt--; +if (!ioport_map_cnt) +munmap (ioport_map,PCI_VIRT_IOPORT_SIZE ); + + PMD_INIT_LOG(DEBUG, "unmapping ioport_mem %d\n", ioport_map_cnt); +} + +#else /* !LINUXAPP && !ARM/64 */ + +int virtio_ioport_init (struct rte_pci_resource *mem_resource) +{ + (void )mem_resource;
ditto.
Quoted 59 lines
drivers/net/virtio/virtio_ioport.c new file +9
-0+ return 0; +} + +void virtio_ioport_unmap (void ) +{ +return ; +} + +#endif /* LINUXAPP, ARM/64 */ drivers/net/virtio/virtio_ioport.h new file +42
-0@@ -0,0 +1,42 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +#ifndef _VIRTIO_IOPORT_H_ +#define _VIRTIO_IOPORT_H_ + +#include <rte_pci.h> + +int virtio_ioport_init (struct rte_pci_resource *mem_resource); +void virtio_ioport_unmap (void ); + +#endif /* _VIRTIO_IOPORT_H_ */ Signature · 1 line
1.7.9.5
Re: [ [PATCH v2] 11/13] virtio_ioport: armv7/v8: mmap virtio iopci bar region
Quoted 81 lines · Yuanhan Liu
Quoted 80 lines · Santosh Shukla
Introducing module to mmap iopci bar region. Applicable for linuxapp for non-x86 archs, Tested for arm64/ThunderX platform for linux. For that adding two global api.
-virtio_ioport_init
-virtio_ioport_unmapSigned-off-by Santosh Shukla <[email protected]>Signed-off-by Rizwan Ansari <[email protected]>Signed-off-by Rakesh Krishnamurthy <[email protected]>--- drivers/net/virtio/Makefile | 1 + drivers/net/virtio/virtio_ioport.c | 163 ++++++++++++++++++++++++++++++++++++ drivers/net/virtio/virtio_ioport.h | 42 ++++++++++ 3 files changed, 206 insertions(+) create mode 100644 drivers/net/virtio/virtio_ioport.c create mode 100644 drivers/net/virtio/virtio_ioport.hdrivers/net/virtio/Makefile +1
-0@@ -50,6 +50,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtqueue.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_pci.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ethdev.c +SRCS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio_ioport.c SRCS-$(CONFIG_RTE_VIRTIO_INC_VECTOR) += virtio_rxtx_simple.c # this lib depends upon:drivers/net/virtio/virtio_ioport.c new file +45
-0@@ -0,0 +1,163 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ + +#include "virtio_ioport.h" + +#if defined(RTE_EXEC_ENV_LINUXAPP ) && (defined(RTE_ARCH_ARM ) || \ + defined(RTE_ARCH_ARM64 )) + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <unistd.h> +#include <sys/mman.h>
Quoted 9 lines
drivers/net/virtio/virtio_ioport.c line 51
Quoted 6 lines
drivers/net/virtio/virtio_ioport.c new file +6
-0+#include <exec-env/rte_virt_ioport.h> + +#include "virtio_logs.h" + +/* start address of first pci_iobar slot (user-space virtual-addres) */ +void *ioport_map;You still forgot "static"?
I misunderstood last comment, sorry we'll do.
Quoted 7 lines
drivers/net/virtio/virtio_ioport.c line 54
Quoted 3 lines
drivers/net/virtio/virtio_ioport.c new file +3
-0+/** +* ioport map count, +* Use-case: virtio-net-pci. How about removing above two lines; it's quite meaningless here, but instead a bit redundant.
ok.
Quoted 7 lines
Quoted 7 lines
drivers/net/virtio/virtio_ioport.c new file +7
-0+* Keeps track of number of virtio-net-pci device mapped/unmapped. Max device +* support by linux kernel is 31, so ioport_map_cnt can not be greater than 31. +*/ +static int ioport_map_cnt; + +static int +virtio_map_ioport (void **resource_addr)
Quoted 9 lines
drivers/net/virtio/virtio_ioport.c line 67
Quoted 6 lines
drivers/net/virtio/virtio_ioport.c new file +6
-0+{ +int fd; +int ret =0 ; + +/* avoid -Werror=unused-parameter, keep compiler happy */ + (void )resource_addr;Using
__rte_unusedis more elegant.
ok.
Quoted 34 lines
Quoted 34 lines
drivers/net/virtio/virtio_ioport.c new file +34
-0+ fd =open (VIRT_IOPORT_DEV ,O_RDWR ); +if (fd <0 ) { +PMD_INIT_LOG (ERR ,"device file %s open error: %d\n" , +DEV_NAME , fd); + ret =-1 ; + goto out; + } + + ioport_map =mmap (NULL ,PCI_VIRT_IOPORT_SIZE , +PROT_EXEC |PROT_WRITE |PROT_READ ,MAP_SHARED , fd,0 ); + +if (ioport_map ==MAP_FAILED ) { +PMD_INIT_LOG (ERR ,"mmap: failed to map bar Address=%p\n" , + *resource_addr); + ret = -ENOMEM ; + goto out1; + } + +PMD_INIT_LOG (INFO ,"First pci_iobar mapped at %p\n" , ioport_map); + +out1: +close (fd); +out: +return ret; +} + +static int +virtio_set_ioport_addr (void **resource_addr,unsigned long offset) +{ +int ret =0 ; + +if (ioport_map_cnt >=PCI_VIRT_IOPORT_MAX ) { + ret =-1 ; + PMD_INIT_LOG(ERR,
Quoted 9 lines
drivers/net/virtio/virtio_ioport.c line 107
Quoted 6 lines
drivers/net/virtio/virtio_ioport.c new file +6
-0+"ioport_map_cnt(%d) greater than" +"PCI_VIRT_IOPORT_MAX(%d)\n" , + ioport_map_cnt, PCI_VIRT_IOPORT_MAX); +return ret; + } + *resource_addr = (void *)((char *)ioport_map + (ioport_map_cnt)*offset);Redundant (), and the void * cast seems to be unnecessary.
(void *) is unnecessary, but couldn't get the redundant() part?
Quoted 29 lines
Quoted 29 lines
drivers/net/virtio/virtio_ioport.c new file +29
-0+ ioport_map_cnt++; + +PMD_INIT_LOG (DEBUG ,"pci.resource_addr %p ioport_map_cnt %d\n" , + *resource_addr, ioport_map_cnt); +return ret; +} + +int virtio_ioport_init (struct rte_pci_resource *mem_resource) +{ +int ret =0 ; + +/** +* Map the all IOBAR entry from /proc/ioport to 4k page_size only once. +* Later virtio_set_ioport_addr() func will update correct bar_addr for +* each ioport (i.e..pci_dev->mem_resource[0].addr) +*/ +if (!ioport_map) { + ret =virtio_map_ioport (&mem_resource->addr); +if (ret <0 ) +return ret; +PMD_INIT_LOG (INFO ,"ioport_map %p\n" , ioport_map); + } + + ret =virtio_set_ioport_addr (&mem_resource->addr, mem_resource->len); +if (ret <0 ) +return ret; + +PMD_INIT_LOG (INFO ,"resource_addr %p resource_len :%ld\n" , + mem_resource->addr, (unsigned long )mem_resource->len);
Quoted 9 lines
drivers/net/virtio/virtio_ioport.c line 142
Quoted 6 lines
drivers/net/virtio/virtio_ioport.c new file +6
-0+return ret; +} + +void virtio_ioport_unmap (void ) +{ +/* unmap ioport memory */ Redundant comment.
ok.
Quoted 6 lines
Quoted 6 lines
drivers/net/virtio/virtio_ioport.c new file +6
-0+ ioport_map_cnt--; +if (!ioport_map_cnt) +munmap (ioport_map,PCI_VIRT_IOPORT_SIZE ); + +PMD_INIT_LOG (DEBUG ,"unmapping ioport_mem %d\n" , ioport_map_cnt); +}
Quoted 9 lines
drivers/net/virtio/virtio_ioport.c line 154
Quoted 6 lines
drivers/net/virtio/virtio_ioport.c new file +6
-0+ +#else /* !LINUXAPP && !ARM/64 */ + +int virtio_ioport_init (struct rte_pci_resource *mem_resource) +{ + (void )mem_resource;ditto.
Is it redundant comment or your suggesting to use : r / (void) / __rte_unused?
Quoted 59 lines
Quoted 59 lines
drivers/net/virtio/virtio_ioport.c new file +9
-0+ return 0; +} + +void virtio_ioport_unmap (void ) +{ +return ; +} + +#endif /* LINUXAPP, ARM/64 */ drivers/net/virtio/virtio_ioport.h new file +42
-1@@ -0,0 +1,42 @@ +/* +* BSD LICENSE +* +* Copyright(c) 2015 Cavium Networks. All rights reserved. +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in +* the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Intel Corporation nor the names of its +* contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +#ifndef _VIRTIO_IOPORT_H_ +#define _VIRTIO_IOPORT_H_ + +#include <rte_pci.h> + +int virtio_ioport_init (struct rte_pci_resource *mem_resource); +void virtio_ioport_unmap (void ); + +#endif /* _VIRTIO_IOPORT_H_ */ --1.7.9.5
Re: [ [PATCH v2] 11/13] virtio_ioport: armv7/v8: mmap virtio iopci bar region
On Wed, Dec 16, 2015 at 07:50:51PM +0530, Santosh Shukla wrote:
...
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
+
*resource_addr= (void *)((char *)ioport_map + (ioport_map_cnt)*offset);Redundant (), and the void * cast seems to be unnecessary.
(void *) is unnecessary, but couldn't get the
redundant()part?
I meant the () of "(ioport_map_cnt)*offset".
Quoted 10 lines
Quoted 9 lines
drivers/net/virtio/virtio_ioport.c line 114
Quoted 8 lines
drivers/net/virtio/virtio_ioport.c new file +7
-0+ ioport_map_cnt++; + +PMD_INIT_LOG (DEBUG ,"pci.resource_addr %p ioport_map_cnt %d\n" , + *resource_addr, ioport_map_cnt); +return ret; +} +Is it redundant comment or your suggesting to use : r / (void) /
__rte_unused?
You should always use __rte_unused instead of (void) cast. Note that you may need check your other patches, to make sure you not miss other such usage.
--yliu
Re: [ [PATCH v2] 11/13] virtio_ioport: armv7/v8: mmap virtio iopci bar region
Quoted 11 lines · Yuanhan Liu
On Wed, Dec 16, 2015 at 07:50:51PM +0530, Santosh Shukla wrote:
...Quoted 6 lines
Quoted 4 lines
Quoted 1 line
+
*resource_addr= (void *)((char *)ioport_map + (ioport_map_cnt)*offset);Redundant (), and the void * cast seems to be unnecessary.
(void *) is unnecessary, but couldn't get the
redundant()part?I meant the () of "(ioport_map_cnt)*offset".
ok.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/net/virtio/virtio_ioport.c new file +7
-0+ ioport_map_cnt++; + +PMD_INIT_LOG (DEBUG ,"pci.resource_addr %p ioport_map_cnt %d\n" , + *resource_addr, ioport_map_cnt); +return ret; +} +
Quoted 6 lines
Quoted 1 line
Is it redundant comment or your suggesting to use : r / (void) /
__rte_unused?You should always use
__rte_unusedinstead of (void) cast. Note that you may need check your other patches, to make sure you not miss other such usage.
yup, noted down. Thanks
Quoted 1 line
--yliu
PATCH v2 1/1 12/13] virtio_ethdev: use virtio_ioport api at device init/close
In reply to Santosh ShuklaCall virtio_ioport_init at device init and virtio_ioport_unmap at device close.
--- drivers/net/virtio/virtio_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/virtio/virtio_ethdev.c +5 -1
@@ -62,7 +62,7 @@#include "virtio_logs.h" #include "virtqueue.h" #include "virtio_rxtx.h" - +#include "virtio_ioport.h" static int eth_virtio_dev_init (struct rte_eth_dev *eth_dev);static int eth_virtio_dev_uninit (struct rte_eth_dev *eth_dev);
@@ -497,6 +497,7 @@ virtio_dev_close(struct rte_eth_dev *dev) hw->started =0 ;virtio_dev_free_mbufs (dev);virtio_free_queues (dev); +virtio_ioport_unmap (); } static void
@@ -1290,6 +1291,9 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)if (virtio_resource_init (pci_dev) <0 )return -1 ; +if (virtio_ioport_init (&pci_dev->mem_resource[0 ])) +return -1 ; + hw->use_msix =virtio_has_msix (&pci_dev->addr); hw->io_base = (uint64_t )(uintptr_t )pci_dev->mem_resource[0 ].addr;
Signature · 1 line
1.7.9.5
PATCH v2 1/1 13/13] virtio_ethdev : fix format specifier error for 64bit addr case
In reply to Santosh Shuklafix format specifier for func virtio_resource_init_by_ioports. %04hx-%04hx couldn't read 64bit address correctly that lead to wrong value in %mem_resource[0].addr / len; result in testpmd failure.
For example, so to read this address 00001040-0000105f; default format-specifier could read 0-0 that lead to below error on arm64/ThunderX
Unhandled fault: alignment fault (0x92000021) at 0x0000007fb5040002
--- drivers/net/virtio/virtio_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_ethdev.c +1 -1
@@ -1169,7 +1169,7 @@ static int virtio_resource_init_by_ioports(struct rte_pci_device *pci_dev)while (*ptr &&isspace (*ptr)) ptr++; -sscanf (ptr,"%04hx-%04hx" , &start, &end); +sscanf (ptr,"%hx-%hx" , &start, &end); size = end - start +1 ;break ;
Signature · 1 line
1.7.9.5
Hello,
this patch set increases the number of warnings for the armv7 build. I believe that most of them are false-positives.
virtio_ethdev.c:729, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
xstats[count].value = *(uint64_t *)(((char *)rxvq) +
* Can you guarantee this is not an unaligned 64-bit access?
virtio_ethdev.c:747, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
ditto...
virtio_pci.c:52, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
*(uint32_t *)d = VIRTIO_READ_REG_4(hw, off);
* I think, here we can live with unaligned_uint32_t, don't we?
virtio_pci.c:55, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
virtio_pci.c:75, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
virtio_pci.c:78, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
virtio_ring.h:144, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
vr->desc = (struct vring_desc *) p;
* What can we do here? Should we annotate vring_desc to be aligned properly?
virtio_ring.h:145, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
virtio_rxtx.c:733, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
header = (struct virtio_net_hdr_mrg_rxbuf *)((char *)rxm->buf_addr +
RTE_PKTMBUF_HEADROOM - hdr_size);
* No idea how to solve this...
Any other ideas are welcome.
Regards
Jan
Quoted 102 lines · On Mon, 14 Dec 2015 18:30:19 +0530 Santosh Shukla <[email protected]> wrote:
This patch set add basic infrastrucure to run virtio-net-pci pmd driver for arm64/arm. Tested on ThunderX platfrom. Verified for existing dpdk(s) test applications like:
- ovs-dpdk-vhost-user: across the VM's, for the use-cases like guest2guest and Host2Guest
- testpmd application: Tested for max virtio-net-pci interface currently supported in kernel i.e. 31 interface.Builds successfully for armv7/v8/thunderX and x86_64/i686 platforms. Made sure that patch changes donot break for
x86_64case. Done similar tests forx86_64too.Patch History:
v2:
- Removed ifdef arm.. clutter fromigb_uio/virtio_ethedevfiles
- Introducedrte_io.hheader file in generic/ and arch specifics i.e.. for armv7 -->rte_io_32.h, for armv8 -->rte_io_64.h.
- RemovedRTE_ARCH_X86ifdef clutter too and addedrte_io.hheader which nothing but wrapssys/io.hforx86_64and i686
- Moved all the RTE_ARCH_ARM/64 dependancy forigb_uiocase to separate header file namedigbuio_ioport_misc.h. Nowigb_uio.cwill call only three function
-igbuio_iomap
-igbuio_ioport_register
-igbuio_ioport_unregister
- Moved ARM/64 specific definition toinclude/exec-env/rte_virt_ioport.hheader
- Included virtio_ioport.c/h; has all private and public api required to map iopci bar for non-x86 arch. Tested on thunderX andx86_64both. Private api includes:
-virtio_map_ioport
-virtio_set_ioport_addr
Public api includes:
-virtio_ioport_init
-virtio_ioport_unmap- Last patch is the miscllanious format specifier fix identifid for 64bit case during regression.
v1:
- First patch addsRTE_VIRTIO_INC_VECTORconfig, much needed for archs like arm/arm64 as they don't support vectored implementation, also wont able to build.
- Second patch is in-general fix for i686.
- Third patch is to emulate x86-style of {in,out}[b,w,l] api support for armv7/v8. As virtio-net-pci pmd driver uses those apis for port rd/wr {b,w,l}
- Fourth patch to enableVIRTIO_PMDfeature in armv7/v8/thunderX config.
- Fifth patch to disable iopl syscall, As arm/arm64 linux kernel doesn't support them.
- Sixth patch introduces ioport memdevice called/dev/igb_ioportby which virtio pmd driver could able to rd/wrPCI_IOBAR.
{applicable for arm/arm64 only, tested for arm64 as of now}Santosh Shukla (13):
virtio: Introduce configRTE_VIRTIO_INC_VECTOR
config: i686: set RTE_VIRTIO_INC_VECTOR=n
rte_io: armv7/v8: Introduce api to emulate x86-style of PCI/ISA
ioport access
virtio_pci: userte_io.hfor non-x86 arch
virtio: changeio_basedatatype fromuint32_ttouint64_type
config: armv7/v8: EnableRTE_LIBRTE_VIRTIO_PMD
linuxapp: eal: arm: Always return 0 forrte_eal_iopl_init()
rte_io: x86: Removesys/io.hifdef x86 clutter
igb_uio: ioport: map iopci region for armv7/v8include/exec-env: ioport: addrte_virt_ioportheader file
virtio_ioport: armv7/v8: mmap virtio iopci bar region
virtio_ethdev: usevirtio_ioportapi at device init/closevirtio_ethdev: fix format specifier error for 64bit addr caseconfig/common_linuxapp | 1 + config/defconfig_arm-armv7a-linuxapp-gcc | 6 +- config/defconfig_arm64-armv8a-linuxapp-gcc | 6 +- config/defconfig_i686-native-linuxapp-gcc | 1 + config/defconfig_i686-native-linuxapp-icc | 1 + drivers/net/virtio/Makefile | 3 +- drivers/net/virtio/virtio_ethdev.c | 10 +- drivers/net/virtio/virtio_ioport.c | 163 ++++++++++++++++++++ drivers/net/virtio/virtio_ioport.h | 42 +++++ drivers/net/virtio/virtio_pci.h | 6 +- drivers/net/virtio/virtio_rxtx.c | 7 + lib/librte_eal/common/Makefile | 1 + lib/librte_eal/common/include/arch/arm/rte_io.h | 60 +++++++ lib/librte_eal/common/include/arch/arm/rte_io_32.h | 155 +++++++++++++++++++ lib/librte_eal/common/include/arch/arm/rte_io_64.h | 155 +++++++++++++++++++ lib/librte_eal/common/include/arch/x86/rte_io.h | 42 +++++ lib/librte_eal/common/include/generic/rte_io.h | 81 ++++++++++ lib/librte_eal/linuxapp/eal/Makefile | 2 +- lib/librte_eal/linuxapp/eal/eal.c | 7 +- .../eal/include/exec-env/rte_virt_ioport.h | 81 ++++++++++ lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 8 +- .../linuxapp/igb_uio/igbuio_ioport_misc.h | 133 ++++++++++++++++ 22 files changed, 957 insertions(+), 14 deletions(-) create mode 100644 drivers/net/virtio/virtio_ioport.c create mode 100644 drivers/net/virtio/virtio_ioport.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_32.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_64.h create mode 100644 lib/librte_eal/common/include/arch/x86/rte_io.h create mode 100644 lib/librte_eal/common/include/generic/rte_io.h create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h create mode 100644 lib/librte_eal/linuxapp/igb_uio/igbuio_ioport_misc.h
Signature · 4 lines
Jan Viktorin E-mail: [email protected] System Architect Web: www.RehiveTech.com RehiveTech Brno, Czech Republic
Quoted 15 lines · Jan Viktorin
Hello,
this patch set increases the number of warnings for the armv7 build. I believe that most of them are false-positives.
virtio_ethdev.c:729, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
xstats[count].value = *(uint64_t *)(((char *)rxvq) +
* Can you guarantee this is not an unaligned 64-bit access?
virtio_ethdev.c:747, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
Quoted 9 lines
ditto...
virtio_pci.c:52, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
*(uint32_t *)d = VIRTIO_READ_REG_4(hw, off);* I think, here we can live with
unaligned_uint32_t, don't we?
Yes.
Quoted 27 lines
virtio_pci.c:55, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
virtio_pci.c:75, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
virtio_pci.c:78, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
virtio_ring.h:144, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
vr->desc= (structvring_desc*) p;* What can we do here? Should we annotate
vring_descto be aligned properly?virtio_ring.h:145, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
similar...
Quoted 9 lines
virtio_rxtx.c:733, GNU Make + GNU C Compiler (gcc), Priority: Normal cast increases required alignment of target type [-Wcast-align]
header = (struct
virtio_net_hdr_mrg_rxbuf*)((char *)rxm->buf_addr +RTE_PKTMBUF_HEADROOM - hdr_size);* No idea how to solve this...
These warnings are in-general virtio-pmd warnings for armv7 case. Patchset enables virtio feature thus above warning noticed.
I spent 10 min and noticed that most of those warning are types (uint64_t*) ((char *) ptr + offset). could avoid such warning by (uint64_t *) (uintptr) ((char*)ptr + offset) where ptr is void *, But this not the case in virtio code, most of such places ptr is uint8_t, keeping then void * then typecasting to ((char *)ptr + offset) then following proposed-way, I guess won't harm functionality and could keep armv7 happy. And yes they are all look false-positive to me too. Pasting code a snape which could get rid of above warning for armv7 case. Let me know your feedback, Others thought/comment welcome. Thanks!
----------------------------------------------------------
(quoted diff) +0 -0
b/drivers/net/virtio/virtio_ethdev.c
index 8107aef..7ef4d13 100644
--- a/drivers/net/virtio/virtio_ethdev.c
(quoted diff) +0 -0
b/drivers/net/virtio/virtio_ethdev.c
index 8107aef..7ef4d13 100644
drivers/net/virtio/virtio_ethdev.c +0 -0
@@ -726,7 +726,7 @@ virtio_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstats *xstats,
snprintf(xstats[count].name, sizeof(xstats[count].name),
"rx_q%u_%s", i,
rte_virtio_q_stat_strings[t].name);
- xstats[count].value = *(uint64_t *)(((char *)rxvq) +
+ xstats[count].value = *(uint64_t
*)(uintptr_t)(((char *)rxvq) +
rte_virtio_q_stat_strings[t].offset);
count++;
}
@@ -744,7 +744,7 @@ virtio_dev_xstats_get(struct rte_eth_dev *dev,
struct rte_eth_xstats *xstats,
snprintf(xstats[count].name, sizeof(xstats[count].name),
"tx_q%u_%s", i,
rte_virtio_q_stat_strings[t].name);
- xstats[count].value = *(uint64_t *)(((char *)txvq) +
+ xstats[count].value = *(uint64_t
*)(uintptr_t)(((char *)txvq) +
rte_virtio_q_stat_strings[t].offset);
count++;
}drivers/net/virtio/virtio_ring.h +2 -2
@@ -141,8 +141,8 @@ vring_init(struct vring *vr, unsigned int num, uint8_t *p, unsigned long align) { vr->num = num; - vr->desc = (struct vring_desc *) p; - vr->avail = (struct vring_avail *) (p + + vr->desc = (struct vring_desc *) (uintptr_t )p; + vr->avail = (struct vring_avail *) ((uintptr_t )p + num *sizeof (struct vring_desc )); vr->used = (void *)RTE_ALIGN_CEIL ((uintptr_t )(&vr->avail->ring[num]), align);
drivers/net/virtio/virtio_rxtx.c +0 -1
@@ -730,7 +730,7 @@ virtio_recv_mergeable_pkts(void *rx_queue,continue ; } - header = (struct virtio_net_hdr_mrg_rxbuf *)((char
*)rxm->buf_addr +
+ header = (struct virtio_net_hdr_mrg_rxbuf
*)(uintptr_t)((char *)rxm->buf_addr +
RTE_PKTMBUF_HEADROOM - hdr_size);
seg_num = header->num_buffers;-----------------------------------------------------------------------------------
Quoted 118 lines
Any other ideas are welcome.
Regards
JanQuoted 93 lines · On Mon, 14 Dec 2015 18:30:19 +0530 Santosh Shukla <[email protected]> wrote:
This patch set add basic infrastrucure to run virtio-net-pci pmd driver for arm64/arm. Tested on ThunderX platfrom. Verified for existing dpdk(s) test applications like:
- ovs-dpdk-vhost-user: across the VM's, for the use-cases like guest2guest and Host2Guest
- testpmd application: Tested for max virtio-net-pci interface currently supported in kernel i.e. 31 interface.Builds successfully for armv7/v8/thunderX and x86_64/i686 platforms. Made sure that patch changes donot break for
x86_64case. Done similar tests forx86_64too.Patch History:
v2:
- Removed ifdef arm.. clutter fromigb_uio/virtio_ethedevfiles
- Introducedrte_io.hheader file in generic/ and arch specifics i.e.. for armv7 -->rte_io_32.h, for armv8 -->rte_io_64.h.
- RemovedRTE_ARCH_X86ifdef clutter too and addedrte_io.hheader which nothing but wrapssys/io.hforx86_64and i686
- Moved all the RTE_ARCH_ARM/64 dependancy forigb_uiocase to separate header file namedigbuio_ioport_misc.h. Nowigb_uio.cwill call only three function
-igbuio_iomap
-igbuio_ioport_register
-igbuio_ioport_unregister
- Moved ARM/64 specific definition toinclude/exec-env/rte_virt_ioport.hheader
- Included virtio_ioport.c/h; has all private and public api required to map iopci bar for non-x86 arch. Tested on thunderX andx86_64both. Private api includes:
-virtio_map_ioport
-virtio_set_ioport_addr
Public api includes:
-virtio_ioport_init
-virtio_ioport_unmap- Last patch is the miscllanious format specifier fix identifid for 64bit case during regression.
v1:
- First patch addsRTE_VIRTIO_INC_VECTORconfig, much needed for archs like arm/arm64 as they don't support vectored implementation, also wont able to build.
- Second patch is in-general fix for i686.
- Third patch is to emulate x86-style of {in,out}[b,w,l] api support for armv7/v8. As virtio-net-pci pmd driver uses those apis for port rd/wr {b,w,l}
- Fourth patch to enableVIRTIO_PMDfeature in armv7/v8/thunderX config.
- Fifth patch to disable iopl syscall, As arm/arm64 linux kernel doesn't support them.
- Sixth patch introduces ioport memdevice called/dev/igb_ioportby which virtio pmd driver could able to rd/wrPCI_IOBAR.
{applicable for arm/arm64 only, tested for arm64 as of now}Santosh Shukla (13):
virtio: Introduce configRTE_VIRTIO_INC_VECTOR
config: i686: set RTE_VIRTIO_INC_VECTOR=n
rte_io: armv7/v8: Introduce api to emulate x86-style of PCI/ISA
ioport access
virtio_pci: userte_io.hfor non-x86 arch
virtio: changeio_basedatatype fromuint32_ttouint64_type
config: armv7/v8: EnableRTE_LIBRTE_VIRTIO_PMD
linuxapp: eal: arm: Always return 0 forrte_eal_iopl_init()
rte_io: x86: Removesys/io.hifdef x86 clutter
igb_uio: ioport: map iopci region for armv7/v8include/exec-env: ioport: addrte_virt_ioportheader file
virtio_ioport: armv7/v8: mmap virtio iopci bar region
virtio_ethdev: usevirtio_ioportapi at device init/closevirtio_ethdev: fix format specifier error for 64bit addr caseconfig/common_linuxapp | 1 + config/defconfig_arm-armv7a-linuxapp-gcc | 6 +- config/defconfig_arm64-armv8a-linuxapp-gcc | 6 +- config/defconfig_i686-native-linuxapp-gcc | 1 + config/defconfig_i686-native-linuxapp-icc | 1 + drivers/net/virtio/Makefile | 3 +- drivers/net/virtio/virtio_ethdev.c | 10 +- drivers/net/virtio/virtio_ioport.c | 163 ++++++++++++++++++++ drivers/net/virtio/virtio_ioport.h | 42 +++++ drivers/net/virtio/virtio_pci.h | 6 +- drivers/net/virtio/virtio_rxtx.c | 7 + lib/librte_eal/common/Makefile | 1 + lib/librte_eal/common/include/arch/arm/rte_io.h | 60 +++++++ lib/librte_eal/common/include/arch/arm/rte_io_32.h | 155 +++++++++++++++++++ lib/librte_eal/common/include/arch/arm/rte_io_64.h | 155 +++++++++++++++++++ lib/librte_eal/common/include/arch/x86/rte_io.h | 42 +++++ lib/librte_eal/common/include/generic/rte_io.h | 81 ++++++++++ lib/librte_eal/linuxapp/eal/Makefile | 2 +- lib/librte_eal/linuxapp/eal/eal.c | 7 +- .../eal/include/exec-env/rte_virt_ioport.h | 81 ++++++++++ lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 8 +- .../linuxapp/igb_uio/igbuio_ioport_misc.h | 133 ++++++++++++++++ 22 files changed, 957 insertions(+), 14 deletions(-) create mode 100644 drivers/net/virtio/virtio_ioport.cQuoted 9 lines
create mode 100644 drivers/net/virtio/virtio_ioport.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_32.h create mode 100644 lib/librte_eal/common/include/arch/arm/rte_io_64.h create mode 100644 lib/librte_eal/common/include/arch/x86/rte_io.h create mode 100644 lib/librte_eal/common/include/generic/rte_io.h create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_virt_ioport.h create mode 100644 lib/librte_eal/linuxapp/igb_uio/igbuio_ioport_misc.h--
Jan Viktorin E-mail: [email protected]
System Architect Web: www.RehiveTech.com
RehiveTech
Brno, Czech Republic
Quoted 42 lines · Santosh Shukla
This patch set add basic infrastrucure to run virtio-net-pci pmd driver for arm64/arm. Tested on ThunderX platfrom. Verified for existing dpdk(s) test applications like:
- ovs-dpdk-vhost-user: across the VM's, for the use-cases like guest2guest and
Host2Guest
- testpmd application: Tested for max virtio-net-pci interface currently supported in kernel i.e. 31 interface.Builds successfully for armv7/v8/thunderX and x86_64/i686 platforms. Made sure
that patch changes donot break forx86_64case. Done similar tests forx86_64
too.Patch History:
v2:
- Removed ifdef arm.. clutter fromigb_uio/virtio_ethedevfiles
- Introducedrte_io.hheader file in generic/ and arch specifics i.e.. for armv7 -->rte_io_32.h, for armv8 -->rte_io_64.h.
- RemovedRTE_ARCH_X86ifdef clutter too and addedrte_io.hheader which nothing
but wrapssys/io.hforx86_64and i686
- Moved all the RTE_ARCH_ARM/64 dependancy forigb_uiocase to separate header
file namedigbuio_ioport_misc.h. Nowigb_uio.cwill call only three
function
-igbuio_iomap
-igbuio_ioport_register
-igbuio_ioport_unregister
- Moved ARM/64 specific definition toinclude/exec-env/rte_virt_ioport.hheader
- Included virtio_ioport.c/h; has all private and public api required to map
iopci bar for non-x86 arch. Tested on thunderX andx86_64both. Private api includes:
-virtio_map_ioport
-virtio_set_ioport_addr
Public api includes:
-virtio_ioport_init
-virtio_ioport_unmap
Quoted 6 lines
- Last patch is the miscllanious format specifier fix identifid for 64bit case
during regression.
Hi Yuanhan, Huawei and Others.
I got arch specific review comment from arm maintainers and I am waiting for your review feedback on virtio specific patches? Is v3 patch and virtio iopci bar mapping to user-space approach ok with all? Thanks.
Quoted 35 lines
v1:
- First patch addsRTE_VIRTIO_INC_VECTORconfig, much needed for archs like arm/arm64 as they don't support vectored implementation, also wont able
to
build.
- Second patch is in-general fix for i686.
- Third patch is to emulate x86-style of {in,out}[b,w,l] api support for armv7/v8.
As virtio-net-pci pmd driver uses those apis for port rd/wr {b,w,l}
- Fourth patch to enableVIRTIO_PMDfeature in armv7/v8/thunderX config.
- Fifth patch to disable iopl syscall, As arm/arm64 linux kernel doesn't support
them.
- Sixth patch introduces ioport memdevice called/dev/igb_ioportby which virtio
pmd driver could able to rd/wrPCI_IOBAR.
{applicable for arm/arm64 only, tested for arm64 as of now}Santosh Shukla (13):
virtio: Introduce configRTE_VIRTIO_INC_VECTOR
config: i686: set RTE_VIRTIO_INC_VECTOR=n
rte_io: armv7/v8: Introduce api to emulate x86-style of PCI/ISA
ioport access
virtio_pci: userte_io.hfor non-x86 arch
virtio: changeio_basedatatype fromuint32_ttouint64_type
config: armv7/v8: EnableRTE_LIBRTE_VIRTIO_PMD
linuxapp: eal: arm: Always return 0 forrte_eal_iopl_init()
rte_io: x86: Removesys/io.hifdef x86 clutter
igb_uio: ioport: map iopci region for armv7/v8include/exec-env: ioport: addrte_virt_ioportheader file
virtio_ioport: armv7/v8: mmap virtio iopci bar region
virtio_ethdev: usevirtio_ioportapi at device init/closevirtio_ethdev: fix format specifier error for 64bit addr case
Hello Santosh,
Quoted 6 lines · Santosh Shukla
Hi Yuanhan, Huawei and Others.
I got arch specific review comment from arm maintainers and I am waiting for your review feedback on virtio specific patches? Is v3 patch and virtio iopci bar mapping to user-space approach ok with all? Thanks.
Please, don't forget to CC me as well.
I did something similar for powerpc, but there was no need to add any remapping in igb_uio.
Is there something specific to arm that makes it impossible to reuse resources mmapping from /sys ?
I can send a patch that should do the job for eal.
I am a bit short on time and will be on holidays for two weeks, so I can't look at these patches before January.
Regards,
Signature · 1 line
David Marchand
Quoted 12 lines · David Marchand
Hello Santosh,
Quoted 7 lines · Santosh Shukla
Hi Yuanhan, Huawei and Others.
I got arch specific review comment from arm maintainers and I am waiting for your review feedback on virtio specific patches? Is v3 patch and virtio
iopci bar mapping to user-space approach ok with all? Thanks.
Quoted 4 lines
Please, don't forget to CC me as well.
I did something similar for powerpc, but there was no need to add any remapping in
igb_uio.
Is it for mapping iopci bar? does that includes virtio
For detailed explanation refer [1]
[1] http://dpdk.org/dev/patchwork/patch/9365/
Quoted 2 lines
Is there something specific to arm that makes it impossible to reuse resources mmapping from /sys ?
/sysfs wont map resource0, it could map resource1 i.e. iomem but virtio header resides in iopci bar region so iomem memory wont be effective / invalid addr. For that someone to explicitly map iopci region thus this code/pach.
Quoted 2 lines
I can send a patch that should do the job for eal.
Pl. send then, My patches are waiting for review for quite a long time. It will be good if you send now.
Quoted 7 lines
I am a bit short on time and will be on holidays for two weeks, so I can't look at these patches before January.
Regards,
--
David Marchand
PATCH 1/1 eal: map io resources for non x86 architectures
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by accepting IORESOURCE_IO flag for architectures other than x86.
--- lib/librte_eal/common/include/rte_pci.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_pci.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-)
lib/librte_eal/common/include/rte_pci.h +2 -1
@@ -105,7 +105,8 @@ extern struct pci_device_list pci_device_list; /**< Global list of PCI devices./** Nb. of values in PCI resource format. */ #define PCI_RESOURCE_FMT_NVAL 3 -/** IO resource type: memory address space */ +/** IO resource type: */ +#define IORESOURCE_IO 0x00000100#define IORESOURCE_MEM 0x00000200/**
lib/librte_eal/linuxapp/eal/eal_pci.c +15 -6
@@ -236,12 +236,21 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) goto error; } -if (flags &IORESOURCE_MEM ) { - dev->mem_resource[i].phys_addr = phys_addr; - dev->mem_resource[i].len = end_addr - phys_addr +1 ; -/* not mapped for now */ - dev->mem_resource[i].addr =NULL ; - } +/* we only care about IORESOURCE_IO or IORESOURCE_MEM */ +if (!(flags &IORESOURCE_IO ) && + !(flags &IORESOURCE_MEM )) +continue ; + +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 ) +/* x86 can not remap ioports, so skip it, remapping code will +* look at dev->mem_resource[i].phys_addr == 0 and skip it */ +if (flags &IORESOURCE_IO ) +continue ; +#endif + dev->mem_resource[i].phys_addr = phys_addr; + dev->mem_resource[i].len = end_addr - phys_addr +1 ; +/* not mapped for now */ + dev->mem_resource[i].addr =NULL ; }fclose (f);return 0 ;
Signature · 1 line
1.7.10.4
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.
One question: this patch could be a replacement of the igbuio_iomap patch from Santosh? If so, I like it: It's more elegant.
--yliu
Quoted 55 lines
Signed-off-by David Marchand <[email protected]>--- lib/librte_eal/common/include/rte_pci.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_pci.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-)lib/librte_eal/common/include/rte_pci.h +2
-1@@ -105,7 +105,8 @@ extern struct pci_device_list pci_device_list; /**< Global list of PCI devices./** Nb. of values in PCI resource format. */ #define PCI_RESOURCE_FMT_NVAL 3 -/** IO resource type: memory address space */ +/** IO resource type: */ +#define IORESOURCE_IO 0x00000100#define IORESOURCE_MEM 0x00000200/** lib/librte_eal/linuxapp/eal/eal_pci.c +15
-6@@ -236,12 +236,21 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) goto error; } -if (flags &IORESOURCE_MEM ) { - dev->mem_resource[i].phys_addr = phys_addr; - dev->mem_resource[i].len = end_addr - phys_addr +1 ; -/* not mapped for now */ - dev->mem_resource[i].addr =NULL ; - } +/* we only care about IORESOURCE_IO or IORESOURCE_MEM */ +if (!(flags &IORESOURCE_IO ) && + !(flags &IORESOURCE_MEM )) +continue ; + +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 ) +/* x86 can not remap ioports, so skip it, remapping code will +* look at dev->mem_resource[i].phys_addr == 0 and skip it */ +if (flags &IORESOURCE_IO ) +continue ; +#endif + dev->mem_resource[i].phys_addr = phys_addr; + dev->mem_resource[i].len = end_addr - phys_addr +1 ; +/* not mapped for now */ + dev->mem_resource[i].addr =NULL ; }fclose (f);return 0 ;Signature · 1 line
1.7.10.4
Re: [PATCH] eal: map io resources for non x86 architectures
Yuanhan,
Quoted 9 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.
Well, yes, unless I missed something since I am no guru :-).
Signature · 1 line
David Marchand
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 11 lines · David Marchand
Yuanhan,
On Wed, Dec 16, 2015 at 1:48 PM, Yuanhan Liu <[email protected]> wrote:
On Wed, Dec 16, 2015 at 01:31:04PM +0100, David Marchand wrote:
> x86 requires a special set of instructions to access ioports, but other > architectures let you remap io resources.
> So let eal remap io resources by acceptingIORESOURCE_IOflag for > architectures other than x86.
Quoted 5 lines
One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.Well, yes, unless I missed something since I am no guru :-).
Great then. If there is a test-by, I could give my Ack :) (I have no arm or other platform for testing).
--yliu
Re: [PATCH] eal: map io resources for non x86 architectures
In reply to Yuanhan LiuQuoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliu
I did tried similar in past but not in parse_sysfs (such that mem.resource_addr to accept IO_RESOURCE_IO types) and observed that pci_map_resource not able to map address hence segfault at tespmd initialization.
i was getting these:
EAL: pci_map_resource(): cannot mmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)
after enabling RTE_PCI_NEED_DRV_MAPPING flags in virtio_ethdev. I guess patch assume that flag enabled for driver right?
Quoted 55 lines
Quoted 55 lines
Signed-off-by David Marchand <[email protected]>--- lib/librte_eal/common/include/rte_pci.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_pci.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-)lib/librte_eal/common/include/rte_pci.h +2
-1@@ -105,7 +105,8 @@ extern struct pci_device_list pci_device_list; /**< Global list of PCI devices./** Nb. of values in PCI resource format. */ #define PCI_RESOURCE_FMT_NVAL 3 -/** IO resource type: memory address space */ +/** IO resource type: */ +#define IORESOURCE_IO 0x00000100#define IORESOURCE_MEM 0x00000200/** lib/librte_eal/linuxapp/eal/eal_pci.c +15
-7@@ -236,12 +236,21 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) goto error; } -if (flags &IORESOURCE_MEM ) { - dev->mem_resource[i].phys_addr = phys_addr; - dev->mem_resource[i].len = end_addr - phys_addr +1 ; -/* not mapped for now */ - dev->mem_resource[i].addr =NULL ; - } +/* we only care about IORESOURCE_IO or IORESOURCE_MEM */ +if (!(flags &IORESOURCE_IO ) && + !(flags &IORESOURCE_MEM )) +continue ; + +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 ) +/* x86 can not remap ioports, so skip it, remapping code will +* look at dev->mem_resource[i].phys_addr == 0 and skip it */ +if (flags &IORESOURCE_IO ) +continue ; +#endif + dev->mem_resource[i].phys_addr = phys_addr; + dev->mem_resource[i].len = end_addr - phys_addr +1 ; +/* not mapped for now */ + dev->mem_resource[i].addr =NULL ; }fclose (f);return 0 ; --1.7.10.4
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliu
Quoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)
That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
619 enum pci_mmap_state mmap_state, int write_combine)
620 {
621 if (mmap_state == pci_mmap_io)
622 return -EINVAL;
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
--yliu
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 34 lines · Yuanhan Liu
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliuQuoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(structpci_dev*dev, structvm_area_struct*vma,
619 enumpci_mmap_statemmap_state, intwrite_combine)
620 {
621 if (mmap_state==pci_mmap_io)
622 return-EINVAL;
Quoted 6 lines
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
Right and I did shared detailed explanation on why it wont work on this link [1], infact this patch shouldn;t work for mips too.
As I mentioned earlier I did tried similar approach and so to get everything working like iomem is currently in dpdk; we need to add something like pci_remap_iospace --> ioremap_page_range() but this api not really pci_mmap_page_range types. user need to write more code on top so to use this api efficiently, also this api looks like meant to use by arch file only in kernel space.
Quoted 1 line
--yliu
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 46 lines · Santosh Shukla
Quoted 34 lines · Yuanhan Liu
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliuQuoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(structpci_dev*dev, structvm_area_struct*vma,
619 enumpci_mmap_statemmap_state, intwrite_combine)
620 {
621 if (mmap_state==pci_mmap_io)
622 return-EINVAL;Quoted 6 lines
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
Right and I did shared detailed explanation on why it wont work on this link [1], infact this patch shouldn;t work for mips too.
Quoted 8 lines
As I mentioned earlier I did tried similar approach and so to get everything working like iomem is currently in dpdk; we need to add something like
pci_remap_iospace-->ioremap_page_range()but this api not reallypci_mmap_page_rangetypes. user need to write more code on top so to use this api efficiently, also this api looks like meant to use by arch file only in kernel space.
missed link;
[1] http://dpdk.org/dev/patchwork/patch/9365/
Quoted 1 line
Quoted 1 line
--yliu
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 55 lines · Santosh Shukla
Quoted 46 lines · Santosh Shukla
Quoted 34 lines · Yuanhan Liu
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliuQuoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(structpci_dev*dev, structvm_area_struct*vma,
619 enumpci_mmap_statemmap_state, intwrite_combine)
620 {
621 if (mmap_state==pci_mmap_io)
622 return-EINVAL;Quoted 6 lines
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
Right and I did shared detailed explanation on why it wont work on this link [1], infact this patch shouldn;t work for mips too.
Quoted 8 lines
As I mentioned earlier I did tried similar approach and so to get everything working like iomem is currently in dpdk; we need to add something like
pci_remap_iospace-->ioremap_page_range()but this api not reallypci_mmap_page_rangetypes. user need to write more code on top so to use this api efficiently, also this api looks like meant to use by arch file only in kernel space.
Quoted 4 lines
missed link;
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add /dev/ioport interface in drivers/char/mem.c which could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.
Let me know!
Quoted 1 line
Quoted 1 line
Quoted 1 line
--yliu
Re: [PATCH] eal: map io resources for non x86 architectures
Hi,
2015-12-17 15:37, Santosh Shukla:
Quoted 61 lines · Santosh Shukla
Quoted 55 lines · Santosh Shukla
Quoted 46 lines
Quoted 34 lines · Yuanhan Liu
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliuQuoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(structpci_dev*dev, structvm_area_struct*vma,
619 enumpci_mmap_statemmap_state, intwrite_combine)
620 {
621 if (mmap_state==pci_mmap_io)
622 return-EINVAL;Quoted 6 lines
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
Right and I did shared detailed explanation on why it wont work on this link [1], infact this patch shouldn;t work for mips too.
Quoted 8 lines
As I mentioned earlier I did tried similar approach and so to get everything working like iomem is currently in dpdk; we need to add something like
pci_remap_iospace-->ioremap_page_range()but this api not reallypci_mmap_page_rangetypes. user need to write more code on top so to use this api efficiently, also this api looks like meant to use by arch file only in kernel space.Quoted 4 lines
missed link;
Quoted 7 lines
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add
/dev/ioportinterface indrivers/char/mem.cwhich could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.
Your first approach use an out-of-tree kernel module (igb_uio), so we cannot really say there is no kernel dependency.
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 72 lines · Thomas Monjalon
Hi,
2015-12-17 15:37, Santosh Shukla:
Quoted 61 lines · Santosh Shukla
Quoted 55 lines · Santosh Shukla
Quoted 46 lines
Quoted 34 lines · Yuanhan Liu
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliuQuoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(structpci_dev*dev, structvm_area_struct*vma,
619 enumpci_mmap_statemmap_state, intwrite_combine)
620 {
621 if (mmap_state==pci_mmap_io)
622 return-EINVAL;Quoted 6 lines
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
Right and I did shared detailed explanation on why it wont work on this link [1], infact this patch shouldn;t work for mips too.
Quoted 8 lines
As I mentioned earlier I did tried similar approach and so to get everything working like iomem is currently in dpdk; we need to add something like
pci_remap_iospace-->ioremap_page_range()but this api not reallypci_mmap_page_rangetypes. user need to write more code on top so to use this api efficiently, also this api looks like meant to use by arch file only in kernel space.Quoted 4 lines
missed link;
Quoted 7 lines
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add
/dev/ioportinterface indrivers/char/mem.cwhich could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.
Quoted 2 lines
Your first approach use an out-of-tree kernel module (
igb_uio), so we cannot really say there is no kernel dependency.
Agree but I mentioned kernel __version__ dependency.
Quoted 2 lines
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
IIUC, your suggesting archs like arm/arm64 to support io_mappe_io in pci_mmap_page_range()?
Re: [PATCH] eal: map io resources for non x86 architectures
2015-12-17 15:51, Santosh Shukla:
Quoted 74 lines
Quoted 72 lines · Thomas Monjalon
Hi,
2015-12-17 15:37, Santosh Shukla:
Quoted 68 lines · Santosh Shukla
Quoted 55 lines · Santosh Shukla
Quoted 46 lines
Quoted 34 lines · Yuanhan Liu
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliuQuoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(structpci_dev*dev, structvm_area_struct*vma,
619 enumpci_mmap_statemmap_state, intwrite_combine)
620 {
621 if (mmap_state==pci_mmap_io)
622 return-EINVAL;Quoted 6 lines
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
Right and I did shared detailed explanation on why it wont work on this link [1], infact this patch shouldn;t work for mips too.
Quoted 8 lines
As I mentioned earlier I did tried similar approach and so to get everything working like iomem is currently in dpdk; we need to add something like
pci_remap_iospace-->ioremap_page_range()but this api not reallypci_mmap_page_rangetypes. user need to write more code on top so to use this api efficiently, also this api looks like meant to use by arch file only in kernel space.Quoted 4 lines
missed link;
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add
/dev/ioportinterface indrivers/char/mem.cwhich could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.
Quoted 4 lines
Quoted 2 lines
Your first approach use an out-of-tree kernel module (
igb_uio), so we cannot really say there is no kernel dependency.Agree but I mentioned kernel
__version__dependency.
Yes you did.
One of the main issue with out-of-tree kernel modules is the version dependency. Probably that igb_uio from DPDK 2.3 will not compile with the kernel 5.0.
Quoted 5 lines
Quoted 2 lines
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
IIUC, your suggesting archs like arm/arm64 to support
io_mappe_ioinpci_mmap_page_range()?
I don't know what is the best solution in the kernel.
First we need to be sure that there is absolutely no solution without kernel changes.
Then we can try a pci_mmap solution or, as you suggest, an interface in drivers/char/mem.c
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 78 lines · Thomas Monjalon
2015-12-17 15:51, Santosh Shukla:
Quoted 77 lines
Quoted 74 lines · Thomas Monjalon
Hi,
2015-12-17 15:37, Santosh Shukla:
Quoted 61 lines · Santosh Shukla
Quoted 55 lines · Santosh Shukla
Quoted 46 lines
Quoted 34 lines · Yuanhan Liu
Quoted 14 lines · Santosh Shukla
Quoted 11 lines · Yuanhan Liu
Quoted 4 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.One question: this patch could be a replacement of the
igbuio_iomappatch from Santosh? If so, I like it: It's more elegant.--yliuQuoted 8 lines
I did tried similar in past but not in
parse_sysfs(such that mem.resource_addr to acceptIO_RESOURCE_IOtypes) and observed thatpci_map_resourcenot able to map address hence segfault at tespmd initialization.i was getting these:
EAL:pci_map_resource(): cannotmmap(19, 0x7fa5c00000, 0x20, 0x0):
Invalid argument (0xffffffffffffffff)That's because ARM (at least the kernel) doesn't allow an IO map:
arch/arm/kernel/bios32.c
------------------------
618 int pci_mmap_page_range(structpci_dev*dev, structvm_area_struct*vma,
619 enumpci_mmap_statemmap_state, intwrite_combine)
620 {
621 if (mmap_state==pci_mmap_io)
622 return-EINVAL;Quoted 6 lines
And with a quick glimpse of powerpc, I see no such limitation. Hence, this peice of code may work only on Powerpc platform (and maybe a few others we don't care).
So, apparently, this will not work for ARM.
Right and I did shared detailed explanation on why it wont work on this link [1], infact this patch shouldn;t work for mips too.
Quoted 8 lines
As I mentioned earlier I did tried similar approach and so to get everything working like iomem is currently in dpdk; we need to add something like
pci_remap_iospace-->ioremap_page_range()but this api not reallypci_mmap_page_rangetypes. user need to write more code on top so to use this api efficiently, also this api looks like meant to use by arch file only in kernel space.Quoted 4 lines
missed link;
Quoted 7 lines
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add
/dev/ioportinterface indrivers/char/mem.cwhich could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.Your first approach use an out-of-tree kernel module (
igb_uio), so we cannot really say there is no kernel dependency.
Quoted 7 lines
Quoted 1 line
Agree but I mentioned kernel
__version__dependency.Yes you did.
One of the main issue with out-of-tree kernel modules is the version dependency. Probably thatigb_uiofrom DPDK 2.3 will not compile with the kernel 5.0.
don't know kernel 5.0 feature list so I guess your may be right. is uio obsoleted for 5.0 kernel?
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
IIUC, your suggesting archs like arm/arm64 to support
io_mappe_ioinpci_mmap_page_range()?I don't know what is the best solution in the kernel. First we need to be sure that there is absolutely no solution without kernel changes.
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
# either we need to modify kernel
- Make sure all the non-x86 arch to support mapping for
iopci region (i.e. pci_mmap_page_range). I don;t think its a correct
approach though.
or
- include /dev/ioport char-mem device file who could do
more than byte operation, Note that this implementation does not exist
in kernel. I could send an RFC to lkml.OR keep device file in user space (current approach) Right now Virtio-for-arm patches are blocked on this, let me know if someone has better approach/thought in mind.
Thanks.
Quoted 3 lines
Then we can try a
pci_mmapsolution or, as you suggest, an interface indrivers/char/mem.c
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 13 lines · Santosh Shukla
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 7 lines
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add
/dev/ioportinterface indrivers/char/mem.cwhich could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.Your first approach use an out-of-tree kernel module (
igb_uio), so we cannot really say there is no kernel dependency.Agree but I mentioned kernel
__version__dependency.
Quoted 8 lines
Quoted 5 lines
Yes you did.
One of the main issue with out-of-tree kernel modules is the version dependency. Probably thatigb_uiofrom DPDK 2.3 will not compile with the kernel 5.0.don't know kernel 5.0 feature list so I guess your may be right. is uio obsoleted for 5.0 kernel?
Nope, Thomas meant to say that we should keep the old DPDK will work with newer kernel, not just the newest DPDK work on newest linux kernel only. The out-of-tree kernel makes no garantee on that.
Quoted 13 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
IIUC, your suggesting archs like arm/arm64 to support
io_mappe_ioinpci_mmap_page_range()?I don't know what is the best solution in the kernel. First we need to be sure that there is absolutely no solution without kernel changes.
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
Quoted 8 lines
# either we need to modify kernel
- Make sure all the non-x86 arch to support mapping for
iopci region (i.e. pci_mmap_page_range). I don;t think its a correct
approach though.
or
- include /dev/ioport char-mem device file who could do
more than byte operation, Note that this implementation does not exist
in kernel. I could send an RFC to lkml.Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
--yliu
Quoted 10 lines
OR keep device file in user space (current approach) Right now Virtio-for-arm patches are blocked on this, let me know if someone has better approach/thought in mind.
Thanks.
Quoted 3 lines
Then we can try a
pci_mmapsolution or, as you suggest, an interface indrivers/char/mem.c
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 49 lines · Yuanhan Liu
Quoted 13 lines · Santosh Shukla
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 7 lines
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add
/dev/ioportinterface indrivers/char/mem.cwhich could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.Your first approach use an out-of-tree kernel module (
igb_uio), so we cannot really say there is no kernel dependency.Agree but I mentioned kernel
__version__dependency.Quoted 8 lines
Quoted 5 lines
Yes you did.
One of the main issue with out-of-tree kernel modules is the version dependency. Probably thatigb_uiofrom DPDK 2.3 will not compile with the kernel 5.0.don't know kernel 5.0 feature list so I guess your may be right. is uio obsoleted for 5.0 kernel?
Nope, Thomas meant to say that we should keep the old DPDK will work with newer kernel, not just the newest DPDK work on newest linux kernel only. The out-of-tree kernel makes no garantee on that.
Quoted 13 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
IIUC, your suggesting archs like arm/arm64 to support
io_mappe_ioinpci_mmap_page_range()?I don't know what is the best solution in the kernel. First we need to be sure that there is absolutely no solution without kernel changes.
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
Quoted 8 lines
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.
Quoted 2 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
IMO, We need to support DPDK-ARM for the old kernels also. If there is no means to expose iomap region to userspace in the existing kernel then we add that support through out-of-tree driver like igb_uio and when make become part of the kernel then we can turn off of the out-of-tree driver based
on the kernel major and minor version numbers.
Jerin
Quoted 12 lines
--yliuQuoted 10 lines
OR keep device file in user space (current approach) Right now Virtio-for-arm patches are blocked on this, let me know if someone has better approach/thought in mind.
Thanks.
Quoted 3 lines
Then we can try a
pci_mmapsolution or, as you suggest, an interface indrivers/char/mem.c
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 9 lines · Jerin Jacob
Quoted 9 lines
Quoted 8 lines
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.
Quoted 8 lines
Quoted 2 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
IMO, We need to support DPDK-ARM for the old kernels also. If there is no means to expose iomap region to userspace in the existing kernel then we add that support through out-of-tree driver like
igb_uioand when make become part of the kernel then we can turn off of the out-of-tree driver based
on the kernel major and minor version numbers.
Agreed.
(BTW, I have no idea why the CC list of my last reply was shortened to Santosh only. I double checked with my sent box, the mail header sent out looks normal:
Date: Fri, 18 Dec 2015 13:30:53 +0800 From: Yuanhan Liu <[email protected]>
To: Santosh Shukla <[email protected]>
Cc: Thomas Monjalon <[email protected]>, [email protected], David Marchand <[email protected]>
Not sure it's a bug from my mutt email client, or the mailing list)
--yliu
Re: [PATCH] eal: map io resources for non x86 architectures
In reply to Jerin Jacob2015-12-18 12:04, Jerin Jacob:
Quoted 35 lines · Yuanhan Liu
Quoted 34 lines · Santosh Shukla
Quoted 6 lines
Quoted 3 lines
One of the main issue with out-of-tree kernel modules is the version dependency. Probably that
igb_uiofrom DPDK 2.3 will not compile with the kernel 5.0.don't know kernel 5.0 feature list so I guess your may be right. is uio obsoleted for 5.0 kernel?
Nope, Thomas meant to say that we should keep the old DPDK will work with newer kernel, not just the newest DPDK work on newest linux kernel only. The out-of-tree kernel makes no garantee on that.
Quoted 21 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
IIUC, your suggesting archs like arm/arm64 to support
io_mappe_ioinpci_mmap_page_range()?I don't know what is the best solution in the kernel. First we need to be sure that there is absolutely no solution without kernel changes.
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.
Quoted 8 lines
Quoted 2 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
IMO, We need to support DPDK-ARM for the old kernels also. If there is no means to expose iomap region to userspace in the existing kernel then we add that support through out-of-tree driver like
igb_uioand when make become part of the kernel then we can turn off of the out-of-tree driver based
on the kernel major and minor version numbers.
Of course, we have to support DPDK for old/current kernels.
But if we continue to implement features in out-of-tree modules without trying to have a solution with upstream kernel, we are stuck with our legacy forever. So, as sane policy, we should not accept new changes in our kernel modules if there is no alternative in Linus' repo.
Re: [PATCH] eal: map io resources for non x86 architectures
In reply to Yuanhan LiuQuoted 49 lines · Yuanhan Liu
Quoted 13 lines · Santosh Shukla
Quoted 13 lines
Quoted 12 lines
Quoted 10 lines
Quoted 7 lines
IMO, it is worth keeping one special device file who could work across archs like arm/arm64/powerpc and others, who could map iopci bar to dpdk user-space. also this approach has no kernel version dependency too. BTW; I did mentioned in second approach in to add
/dev/ioportinterface indrivers/char/mem.cwhich could read more than byte in one single operation, but that has kernel dependency. However that approach too is arch agnostic.Your first approach use an out-of-tree kernel module (
igb_uio), so we cannot really say there is no kernel dependency.Agree but I mentioned kernel
__version__dependency.Quoted 8 lines
Quoted 5 lines
Yes you did.
One of the main issue with out-of-tree kernel modules is the version dependency. Probably thatigb_uiofrom DPDK 2.3 will not compile with the kernel 5.0.don't know kernel 5.0 feature list so I guess your may be right. is uio obsoleted for 5.0 kernel?
Nope, Thomas meant to say that we should keep the old DPDK will work with newer kernel, not just the newest DPDK work on newest linux kernel only. The out-of-tree kernel makes no garantee on that.
Quoted 13 lines
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
We should try to remove the need for any out-of-tree kernel module. That's why the Linux upstream approach is a better solution.
IIUC, your suggesting archs like arm/arm64 to support
io_mappe_ioinpci_mmap_page_range()?I don't know what is the best solution in the kernel. First we need to be sure that there is absolutely no solution without kernel changes.
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
Quoted 8 lines
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.
Quoted 3 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
The latter one I already shared old lkml thread, Pl. revisit my v1 0/6 patch [1] and in that refer [2].
Josh has already proposed to lkml but for some reason thread didn't went far. I can restart that discussion giving dpdk use-case as an example/ requirement.
And for the former one, I'll have to check with linux-arm why iopci region not mappable. By grepping kernel source all i could see two commit - latest one is 415ae101 and older one 1da177e. Both has nothing to explain why
if (mmap_state == pci_mmap_io)
return -EINVAL;
Setting pci io region to -EINVAL, should have fundamental reason for sure. But we'll have to check, for that I could post as a query rather a patch to lkml.
Note that dpdk already has out-of-tree implementation for dom0/xen-case too, it creates special device file which maps pci resources. so keep one more igb_uio char device so to map iopci region wont hurt much though!
[1] http://permalink.gmane.org/gmane.comp.networking.dpdk.devel/29531
Quoted 11 lines
--yliuQuoted 10 lines
OR keep device file in user space (current approach) Right now Virtio-for-arm patches are blocked on this, let me know if someone has better approach/thought in mind.
Thanks.
Quoted 3 lines
Then we can try a
pci_mmapsolution or, as you suggest, an interface indrivers/char/mem.c
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 12 lines · Santosh Shukla
Quoted 12 lines
Quoted 11 lines
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.
Quoted 6 lines
Quoted 3 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
The latter one I already shared old lkml thread, Pl. revisit my v1 0/6 patch [1] and in that refer [2].
Oops, sorry, a bit busy, that I didn't look at it carefully. My bad, anyway.
Quoted 3 lines
Josh has already proposed to lkml but for some reason thread didn't went far. I can restart that discussion giving dpdk use-case as an example/ requirement.
I had a quick go through of the discussion. Both hpa and Arnd seem to be fine with the ioctl interface on /dev/port. Have you tried that? And if you want to restart it, ioctl might be a better option than /dev/ioport, judging from the discussion.
Quoted 11 lines
And for the former one, I'll have to check with linux-arm why iopci region not mappable. By grepping kernel source all i could see two commit - latest one is
415ae101and older one 1da177e. Both has nothing to explain why
if (mmap_state==pci_mmap_io)return -EINVAL;Setting pci io region to
-EINVAL, should have fundamental reason for sure. But we'll have to check, for that I could post as a query rather a patch to lkml.
No idea, such check should have been there in the very beginning for some reason. And here is a quote from Arnd:
Only powerpc, microblaze, alpha, sparc and xtensa allow users to mmap I/O space, even though a lot of others could.
Quoted 5 lines
Note that dpdk already has out-of-tree implementation for dom0/xen-case too, it creates special device file which maps pci resources. so keep one more
igb_uiochar device so to map iopci region wont hurt much though!
Xen is not a good example here; I'm even not sure it still works or not :)
--yliu
Quoted 13 lines
[1] http://permalink.gmane.org/gmane.comp.networking.dpdk.devel/29531
Quoted 11 lines
--yliuQuoted 10 lines
OR keep device file in user space (current approach) Right now Virtio-for-arm patches are blocked on this, let me know if someone has better approach/thought in mind.
Thanks.
Quoted 3 lines
Then we can try a
pci_mmapsolution or, as you suggest, an interface indrivers/char/mem.c
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 23 lines · Yuanhan Liu
Quoted 12 lines · Santosh Shukla
Quoted 12 lines
Quoted 11 lines
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.Quoted 6 lines
Quoted 3 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
The latter one I already shared old lkml thread, Pl. revisit my v1 0/6 patch [1] and in that refer [2].
Oops, sorry, a bit busy, that I didn't look at it carefully. My bad, anyway.
Quoted 9 lines
Quoted 3 lines
Josh has already proposed to lkml but for some reason thread didn't went far. I can restart that discussion giving dpdk use-case as an example/ requirement.
I had a quick go through of the discussion. Both hpa and Arnd seem to be fine with the ioctl interface on
/dev/port. Have you tried that? And if you want to restart it, ioctl might be a better option than/dev/ioport, judging from the discussion.
I tried legacy patch and re-writing with ioctl-way; doing changes in dpdk port as well in kernel, had to test on quite other hw not only arm64 though! so it will take time for me, I am travelling tomorrow so bit delayed, We'll post patch to lkml and share dpdk-virtio feedback perhaps by Monday.
Quoted 41 lines
Quoted 11 lines
And for the former one, I'll have to check with linux-arm why iopci region not mappable. By grepping kernel source all i could see two commit - latest one is
415ae101and older one 1da177e. Both has nothing to explain why
if (mmap_state==pci_mmap_io)return -EINVAL;Setting pci io region to
-EINVAL, should have fundamental reason for sure. But we'll have to check, for that I could post as a query rather a patch to lkml.No idea, such check should have been there in the very beginning for some reason. And here is a quote from Arnd:
Only powerpc, microblaze, alpha, sparc and xtensa allow users to mmap I/O space, even though a lot of others could.
Quoted 5 lines
Note that dpdk already has out-of-tree implementation for dom0/xen-case too, it creates special device file which maps pci resources. so keep one more
igb_uiochar device so to map iopci region wont hurt much though!Xen is not a good example here; I'm even not sure it still works or not :)
--yliuQuoted 13 lines
[1] http://permalink.gmane.org/gmane.comp.networking.dpdk.devel/29531
Quoted 11 lines
--yliuQuoted 10 lines
OR keep device file in user space (current approach) Right now Virtio-for-arm patches are blocked on this, let me know if someone has better approach/thought in mind.
Thanks.
Quoted 3 lines
Then we can try a
pci_mmapsolution or, as you suggest, an interface indrivers/char/mem.c
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 35 lines · Santosh Shukla
Quoted 23 lines · Yuanhan Liu
Quoted 12 lines · Santosh Shukla
Quoted 12 lines
Quoted 11 lines
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.Quoted 6 lines
Quoted 3 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
The latter one I already shared old lkml thread, Pl. revisit my v1 0/6 patch [1] and in that refer [2].
Oops, sorry, a bit busy, that I didn't look at it carefully. My bad, anyway.
Quoted 9 lines
Quoted 3 lines
Josh has already proposed to lkml but for some reason thread didn't went far. I can restart that discussion giving dpdk use-case as an example/ requirement.
I had a quick go through of the discussion. Both hpa and Arnd seem to be fine with the ioctl interface on
/dev/port. Have you tried that? And if you want to restart it, ioctl might be a better option than/dev/ioport, judging from the discussion.
Quoted 6 lines
I tried legacy patch and re-writing with ioctl-way; doing changes in dpdk port as well in kernel, had to test on quite other hw not only arm64 though! so it will take time for me, I am travelling tomorrow so bit delayed, We'll post patch to lkml and share dpdk-virtio feedback perhaps by Monday.
I posted a query about /dev/ioports approach in lkml thread [1], and Arnd suggested to use vfio framework but it looks like vfio too does not map ioresource_io region. Same communicated to Arnd and waiting for his reply.
In mean time I like to ask general question;
- Has anyone tried vfio/non-iommu approach for virtio pmd driver? If not then Is there any plan? Someone planning to take up.
[1] https://lkml.org/lkml/2015/12/23/145
Re: [PATCH] eal: map io resources for non x86 architectures
Hi Santosh,
Quoted 45 lines
Quoted 36 lines · Santosh Shukla
Quoted 24 lines · Yuanhan Liu
Quoted 13 lines · Santosh Shukla
Quoted 13 lines
Quoted 12 lines
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.Quoted 6 lines
Quoted 3 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
The latter one I already shared old lkml thread, Pl. revisit my v1 0/6 patch [1] and in that refer [2].
Oops, sorry, a bit busy, that I didn't look at it carefully. My bad, anyway.
Quoted 9 lines
Quoted 3 lines
Josh has already proposed to lkml but for some reason thread didn't went far. I can restart that discussion giving dpdk use-case as an example/ requirement.
I had a quick go through of the discussion. Both hpa and Arnd seem to be fine with the ioctl interface on
/dev/port. Have you tried that? And if you want to restart it, ioctl might be a better option than/dev/ioport, judging from the discussion.Quoted 6 lines
I tried legacy patch and re-writing with ioctl-way; doing changes in dpdk port as well in kernel, had to test on quite other hw not only arm64 though! so it will take time for me, I am travelling tomorrow so bit delayed, We'll post patch to lkml and share dpdk-virtio feedback perhaps by Monday.
Quoted 8 lines
I posted a query about
/dev/ioportsapproach in lkml thread [1], and Arnd suggested to use vfio framework but it looks like vfio too does not mapioresource_ioregion. Same communicated to Arnd and waiting for his reply.In mean time I like to ask general question;
- Has anyone tried vfio/non-iommu approach for virtio pmd driver? If not then Is there any plan? Someone planning to take up.
[1] https://lkml.org/lkml/2015/12/23/145
I have submitted a patch to support no-iommu mode, but I'm not aware of anyone trying VFIO-noiommu at all. That's probably expected since it's Christmas/New Year in a lot of places, and everyone is on a break.
That said, I'm not sure I completely understand what is it that you're asking about. The code you're referring to (in vfio_pci.c, line 854 as of kernel 4.3) is checking if a PCI BAR is available for IO (hence checking if the IORESOURCE_MEM bit is set). There isn't any "ioresource_mem" region as far as VFIO is concerned, there are only BARs, ROM, VGA and PCI config regions (linux/vfio.h, line 314 as of kernel 4.3). So if you're missing some PCI regions for VFIO to map, they would first need to be added to VFIO kernel implementation before they can be used by DPDK. That is, unless I'm misunderstanding something :)
Thanks,
Anatoly
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 51 lines · Anatoly
Hi Santosh,
Quoted 49 lines
Quoted 36 lines · Santosh Shukla
Quoted 24 lines · Yuanhan Liu
Quoted 13 lines · Santosh Shukla
Quoted 13 lines
Quoted 12 lines
I guess we have done enough evaluation / investigation that suggest - so to map iopci region to userspace in arch agnostic-way -
# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.Quoted 6 lines
Quoted 3 lines
Maybe you could propose the two to lkml, to get some feedbacks from those kernel/ARM gurus? Please cc me if you do so.
The latter one I already shared old lkml thread, Pl. revisit my v1 0/6 patch [1] and in that refer [2].
Oops, sorry, a bit busy, that I didn't look at it carefully. My bad, anyway.
Quoted 9 lines
Quoted 3 lines
Josh has already proposed to lkml but for some reason thread didn't went far. I can restart that discussion giving dpdk use-case as an example/ requirement.
I had a quick go through of the discussion. Both hpa and Arnd seem to be fine with the ioctl interface on
/dev/port. Have you tried that? And if you want to restart it, ioctl might be a better option than/dev/ioport, judging from the discussion.Quoted 6 lines
I tried legacy patch and re-writing with ioctl-way; doing changes in dpdk port as well in kernel, had to test on quite other hw not only arm64 though! so it will take time for me, I am travelling tomorrow so bit delayed, We'll post patch to lkml and share dpdk-virtio feedback perhaps by Monday.
I posted a query about
/dev/ioportsapproach in lkml thread [1], and Arnd suggested to use vfio framework but it looks like vfio too does not mapioresource_ioregion. Same communicated to Arnd and waiting for his reply.
Quoted 8 lines
Quoted 4 lines
In mean time I like to ask general question;
- Has anyone tried vfio/non-iommu approach for virtio pmd driver? If not then Is there any plan? Someone planning to take up.
[1] https://lkml.org/lkml/2015/12/23/145I have submitted a patch to support no-iommu mode, but I'm not aware of anyone trying VFIO-noiommu at all. That's probably expected since it's Christmas/New Year in a lot of places, and everyone is on a break.
That said, I'm not sure I completely understand what is it that you're asking about. The code you're referring to (in
vfio_pci.c, line 854 as of kernel 4.3) is checking if a PCI BAR is available for IO (hence checking if theIORESOURCE_MEM
Thanks for reply! You comment might help to move this discuss to next level.
Look at kernel/resource.c, it exports two symbol ioport_resource and iomem_resource and sets appropriate flag type i.e.. IORESOURCE_IO and IORESOURCE_MEM. In virtio-net case; it creates both pci region i.e.. _io bar and _mem bar. dpdk virtio pmd driver (<= 0.95 virtio spec) uses pci _io bar region for device initialization as virtio headers are locate at pci _io bar region. Since it uses pci _iobar region so likely it update pci_resource.[index].flag = IORESOURCE_IO. and vfio mmap function wont handle ioresource_io (i guess). And that is why I asked same to lkml thread.
bit is set). There isn't any "ioresource_mem" region as far as VFIO is concerned, there are only BARs, ROM, VGA and PCI
config regions (linux/vfio.h, line 314 as of kernel 4.3). So if you're missing some PCI regions for VFIO to map, they would first need to be added to VFIO kernel implementation before they can be used by DPDK. That is, unless I'm misunderstanding something :)
Quoted 1 line
Agree. As mentioned above, I guess ioresource_io pci bar implementation missing in vfio kernel? but before adding code support in kernel I would like to hear from experts example, You, Alex! (looping alex)
Quoted 2 lines
Thanks,
Anatoly
Re: [PATCH] eal: map io resources for non x86 architectures
Hi Santosh,
Quoted 8 lines
Look at
kernel/resource.c, it exports two symbolioport_resourceandiomem_resourceand sets appropriate flag type i.e..IORESOURCE_IOandIORESOURCE_MEM. In virtio-net case; it creates both pci region i.e.._iobar and_membar. dpdk virtio pmd driver (<= 0.95 virtio spec) uses pci_iobar region for device initialization as virtio headers are locate at pci_iobar region. Since it uses pci_iobarregion so likely it update pci_resource.[index].flag =IORESOURCE_IO. and vfio mmap function wont handleioresource_io(i guess). And that is why I asked same to lkml thread.
Yes, I can see that this is what I was misunderstanding (that IORESOURCE_IO isn't a BAR but rather a flag). Technically, if you also set IORESOURCE_MEM along with IORESOURCE_IO, then the BAR would be mapped by VFIO, but this sounds like a dangerous hack :) other than that, yes, I'm afraid it's up to kernel guys to add support for it. Once done, provided IO BARs are meant to be worked with the same way as MEM BARs, there's a good chance it would work out of the box with DPDK.
Thanks,
Anatoly
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 11 lines · Anatoly
Hi Santosh,
Quoted 8 lines
Look at
kernel/resource.c, it exports two symbolioport_resourceandiomem_resourceand sets appropriate flag type i.e..IORESOURCE_IOandIORESOURCE_MEM. In virtio-net case; it creates both pci region i.e.._iobar and_membar. dpdk virtio pmd driver (<= 0.95 virtio spec) uses pci_iobar region for device initialization as virtio headers are locate at pci_iobar region. Since it uses pci_iobarregion so likely it update pci_resource.[index].flag =IORESOURCE_IO. and vfio mmap function wont handleioresource_io(i guess). And that is why I asked same to lkml thread.
Quoted 2 lines
Yes, I can see that this is what I was misunderstanding (that
IORESOURCE_IOisn't a BAR but rather a flag). Technically, if you also setIORESOURCE_MEMalong withIORESOURCE_IO, then the BAR would be mapped by VFIO, but this sounds like a dangerous hack :) other than that, yes, I'm afraid it's up to kernel guys to add support for it. Once done, provided IO BARs are meant to be worked with the same way as MEM BARs, there's a good chance it would work out of the box with DPDK.
I guess so, I'll give it a try; although before that I need to port / use your vfio/noiommu patch for virtio pmd driver and perhaps do dependant changes, I will post my test feedback.
Thanks
Quoted 2 lines
Thanks,
Anatoly
Re: [PATCH] eal: map io resources for non x86 architectures
In reply to Santosh ShuklaQuoted 116 lines · Santosh Shukla
Quoted 84 lines · Anatoly
Hi Santosh,
Quoted 71 lines
Quoted 50 lines · Santosh Shukla
Quoted 39 lines · Yuanhan Liu
Quoted 18 lines · Santosh Shukla
Quoted 18 lines
Quoted 17 lines
I guess we have done enough evaluation / investigation that
suggest - so to map iopci region to userspace in arch agnostic-way -# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.Quoted 8 lines
Quoted 4 lines
Maybe you could propose the two to lkml, to get some feedbacks
from those kernel/ARM gurus? Please cc me if you do so.The latter one I already shared old lkml thread, Pl. revisit my v1
0/6 patch [1] and in that refer [2].Oops, sorry, a bit busy, that I didn't look at it carefully. My bad,
anyway.Quoted 5 lines
Josh has already proposed to lkml but for some reason thread didn't
went far. I can restart that discussion giving dpdk use- case as an
example/ requirement.Quoted 8 lines
I had a quick go through of the discussion. Both hpa and Arnd seem to
be fine with the ioctl interface on/dev/port. Have you tried that?
And if you want to restart it, ioctl might be a better option than/dev/ioport, judging from the discussion.Quoted 10 lines
I tried legacy patch and re-writing with ioctl-way; doing changes in
dpdk port as well in kernel, had to test on quite other hw not only
arm64 though! so it will take time for me, I am travelling tomorrow so
bit delayed, We'll post patch to lkml and share dpdk-virtio feedback
perhaps by Monday.I posted a query about
/dev/ioportsapproach in lkml thread [1], and Arnd
suggested to use vfio framework but it looks like vfio too does not mapioresource_ioregion. Same communicated to Arnd and waiting for his reply.Quoted 5 lines
In mean time I like to ask general question;
- Has anyone tried vfio/non-iommu approach for virtio pmd driver? If not
then Is there any plan? Someone planning to take up.
[1] https://lkml.org/lkml/2015/12/23/145I have submitted a patch to support no-iommu mode, but I'm not aware of anyone trying VFIO-noiommu at all. That's probably expected since it's Christmas/New Year in a lot of places, and everyone is on a break.
Quoted 4 lines
That said, I'm not sure I completely understand what is it that you're asking about. The code you're referring to (in
vfio_pci.c, line 854 as of kernel 4.3) is checking if a PCI BAR is available for IO (hence checking if theIORESOURCE_MEMThanks for reply! You comment might help to move this discuss to next level.
Look at
kernel/resource.c, it exports two symbolioport_resourceandiomem_resourceand sets appropriate flag type i.e..IORESOURCE_IOandIORESOURCE_MEM. In virtio-net case; it creates both pci region i.e.._iobar and_membar. dpdk virtio pmd driver (<= 0.95 virtio spec) uses pci_iobar region for device initialization as virtio headers are locate at pci_iobar region. Since it uses pci_iobarregion so likely it update pci_resource.[index].flag = IORESOURCE_IO. and vfio mmap function wont handleioresource_io(i guess). And that is why I asked same to lkml thread.bit is set). There isn't any "
ioresource_mem" region as far as VFIO is
concerned, there are only BARs, ROM, VGA and PCI
config regions (linux/vfio.h, line 314 as of kernel 4.3). So if you're
missing some PCI regions for VFIO to map, they would first need to be added to VFIO kernel implementation before they can be used by DPDK. That is, unless I'm misunderstanding something :)Quoted 1 line
Quoted 4 lines
Agree. As mentioned above, I guess
ioresource_iopci bar implementation missing in vfio kernel? but before adding code support in kernel I would like to hear from experts example, You, Alex! (looping alex)
MMIO and I/O port space are simply regions as far as VFIO is concerned. The userspace API supports the concept of I/O port regions that can be mmap'd by userspace, but the implementation does not since I/O port regions cannot be mmap'd on x86. Someone needs to propose some code for vfio-pci to support it. Thanks,
Alex
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 122 lines · Alex Williamson
Quoted 116 lines · Santosh Shukla
Quoted 84 lines · Anatoly
Hi Santosh,
Quoted 71 lines
Quoted 50 lines · Santosh Shukla
Quoted 39 lines · Yuanhan Liu
Quoted 18 lines · Santosh Shukla
Quoted 18 lines
Quoted 17 lines
I guess we have done enough evaluation / investigation that
suggest - so to map iopci region to userspace in arch agnostic-way -# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.Quoted 8 lines
Quoted 4 lines
Maybe you could propose the two to lkml, to get some feedbacks
from those kernel/ARM gurus? Please cc me if you do so.The latter one I already shared old lkml thread, Pl. revisit my v1
0/6 patch [1] and in that refer [2].Oops, sorry, a bit busy, that I didn't look at it carefully. My bad,
anyway.Quoted 5 lines
Josh has already proposed to lkml but for some reason thread didn't
went far. I can restart that discussion giving dpdk use- case as an
example/ requirement.Quoted 8 lines
I had a quick go through of the discussion. Both hpa and Arnd seem to
be fine with the ioctl interface on/dev/port. Have you tried that?
And if you want to restart it, ioctl might be a better option than/dev/ioport, judging from the discussion.Quoted 10 lines
I tried legacy patch and re-writing with ioctl-way; doing changes in
dpdk port as well in kernel, had to test on quite other hw not only
arm64 though! so it will take time for me, I am travelling tomorrow so
bit delayed, We'll post patch to lkml and share dpdk-virtio feedback
perhaps by Monday.I posted a query about
/dev/ioportsapproach in lkml thread [1], and Arnd
suggested to use vfio framework but it looks like vfio too does not mapioresource_ioregion. Same communicated to Arnd and waiting for his reply.Quoted 5 lines
In mean time I like to ask general question;
- Has anyone tried vfio/non-iommu approach for virtio pmd driver? If not
then Is there any plan? Someone planning to take up.
[1] https://lkml.org/lkml/2015/12/23/145I have submitted a patch to support no-iommu mode, but I'm not aware of anyone trying VFIO-noiommu at all. That's probably expected since it's Christmas/New Year in a lot of places, and everyone is on a break.
Quoted 4 lines
That said, I'm not sure I completely understand what is it that you're asking about. The code you're referring to (in
vfio_pci.c, line 854 as of kernel 4.3) is checking if a PCI BAR is available for IO (hence checking if theIORESOURCE_MEMThanks for reply! You comment might help to move this discuss to next level.
Look at
kernel/resource.c, it exports two symbolioport_resourceandiomem_resourceand sets appropriate flag type i.e..IORESOURCE_IOandIORESOURCE_MEM. In virtio-net case; it creates both pci region i.e.._iobar and_membar. dpdk virtio pmd driver (<= 0.95 virtio spec) uses pci_iobar region for device initialization as virtio headers are locate at pci_iobar region. Since it uses pci_iobarregion so likely it update pci_resource.[index].flag =IORESOURCE_IO. and vfio mmap function wont handleioresource_io(i guess). And that is why I asked same to lkml thread.bit is set). There isn't any "
ioresource_mem" region as far as VFIO is
concerned, there are only BARs, ROM, VGA and PCI
config regions (linux/vfio.h, line 314 as of kernel 4.3). So if you're
missing some PCI regions for VFIO to map, they would first need to be added to VFIO kernel implementation before they can be used by DPDK. That is, unless I'm misunderstanding something :)Quoted 1 line
Quoted 4 lines
Agree. As mentioned above, I guess
ioresource_iopci bar implementation missing in vfio kernel? but before adding code support in kernel I would like to hear from experts example, You, Alex! (looping alex)
Quoted 6 lines
MMIO and I/O port space are simply regions as far as VFIO is concerned.
The userspace API supports the concept of I/O port regions that can be
mmap'd by userspace, but the implementation does not since I/O port regions cannot be mmap'd on x86. Someone needs to propose some code for vfio-pci to support it. Thanks,
I will work on this and post an RFC soon to LKML, That RFC targetted to map IOport region for non-x86 platform in particular. Thanks for confirming the vfio behaviour.
Quoted 1 line
Alex
Re: [PATCH] eal: map io resources for non x86 architectures
Quoted 131 lines · Santosh Shukla
Quoted 122 lines · Alex Williamson
Quoted 116 lines · Santosh Shukla
Quoted 84 lines · Anatoly
Hi Santosh,
Quoted 71 lines
Quoted 50 lines · Santosh Shukla
Quoted 39 lines · Yuanhan Liu
Quoted 18 lines · Santosh Shukla
Quoted 18 lines
Quoted 17 lines
I guess we have done enough evaluation / investigation that
suggest - so to map iopci region to userspace in arch agnostic-way -# either we need to modify kernel - Make sure all the non-x86 arch to support mapping for iopci region (i.e. pci_mmap_page_range). I don;t think its a correct approach though. or - include /dev/ioport char-mem device file who could do more than byte operation, Note that this implementation does not exist in kernel. I could send an RFC to lkml.Quoted 8 lines
Quoted 4 lines
Maybe you could propose the two to lkml, to get some feedbacks
from those kernel/ARM gurus? Please cc me if you do so.The latter one I already shared old lkml thread, Pl. revisit my v1
0/6 patch [1] and in that refer [2].Oops, sorry, a bit busy, that I didn't look at it carefully. My bad,
anyway.Quoted 5 lines
Josh has already proposed to lkml but for some reason thread didn't
went far. I can restart that discussion giving dpdk use- case as an
example/ requirement.Quoted 8 lines
I had a quick go through of the discussion. Both hpa and Arnd seem to
be fine with the ioctl interface on/dev/port. Have you tried that?
And if you want to restart it, ioctl might be a better option than/dev/ioport, judging from the discussion.Quoted 10 lines
I tried legacy patch and re-writing with ioctl-way; doing changes in
dpdk port as well in kernel, had to test on quite other hw not only
arm64 though! so it will take time for me, I am travelling tomorrow so
bit delayed, We'll post patch to lkml and share dpdk-virtio feedback
perhaps by Monday.I posted a query about
/dev/ioportsapproach in lkml thread [1], and Arnd
suggested to use vfio framework but it looks like vfio too does not mapioresource_ioregion. Same communicated to Arnd and waiting for his reply.Quoted 5 lines
In mean time I like to ask general question;
- Has anyone tried vfio/non-iommu approach for virtio pmd driver? If not
then Is there any plan? Someone planning to take up.
[1] https://lkml.org/lkml/2015/12/23/145I have submitted a patch to support no-iommu mode, but I'm not aware of anyone trying VFIO-noiommu at all. That's probably expected since it's Christmas/New Year in a lot of places, and everyone is on a break.
Quoted 4 lines
That said, I'm not sure I completely understand what is it that you're asking about. The code you're referring to (in
vfio_pci.c, line 854 as of kernel 4.3) is checking if a PCI BAR is available for IO (hence checking if theIORESOURCE_MEMThanks for reply! You comment might help to move this discuss to next level.
Look at
kernel/resource.c, it exports two symbolioport_resourceandiomem_resourceand sets appropriate flag type i.e..IORESOURCE_IOandIORESOURCE_MEM. In virtio-net case; it creates both pci region i.e.._iobar and_membar. dpdk virtio pmd driver (<= 0.95 virtio spec) uses pci_iobar region for device initialization as virtio headers are locate at pci_iobar region. Since it uses pci_iobarregion so likely it update pci_resource.[index].flag =IORESOURCE_IO. and vfio mmap function wont handleioresource_io(i guess). And that is why I asked same to lkml thread.bit is set). There isn't any "
ioresource_mem" region as far as VFIO is
concerned, there are only BARs, ROM, VGA and PCI
config regions (linux/vfio.h, line 314 as of kernel 4.3). So if you're
missing some PCI regions for VFIO to map, they would first need to be added to VFIO kernel implementation before they can be used by DPDK. That is, unless I'm misunderstanding something :)Quoted 1 line
Quoted 4 lines
Agree. As mentioned above, I guess
ioresource_iopci bar implementation missing in vfio kernel? but before adding code support in kernel I would like to hear from experts example, You, Alex! (looping alex)Quoted 6 lines
MMIO and I/O port space are simply regions as far as VFIO is concerned.
The userspace API supports the concept of I/O port regions that can be
mmap'd by userspace, but the implementation does not since I/O port regions cannot be mmap'd on x86. Someone needs to propose some code for vfio-pci to support it. Thanks,
Quoted 4 lines
I will work on this and post an RFC soon to LKML, That RFC targetted to map IOport region for non-x86 platform in particular. Thanks for confirming the vfio behaviour.
Some update:
Patches used for setup -
- Used Alex(s) vfio-noiommu linux-next patch
- then used Anatoly(s) vfio-noiommu dpdk patch [1]
- Added ioport pci bar map code support in kernel
- Did similar change at dpdk(s) eal_pci_vfio.c file
I could able to run testpmd on virtio-net dpdk's pmd driver.. I am cleaning the patches / changes in kernel and dpdk, soon posting the v3 patchset..
Thanks for the input!
[1] http://dpdk.org/dev/patchwork/patch/9619/
Quoted 1 line
Quoted 1 line
Alex
Re: [PATCH] eal: map io resources for non x86 architectures
In reply to David MarchandQuoted 40 lines · David Marchand
x86 requires a special set of instructions to access ioports, but other architectures let you remap io resources.
So let eal remap io resources by acceptingIORESOURCE_IOflag for architectures other than x86.Signed-off-by David Marchand <[email protected]>--- lib/librte_eal/common/include/rte_pci.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_pci.c | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-)lib/librte_eal/common/include/rte_pci.h +2
-1@@ -105,7 +105,8 @@ extern struct pci_device_list pci_device_list; /**< Global list of PCI devices./** Nb. of values in PCI resource format. */ #define PCI_RESOURCE_FMT_NVAL 3 -/** IO resource type: memory address space */ +/** IO resource type: */ +#define IORESOURCE_IO 0x00000100#define IORESOURCE_MEM 0x00000200/** lib/librte_eal/linuxapp/eal/eal_pci.c +1
-6@@ -236,12 +236,21 @@ pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) goto error; } -if (flags &IORESOURCE_MEM ) { - dev->mem_resource[i].phys_addr = phys_addr; - dev->mem_resource[i].len = end_addr - phys_addr +1 ; -/* not mapped for now */ - dev->mem_resource[i].addr =NULL ; - } +/* we only care about IORESOURCE_IO or IORESOURCE_MEM */
lib/librte_eal/linuxapp/eal/eal_pci.c pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) · line 249
Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_pci.c +10
-0+if (!(flags &IORESOURCE_IO ) && + !(flags &IORESOURCE_MEM )) +continue ; + +#if defined(RTE_ARCH_X86_64 ) || defined(RTE_ARCH_I686 ) +/* x86 can not remap ioports, so skip it, remapping code will +* look at dev->mem_resource[i].phys_addr == 0 and skip it */ +if (flags &IORESOURCE_IO ) +continue ; +#endif
As a tangential comment: We maybe could look to make certain preprocessor defines available as C globals as well. There is no reason that the ifdef here could not be implemented as a runtime check in C code.
/Bruce
Re: [PATCH] eal: map io resources for non x86 architectures
Bruce,
Quoted 6 lines · Bruce Richardson
Review
Quoted 3 lines
(quoted diff) +2
-0+#if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) + /* x86 can not remap ioports, so skip it, remapping codewill
Quoted 1 line
+ * look at dev->mem_resource[i].phys_addr == 0 and skip it
*/
Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_pci.c pci_parse_sysfs_resource(const char *filename, struct rte_pci_device *dev) · line 249
Quoted 3 lines
lib/librte_eal/linuxapp/eal/eal_pci.c +3
-0+if (flags &IORESOURCE_IO ) +continue ; +#endif As a tangential comment: We maybe could look to make certain preprocessor defines available as C globals as well. There is no reason that the ifdef here
could not be implemented as a runtime check in C code.
Well, instead of having the same information as the preprocessor define, maybe some capability per arch/cpu would be better "arch supports io remap". Maybe we can extend the cpuflags ?
Signature · 1 line
David Marchand