Skip to contentSkip to conversation

net/virtio: support modern device id

PATCH In review Jason Wang 4 participants 9 messages Sep 28, 2016 – Oct 20, 2016 Network drivers

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH v2 1/2 net/virtio: support modern device id

Add modern device id and rename VIRTIO_PCI_DEVICEID_MIN to VIRTIO_PCI_LEGACY_DEVICEID_NET. While at it, remove unused macros too.

---
 drivers/net/virtio/virtio_ethdev.c | 3 ++-
 drivers/net/virtio/virtio_pci.h    | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/virtio/virtio_ethdev.c +2 -1
index ef0d6ee..bb6181d 100644
@@ -103,7 +103,8 @@ static int virtio_dev_queue_stats_mapping_set(
  * The set of PCI devices this driver supports
  */
 static const struct rte_pci_id pci_id_virtio_map[] = {
-	{ RTE_PCI_DEVICE(VIRTIO_PCI_VENDORID, VIRTIO_PCI_DEVICEID_MIN) },
+	{ RTE_PCI_DEVICE(VIRTIO_PCI_VENDORID, VIRTIO_PCI_LEGACY_DEVICEID_NET) },
+	{ RTE_PCI_DEVICE(VIRTIO_PCI_VENDORID, VIRTIO_PCI_MODERN_DEVICEID_NET) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
drivers/net/virtio/virtio_pci.h +2 -2
index dd7693f..3430a39 100644
@@ -44,8 +44,8 @@ struct virtnet_ctl;
 
 /* VirtIO PCI vendor/device ID. */
 #define VIRTIO_PCI_VENDORID     0x1AF4
-#define VIRTIO_PCI_DEVICEID_MIN 0x1000
-#define VIRTIO_PCI_DEVICEID_MAX 0x103F
+#define VIRTIO_PCI_LEGACY_DEVICEID_NET 0x1000
+#define VIRTIO_PCI_MODERN_DEVICEID_NET 0x1041
 
 /* VirtIO ABI version, this must match exactly. */
 #define VIRTIO_PCI_ABI_VERSION 0
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 2/2 virtio: support IOMMU platform

Negotiate VIRTIO_F_IOMMU_PLATFORM to have IOMMU support.

---
Changes from v1:
- remove unnecessary NEED_MAPPING flag

---
 drivers/net/virtio/virtio_ethdev.h | 3 ++-
 drivers/net/virtio/virtio_pci.h    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_ethdev.h +2 -1
index 2ecec6e..04a06e2 100644
@@ -63,7 +63,8 @@
 	 1u << VIRTIO_NET_F_CTRL_RX	  |	\
 	 1u << VIRTIO_NET_F_CTRL_VLAN	  |	\
 	 1u << VIRTIO_NET_F_MRG_RXBUF	  |	\
-	 1ULL << VIRTIO_F_VERSION_1)
+	 1ULL << VIRTIO_F_VERSION_1       |	\
+	 1ULL << VIRTIO_F_IOMMU_PLATFORM )
 
 /*
  * CQ function prototype
drivers/net/virtio/virtio_pci.h +2 -1
index 3430a39..0aa0015 100644
@@ -138,6 +138,7 @@ struct virtnet_ctl;
 #define VIRTIO_RING_F_INDIRECT_DESC	28
 
 #define VIRTIO_F_VERSION_1		32
+#define VIRTIO_F_IOMMU_PLATFORM	33
 
 /*
  * Some VirtIO feature bits (currently bits 28 through 31) are
@@ -145,7 +146,7 @@ struct virtnet_ctl;
  * rest are per-device feature bits.
  */
 #define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END   32
+#define VIRTIO_TRANSPORT_F_END   34
 
 /* The Guest publishes the used index for which it expects an interrupt
  * at the end of the avail ring. Host should ignore the avail->flags field. */
Signature · 1 line
2.7.4
Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH V2 2/2] virtio: support IOMMU platform

In reply to Jason Wang
Quoted 10 lines · Jason Wang

Negotiate VIRTIO_F_IOMMU_PLATFORM to have IOMMU support.

---
Changes from v1:
- remove unnecessary NEED_MAPPING flag

---
 drivers/net/virtio/virtio_ethdev.h | 3 ++-
 drivers/net/virtio/virtio_pci.h    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Thanks,
Maxime

#3 lore raw

Re: [PATCH V2 2/2] virtio: support IOMMU platform

In reply to Jason Wang
Quoted 6 lines · Jason Wang

