Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55a7c066 authored by Anthony Liguori's avatar Anthony Liguori Committed by Rusty Russell
Browse files

virtio: Use PCI revision field to indicate virtio PCI ABI version



As Avi pointed out, as we continue to massage the virtio PCI ABI, we can make
things a little more friendly to users by utilizing the PCI revision field to
indicate which version of the ABI we're using.  This is a hard ABI version
and incrementing it will cause the guest driver to break.

This is the necessary changes to virtio_pci to support this.

Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 3343660d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -311,6 +311,12 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
	if (pci_dev->device < 0x1000 || pci_dev->device > 0x103f)
		return -ENODEV;

	if (pci_dev->revision != VIRTIO_PCI_ABI_VERSION) {
		printk(KERN_ERR "virtio_pci: expected ABI version %d, got %d\n",
		       VIRTIO_PCI_ABI_VERSION, pci_dev->revision);
		return -ENODEV;
	}

	/* allocate our structure and fill it out */
	vp_dev = kzalloc(sizeof(struct virtio_pci_device), GFP_KERNEL);
	if (vp_dev == NULL)
+2 −0
Original line number Diff line number Diff line
@@ -52,4 +52,6 @@
 * configuration space */
#define VIRTIO_PCI_CONFIG		20

/* Virtio ABI version, this must match exactly */
#define VIRTIO_PCI_ABI_VERSION		0
#endif