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.dea...@arm.com>
---
 tools/kvm/virtio/mmio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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,
        };
-- 
1.7.4.1

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

Reply via email to