diff mbox

[RFC,10/16] kvm tools: virtio-mmio: use subsys_id instead of pci device ID

Message ID 1352721450-11340-11-git-send-email-will.deacon@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Will Deacon Nov. 12, 2012, 11:57 a.m. UTC
The virtio MMIO code attempts to map PCI device IDs to virtio MMIO
device IDs by subtracting 0x1000 and adding 1, however this conversion
only works for NET and BLK devices.

This patch uses the subsys_id (which is actually the virtio device ID
for virtio-mmio devices) instead of the PCI device ID when populating
the mmio device header.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 tools/kvm/virtio/mmio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/virtio/mmio.c b/tools/kvm/virtio/mmio.c
index 2d538b8..18a268b 100644
--- a/tools/kvm/virtio/mmio.c
+++ b/tools/kvm/virtio/mmio.c
@@ -231,7 +231,7 @@  int virtio_mmio_init(struct kvm *kvm, void *dev, struct virtio_device *vdev,
 	vmmio->hdr = (struct virtio_mmio_hdr) {
 		.magic		= {'v', 'i', 'r', 't'},
 		.version	= 1,
-		.device_id	= device_id - 0x1000 + 1,
+		.device_id	= subsys_id,
 		.vendor_id	= 0x4d564b4c , /* 'LKVM' */
 		.queue_num_max	= 256,
 	};