[PATCH] kvm tools: Use virtio IDs from <linux/virtio_ids.h>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of redefining virtio IDs in our headers, use IDs defined
in <linux/virtio_ids.h>.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
---
 tools/kvm/include/kvm/virtio-pci-dev.h |    7 ++-----
 tools/kvm/virtio/blk.c                 |    4 ++--
 tools/kvm/virtio/console.c             |    4 ++--
 tools/kvm/virtio/net.c                 |    4 ++--
 tools/kvm/virtio/rng.c                 |    4 ++--
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/tools/kvm/include/kvm/virtio-pci-dev.h b/tools/kvm/include/kvm/virtio-pci-dev.h
index 706ad20..fa8328d 100644
--- a/tools/kvm/include/kvm/virtio-pci-dev.h
+++ b/tools/kvm/include/kvm/virtio-pci-dev.h
@@ -1,6 +1,8 @@
 #ifndef VIRTIO_PCI_DEV_H_
 #define VIRTIO_PCI_DEV_H_
 
+#include <linux/virtio_ids.h>
+
 /*
  * Virtio PCI device constants and resources
  * they do use (such as irqs and pins).
@@ -11,11 +13,6 @@
 #define PCI_DEVICE_ID_VIRTIO_CONSOLE		0x1003
 #define PCI_DEVICE_ID_VIRTIO_RNG		0x1004
 
-#define PCI_SUBSYSTEM_ID_VIRTIO_NET		0x0001
-#define PCI_SUBSYSTEM_ID_VIRTIO_BLK		0x0002
-#define PCI_SUBSYSTEM_ID_VIRTIO_CONSOLE		0x0003
-#define PCI_SUBSYSTEM_ID_VIRTIO_RNG		0x0004
-
 #define PCI_VENDOR_ID_REDHAT_QUMRANET		0x1af4
 #define PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET	0x1af4
 
diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index 6c9eb19..c9b8a54 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -299,7 +299,7 @@ void virtio_blk__init(struct kvm *kvm, struct disk_image *disk)
 			.revision_id		= 0,
 			.class			= 0x010000,
 			.subsys_vendor_id	= PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET,
-			.subsys_id		= PCI_SUBSYSTEM_ID_VIRTIO_BLK,
+			.subsys_id		= VIRTIO_ID_BLOCK,
 			.bar[0]			= blk_dev_base_addr | PCI_BASE_ADDRESS_SPACE_IO,
 		},
 		/*
@@ -310,7 +310,7 @@ void virtio_blk__init(struct kvm *kvm, struct disk_image *disk)
 		.host_features			= (1UL << VIRTIO_BLK_F_SEG_MAX | 1UL << VIRTIO_BLK_F_FLUSH),
 	};
 
-	if (irq__register_device(PCI_DEVICE_ID_VIRTIO_BLK, &dev, &pin, &line) < 0)
+	if (irq__register_device(VIRTIO_ID_BLOCK, &dev, &pin, &line) < 0)
 		return;
 
 	bdev->pci_hdr.irq_pin	= pin;
diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c
index 66da288..c0e251c 100644
--- a/tools/kvm/virtio/console.c
+++ b/tools/kvm/virtio/console.c
@@ -35,7 +35,7 @@ static struct pci_device_header virtio_console_pci_device = {
 	.revision_id		= 0,
 	.class			= 0x078000,
 	.subsys_vendor_id	= PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET,
-	.subsys_id		= PCI_SUBSYSTEM_ID_VIRTIO_CONSOLE,
+	.subsys_id		= VIRTIO_ID_CONSOLE,
 	.bar[0]			= IOPORT_VIRTIO_CONSOLE | PCI_BASE_ADDRESS_SPACE_IO,
 };
 
@@ -244,7 +244,7 @@ void virtio_console__init(struct kvm *kvm)
 {
 	u8 dev, line, pin;
 
-	if (irq__register_device(PCI_DEVICE_ID_VIRTIO_CONSOLE, &dev, &pin, &line) < 0)
+	if (irq__register_device(VIRTIO_ID_CONSOLE, &dev, &pin, &line) < 0)
 		return;
 
 	virtio_console_pci_device.irq_pin	= pin;
diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c
index 567f921..b47f02a 100644
--- a/tools/kvm/virtio/net.c
+++ b/tools/kvm/virtio/net.c
@@ -36,7 +36,7 @@ static struct pci_device_header pci_header = {
 	.revision_id			= 0,
 	.class				= 0x020000,
 	.subsys_vendor_id		= PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET,
-	.subsys_id			= PCI_SUBSYSTEM_ID_VIRTIO_NET,
+	.subsys_id			= VIRTIO_ID_NET,
 	.bar[0]				= IOPORT_VIRTIO_NET | PCI_BASE_ADDRESS_SPACE_IO,
 };
 
@@ -388,7 +388,7 @@ void virtio_net__init(const struct virtio_net_parameters *params)
 	if (virtio_net__tap_init(params)) {
 		u8 dev, line, pin;
 
-		if (irq__register_device(PCI_DEVICE_ID_VIRTIO_NET, &dev, &pin, &line) < 0)
+		if (irq__register_device(VIRTIO_ID_NET, &dev, &pin, &line) < 0)
 			return;
 
 		pci_header.irq_pin	= pin;
diff --git a/tools/kvm/virtio/rng.c b/tools/kvm/virtio/rng.c
index cf258fa..9bd0098 100644
--- a/tools/kvm/virtio/rng.c
+++ b/tools/kvm/virtio/rng.c
@@ -30,7 +30,7 @@ static struct pci_device_header virtio_rng_pci_device = {
 	.revision_id		= 0,
 	.class			= 0x010000,
 	.subsys_vendor_id	= PCI_SUBSYSTEM_VENDOR_ID_REDHAT_QUMRANET,
-	.subsys_id		= PCI_SUBSYSTEM_ID_VIRTIO_RNG,
+	.subsys_id		= VIRTIO_ID_RNG,
 	.bar[0]			= IOPORT_VIRTIO_RNG | PCI_BASE_ADDRESS_SPACE_IO,
 };
 
@@ -172,7 +172,7 @@ void virtio_rng__init(struct kvm *kvm)
 	if (rdev.fd < 0)
 		die("Failed initializing RNG");
 
-	if (irq__register_device(PCI_DEVICE_ID_VIRTIO_RNG, &dev, &pin, &line) < 0)
+	if (irq__register_device(VIRTIO_ID_RNG, &dev, &pin, &line) < 0)
 		return;
 
 	virtio_rng_pci_device.irq_pin	= pin;
-- 
1.7.5.rc3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux