Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=55a7c066041e7850948d29ed813f62821a9ec046 Commit: 55a7c066041e7850948d29ed813f62821a9ec046 Parent: 3343660d8c62c6b00b2f15324ef3fcb6be207bfa Author: Anthony Liguori <[EMAIL PROTECTED]> AuthorDate: Mon Jan 28 09:59:59 2008 -0600 Committer: Rusty Russell <[EMAIL PROTECTED]> CommitDate: Mon Feb 4 23:50:12 2008 +1100
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: Anthony Liguori <[EMAIL PROTECTED]> Signed-off-by: Rusty Russell <[EMAIL PROTECTED]> --- drivers/virtio/virtio_pci.c | 6 ++++++ include/linux/virtio_pci.h | 2 ++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 192687e..26f787d 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c @@ -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) diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h index 860eb37..b315165 100644 --- a/include/linux/virtio_pci.h +++ b/include/linux/virtio_pci.h @@ -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 - To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html