Commit 99b3718ee12ae5f1b41ccd848fb2f80ddb94a04e

Authored by aliguori
1 parent 14d50bef

Use the default subsystem vendor ID for virtio devices (Mark McLoughlin)

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.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6440 c046a42c-6fe2-441c-8c8c-71466251a162
hw/virtio-balloon.c
@@ -174,7 +174,8 @@ void *virtio_balloon_init(PCIBus *bus) @@ -174,7 +174,8 @@ void *virtio_balloon_init(PCIBus *bus)
174 s = (VirtIOBalloon *)virtio_init_pci(bus, "virtio-balloon", 174 s = (VirtIOBalloon *)virtio_init_pci(bus, "virtio-balloon",
175 PCI_VENDOR_ID_REDHAT_QUMRANET, 175 PCI_VENDOR_ID_REDHAT_QUMRANET,
176 PCI_DEVICE_ID_VIRTIO_BALLOON, 176 PCI_DEVICE_ID_VIRTIO_BALLOON,
177 - 0, VIRTIO_ID_BALLOON, 177 + PCI_VENDOR_ID_REDHAT_QUMRANET,
  178 + VIRTIO_ID_BALLOON,
178 0x05, 0x00, 0x00, 179 0x05, 0x00, 0x00,
179 8, sizeof(VirtIOBalloon)); 180 8, sizeof(VirtIOBalloon));
180 if (s == NULL) 181 if (s == NULL)
hw/virtio-blk.c
@@ -303,7 +303,8 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs) @@ -303,7 +303,8 @@ void *virtio_blk_init(PCIBus *bus, BlockDriverState *bs)
303 s = (VirtIOBlock *)virtio_init_pci(bus, "virtio-blk", 303 s = (VirtIOBlock *)virtio_init_pci(bus, "virtio-blk",
304 PCI_VENDOR_ID_REDHAT_QUMRANET, 304 PCI_VENDOR_ID_REDHAT_QUMRANET,
305 PCI_DEVICE_ID_VIRTIO_BLOCK, 305 PCI_DEVICE_ID_VIRTIO_BLOCK,
306 - 0, VIRTIO_ID_BLOCK, 306 + PCI_VENDOR_ID_REDHAT_QUMRANET,
  307 + VIRTIO_ID_BLOCK,
307 0x01, 0x80, 0x00, 308 0x01, 0x80, 0x00,
308 sizeof(struct virtio_blk_config), sizeof(VirtIOBlock)); 309 sizeof(struct virtio_blk_config), sizeof(VirtIOBlock));
309 if (!s) 310 if (!s)
hw/virtio-console.c
@@ -128,7 +128,8 @@ void *virtio_console_init(PCIBus *bus, CharDriverState *chr) @@ -128,7 +128,8 @@ void *virtio_console_init(PCIBus *bus, CharDriverState *chr)
128 s = (VirtIOConsole *)virtio_init_pci(bus, "virtio-console", 128 s = (VirtIOConsole *)virtio_init_pci(bus, "virtio-console",
129 PCI_VENDOR_ID_REDHAT_QUMRANET, 129 PCI_VENDOR_ID_REDHAT_QUMRANET,
130 PCI_DEVICE_ID_VIRTIO_CONSOLE, 130 PCI_DEVICE_ID_VIRTIO_CONSOLE,
131 - 0, VIRTIO_ID_CONSOLE, 131 + PCI_VENDOR_ID_REDHAT_QUMRANET,
  132 + VIRTIO_ID_CONSOLE,
132 0x03, 0x80, 0x00, 133 0x03, 0x80, 0x00,
133 0, sizeof(VirtIOConsole)); 134 0, sizeof(VirtIOConsole));
134 if (s == NULL) 135 if (s == NULL)
hw/virtio-net.c
@@ -323,7 +323,8 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) @@ -323,7 +323,8 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
323 n = (VirtIONet *)virtio_init_pci(bus, "virtio-net", 323 n = (VirtIONet *)virtio_init_pci(bus, "virtio-net",
324 PCI_VENDOR_ID_REDHAT_QUMRANET, 324 PCI_VENDOR_ID_REDHAT_QUMRANET,
325 PCI_DEVICE_ID_VIRTIO_NET, 325 PCI_DEVICE_ID_VIRTIO_NET,
326 - 0, VIRTIO_ID_NET, 326 + PCI_VENDOR_ID_REDHAT_QUMRANET,
  327 + VIRTIO_ID_NET,
327 0x02, 0x00, 0x00, 328 0x02, 0x00, 0x00,
328 sizeof(struct virtio_net_config), 329 sizeof(struct virtio_net_config),
329 sizeof(VirtIONet)); 330 sizeof(VirtIONet));