Skip to contentSkip to conversation

virtio_pci: use PAGE_SIZE for pci vring align

PATCH In review Xianting Tian 3 participants 3 messages Nov 10, 2022 virtio core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio_pci: use PAGE_SIZE for pci vring align

As the comments of VIRTIO_PCI_VRING_ALIGN shows, we should use PAGE_SZIE not the hard code 4096.

---
 include/uapi/linux/virtio_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/virtio_pci.h +1 -1
index f703afc7ad31..ed5f678c682b 100644
@@ -90,7 +90,7 @@
 
 /* The alignment to use between consumer and producer parts of vring.
  * x86 pagesize again. */
-#define VIRTIO_PCI_VRING_ALIGN		4096
+#define VIRTIO_PCI_VRING_ALIGN		PAGE_SIZE
 
 #endif /* VIRTIO_PCI_NO_LEGACY */
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 14 lines · Xianting Tian

As the comments of VIRTIO_PCI_VRING_ALIGN shows, we should use PAGE_SZIE not the hard code 4096.

---
 include/uapi/linux/virtio_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/virtio_pci.h +0 -0
index f703afc7ad31..ed5f678c682b 100644

include/uapi/linux/virtio_pci.h line 92

Quoted 3 lines
include/uapi/linux/virtio_pci.h +0 -0
@@ -90,7 +90,7 @@
 
 /* The alignment to use between consumer and producer parts of vring.
  * x86 pagesize again. */

See the comment above, PAGE_SIZE varies among archs.

Thanks

Quoted 8 lines
include/uapi/linux/virtio_pci.h +1 -2
-#define VIRTIO_PCI_VRING_ALIGN         4096
+#define VIRTIO_PCI_VRING_ALIGN         PAGE_SIZE
 
 #endif /* VIRTIO_PCI_NO_LEGACY */
 
--

2.17.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#2 lore raw
In reply to Xianting Tian
Quoted 4 lines · Xianting Tian

As the comments of VIRTIO_PCI_VRING_ALIGN shows, we should use PAGE_SZIE not the hard code 4096.

where does it show this?
what is the problem you are trying to solve?
PAGE_SIZE is generally not valid in uapi

Quoted 19 lines
---
 include/uapi/linux/virtio_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/virtio_pci.h +1 -1
index f703afc7ad31..ed5f678c682b 100644
@@ -90,7 +90,7 @@
 
 /* The alignment to use between consumer and producer parts of vring.
  * x86 pagesize again. */
-#define VIRTIO_PCI_VRING_ALIGN		4096
+#define VIRTIO_PCI_VRING_ALIGN		PAGE_SIZE
 
 #endif /* VIRTIO_PCI_NO_LEGACY */
 
Signature · 1 line
2.17.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization