On Fri, Oct 18, 2019 at 10:33:47AM +0200, David Marchand wrote: > On Fri, Oct 18, 2019 at 10:19 AM Tiwei Bie <tiwei....@intel.com> wrote: > > On Thu, Oct 17, 2019 at 01:56:28PM +0200, David Marchand wrote: > > > On x86, iopl permissions are only needed when the virtio devices are > > > bound to a uio kernel module. > > > > > > When running a dpdk application as non root, the virtio driver was > > > refusing to register because of this check while it could work when > > > binding the device to vfio (requires to have a vIOMMU configured). > > > > > > We still need to call rte_eal_iopl_init() in the constructor so that > > > the interrupt thread would inherit this permission in the case it could > > > be used with UIO later. > > > Log a warning message for the user to understand what is wrong. > > > > > > Signed-off-by: David Marchand <david.march...@redhat.com> > > > --- > > > drivers/net/virtio/virtio_ethdev.c | 8 ++------ > > > 1 file changed, 2 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/net/virtio/virtio_ethdev.c > > > b/drivers/net/virtio/virtio_ethdev.c > > > index 7261109..3506ca0 100644 > > > --- a/drivers/net/virtio/virtio_ethdev.c > > > +++ b/drivers/net/virtio/virtio_ethdev.c > > > @@ -1995,11 +1995,6 @@ exit: > > > static int eth_virtio_pci_probe(struct rte_pci_driver *pci_drv > > > __rte_unused, > > > struct rte_pci_device *pci_dev) > > > { > > > - if (rte_eal_iopl_init() != 0) { > > > - PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio > > > PMD"); > > > - return 1; > > > - } > > > - > > > /* virtio pmd skips probe if device needs to work in vdpa mode */ > > > if (vdpa_mode_selected(pci_dev->device.devargs)) > > > return 1; > > > @@ -2031,7 +2026,8 @@ static struct rte_pci_driver rte_virtio_pmd = { > > > > > > RTE_INIT(rte_virtio_pmd_init) > > > { > > > - rte_eal_iopl_init(); > > > + if (rte_eal_iopl_init() != 0) > > > + PMD_INIT_LOG(WARNING, "IOPL call failed - virtio devices > > > won't be functional if bound to UIO drivers"); > > > > Basically this will undo what below commit did, i.e. > > annoying log will show again. > > > > https://github.com/DPDK/dpdk/commit/705dced4a72a1053368c84c4b68f04f028a78b30 > > Yes.. true. > I wanted to keep a trace for debug, so maybe lower this to debug > level, or just drop this message. > > > > > > Maybe it's better to print this error when we really > > need the port IO (legacy device): > > virtio calls rte_pci_ioport_map, so I suppose we can change the log > level to ERR in the first patch of this series: > http://patchwork.dpdk.org/patch/61370/ > > And I suppose I could add some context in this log, like the device name.
Sounds like a good idea to me. Thanks, Tiwei > > > > > https://github.com/DPDK/dpdk/blob/31b798a6f08e9b333b94b8bb26910209aa810b73/drivers/net/virtio/virtio_pci.c#L679-L680 > > https://github.com/DPDK/dpdk/blob/31b798a6f08e9b333b94b8bb26910209aa810b73/drivers/net/virtio/virtio_ethdev.c#L1834-L1835 > > > -- > David Marchand