Negotiate VIRTIO_F_IOMMU_PLATFORM to have IOMMU support.

---
Changes from v1:
- remove unnecessary NEED_MAPPING flag

One thing we probably should do is enable this flag with VFIO but not with UIO or VFIO-noiommu.

Quoted 10 lines
---
 drivers/net/virtio/virtio_ethdev.h | 3 ++-
 drivers/net/virtio/virtio_pci.h    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_ethdev.h +0 -0
index 2ecec6e..04a06e2 100644

drivers/net/virtio/virtio_ethdev.h line 67

Quoted 6 lines
drivers/net/virtio/virtio_ethdev.h +2 -1
@@ -63,7 +63,8 @@
 	 1u << VIRTIO_NET_F_CTRL_RX	  |	\
 	 1u << VIRTIO_NET_F_CTRL_VLAN	  |	\
 	 1u << VIRTIO_NET_F_MRG_RXBUF	  |	\
-	 1ULL << VIRTIO_F_VERSION_1)
+	 1ULL << VIRTIO_F_VERSION_1       |	\
+	 1ULL << VIRTIO_F_IOMMU_PLATFORM )

Space before ) looks kind of ugly.

Quoted 16 lines
drivers/net/virtio/virtio_ethdev.h +0 -0
 /*
  * CQ function prototype
drivers/net/virtio/virtio_pci.h +1 -0
index 3430a39..0aa0015 100644
@@ -138,6 +138,7 @@ struct virtnet_ctl;
 #define VIRTIO_RING_F_INDIRECT_DESC	28
 
 #define VIRTIO_F_VERSION_1		32
+#define VIRTIO_F_IOMMU_PLATFORM	33
 
 /*
  * Some VirtIO feature bits (currently bits 28 through 31) are

drivers/net/virtio/virtio_pci.h struct virtnet_ctl; · line 150

Quoted 6 lines
drivers/net/virtio/virtio_pci.h +1 -1
@@ -145,7 +146,7 @@ struct virtnet_ctl;
  * rest are per-device feature bits.
  */
 #define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END   32
+#define VIRTIO_TRANSPORT_F_END   34
 

This seems unused. Drop it?

Quoted 4 lines
drivers/net/virtio/virtio_pci.h +0 -0
 /* The Guest publishes the used index for which it expects an interrupt
  * at the end of the avail ring. Host should ignore the avail->flags field. */
Signature · 1 line
2.7.4
#4 lore raw

Re: [PATCH V2 2/2] virtio: support IOMMU platform

In reply to Michael S. Tsirkin
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Jason Wang

Negotiate VIRTIO_F_IOMMU_PLATFORM to have IOMMU support.

---
Changes from v1:
- remove unnecessary NEED_MAPPING flag

One thing we probably should do is enable this flag with VFIO but not with UIO or VFIO-noiommu.

Good suggestion. I think we could do that in another patch.

Quoted 5 lines
Quoted 5 lines
---
 drivers/net/virtio/virtio_ethdev.h | 3 ++-
 drivers/net/virtio/virtio_pci.h    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Quoted 13 lines

drivers/net/virtio/virtio_ethdev.h line 67

Quoted 11 lines
drivers/net/virtio/virtio_ethdev.h +2 -1
index 2ecec6e..04a06e2 100644
@@ -63,7 +63,8 @@
 	 1u << VIRTIO_NET_F_CTRL_RX	  |	\
 	 1u << VIRTIO_NET_F_CTRL_VLAN	  |	\
 	 1u << VIRTIO_NET_F_MRG_RXBUF	  |	\
-	 1ULL << VIRTIO_F_VERSION_1)
+	 1ULL << VIRTIO_F_VERSION_1       |	\
+	 1ULL << VIRTIO_F_IOMMU_PLATFORM )

Space before ) looks kind of ugly.

Yes, a bit. I will remove it while apply.

Quoted 6 lines

drivers/net/virtio/virtio_ethdev.h line 70

Quoted 4 lines
drivers/net/virtio/virtio_ethdev.h +1 -1
 #define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END   32
+#define VIRTIO_TRANSPORT_F_END   34
 

This seems unused. Drop it?

Indeed. I will submit a patch to remove both (_START and _END).

	--yliu
author
#6 lore raw

Re: [PATCH V2 2/2] virtio: support IOMMU platform

In reply to Michael S. Tsirkin
Quoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Jason Wang

Negotiate VIRTIO_F_IOMMU_PLATFORM to have IOMMU support.

---
Changes from v1:
- remove unnecessary NEED_MAPPING flag

One thing we probably should do is enable this flag with VFIO but not with UIO or VFIO-noiommu.

Sounds good, will try do it in next version.

Quoted 5 lines
Quoted 5 lines
---
  drivers/net/virtio/virtio_ethdev.h | 3 ++-
  drivers/net/virtio/virtio_pci.h    | 3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)
Quoted 12 lines

drivers/net/virtio/virtio_ethdev.h line 67

Quoted 11 lines
drivers/net/virtio/virtio_ethdev.h +2 -1
index 2ecec6e..04a06e2 100644
@@ -63,7 +63,8 @@
  	 1u << VIRTIO_NET_F_CTRL_RX	  |	\
  	 1u << VIRTIO_NET_F_CTRL_VLAN	  |	\
  	 1u << VIRTIO_NET_F_MRG_RXBUF	  |	\
-	 1ULL << VIRTIO_F_VERSION_1)
+	 1ULL << VIRTIO_F_VERSION_1       |	\
+	 1ULL << VIRTIO_F_IOMMU_PLATFORM )

Space before ) looks kind of ugly.

Will fix this.

Quoted 14 lines
Quoted 14 lines
drivers/net/virtio/virtio_ethdev.h +0 -0
  /*
   * CQ function prototype
drivers/net/virtio/virtio_pci.h +1 -0
index 3430a39..0aa0015 100644
@@ -138,6 +138,7 @@ struct virtnet_ctl;
  #define VIRTIO_RING_F_INDIRECT_DESC	28
 
  #define VIRTIO_F_VERSION_1		32
+#define VIRTIO_F_IOMMU_PLATFORM	33
 
Quoted 10 lines

drivers/net/virtio/virtio_pci.h struct virtnet_ctl; · line 150

Quoted 9 lines
drivers/net/virtio/virtio_pci.h +1 -1
  /*
   * Some VirtIO feature bits (currently bits 28 through 31) are
@@ -145,7 +146,7 @@ struct virtnet_ctl;
   * rest are per-device feature bits.
   */
  #define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END   32
+#define VIRTIO_TRANSPORT_F_END   34
 

This seems unused. Drop it?

Ok.

Quoted 5 lines
Quoted 5 lines
drivers/net/virtio/virtio_pci.h +0 -0
  /* The Guest publishes the used index for which it expects an interrupt
   * at the end of the avail ring. Host should ignore the avail->flags field. */
Signature · 1 line
2.7.4
author
#5 lore raw

Re: [PATCH V2 2/2] virtio: support IOMMU platform

In reply to Yuanhan Liu
Quoted 11 lines · Yuanhan Liu
Quoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Jason Wang

Negotiate VIRTIO_F_IOMMU_PLATFORM to have IOMMU support.

---
Changes from v1:
- remove unnecessary NEED_MAPPING flag

One thing we probably should do is enable this flag with VFIO but not with UIO or VFIO-noiommu.

Good suggestion. I think we could do that in another patch.

Yes.

Quoted 20 lines
Quoted 6 lines
Quoted 6 lines
---
  drivers/net/virtio/virtio_ethdev.h | 3 ++-
  drivers/net/virtio/virtio_pci.h    | 3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)
Quoted 12 lines

drivers/net/virtio/virtio_ethdev.h line 67

Quoted 11 lines
drivers/net/virtio/virtio_ethdev.h +2 -1
index 2ecec6e..04a06e2 100644
@@ -63,7 +63,8 @@
  	 1u << VIRTIO_NET_F_CTRL_RX	  |	\
  	 1u << VIRTIO_NET_F_CTRL_VLAN	  |	\
  	 1u << VIRTIO_NET_F_MRG_RXBUF	  |	\
-	 1ULL << VIRTIO_F_VERSION_1)
+	 1ULL << VIRTIO_F_VERSION_1       |	\
+	 1ULL << VIRTIO_F_IOMMU_PLATFORM )

Space before ) looks kind of ugly.

Yes, a bit. I will remove it while apply.

Quoted 8 lines
Quoted 5 lines

drivers/net/virtio/virtio_ethdev.h line 70

Quoted 4 lines
drivers/net/virtio/virtio_ethdev.h +1 -1
  #define VIRTIO_TRANSPORT_F_START 28
-#define VIRTIO_TRANSPORT_F_END   32
+#define VIRTIO_TRANSPORT_F_END   34
 

This seems unused. Drop it?

Indeed. I will submit a patch to remove both (_START and _END).

	--yliu

Thanks