mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
virtio: Provide version-specific variants of virtio PCI devices
Many of the current virtio-*-pci device types actually represent 3 different types of devices: * virtio 1.0 non-transitional devices * virtio 1.0 transitional devices * virtio 0.9 ("legacy device" in virtio 1.0 terminology) That would be just an annoyance if it didn't break our device/bus compatibility QMP interfaces. With these multi-purpose device types, there's no way to tell management software that transitional devices and legacy devices require a Conventional PCI bus. The multi-purpose device types would also prevent us from telling management software what's the PCI vendor/device ID for them, because their PCI IDs change at runtime depending on the bus where they were plugged. This patch adds separate device types for each of those virtio device flavors: - virtio-*-pci: the existing multi-purpose device types - Configurable using `disable-legacy` and `disable-modern` properties - Legacy driver support is automatically enabled/disabled depending on the bus where it is plugged - Supports Conventional PCI and PCI Express buses (but Conventional PCI is incompatible with disable-legacy=off) - Changes PCI vendor/device IDs at runtime - virtio-*-pci-transitional: virtio-1.0 device supporting legacy drivers - Supports Conventional PCI buses only, because it has a PIO BAR - virtio-*-pci-non-transitional: modern-only - Supports both Conventional PCI and PCI Express buses The existing TYPE_* macros for these types will point to an abstract base type, so existing casts in the code will keep working for all variants. A simple test script (tests/acceptance/virtio_version.py) is included, to check if the new device types are equivalent to using the `disable-legacy` and `disable-modern` options. Acked-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
a4ee4c8baa
commit
f6e501a28e
3 changed files with 236 additions and 24 deletions
|
@ -216,7 +216,7 @@ static inline void virtio_pci_disable_modern(VirtIOPCIProxy *proxy)
|
|||
/*
|
||||
* virtio-scsi-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci"
|
||||
#define TYPE_VIRTIO_SCSI_PCI "virtio-scsi-pci-base"
|
||||
#define VIRTIO_SCSI_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIOSCSIPCI, (obj), TYPE_VIRTIO_SCSI_PCI)
|
||||
|
||||
|
@ -229,7 +229,7 @@ struct VirtIOSCSIPCI {
|
|||
/*
|
||||
* vhost-scsi-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VHOST_SCSI_PCI "vhost-scsi-pci"
|
||||
#define TYPE_VHOST_SCSI_PCI "vhost-scsi-pci-base"
|
||||
#define VHOST_SCSI_PCI(obj) \
|
||||
OBJECT_CHECK(VHostSCSIPCI, (obj), TYPE_VHOST_SCSI_PCI)
|
||||
|
||||
|
@ -239,7 +239,7 @@ struct VHostSCSIPCI {
|
|||
};
|
||||
#endif
|
||||
|
||||
#define TYPE_VHOST_USER_SCSI_PCI "vhost-user-scsi-pci"
|
||||
#define TYPE_VHOST_USER_SCSI_PCI "vhost-user-scsi-pci-base"
|
||||
#define VHOST_USER_SCSI_PCI(obj) \
|
||||
OBJECT_CHECK(VHostUserSCSIPCI, (obj), TYPE_VHOST_USER_SCSI_PCI)
|
||||
|
||||
|
@ -252,7 +252,7 @@ struct VHostUserSCSIPCI {
|
|||
/*
|
||||
* vhost-user-blk-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VHOST_USER_BLK_PCI "vhost-user-blk-pci"
|
||||
#define TYPE_VHOST_USER_BLK_PCI "vhost-user-blk-pci-base"
|
||||
#define VHOST_USER_BLK_PCI(obj) \
|
||||
OBJECT_CHECK(VHostUserBlkPCI, (obj), TYPE_VHOST_USER_BLK_PCI)
|
||||
|
||||
|
@ -265,7 +265,7 @@ struct VHostUserBlkPCI {
|
|||
/*
|
||||
* virtio-blk-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci"
|
||||
#define TYPE_VIRTIO_BLK_PCI "virtio-blk-pci-base"
|
||||
#define VIRTIO_BLK_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIOBlkPCI, (obj), TYPE_VIRTIO_BLK_PCI)
|
||||
|
||||
|
@ -277,7 +277,7 @@ struct VirtIOBlkPCI {
|
|||
/*
|
||||
* virtio-balloon-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VIRTIO_BALLOON_PCI "virtio-balloon-pci"
|
||||
#define TYPE_VIRTIO_BALLOON_PCI "virtio-balloon-pci-base"
|
||||
#define VIRTIO_BALLOON_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIOBalloonPCI, (obj), TYPE_VIRTIO_BALLOON_PCI)
|
||||
|
||||
|
@ -289,7 +289,7 @@ struct VirtIOBalloonPCI {
|
|||
/*
|
||||
* virtio-serial-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VIRTIO_SERIAL_PCI "virtio-serial-pci"
|
||||
#define TYPE_VIRTIO_SERIAL_PCI "virtio-serial-pci-base"
|
||||
#define VIRTIO_SERIAL_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIOSerialPCI, (obj), TYPE_VIRTIO_SERIAL_PCI)
|
||||
|
||||
|
@ -301,7 +301,7 @@ struct VirtIOSerialPCI {
|
|||
/*
|
||||
* virtio-net-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VIRTIO_NET_PCI "virtio-net-pci"
|
||||
#define TYPE_VIRTIO_NET_PCI "virtio-net-pci-base"
|
||||
#define VIRTIO_NET_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIONetPCI, (obj), TYPE_VIRTIO_NET_PCI)
|
||||
|
||||
|
@ -316,7 +316,7 @@ struct VirtIONetPCI {
|
|||
|
||||
#ifdef CONFIG_VIRTFS
|
||||
|
||||
#define TYPE_VIRTIO_9P_PCI "virtio-9p-pci"
|
||||
#define TYPE_VIRTIO_9P_PCI "virtio-9p-pci-base"
|
||||
#define VIRTIO_9P_PCI(obj) \
|
||||
OBJECT_CHECK(V9fsPCIState, (obj), TYPE_VIRTIO_9P_PCI)
|
||||
|
||||
|
@ -330,7 +330,7 @@ typedef struct V9fsPCIState {
|
|||
/*
|
||||
* virtio-rng-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VIRTIO_RNG_PCI "virtio-rng-pci"
|
||||
#define TYPE_VIRTIO_RNG_PCI "virtio-rng-pci-base"
|
||||
#define VIRTIO_RNG_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIORngPCI, (obj), TYPE_VIRTIO_RNG_PCI)
|
||||
|
||||
|
@ -365,7 +365,7 @@ struct VirtIOInputHIDPCI {
|
|||
|
||||
#ifdef CONFIG_LINUX
|
||||
|
||||
#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci"
|
||||
#define TYPE_VIRTIO_INPUT_HOST_PCI "virtio-input-host-pci-base"
|
||||
#define VIRTIO_INPUT_HOST_PCI(obj) \
|
||||
OBJECT_CHECK(VirtIOInputHostPCI, (obj), TYPE_VIRTIO_INPUT_HOST_PCI)
|
||||
|
||||
|
@ -392,7 +392,7 @@ struct VirtIOGPUPCI {
|
|||
/*
|
||||
* vhost-vsock-pci: This extends VirtioPCIProxy.
|
||||
*/
|
||||
#define TYPE_VHOST_VSOCK_PCI "vhost-vsock-pci"
|
||||
#define TYPE_VHOST_VSOCK_PCI "vhost-vsock-pci-base"
|
||||
#define VHOST_VSOCK_PCI(obj) \
|
||||
OBJECT_CHECK(VHostVSockPCI, (obj), TYPE_VHOST_VSOCK_PCI)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue