[dpdk-dev] [PATCH v3 09/12] virtio: vfio: Enable RTE_PCI_DRV_NEED_MAPPING flag in driver
On Tue, Jan 12, 2016 at 12:44 PM, Yuanhan Liu wrote: > On Sat, Jan 09, 2016 at 06:08:46PM +0530, Santosh Shukla wrote: >> On Thu, Jan 7, 2016 at 11:50 PM, Stephen Hemminger >> wrote: >> > On Thu, 7 Jan 2016 22:03:06 +0530 >> > Santosh Shukla wrote: >> > >> >> +#ifdef RTE_EAL_VFIO >> >> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | >> >> RTE_PCI_DRV_DETACHABLE, >> >> +#else >> >> .drv_flags = RTE_PCI_DRV_DETACHABLE, >> >> +#endif >> > >> > Since VFIO is determined at runtime not compile time, the flags should >> > be updated at runtime not compile time. >> > >> > >> In general, Yes, Its a wrong approach i..e. Wrapping __need_mapping >> flag only for vfio case. I am thinking to add vfio parser routine >> something similar to virtio_xxx_xx_uio_xx() / virtio_xx_xx_ioport() >> currently exist. This will remove RTE_EAL_VFIO ifdef clutter for this >> patch and [08/12] patch and also virtio pmd driver can then initialize >> device for vfio mode.. >> >> _but_ I still need _MAPPING flag enabled for in virtio driver as >> because for vfio case - I want vfio_xx_mmap() routine to create vfio >> container/group_id and then create vfio_dev_fd for each virtio-net-pci >> interface. > > I'm thinking my following patch will help: > > http://dpdk.org/dev/patchwork/patch/9814/ > Yes, It works, so wont need NEED_MAPPING flag, Sending v4 patch series rebased on this patch.. > --yliu > >> Let me know my approach aligned to your suggestion.
[dpdk-dev] [PATCH v3 09/12] virtio: vfio: Enable RTE_PCI_DRV_NEED_MAPPING flag in driver
On Sat, Jan 09, 2016 at 06:08:46PM +0530, Santosh Shukla wrote: > On Thu, Jan 7, 2016 at 11:50 PM, Stephen Hemminger > wrote: > > On Thu, 7 Jan 2016 22:03:06 +0530 > > Santosh Shukla wrote: > > > >> +#ifdef RTE_EAL_VFIO > >> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | > >> RTE_PCI_DRV_DETACHABLE, > >> +#else > >> .drv_flags = RTE_PCI_DRV_DETACHABLE, > >> +#endif > > > > Since VFIO is determined at runtime not compile time, the flags should > > be updated at runtime not compile time. > > > > > In general, Yes, Its a wrong approach i..e. Wrapping __need_mapping > flag only for vfio case. I am thinking to add vfio parser routine > something similar to virtio_xxx_xx_uio_xx() / virtio_xx_xx_ioport() > currently exist. This will remove RTE_EAL_VFIO ifdef clutter for this > patch and [08/12] patch and also virtio pmd driver can then initialize > device for vfio mode.. > > _but_ I still need _MAPPING flag enabled for in virtio driver as > because for vfio case - I want vfio_xx_mmap() routine to create vfio > container/group_id and then create vfio_dev_fd for each virtio-net-pci > interface. I'm thinking my following patch will help: http://dpdk.org/dev/patchwork/patch/9814/ --yliu > Let me know my approach aligned to your suggestion.
[dpdk-dev] [PATCH v3 09/12] virtio: vfio: Enable RTE_PCI_DRV_NEED_MAPPING flag in driver
On Thu, Jan 7, 2016 at 11:50 PM, Stephen Hemminger wrote: > On Thu, 7 Jan 2016 22:03:06 +0530 > Santosh Shukla wrote: > >> +#ifdef RTE_EAL_VFIO >> + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, >> +#else >> .drv_flags = RTE_PCI_DRV_DETACHABLE, >> +#endif > > Since VFIO is determined at runtime not compile time, the flags should > be updated at runtime not compile time. > > In general, Yes, Its a wrong approach i..e. Wrapping __need_mapping flag only for vfio case. I am thinking to add vfio parser routine something similar to virtio_xxx_xx_uio_xx() / virtio_xx_xx_ioport() currently exist. This will remove RTE_EAL_VFIO ifdef clutter for this patch and [08/12] patch and also virtio pmd driver can then initialize device for vfio mode.. _but_ I still need _MAPPING flag enabled for in virtio driver as because for vfio case - I want vfio_xx_mmap() routine to create vfio container/group_id and then create vfio_dev_fd for each virtio-net-pci interface. Let me know my approach aligned to your suggestion.
[dpdk-dev] [PATCH v3 09/12] virtio: vfio: Enable RTE_PCI_DRV_NEED_MAPPING flag in driver
Flag required for vfio case, It helps to update vfio_dev_fd for each virtio net interface. Signed-off-by: Santosh Shukla --- drivers/net/virtio/virtio_ethdev.c |4 1 file changed, 4 insertions(+) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 9ca99d5..8d55049 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -1447,7 +1447,11 @@ static struct eth_driver rte_virtio_pmd = { .pci_drv = { .name = "rte_virtio_pmd", .id_table = pci_id_virtio_map, +#ifdef RTE_EAL_VFIO + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, +#else .drv_flags = RTE_PCI_DRV_DETACHABLE, +#endif }, .eth_dev_init = eth_virtio_dev_init, .eth_dev_uninit = eth_virtio_dev_uninit, -- 1.7.9.5
[dpdk-dev] [PATCH v3 09/12] virtio: vfio: Enable RTE_PCI_DRV_NEED_MAPPING flag in driver
On Thu, 7 Jan 2016 22:03:06 +0530 Santosh Shukla wrote: > +#ifdef RTE_EAL_VFIO > + .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_DETACHABLE, > +#else > .drv_flags = RTE_PCI_DRV_DETACHABLE, > +#endif Since VFIO is determined at runtime not compile time, the flags should be updated at runtime not compile time.