mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
pc,pci,virtio: bugfixes, improvements
vhost-user-rng support. Fixes all over the place. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmDlrDoPHG1zdEByZWRo YXQuY29tAAoJECgfDbjSjVRph80H/iER8A3qu8+BPHHeuhP/0dqu624P9oiLVPRw 1Mhu9xSF2f1MWFh1w66VpBAS1ydgv2KxWhA3wVG9aV9Z90e/D3gdscPDTkxSgBus iPSYOKzZcBV36JVmKgh2UgbUWy9vfZFIvtZKIGH4eOojxBUnIEE2X1fOPdxXoUza hveQxOcrcO1Z2AMVaNrwIHw1D5eKG89GAS2LJkP+MTCzmL9l/K7nP+nGmBFPeDX3 0P/DYDFTkmpjbicsyPDZl6RNCh0mt2lwb4z0yNrB+IMPzrWI28IFZWc7EfQTZ9Ja jo9JC0FeEhYfYgEUGndmS/vrTpSsPODk5DeVzxeSx5DvB65KAI8= =axSa -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging pc,pci,virtio: bugfixes, improvements vhost-user-rng support. Fixes all over the place. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Wed 07 Jul 2021 14:29:30 BST # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [full] # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * remotes/mst/tags/for_upstream: MAINTAINERS: Add maintainer for vhost-user RNG implementation docs: add slot when adding new PCIe root port acpi/ged: fix reset cause tests: acpi: pc: update expected DSDT blobs acpi: pc: revert back to v5.2 PCI slot enumeration tests: acpi: prepare for changing DSDT tables migration: failover: reset partially_hotplugged virtio-pci: Changed return values for "notify", "device" and "isr" read. virtio-pci: Added check for virtio device in PCI config cbs. virtio-pci: Added check for virtio device presence in mm callbacks. hw/pci-host/q35: Ignore write of reserved PCIEXBAR LENGTH field virtio: Clarify MR transaction optimization virtio: disable ioeventfd for record/replay Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
05de778b5b
22 changed files with 115 additions and 8 deletions
|
@ -207,7 +207,7 @@ static void ged_regs_write(void *opaque, hwaddr addr, uint64_t data,
|
|||
return;
|
||||
case ACPI_GED_REG_RESET:
|
||||
if (data == ACPI_GED_RESET_VALUE) {
|
||||
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
|
||||
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -198,6 +198,10 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
|
|||
goto fail_guest_notifiers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Batch all the host notifiers in a single transaction to avoid
|
||||
* quadratic time complexity in address_space_update_ioeventfds().
|
||||
*/
|
||||
memory_region_transaction_begin();
|
||||
|
||||
/* Set up virtqueue notify */
|
||||
|
@ -211,6 +215,10 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev)
|
|||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* The transaction expects the ioeventfds to be open when it
|
||||
* commits. Do it now, before the cleanup loop.
|
||||
*/
|
||||
memory_region_transaction_commit();
|
||||
|
||||
while (j--) {
|
||||
|
@ -330,12 +338,20 @@ void virtio_blk_data_plane_stop(VirtIODevice *vdev)
|
|||
|
||||
aio_context_release(s->ctx);
|
||||
|
||||
/*
|
||||
* Batch all the host notifiers in a single transaction to avoid
|
||||
* quadratic time complexity in address_space_update_ioeventfds().
|
||||
*/
|
||||
memory_region_transaction_begin();
|
||||
|
||||
for (i = 0; i < nvqs; i++) {
|
||||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* The transaction expects the ioeventfds to be open when it
|
||||
* commits. Do it now, before the cleanup loop.
|
||||
*/
|
||||
memory_region_transaction_commit();
|
||||
|
||||
for (i = 0; i < nvqs; i++) {
|
||||
|
|
|
@ -435,11 +435,15 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
aml_append(dev, aml_name_decl("_ADR", aml_int(slot << 16)));
|
||||
|
||||
if (bsel) {
|
||||
aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
|
||||
/*
|
||||
* Can't declare _SUN here for every device as it changes 'slot'
|
||||
* enumeration order in linux kernel, so use another variable for it
|
||||
*/
|
||||
aml_append(dev, aml_name_decl("ASUN", aml_int(slot)));
|
||||
method = aml_method("_DSM", 4, AML_SERIALIZED);
|
||||
aml_append(method, aml_return(
|
||||
aml_call6("PDSM", aml_arg(0), aml_arg(1), aml_arg(2),
|
||||
aml_arg(3), aml_name("BSEL"), aml_name("_SUN"))
|
||||
aml_arg(3), aml_name("BSEL"), aml_name("ASUN"))
|
||||
));
|
||||
aml_append(dev, method);
|
||||
}
|
||||
|
@ -466,6 +470,7 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
|
|||
aml_append(method, aml_return(aml_int(s3d)));
|
||||
aml_append(dev, method);
|
||||
} else if (hotplug_enabled_dev) {
|
||||
aml_append(dev, aml_name_decl("_SUN", aml_int(slot)));
|
||||
/* add _EJ0 to make slot hotpluggable */
|
||||
method = aml_method("_EJ0", 1, AML_NOTSERIALIZED);
|
||||
aml_append(method,
|
||||
|
|
|
@ -3234,6 +3234,7 @@ static bool failover_replug_primary(VirtIONet *n, DeviceState *dev,
|
|||
}
|
||||
hotplug_handler_plug(hotplug_ctrl, dev, &err);
|
||||
}
|
||||
pdev->partially_hotplugged = false;
|
||||
|
||||
out:
|
||||
error_propagate(errp, err);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/log.h"
|
||||
#include "hw/i386/pc.h"
|
||||
#include "hw/pci-host/q35.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
|
@ -318,6 +319,8 @@ static void mch_update_pciexbar(MCHPCIState *mch)
|
|||
addr_mask |= MCH_HOST_BRIDGE_PCIEXBAR_64ADMSK;
|
||||
break;
|
||||
case MCH_HOST_BRIDGE_PCIEXBAR_LENGTH_RVD:
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "Q35: Reserved PCIEXBAR LENGTH\n");
|
||||
return;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "trace.h"
|
||||
#include "hw/s390x/css-bridge.h"
|
||||
#include "hw/s390x/s390-virtio-ccw.h"
|
||||
#include "sysemu/replay.h"
|
||||
|
||||
#define NR_CLASSIC_INDICATOR_BITS 64
|
||||
|
||||
|
@ -770,6 +771,11 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp)
|
|||
dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD;
|
||||
}
|
||||
|
||||
/* fd-based ioevents can't be synchronized in record/replay */
|
||||
if (replay_mode != REPLAY_MODE_NONE) {
|
||||
dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD;
|
||||
}
|
||||
|
||||
if (k->realize) {
|
||||
k->realize(dev, &err);
|
||||
if (err) {
|
||||
|
|
|
@ -152,6 +152,10 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev)
|
|||
goto fail_guest_notifiers;
|
||||
}
|
||||
|
||||
/*
|
||||
* Batch all the host notifiers in a single transaction to avoid
|
||||
* quadratic time complexity in address_space_update_ioeventfds().
|
||||
*/
|
||||
memory_region_transaction_begin();
|
||||
|
||||
rc = virtio_scsi_set_host_notifier(s, vs->ctrl_vq, 0);
|
||||
|
@ -198,6 +202,10 @@ fail_host_notifiers:
|
|||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* The transaction expects the ioeventfds to be open when it
|
||||
* commits. Do it now, before the cleanup loop.
|
||||
*/
|
||||
memory_region_transaction_commit();
|
||||
|
||||
for (i = 0; i < vq_init_count; i++) {
|
||||
|
@ -238,12 +246,20 @@ void virtio_scsi_dataplane_stop(VirtIODevice *vdev)
|
|||
|
||||
blk_drain_all(); /* ensure there are no in-flight requests */
|
||||
|
||||
/*
|
||||
* Batch all the host notifiers in a single transaction to avoid
|
||||
* quadratic time complexity in address_space_update_ioeventfds().
|
||||
*/
|
||||
memory_region_transaction_begin();
|
||||
|
||||
for (i = 0; i < vs->conf.num_queues + 2; i++) {
|
||||
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* The transaction expects the ioeventfds to be open when it
|
||||
* commits. Do it now, before the cleanup loop.
|
||||
*/
|
||||
memory_region_transaction_commit();
|
||||
|
||||
for (i = 0; i < vs->conf.num_queues + 2; i++) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "qemu/host-utils.h"
|
||||
#include "qemu/module.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "sysemu/replay.h"
|
||||
#include "hw/virtio/virtio-mmio.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/log.h"
|
||||
|
@ -740,6 +741,11 @@ static void virtio_mmio_realizefn(DeviceState *d, Error **errp)
|
|||
proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
|
||||
}
|
||||
|
||||
/* fd-based ioevents can't be synchronized in record/replay */
|
||||
if (replay_mode != REPLAY_MODE_NONE) {
|
||||
proxy->flags &= ~VIRTIO_IOMMIO_FLAG_USE_IOEVENTFD;
|
||||
}
|
||||
|
||||
if (proxy->legacy) {
|
||||
memory_region_init_io(&proxy->iomem, OBJECT(d),
|
||||
&virtio_legacy_mem_ops, proxy,
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "qemu/range.h"
|
||||
#include "hw/virtio/virtio-bus.h"
|
||||
#include "qapi/visitor.h"
|
||||
#include "sysemu/replay.h"
|
||||
|
||||
#define VIRTIO_PCI_REGION_SIZE(dev) VIRTIO_PCI_CONFIG_OFF(msix_present(dev))
|
||||
|
||||
|
@ -423,6 +424,11 @@ static uint64_t virtio_pci_config_read(void *opaque, hwaddr addr,
|
|||
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
|
||||
uint32_t config = VIRTIO_PCI_CONFIG_SIZE(&proxy->pci_dev);
|
||||
uint64_t val = 0;
|
||||
|
||||
if (vdev == NULL) {
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
||||
if (addr < config) {
|
||||
return virtio_ioport_read(proxy, addr);
|
||||
}
|
||||
|
@ -454,6 +460,11 @@ static void virtio_pci_config_write(void *opaque, hwaddr addr,
|
|||
VirtIOPCIProxy *proxy = opaque;
|
||||
uint32_t config = VIRTIO_PCI_CONFIG_SIZE(&proxy->pci_dev);
|
||||
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
|
||||
|
||||
if (vdev == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (addr < config) {
|
||||
virtio_ioport_write(proxy, addr, val);
|
||||
return;
|
||||
|
@ -1146,6 +1157,10 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr addr,
|
|||
uint32_t val = 0;
|
||||
int i;
|
||||
|
||||
if (vdev == NULL) {
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
||||
switch (addr) {
|
||||
case VIRTIO_PCI_COMMON_DFSELECT:
|
||||
val = proxy->dfselect;
|
||||
|
@ -1229,6 +1244,10 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr,
|
|||
VirtIOPCIProxy *proxy = opaque;
|
||||
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
|
||||
|
||||
if (vdev == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (addr) {
|
||||
case VIRTIO_PCI_COMMON_DFSELECT:
|
||||
proxy->dfselect = val;
|
||||
|
@ -1330,6 +1349,11 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr,
|
|||
static uint64_t virtio_pci_notify_read(void *opaque, hwaddr addr,
|
||||
unsigned size)
|
||||
{
|
||||
VirtIOPCIProxy *proxy = opaque;
|
||||
if (virtio_bus_get_device(&proxy->bus) == NULL) {
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1367,7 +1391,7 @@ static uint64_t virtio_pci_isr_read(void *opaque, hwaddr addr,
|
|||
uint64_t val;
|
||||
|
||||
if (vdev == NULL) {
|
||||
return 0;
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
||||
val = qatomic_xchg(&vdev->isr, 0);
|
||||
|
@ -1388,7 +1412,7 @@ static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr,
|
|||
uint64_t val;
|
||||
|
||||
if (vdev == NULL) {
|
||||
return 0;
|
||||
return UINT64_MAX;
|
||||
}
|
||||
|
||||
switch (size) {
|
||||
|
@ -1760,6 +1784,11 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)
|
|||
proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;
|
||||
}
|
||||
|
||||
/* fd-based ioevents can't be synchronized in record/replay */
|
||||
if (replay_mode != REPLAY_MODE_NONE) {
|
||||
proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;
|
||||
}
|
||||
|
||||
/*
|
||||
* virtio pci bar layout used by default.
|
||||
* subclasses can re-arrange things if needed.
|
||||
|
|
|
@ -3728,6 +3728,10 @@ static int virtio_device_start_ioeventfd_impl(VirtIODevice *vdev)
|
|||
VirtioBusState *qbus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev)));
|
||||
int i, n, r, err;
|
||||
|
||||
/*
|
||||
* Batch all the host notifiers in a single transaction to avoid
|
||||
* quadratic time complexity in address_space_update_ioeventfds().
|
||||
*/
|
||||
memory_region_transaction_begin();
|
||||
for (n = 0; n < VIRTIO_QUEUE_MAX; n++) {
|
||||
VirtQueue *vq = &vdev->vq[n];
|
||||
|
@ -3766,6 +3770,10 @@ assign_error:
|
|||
r = virtio_bus_set_host_notifier(qbus, n, false);
|
||||
assert(r >= 0);
|
||||
}
|
||||
/*
|
||||
* The transaction expects the ioeventfds to be open when it
|
||||
* commits. Do it now, before the cleanup loop.
|
||||
*/
|
||||
memory_region_transaction_commit();
|
||||
|
||||
while (--i >= 0) {
|
||||
|
@ -3790,6 +3798,10 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev)
|
|||
VirtioBusState *qbus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev)));
|
||||
int n, r;
|
||||
|
||||
/*
|
||||
* Batch all the host notifiers in a single transaction to avoid
|
||||
* quadratic time complexity in address_space_update_ioeventfds().
|
||||
*/
|
||||
memory_region_transaction_begin();
|
||||
for (n = 0; n < VIRTIO_QUEUE_MAX; n++) {
|
||||
VirtQueue *vq = &vdev->vq[n];
|
||||
|
@ -3801,6 +3813,10 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev)
|
|||
r = virtio_bus_set_host_notifier(qbus, n, false);
|
||||
assert(r >= 0);
|
||||
}
|
||||
/*
|
||||
* The transaction expects the ioeventfds to be open when it
|
||||
* commits. Do it now, before the cleanup loop.
|
||||
*/
|
||||
memory_region_transaction_commit();
|
||||
|
||||
for (n = 0; n < VIRTIO_QUEUE_MAX; n++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue