mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
hw/virtio-pci: fix virtio behaviour
Enable transitional virtio devices by default. Enable virtio-1.0 for devices plugged into PCIe ports (Root ports or Downstream ports). Using the virtio-1 mode will remove the limitation of the number of devices that can be attached to a machine by removing the need for the IO BAR. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
be0d9760d7
commit
9a4c0e220d
5 changed files with 45 additions and 26 deletions
|
@ -61,8 +61,6 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
|
|||
enum {
|
||||
VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT,
|
||||
VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
|
||||
VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT,
|
||||
VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT,
|
||||
VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT,
|
||||
VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
|
||||
VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT,
|
||||
|
@ -77,8 +75,6 @@ enum {
|
|||
#define VIRTIO_PCI_FLAG_USE_IOEVENTFD (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
|
||||
|
||||
/* virtio version flags */
|
||||
#define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
|
||||
#define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
|
||||
#define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
|
||||
|
||||
/* migrate extra state */
|
||||
|
@ -144,6 +140,8 @@ struct VirtIOPCIProxy {
|
|||
uint32_t modern_mem_bar;
|
||||
int config_cap;
|
||||
uint32_t flags;
|
||||
bool disable_modern;
|
||||
OnOffAuto disable_legacy;
|
||||
uint32_t class_code;
|
||||
uint32_t nvectors;
|
||||
uint32_t dfselect;
|
||||
|
@ -158,6 +156,21 @@ struct VirtIOPCIProxy {
|
|||
VirtioBusState bus;
|
||||
};
|
||||
|
||||
static inline bool virtio_pci_modern(VirtIOPCIProxy *proxy)
|
||||
{
|
||||
return !proxy->disable_modern;
|
||||
}
|
||||
|
||||
static inline bool virtio_pci_legacy(VirtIOPCIProxy *proxy)
|
||||
{
|
||||
return proxy->disable_legacy == ON_OFF_AUTO_OFF;
|
||||
}
|
||||
|
||||
static inline void virtio_pci_force_virtio_1(VirtIOPCIProxy *proxy)
|
||||
{
|
||||
proxy->disable_modern = false;
|
||||
proxy->disable_legacy = ON_OFF_AUTO_ON;
|
||||
}
|
||||
|
||||
/*
|
||||
* virtio-scsi-pci: This extends VirtioPCIProxy.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue