Re: [virtio] [PATCH] pci: switch from subsystem id to device id

From
Michael S. Tsirkin <>
Date
2014-06-02T16:01:45+00:00
ID
Thread
Re: [virtio] [PATCH] pci: switch from subsystem id to device id
On Mon, Jun 02, 2014 at 02:42:55PM +0200, Gerd Hoffmann wrote:
>   Hi,
> 
> > Note: issue reporter suggested 0x10XX where XX is the virtio
> > device ID. This would break all legacy drivers, historically
> > PCI Device ID is off by one: 0xFFF + Virtio Device ID.
> 
> Adding 0xfff works for for net+block only.
> There seems to be no fixed scheme:
> 
> nilsson kraxel ~/projects/qemu/include # grep VIRTIO_ID hw/virtio/*.h 
> hw/virtio/virtio-balloon.h:#define VIRTIO_ID_BALLOON 5
> hw/virtio/virtio-blk.h:#define VIRTIO_ID_BLOCK 2
> hw/virtio/virtio-net.h:#define VIRTIO_ID_NET   1
> hw/virtio/virtio-rng.h:#define VIRTIO_ID_RNG    4
> hw/virtio/virtio-scsi.h:#define VIRTIO_ID_SCSI  8
> hw/virtio/virtio-serial.h:#define VIRTIO_ID_CONSOLE             3
> 
> nilsson kraxel ~/projects/qemu/include # grep VIRTIO hw/pci/*.h
> hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_NET         0x1000
> hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_BLOCK       0x1001
> hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_BALLOON     0x1002
> hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_CONSOLE     0x1003
> hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_SCSI        0x1004
> hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
> hw/pci/pci.h:#define PCI_DEVICE_ID_VIRTIO_9P          0x1009
> 
> cheers,
>   Gerd
> 

You are right of course.
So we'll have to have a table for transitional devices, and something
like 0x1040 + device id or 0x1009 + device id for non transitional ones.