Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > aadbe78a25743146bb784eee19f007c5 > files > 22

kvm-83-164.el5_5.9.src.rpm

From c5f6361b56f83d85cac0ce80bea747177aa6610c Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc@redhat.com>
Date: Fri, 16 Jan 2009 11:12:27 +0000
Subject: [PATCH 21/54] Use the default subsystem vendor ID for virtio devices

A subsystem vendor ID of zero isn't allowed, so we use our
default ID.

Gerd points out that although the PCI subsystem vendor ID is
treated by the guest as the virtio vendor ID:

   /* we use the subsystem vendor/device id as the virtio vendor/device
    * id.  this allows us to use the same PCI vendor/device id for all
    * virtio devices and to identify the particular virtio driver by
    * the subsytem ids */
    vp_dev->vdev.id.vendor = pci_dev->subsystem_vendor;
    vp_dev->vdev.id.device = pci_dev->subsystem_device;

it looks like only the device ID is used right now:

   # grep virtio modules.alias
   alias virtio:d00000001v* virtio_net
   alias virtio:d00000002v* virtio_blk
   alias virtio:d00000003v* virtio_console
   alias virtio:d00000004v* virtio-rng
   alias virtio:d00000005v* virtio_balloon
   alias pci:v00001AF4d*sv*sd*bc*sc*i* virtio_pci
   alias virtio:d00000009v* 9pnet_virtio

so setting the subsystem vendor id to something != zero shouldn't cause
trouble.

[ehabkost: removed virtio-console parts, as virtio-console isn't
available on this branch yet]

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Type: bugfix
RH-Upstream-status: submitted(qemu-devel)
RH-Acked-by: Mark McLoughlin <markmc@redhat.com>
---
 qemu/hw/virtio-balloon.c |    3 ++-
 qemu/hw/virtio-blk.c     |    3 ++-
 qemu/hw/virtio-net.c     |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/qemu/hw/virtio-balloon.c b/qemu/hw/virtio-balloon.c
index 24d387f..e10eac6 100644
--- a/qemu/hw/virtio-balloon.c
+++ b/qemu/hw/virtio-balloon.c
@@ -175,7 +175,8 @@ void *virtio_balloon_init(PCIBus *bus)
     s = (VirtIOBalloon *)virtio_init_pci(bus, "virtio-balloon",
                                          PCI_VENDOR_ID_REDHAT_QUMRANET,
                                          PCI_DEVICE_ID_VIRTIO_BALLOON,
-                                         0, VIRTIO_ID_BALLOON,
+                                         PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                         VIRTIO_ID_BALLOON,
                                          0x05, 0x00, 0x00,
                                          8, sizeof(VirtIOBalloon));
     if (s == NULL)
diff --git a/qemu/hw/virtio-blk.c b/qemu/hw/virtio-blk.c
index bcc5854..71258cb 100644
--- a/qemu/hw/virtio-blk.c
+++ b/qemu/hw/virtio-blk.c
@@ -227,7 +227,8 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs)
     s = (VirtIOBlock *)virtio_init_pci(bus, "virtio-blk",
                                        PCI_VENDOR_ID_REDHAT_QUMRANET,
                                        PCI_DEVICE_ID_VIRTIO_BLOCK,
-                                       0, VIRTIO_ID_BLOCK,
+                                       PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                       VIRTIO_ID_BLOCK,
                                        0x01, 0x80, 0x00,
                                        sizeof(struct virtio_blk_config), sizeof(VirtIOBlock));
     if (!s)
diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index 3bc3ecb..04c8438 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -417,7 +417,8 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
     n = (VirtIONet *)virtio_init_pci(bus, "virtio-net",
                                      PCI_VENDOR_ID_REDHAT_QUMRANET,
                                      PCI_DEVICE_ID_VIRTIO_NET,
-                                     0, VIRTIO_ID_NET,
+                                     PCI_VENDOR_ID_REDHAT_QUMRANET,
+                                     VIRTIO_ID_NET,
                                      0x02, 0x00, 0x00,
                                      sizeof(struct virtio_net_config),
                                      sizeof(VirtIONet));
-- 
1.6.1