@@ -129,6 +129,7 @@
struct virtio_pci_cap {
__u8 cap_vndr; /* Generic PCI field: PCI_CAP_ID_VNDR */
__u8 cap_next; /* Generic PCI field: next ptr. */
+ __u8 cap_len; /* Generic PCI field: capability length */
__u8 cfg_type; /* One of the VIRTIO_PCI_CAP_*_CFG. */
__u8 bar; /* Where to find it. */
__le32 offset; /* Offset within bar. */
@@ -154,7 +155,7 @@ struct virtio_pci_common_cfg {
/* About a specific virtqueue. */
__le16 queue_select; /* read-write */
- __le16 queue_size; /* read-write, power of 2. */
+ __le16 queue_size; /* read-write, power of 2, or 0. */
__le16 queue_msix_vector; /* read-write */
__le16 queue_enable; /* read-write */
__le16 queue_notify_off; /* read-only */
- queue size can actually be 0 which is not a power of 2 - fix capability format. PCI spec says: The layout of the information is vendor specific, except that the byte immediately following the “Next” pointer in the capability structure is defined to be a length field. This length field provides the number of bytes in the capability structure (including the ID and Next pointer bytes). Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- This patch is on top of the new layout branch, too include/uapi/linux/virtio_pci.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)