Commit 35038957 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin
Browse files

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: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarXuan Zhuo <xuanzhuo@linux.alibaba.com>
parent 86f6c224
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -294,8 +294,9 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev)

	err = -EINVAL;
	mdev->common = vp_modern_map_capability(mdev, common,
				      sizeof(struct virtio_pci_common_cfg), 4,
				      0, sizeof(struct virtio_pci_modern_common_cfg),
			      sizeof(struct virtio_pci_common_cfg), 4, 0,
			      offsetofend(struct virtio_pci_modern_common_cfg,
					  queue_reset),
			      &mdev->common_len, NULL);
	if (!mdev->common)
		goto err_map_common;
+0 −7
Original line number Diff line number Diff line
@@ -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
+11 −0
Original line number Diff line number Diff line
@@ -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;