diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2023-10-31 17:02:06 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-11-01 14:31:16 +0100 |
commit | 3503895788d402d6a3814085ed582c364ec3e903 (patch) | |
tree | 7924cd651500b6a72ceca421d9fb2f025e43885e /include | |
parent | vdpa_sim: implement .reset_map support (diff) | |
download | linux-3503895788d402d6a3814085ed582c364ec3e903.tar.xz linux-3503895788d402d6a3814085ed582c364ec3e903.zip |
virtio_pci: move structure to a header
These are guest/host interfaces, so they belong in the header where e.g.
qemu will know to find them.
Note: we added a new structure as opposed to extending existing one
because someone might be relying on the size of the existing structure
staying unchanged. Add a warning to avoid using sizeof.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/virtio_pci_modern.h | 7 | ||||
-rw-r--r-- | include/uapi/linux/virtio_pci.h | 11 |
2 files changed, 11 insertions, 7 deletions
diff --git a/include/linux/virtio_pci_modern.h b/include/linux/virtio_pci_modern.h index d0f2797420f7..a09e13a577a9 100644 --- a/include/linux/virtio_pci_modern.h +++ b/include/linux/virtio_pci_modern.h @@ -5,13 +5,6 @@ #include <linux/pci.h> #include <linux/virtio_pci.h> -struct virtio_pci_modern_common_cfg { - struct virtio_pci_common_cfg cfg; - - __le16 queue_notify_data; /* read-write */ - __le16 queue_reset; /* read-write */ -}; - /** * struct virtio_pci_modern_device - info for modern PCI virtio * @pci_dev: Ptr to the PCI device struct diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h index f703afc7ad31..44f4dd2add18 100644 --- a/include/uapi/linux/virtio_pci.h +++ b/include/uapi/linux/virtio_pci.h @@ -166,6 +166,17 @@ struct virtio_pci_common_cfg { __le32 queue_used_hi; /* read-write */ }; +/* + * Warning: do not use sizeof on this: use offsetofend for + * specific fields you need. + */ +struct virtio_pci_modern_common_cfg { + struct virtio_pci_common_cfg cfg; + + __le16 queue_notify_data; /* read-write */ + __le16 queue_reset; /* read-write */ +}; + /* Fields in VIRTIO_PCI_CAP_PCI_CFG: */ struct virtio_pci_cfg_cap { struct virtio_pci_cap cap; |