qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH 1/3] virtio-bus : Introduce VirtioBus.


From: Cornelia Huck
Subject: Re: [Qemu-devel] [RFC PATCH 1/3] virtio-bus : Introduce VirtioBus.
Date: Tue, 20 Nov 2012 18:27:44 +0100

On Tue, 20 Nov 2012 17:45:15 +0100
KONRAD Frédéric <address@hidden> wrote:


> eg for virtio-block-pci in virtio-pci.c :
> static void virtio_blk_class_init(ObjectClass *klass, void *data)
> {
>      k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK;
>      ...
>      k->class_id = PCI_CLASS_STORAGE_SCSI;
> }
> 
> I think that the better solution is to put these value in a big switch 
> case :
> 
> eg :
> 
> Adding that in virtio-bus.c :
> 
> /* Return the virtio device id of the plugged device. */
> uint16_t get_virtio_device_id(VirtioBus *bus)
> {
>      return bus->vdev->device_id;
> }

Yes, we'll need this for virtio-ccw as well (the id is used as the CU
model).

> 
> Using that in virtio-pci transport initialisation.
> 
>      switch (get_virtio_device_id(&proxy->bus))
>      {
>          case VIRTIO_ID_BLOCK:
>              pci_config_set_device_id(proxy->pci_dev.config,
>                                       PCI_DEVICE_ID_VIRTIO_BLOCK);
>              pci_config_set_class(proxy->pci_dev.config, 
> PCI_CLASS_STORAGE_SCSI);
>          break;
>          default:
>              error_report("unknown device id\n");
>          break;
>      }
> 
> but the transport stay ( a little ) device dependent.

Well, given that the device id _is_ device dependent, doing the device
id -> transport specific id transition in the transport code seems
sensible.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]