pc,pci,virtio: fixes, cleanups
Subsystems (2)
The following changes since commit 8880cc4362fde4ecdac0b2092318893118206fcf:
Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20210902' into staging (2021-09-03 08:27:38 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream
for you to fetch changes up to 499c8b4de96eecc554a03e452226f79f169a233b:
vhost-vdpa: remove the unncessary queue_index assignment (2021-09-04 17:34:05 -0400)
----------------------------------------------------------------
pc,pci,virtio: fixes, cleanups
Fixes, cleanups all over the place.
----------------------------------------------------------------
Alyssa Ross (1):
vhost-user: add missing space in error message
Ani Sinha (5):
hw/acpi: define PIIX4 acpi pci hotplug property strings at a single place hw/acpi: refactor acpi hp modules so that targets can just use what they need hw/pci: remove all references to find_i440fx function
hw/acpi: use existing references to pci device struct within functions
MAINTAINERS: Added myself as a reviewer for acpi/smbios subsystem
David Hildenbrand (2):
virtio-balloon: don't start free page hinting if postcopy is possible
virtio-balloon: free page hinting cleanups
Denis Plotnikov (1):
vhost: make SET_VRING_ADDR, SET_FEATURES send replies
Eduardo Habkost (2):
acpi: Delete broken ACPI_GED_X86 macro
Use PCI_HOST_BRIDGE macro
Eugenio Pérez (1):
vhost-vdpa: Do not send empty IOTLB update batches
Gerd Hoffmann (1):
q35: catch invalid cpu hotplug configuration
Jason Wang (14):
virtio-bus: introduce iommu_enabled()
virtio-pci: implement iommu_enabled()
vhost: correctly detect the enabling IOMMU
vhost-vdpa: remove unused variable "acked_features"
vhost-vdpa: correctly return err in vhost_vdpa_set_backend_cap()
vhost_net: remove the meaningless assignment in vhost_net_start_one()
vhost: use unsigned int for nvqs
vhost_net: do not assume nvqs is always 2
vhost-vdpa: remove the unnecessary check in vhost_vdpa_add()
vhost-vdpa: don't cleanup twice in vhost_vdpa_add()
vhost-vdpa: fix leaking of vhost_net in vhost_vdpa_add()
vhost-vdpa: tweak the error label in vhost_vdpa_add()
vhost-vdpa: fix the wrong assertion in vhost_vdpa_init()
vhost-vdpa: remove the unncessary queue_index assignment
Jingqi Liu (1):
hw/i386/acpi-build: Get NUMA information from struct NumaState
Peter Maydell (2):
tests/vhost-user-bridge.c: Sanity check socket path length tests/vhost-user-bridge.c: Fix typo in help message
Philippe Mathieu-Daudé (2):
hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU hw/virtio: Remove NULL check in virtio_free_region_cache()
Tiberiu Georgescu (1):
hw/virtio: move vhost_set_backend_type() to vhost.c
Yajun Wu (1):
hw/virtio: Fix leak of host-notifier memory-region
Yuwei Zhang (1):
hw/virtio: Add flatview update in vhost_user_cleanup()
configs/devices/mips-softmmu/common.mak | 5 +- include/hw/acpi/acpi.h | 2 + include/hw/acpi/generic_event_device.h | 2 - include/hw/i386/pc.h | 4 - include/hw/pci-host/i440fx.h | 1 - include/hw/virtio/vhost-backend.h | 6 -- include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/vhost.h | 6 +- include/hw/virtio/virtio-bus.h | 4 +- include/net/vhost_net.h | 1 + hw/acpi/acpi-cpu-hotplug-stub.c | 50 +++++++++++ hw/acpi/acpi-mem-hotplug-stub.c | 35 ++++++++ hw/acpi/acpi-nvdimm-stub.c | 8 ++ hw/acpi/acpi-pci-hotplug-stub.c | 47 ++++++++++ hw/acpi/ich9.c | 2 +- hw/acpi/pcihp.c | 6 +- hw/acpi/piix4.c | 4 +- hw/i386/acpi-build.c | 24 +++-- hw/i386/pc.c | 13 +-- hw/i386/pc_q35.c | 2 +- hw/isa/lpc_ich9.c | 13 +++ hw/net/vhost_net.c | 5 +- hw/pci-host/i440fx.c | 8 -- hw/virtio/vhost-backend.c | 30 +------ hw/virtio/vhost-user.c | 151 ++++++++++++++++++++++---------- hw/virtio/vhost-vdpa.c | 39 ++++++--- hw/virtio/vhost.c | 31 ++++++- hw/virtio/virtio-balloon.c | 41 ++++----- hw/virtio/virtio-bus.c | 14 +++ hw/virtio/virtio-pci.c | 14 +++ hw/virtio/virtio.c | 7 +- net/tap.c | 1 + net/vhost-user.c | 1 + net/vhost-vdpa.c | 35 +++----- stubs/pci-host-piix.c | 7 -- tests/vhost-user-bridge.c | 7 +- MAINTAINERS | 1 + hw/acpi/Kconfig | 10 +++ hw/acpi/meson.build | 14 ++- stubs/meson.build | 1 - 40 files changed, 440 insertions(+), 213 deletions(-) create mode 100644 hw/acpi/acpi-cpu-hotplug-stub.c create mode 100644 hw/acpi/acpi-mem-hotplug-stub.c create mode 100644 hw/acpi/acpi-nvdimm-stub.c create mode 100644 hw/acpi/acpi-pci-hotplug-stub.c delete mode 100644 stubs/pci-host-piix.c
[PULL 01/35] vhost-vdpa: Do not send empty IOTLB update batches
From: Eugenio Pérez <[email protected]>
With the introduction of the batch hinting, meaningless batches can be created with no IOTLB updates if the memory region was skipped by vhost_vdpa_listener_skipped_section. This is the case of host notifiers memory regions, device un/realize, and others. This causes the vdpa device to receive dma mapping settings with no changes, a possibly expensive operation for nothing.
To avoid that, VHOST_IOTLB_BATCH_BEGIN hint is delayed until we have a meaningful (not skipped section) mapping or unmapping operation, and VHOST_IOTLB_BATCH_END is not written unless at least one of _UPDATE / _INVALIDATE has been issued.
v3:
* Use a bool instead of a counter avoiding potential number wrapping
* Fix bad check on _commit
* Move VHOST_BACKEND_F_IOTLB_BATCH check to vhost_vdpa_iotlb_batch_begin_once
v2 (from RFC):
* Rename misleading name
* Abstract start batching function for listener_add/del
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 35 ++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 12 deletions(-)
include/hw/virtio/vhost-vdpa.h +1 -0
@@ -22,6 +22,7 @@ typedef struct VhostVDPAHostNotifier { typedef struct vhost_vdpa { int device_fd; uint32_t msg_type; + bool iotlb_batch_begin_sent; MemoryListener listener; struct vhost_dev *dev; VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX];
hw/virtio/vhost-vdpa.c +23 -12
@@ -89,19 +89,13 @@ static int vhost_vdpa_dma_unmap(struct vhost_vdpa *v, hwaddr iova,return ret; } -static void vhost_vdpa_listener_begin (MemoryListener *listener) +static void vhost_vdpa_listener_begin_batch (struct vhost_vdpa *v) { - struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener); -struct vhost_dev *dev = v->dev; -struct vhost_msg_v2 msg = {};int fd = v->device_fd; - -if (!(dev->backend_cap & (0x1ULL <<VHOST_BACKEND_F_IOTLB_BATCH ))) { -return ; - } - - msg.type = v->msg_type; - msg.iotlb.type =VHOST_IOTLB_BATCH_BEGIN ; +struct vhost_msg_v2 msg = { + .type = v->msg_type, + .iotlb.type =VHOST_IOTLB_BATCH_BEGIN , + };if (write (fd, &msg,sizeof (msg)) !=sizeof (msg)) { error_report("failed to write, fd=%d, errno=%d (%s)",
@@ -109,6 +103,16 @@ static void vhost_vdpa_listener_begin(MemoryListener *listener) } } +static void vhost_vdpa_iotlb_batch_begin_once (struct vhost_vdpa *v) +{ +if (v->dev->backend_cap & (0x1ULL <<VHOST_BACKEND_F_IOTLB_BATCH ) && + !v->iotlb_batch_begin_sent) { +vhost_vdpa_listener_begin_batch (v); + } + + v->iotlb_batch_begin_sent = true; +} +static void vhost_vdpa_listener_commit (MemoryListener *listener) { struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener);
@@ -120,6 +124,10 @@ static void vhost_vdpa_listener_commit(MemoryListener *listener)return ; } +if (!v->iotlb_batch_begin_sent) { +return ; + } + msg.type = v->msg_type; msg.iotlb.type =VHOST_IOTLB_BATCH_END ;
@@ -127,6 +135,8 @@ static void vhost_vdpa_listener_commit(MemoryListener *listener)error_report ("failed to write, fd=%d, errno=%d (%s)" , fd, errno,strerror (errno)); } + + v->iotlb_batch_begin_sent = false; } static void vhost_vdpa_listener_region_add(MemoryListener *listener,
@@ -170,6 +180,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener, llsize =int128_sub (llend,int128_make64 (iova)); +vhost_vdpa_iotlb_batch_begin_once (v); ret =vhost_vdpa_dma_map (v, iova,int128_get64 (llsize), vaddr, section->readonly);if (ret) {
@@ -221,6 +232,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener, llsize =int128_sub (llend,int128_make64 (iova)); +vhost_vdpa_iotlb_batch_begin_once (v); ret =vhost_vdpa_dma_unmap (v, iova,int128_get64 (llsize));if (ret) {error_report ("vhost_vdpa dma unmap error!" );
@@ -234,7 +246,6 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,* depends on the addnop(). */ static const MemoryListener vhost_vdpa_memory_listener = { - .begin = vhost_vdpa_listener_begin, .commit = vhost_vdpa_listener_commit, .region_add = vhost_vdpa_listener_region_add, .region_del = vhost_vdpa_listener_region_del,
Signature · 1 line
MST
[PULL 02/35] hw/virtio: Fix leak of host-notifier memory-region
In reply to Michael S. TsirkinFrom: Yajun Wu <[email protected]>
If call virtio_queue_set_host_notifier_mr fails, should free host-notifier memory-region.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/vhost-user.c +1 -0
@@ -1474,6 +1474,7 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev,g_free (name);if (virtio_queue_set_host_notifier_mr (vdev, queue_idx, &n->mr, true)) { +object_unparent (OBJECT (&n->mr));munmap (addr, page_size);return -1 ; }
Signature · 1 line
MST
[PULL 03/35] vhost: make SET_VRING_ADDR, SET_FEATURES send replies
In reply to Michael S. TsirkinFrom: Denis Plotnikov <[email protected]>
On vhost-user-blk migration, qemu normally sends a number of commands to enable logging if VHOST_USER_PROTOCOL_F_LOG_SHMFD is negotiated. Qemu sends VHOST_USER_SET_FEATURES to enable buffers logging and VHOST_USER_SET_VRING_ADDR per each started ring to enable "used ring" data logging.
The issue is that qemu doesn't wait for reply from the vhost daemon for these commands which may result in races between qemu expectation of logging starting and actual login starting in vhost daemon.
The race can appear as follows: on migration setup, qemu enables dirty page logging by sending VHOST_USER_SET_FEATURES. The command doesn't arrive to a vhost-user-blk daemon immediately and the daemon needs some time to turn the logging on internally. If qemu doesn't wait for reply, after sending the command, qemu may start migrateing memory pages to a destination. At this time, the logging may not be actually turned on in the daemon but some guest pages, which the daemon is about to write to, may have already been transferred without logging to the destination. Since the logging wasn't turned on, those pages won't be transferred again as dirty. So we may end up with corrupted data on the destination.
The same scenario is applicable for "used ring" data logging, which is turned on with VHOST_USER_SET_VRING_ADDR command.
To resolve this issue, this patch makes qemu wait for the command result explicitly if VHOST_USER_PROTOCOL_F_REPLY_ACK is negotiated and logging enabled.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 145 ++++++++++++++++++++++++++++------------- 1 file changed, 101 insertions(+), 44 deletions(-)
hw/virtio/vhost-user.c +101 -44
@@ -1095,23 +1095,6 @@ static int vhost_user_set_mem_table(struct vhost_dev *dev,return 0 ; } -static int vhost_user_set_vring_addr (struct vhost_dev *dev, -struct vhost_vring_addr *addr) -{ -VhostUserMsg msg = { - .hdr.request =VHOST_USER_SET_VRING_ADDR , - .hdr.flags =VHOST_USER_VERSION , - .payload.addr = *addr, - .hdr.size =sizeof (msg.payload.addr), - }; - -if (vhost_user_write (dev, &msg,NULL ,0 ) <0 ) { -return -1 ; - } - -return 0 ; -} -static int vhost_user_set_vring_endian (struct vhost_dev *dev,struct vhost_vring_state *ring) {
@@ -1288,33 +1271,6 @@ static int vhost_user_set_vring_call(struct vhost_dev *dev,return vhost_set_vring_file (dev,VHOST_USER_SET_VRING_CALL , file); } -static int vhost_user_set_u64 (struct vhost_dev *dev,int request,uint64_t u64) -{ -VhostUserMsg msg = { - .hdr.request = request, - .hdr.flags =VHOST_USER_VERSION , - .payload.u64 = u64, - .hdr.size =sizeof (msg.payload.u64), - }; - -if (vhost_user_write (dev, &msg,NULL ,0 ) <0 ) { -return -1 ; - } - -return 0 ; -} - -static int vhost_user_set_features (struct vhost_dev *dev, -uint64_t features) -{ -return vhost_user_set_u64 (dev,VHOST_USER_SET_FEATURES , features); -} - -static int vhost_user_set_protocol_features (struct vhost_dev *dev, -uint64_t features) -{ -return vhost_user_set_u64 (dev,VHOST_USER_SET_PROTOCOL_FEATURES , features); -}static int vhost_user_get_u64 (struct vhost_dev *dev,int request,uint64_t *u64) {
@@ -1360,6 +1316,107 @@ static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features)return 0 ; } +static int enforce_reply (struct vhost_dev *dev, +const VhostUserMsg *msg) +{ +uint64_t dummy; + +if (msg->hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +return process_message_reply (dev, msg); + } + +/* +* We need to wait for a reply but the backend does not +* support replies for the command we just sent. +* Send VHOST_USER_GET_FEATURES which makes all backends +* send a reply. +*/ +return vhost_user_get_features (dev, &dummy); +} + +static int vhost_user_set_vring_addr (struct vhost_dev *dev, +struct vhost_vring_addr *addr) +{ +VhostUserMsg msg = { + .hdr.request =VHOST_USER_SET_VRING_ADDR , + .hdr.flags =VHOST_USER_VERSION , + .payload.addr = *addr, + .hdr.size =sizeof (msg.payload.addr), + }; + +bool reply_supported =virtio_has_feature (dev->protocol_features, +VHOST_USER_PROTOCOL_F_REPLY_ACK ); + +/* +* wait for a reply if logging is enabled to make sure +* backend is actually logging changes +*/ +bool wait_for_reply = addr->flags & (1 <<VHOST_VRING_F_LOG ); + +if (reply_supported && wait_for_reply) { + msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; + } + +if (vhost_user_write (dev, &msg,NULL ,0 ) <0 ) { +return -1 ; + } + +if (wait_for_reply) { +return enforce_reply (dev, &msg); + } + +return 0 ; +} + +static int vhost_user_set_u64 (struct vhost_dev *dev,int request,uint64_t u64, +bool wait_for_reply) +{ +VhostUserMsg msg = { + .hdr.request = request, + .hdr.flags =VHOST_USER_VERSION , + .payload.u64 = u64, + .hdr.size =sizeof (msg.payload.u64), + }; + +if (wait_for_reply) { +bool reply_supported =virtio_has_feature (dev->protocol_features, +VHOST_USER_PROTOCOL_F_REPLY_ACK ); +if (reply_supported) { + msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; + } + } + +if (vhost_user_write (dev, &msg,NULL ,0 ) <0 ) { +return -1 ; + } + +if (wait_for_reply) { +return enforce_reply (dev, &msg); + } + +return 0 ; +} + +static int vhost_user_set_features (struct vhost_dev *dev, +uint64_t features) +{ +/* +* wait for a reply if logging is enabled to make sure +* backend is actually logging changes +*/ +bool log_enabled = features & (0x1ULL <<VHOST_F_LOG_ALL ); + +return vhost_user_set_u64 (dev,VHOST_USER_SET_FEATURES , features, + log_enabled); +} + +static int vhost_user_set_protocol_features (struct vhost_dev *dev, +uint64_t features) +{ +return vhost_user_set_u64 (dev,VHOST_USER_SET_PROTOCOL_FEATURES , features, + false); +} +static int vhost_user_set_owner (struct vhost_dev *dev) {VhostUserMsg msg = {
Signature · 1 line
MST
[PULL 05/35] q35: catch invalid cpu hotplug configuration
In reply to Michael S. TsirkinFrom: Gerd Hoffmann <[email protected]>
Related: https://bugzilla.redhat.com//show_bug.cgi?id=1985924
Message-Id: <[email protected]>
--- hw/isa/lpc_ich9.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/isa/lpc_ich9.c +13 -0
@@ -31,6 +31,7 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "cpu.h" +#include "qapi/error.h" #include "qapi/visitor.h" #include "qemu/range.h" #include "hw/isa/isa.h"
@@ -676,6 +677,18 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)DeviceState *dev =DEVICE (d);ISABus *isa_bus; +if ((lpc->smi_host_features &BIT_ULL (ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT )) && + !(lpc->smi_host_features &BIT_ULL (ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT ))) { +/* +* smi_features_ok_callback() throws an error on this. +* +* So bail out here instead of advertizing the invalid +* configuration and get obscure firmware failures from that. +*/ +error_setg (errp,"cpu hot-unplug requires cpu hot-plug" ); +return ; + } + isa_bus =isa_bus_new (DEVICE (d),get_system_memory (),get_system_io (), errp);if (!isa_bus) {
Signature · 1 line
MST
[PULL 04/35] hw/acpi: define PIIX4 acpi pci hotplug property strings at a single place
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
Now that we have "acpi-pci-hotplug-with-bridge-support" PIIX4 PM property being used for both q35 and i440fx machine types, it is better that we defined this property string at a single place within a header file like other PIIX4 properties. We can then use this single definition at all the places that needs it instead of duplicating the string everywhere. While at it, this change also adds a definition for "acpi-root-pci-hotplug" PIIX4 PM property and uses this definition at all places that were formally using the string value.
Message-Id: <[email protected]>
--- include/hw/acpi/acpi.h | 2 ++ hw/acpi/ich9.c | 2 +- hw/acpi/piix4.c | 4 ++-- hw/i386/acpi-build.c | 4 ++-- hw/i386/pc.c | 4 ++-- hw/i386/pc_q35.c | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-)
include/hw/acpi/acpi.h +2 -0
@@ -47,6 +47,8 @@#define ACPI_PM_PROP_PM_IO_BASE "pm_io_base"#define ACPI_PM_PROP_GPE0_BLK "gpe0_blk"#define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len" +#define ACPI_PM_PROP_ACPI_PCIHP_BRIDGE "acpi-pci-hotplug-with-bridge-support" +#define ACPI_PM_PROP_ACPI_PCI_ROOTHP "acpi-root-pci-hotplug"/* PM Timer ticks per second (HZ) */ #define PM_TIMER_FREQUENCY 3579545
hw/acpi/ich9.c +1 -1
@@ -451,7 +451,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)object_property_add_bool (obj,ACPI_PM_PROP_TCO_ENABLED , ich9_pm_get_enable_tco, ich9_pm_set_enable_tco); -object_property_add_bool (obj,"acpi-pci-hotplug-with-bridge-support" , +object_property_add_bool (obj,ACPI_PM_PROP_ACPI_PCIHP_BRIDGE , ich9_pm_get_acpi_pci_hotplug, ich9_pm_set_acpi_pci_hotplug); }
hw/acpi/piix4.c +2 -2
@@ -647,9 +647,9 @@ static Property piix4_pm_properties[] = {DEFINE_PROP_UINT8 (ACPI_PM_PROP_S3_DISABLED , PIIX4PMState, disable_s3,0 ),DEFINE_PROP_UINT8 (ACPI_PM_PROP_S4_DISABLED , PIIX4PMState, disable_s4,0 ),DEFINE_PROP_UINT8 (ACPI_PM_PROP_S4_VAL , PIIX4PMState, s4_val,2 ), -DEFINE_PROP_BOOL ("acpi-pci-hotplug-with-bridge-support" , PIIX4PMState, +DEFINE_PROP_BOOL (ACPI_PM_PROP_ACPI_PCIHP_BRIDGE , PIIX4PMState, use_acpi_hotplug_bridge, true), -DEFINE_PROP_BOOL ("acpi-root-pci-hotplug" , PIIX4PMState, +DEFINE_PROP_BOOL (ACPI_PM_PROP_ACPI_PCI_ROOTHP , PIIX4PMState, use_acpi_root_pci_hotplug, true),DEFINE_PROP_BOOL ("memory-hotplug-support" , PIIX4PMState, acpi_memory_hotplug.is_enabled, true),
hw/i386/acpi-build.c +2 -2
@@ -267,10 +267,10 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm)qobject_unref (o); pm->pcihp_bridge_en = -object_property_get_bool (obj,"acpi-pci-hotplug-with-bridge-support" , +object_property_get_bool (obj,ACPI_PM_PROP_ACPI_PCIHP_BRIDGE ,NULL ); pm->pcihp_root_en = -object_property_get_bool (obj,"acpi-root-pci-hotplug" , +object_property_get_bool (obj,ACPI_PM_PROP_ACPI_PCI_ROOTHP ,NULL ); }
hw/i386/pc.c +2 -2
@@ -101,7 +101,7 @@ GlobalProperty pc_compat_6_0[] = { { "qemu64" "-" TYPE_X86_CPU, "model", "6" }, { "qemu64" "-" TYPE_X86_CPU, "stepping", "3" }, { TYPE_X86_CPU, "x-vendor-cpuid-only", "off" }, - { "ICH9-LPC", "acpi-pci-hotplug-with-bridge-support", "off" }, + { "ICH9-LPC", ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, "off" }, };const size_t pc_compat_6_0_len =G_N_ELEMENTS (pc_compat_6_0);
@@ -313,7 +313,7 @@ const size_t pc_compat_2_0_len = G_N_ELEMENTS(pc_compat_2_0);GlobalProperty pc_compat_1_7[] = { PC_CPU_MODEL_IDS("1.7.0") {TYPE_USB_DEVICE ,"msos-desc" ,"no" }, - {"PIIX4_PM" ,"acpi-pci-hotplug-with-bridge-support" ,"off" }, + {"PIIX4_PM" ,ACPI_PM_PROP_ACPI_PCIHP_BRIDGE ,"off" }, {"hpet" ,HPET_INTCAP ,"4" }, };const size_t pc_compat_1_7_len =G_N_ELEMENTS (pc_compat_1_7);
hw/i386/pc_q35.c +1 -1
@@ -238,7 +238,7 @@ static void pc_q35_init(MachineState *machine) OBJECT(lpc), &error_abort); acpi_pcihp =object_property_get_bool (OBJECT (lpc), -"acpi-pci-hotplug-with-bridge-support" , +ACPI_PM_PROP_ACPI_PCIHP_BRIDGE ,NULL );if (acpi_pcihp) {
Signature · 1 line
MST
[PULL 07/35] hw/virtio: move vhost_set_backend_type() to vhost.c
In reply to Michael S. TsirkinFrom: Tiberiu Georgescu <[email protected]>
Just a small refactor patch.
vhost_set_backend_type() gets called only in vhost.c, so we can move the function there and make it static. We can then extern the visibility of kernel_ops, to match the other VhostOps in vhost-backend.h. The VhostOps constants now make more sense in vhost.h
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-backend.h | 6 ------ include/hw/virtio/vhost.h | 4 ++++ hw/virtio/vhost-backend.c | 30 +----------------------------- hw/virtio/vhost.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 35 deletions(-)
include/hw/virtio/vhost-backend.h +0 -6
@@ -173,12 +173,6 @@ typedef struct VhostOps {vhost_force_iommu_op vhost_force_iommu; } VhostOps; -extern const VhostOps user_ops; -extern const VhostOps vdpa_ops; - -int vhost_set_backend_type (struct vhost_dev *dev, -VhostBackendType backend_type); - int vhost_backend_update_device_iotlb(struct vhost_dev *dev, uint64_t iova, uint64_t uaddr, uint64_t len,
include/hw/virtio/vhost.h +4 -0
@@ -95,6 +95,10 @@ struct vhost_dev {const VhostDevConfigOps *config_ops; }; +extern const VhostOps kernel_ops; +extern const VhostOps user_ops; +extern const VhostOps vdpa_ops; +struct vhost_net {struct vhost_dev dev;struct vhost_virtqueue vqs[2 ];
hw/virtio/vhost-backend.c +1 -29
@@ -293,7 +293,7 @@ static void vhost_kernel_set_iotlb_callback(struct vhost_dev *dev,qemu_set_fd_handler ((uintptr_t )dev->opaque,NULL ,NULL ,NULL ); } -static const VhostOps kernel_ops = { +const VhostOps kernel_ops = { .backend_type =VHOST_BACKEND_TYPE_KERNEL , .vhost_backend_init = vhost_kernel_init, .vhost_backend_cleanup = vhost_kernel_cleanup,
@@ -328,34 +328,6 @@ static const VhostOps kernel_ops = { };#endif -int vhost_set_backend_type (struct vhost_dev *dev,VhostBackendType backend_type) -{ -int r =0 ; - -switch (backend_type) { -#ifdef CONFIG_VHOST_KERNEL -case VHOST_BACKEND_TYPE_KERNEL : - dev->vhost_ops = &kernel_ops; -break ; -#endif -#ifdef CONFIG_VHOST_USER -case VHOST_BACKEND_TYPE_USER : - dev->vhost_ops = &user_ops; -break ; -#endif -#ifdef CONFIG_VHOST_VDPA -case VHOST_BACKEND_TYPE_VDPA : - dev->vhost_ops = &vdpa_ops; -break ; -#endif -default : -error_report ("Unknown vhost backend type" ); - r =-1 ; - } - -return r; -} - int vhost_backend_update_device_iotlb(struct vhost_dev *dev, uint64_t iova, uint64_t uaddr, uint64_t len,
hw/virtio/vhost.c +29 -0
@@ -174,6 +174,35 @@ static uint64_t vhost_get_log_size(struct vhost_dev *dev)return log_size; } +static int vhost_set_backend_type (struct vhost_dev *dev, +VhostBackendType backend_type) +{ +int r =0 ; + +switch (backend_type) { +#ifdef CONFIG_VHOST_KERNEL +case VHOST_BACKEND_TYPE_KERNEL : + dev->vhost_ops = &kernel_ops; +break ; +#endif +#ifdef CONFIG_VHOST_USER +case VHOST_BACKEND_TYPE_USER : + dev->vhost_ops = &user_ops; +break ; +#endif +#ifdef CONFIG_VHOST_VDPA +case VHOST_BACKEND_TYPE_VDPA : + dev->vhost_ops = &vdpa_ops; +break ; +#endif +default : +error_report ("Unknown vhost backend type" ); + r =-1 ; + } + +return r; +} +static struct vhost_log *vhost_log_alloc (uint64_t size,bool share) {Error *err =NULL ;
Signature · 1 line
MST
[PULL 09/35] acpi: Delete broken ACPI_GED_X86 macro
In reply to Michael S. TsirkinFrom: Eduardo Habkost <[email protected]>
The macro never worked and never will, because the AcpiGedX86State type never existed.
Message-Id: <[email protected]>
--- include/hw/acpi/generic_event_device.h | 2 -- 1 file changed, 2 deletions(-)
include/hw/acpi/generic_event_device.h +0 -2
@@ -70,8 +70,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED)#define TYPE_ACPI_GED_X86 "acpi-ged-x86" -#define ACPI_GED_X86 (obj) \ - OBJECT_CHECK(AcpiGedX86State, (obj), TYPE_ACPI_GED_X86)#define ACPI_GED_EVT_SEL_OFFSET 0x0#define ACPI_GED_EVT_SEL_LEN 0x4
Signature · 1 line
MST
[PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when CONFIG_ACPI_X86 is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part of CONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling ACPI_X86.
This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193
Message-Id: <[email protected]>
--- configs/devices/mips-softmmu/common.mak | 5 +-- hw/acpi/acpi-cpu-hotplug-stub.c | 50 +++++++++++++++++++++++++ hw/acpi/acpi-mem-hotplug-stub.c | 35 +++++++++++++++++ hw/acpi/acpi-nvdimm-stub.c | 8 ++++ hw/acpi/acpi-pci-hotplug-stub.c | 47 +++++++++++++++++++++++ hw/acpi/Kconfig | 10 +++++ hw/acpi/meson.build | 14 +++++-- 7 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 hw/acpi/acpi-cpu-hotplug-stub.c create mode 100644 hw/acpi/acpi-mem-hotplug-stub.c create mode 100644 hw/acpi/acpi-nvdimm-stub.c create mode 100644 hw/acpi/acpi-pci-hotplug-stub.c
configs/devices/mips-softmmu/common.mak +1 -4
@@ -18,10 +18,7 @@ CONFIG_PCSPK=y CONFIG_PCKBD=y CONFIG_FDC=y CONFIG_ACPI=y -CONFIG_ACPI_X86=y -CONFIG_ACPI_MEMORY_HOTPLUG=y -CONFIG_ACPI_NVDIMM=y -CONFIG_ACPI_CPU_HOTPLUG=y +CONFIG_ACPI_PIIX4=y CONFIG_APM=y CONFIG_I8257=y CONFIG_PIIX4=y
hw/acpi/acpi-cpu-hotplug-stub.c new file +50 -0
50 lines not on this page · raw message
hw/acpi/acpi-mem-hotplug-stub.c new file +35 -0
@@ -0,0 +1,35 @@ +#include "qemu/osdep.h" +#include "hw/acpi/memory_hotplug.h" +#include "migration/vmstate.h" + +const VMStateDescription vmstate_memory_hotplug; + +void acpi_memory_hotplug_init (MemoryRegion *as,Object *owner, +MemHotplugState *state,hwaddr io_base) +{ +return ; +} + +void acpi_memory_ospm_status (MemHotplugState *mem_st,ACPIOSTInfoList ***list) +{ +return ; +} + +void acpi_memory_plug_cb (HotplugHandler *hotplug_dev,MemHotplugState *mem_st, +DeviceState *dev,Error **errp) +{ +return ; +} + +void acpi_memory_unplug_cb (MemHotplugState *mem_st, +DeviceState *dev,Error **errp) +{ +return ; +} + +void acpi_memory_unplug_request_cb (HotplugHandler *hotplug_dev, +MemHotplugState *mem_st, +DeviceState *dev,Error **errp) +{ +return ; +}
hw/acpi/acpi-nvdimm-stub.c new file +8 -0
@@ -0,0 +1,8 @@ +#include "qemu/osdep.h" +#include "hw/mem/nvdimm.h" +#include "hw/hotplug.h" + +void nvdimm_acpi_plug_cb (HotplugHandler *hotplug_dev,DeviceState *dev) +{ +return ; +}
hw/acpi/acpi-pci-hotplug-stub.c new file +47 -0
47 lines not on this page · raw message
hw/acpi/Kconfig +10 -0
@@ -8,6 +8,8 @@ config ACPI_X86 select ACPI_CPU_HOTPLUG select ACPI_MEMORY_HOTPLUG select ACPI_HMAT + select ACPI_PIIX4 + select ACPI_PCIHP config ACPI_X86_ICH bool
@@ -24,6 +26,14 @@ config ACPI_NVDIMM bool depends on ACPI +config ACPI_PIIX4 + bool + depends on ACPI + +config ACPI_PCIHP + bool + depends on ACPI + config ACPI_HMAT bool depends on ACPI
hw/acpi/meson.build +10 -4
@@ -6,16 +6,20 @@ acpi_ss.add(files( 'core.c', 'utils.c', )) -acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c')) -acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu_hotplug.c')) +acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c', 'cpu_hotplug.c')) +acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_false: files('acpi-cpu-hotplug-stub.c')) acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_true: files('memory_hotplug.c')) +acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_false: files('acpi-mem-hotplug-stub.c')) acpi_ss.add(when: 'CONFIG_ACPI_NVDIMM', if_true: files('nvdimm.c')) +acpi_ss.add(when: 'CONFIG_ACPI_NVDIMM', if_false: files('acpi-nvdimm-stub.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCI', if_true: files('pci.c')) acpi_ss.add(when: 'CONFIG_ACPI_VMGENID', if_true: files('vmgenid.c')) acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c')) acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c')) acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files('ghes-stub.c')) -acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('piix4.c', 'pcihp.c')) +acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c')) +acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c')) +acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
@@ -23,4 +27,6 @@ acpi_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c')) softmmu_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c')) softmmu_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss) softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c', - 'acpi-x86-stub.c', 'ipmi-stub.c', 'ghes-stub.c')) + 'acpi-x86-stub.c', 'ipmi-stub.c', 'ghes-stub.c', + 'acpi-mem-hotplug-stub.c', 'acpi-cpu-hotplug-stub.c', + 'acpi-pci-hotplug-stub.c', 'acpi-nvdimm-stub.c'))
Signature · 1 line
MST
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Hi Ani,
Quoted 17 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.
Quoted 7 lines
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193
FYI per https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
this should have been:
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221
Can we close these issues manually?
Quoted 17 lines
Signed-off-by Ani Sinha <[email protected]>Message-Id: <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- configs/devices/mips-softmmu/common.mak | 5 +-- hw/acpi/acpi-cpu-hotplug-stub.c | 50 +++++++++++++++++++++++++ hw/acpi/acpi-mem-hotplug-stub.c | 35 +++++++++++++++++ hw/acpi/acpi-nvdimm-stub.c | 8 ++++ hw/acpi/acpi-pci-hotplug-stub.c | 47 +++++++++++++++++++++++ hw/acpi/Kconfig | 10 +++++ hw/acpi/meson.build | 14 +++++-- 7 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 hw/acpi/acpi-cpu-hotplug-stub.c create mode 100644 hw/acpi/acpi-mem-hotplug-stub.c create mode 100644 hw/acpi/acpi-nvdimm-stub.c create mode 100644 hw/acpi/acpi-pci-hotplug-stub.c
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 28 lines · Philippe Mathieu-Daudé
Hi Ani,
Quoted 17 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Quoted 7 lines
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193
Quoted 6 lines
FYI per https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
this should have been:Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221
Ah my apologies. Will do this next time.
Quoted 1 line
Can we close these issues manually?
Since both you and I have verified that those issues gets fixed with my change, yes we can close them. I do not have a gitlab account. Should I have one? Is there special permissions needed to handle these tickets?
Quoted 20 lines
Quoted 18 lines
Signed-off-by Ani Sinha <[email protected]>Message-Id: <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- configs/devices/mips-softmmu/common.mak | 5 +-- hw/acpi/acpi-cpu-hotplug-stub.c | 50 +++++++++++++++++++++++++ hw/acpi/acpi-mem-hotplug-stub.c | 35 +++++++++++++++++ hw/acpi/acpi-nvdimm-stub.c | 8 ++++ hw/acpi/acpi-pci-hotplug-stub.c | 47 +++++++++++++++++++++++ hw/acpi/Kconfig | 10 +++++ hw/acpi/meson.build | 14 +++++-- 7 files changed, 161 insertions(+), 8 deletions(-) create mode 100644 hw/acpi/acpi-cpu-hotplug-stub.c create mode 100644 hw/acpi/acpi-mem-hotplug-stub.c create mode 100644 hw/acpi/acpi-nvdimm-stub.c create mode 100644 hw/acpi/acpi-pci-hotplug-stub.c
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 34 lines · Ani Sinha
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Quoted 7 lines
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193Quoted 6 lines
FYI per https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
this should have been:Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221
Quoted 7 lines
Ah my apologies. Will do this next time.
Quoted 1 line
Can we close these issues manually?
Since both you and I have verified that those issues gets fixed with my change, yes we can close them. I do not have a gitlab account. Should I have one? Is there special permissions needed to handle these tickets?
Since you are listed in the MAINTAINERS file, long-term you'll eventually use it anyway (i.e. to run the CI pipelines before sending patches, to subscribe to the 'ACPI' label to get notifications or comment ACPI-related issues).
The process is quite straight-forward, once having an account you simply request to be member of the project via the WebUI then you can help triaging the issues (and closing these two).
Regards,
Phil.
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 44 lines · Philippe Mathieu-Daudé
Quoted 34 lines · Ani Sinha
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Quoted 7 lines
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193Quoted 6 lines
FYI per https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
this should have been:Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221Quoted 7 lines
Ah my apologies. Will do this next time.
Quoted 1 line
Can we close these issues manually?
Since both you and I have verified that those issues gets fixed with my change, yes we can close them. I do not have a gitlab account. Should I have one? Is there special permissions needed to handle these tickets?
Quoted 8 lines
Since you are listed in the
MAINTAINERSfile, long-term you'll eventually use it anyway (i.e. to run the CI pipelines before sending patches, to subscribe to the 'ACPI' label to get notifications or comment ACPI-related issues).The process is quite straight-forward, once having an account you simply request to be member of the project via the WebUI then you can help triaging the issues (and closing these two).
Hmm. I created an account and added a comment to the tickets. However I am unable to close them. I requested access to the project.
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 51 lines · Ani Sinha
Quoted 49 lines · Philippe Mathieu-Daudé
Quoted 34 lines · Ani Sinha
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Quoted 7 lines
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193Quoted 6 lines
FYI per https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
this should have been:Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221Quoted 7 lines
Ah my apologies. Will do this next time.
Quoted 1 line
Can we close these issues manually?
Since both you and I have verified that those issues gets fixed with my change, yes we can close them. I do not have a gitlab account. Should I have one? Is there special permissions needed to handle these tickets?
Since you are listed in the
MAINTAINERSfile, long-term you'll eventually use it anyway (i.e. to run the CI pipelines before sending patches, to subscribe to the 'ACPI' label to get notifications or comment ACPI-related issues).
Quoted 6 lines
Quoted 3 lines
The process is quite straight-forward, once having an account you simply request to be member of the project via the WebUI then you can help triaging the issues (and closing these two).
Hmm. I created an account and added a comment to the tickets. However I am unable to close them. I requested access to the project.
I could be wrong, but I think only reporters can open and close bugs like yourself on gitlab.
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 56 lines · Ani Sinha
Quoted 55 lines · Ani Sinha
Quoted 52 lines · Philippe Mathieu-Daudé
Quoted 34 lines · Ani Sinha
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Quoted 7 lines
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193Quoted 6 lines
FYI per https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
this should have been:Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221Quoted 7 lines
Ah my apologies. Will do this next time.
Quoted 1 line
Can we close these issues manually?
Since both you and I have verified that those issues gets fixed with my change, yes we can close them. I do not have a gitlab account. Should I have one? Is there special permissions needed to handle these tickets?
Since you are listed in the
MAINTAINERSfile, long-term you'll eventually use it anyway (i.e. to run the CI pipelines before sending patches, to subscribe to the 'ACPI' label to get notifications or comment ACPI-related issues).The process is quite straight-forward, once having an account you simply request to be member of the project via the WebUI then you can help triaging the issues (and closing these two).
Quoted 5 lines
Quoted 2 lines
Hmm. I created an account and added a comment to the tickets. However I am unable to close them. I requested access to the project.
I could be wrong, but I think only reporters can open and close bugs like yourself on gitlab.
Hmm it is unclear who can close an issue, per:
https://docs.gitlab.com/ee/user/permissions.html#project-members-permissions
Let's wait until you get added to the project as a member: I assume you are currently 'guest' and would become 'reporter'.
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 81 lines · Philippe Mathieu-Daudé
Quoted 3 lines · Ani Sinha
Quoted 2 lines · Ani Sinha
On Mon, Sep 6, 2021 at 3:54 PM Philippe Mathieu-Daudé <
Quoted 7 lines · [email protected]> wrote:
Quoted 7 lines
Quoted 7 lines · Ani Sinha
Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory
hotplug, pci
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86isturned on.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
This brings in support for whole lot of subsystems that some
targets like
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
mips does not need. They are added just to satisfy symbol
dependencies. This
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
is ugly and should be avoided. Targets should be able to pull in
just what they
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
need and no more. For example, mips only needs support for PIIX4
and does not
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
need acpi pci hotplug support or cpu hotplug support or memory
hotplug support
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpihotplug
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
subsystems. Targets like mips can only enable PIIX4 support and not
the rest
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
of all the other modules which were being previously pulled in as a
part of
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
CONFIG_ACPI_X86. Function stubs make sure that symbols which piix4needs but
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
are not required by mips (for example, symbols specific to pci
hotplug etc)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
are available to satisfy the dependencies.
Currently, this change only addresses issues with mips malta
targets. In future
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
we might be able to clean up other targets which are similarly
pulling in lot
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193FYI per
https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
this should have been:
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221Ah my apologies. Will do this next time.
Quoted 1 line
Can we close these issues manually?
Since both you and I have verified that those issues gets fixed with
my
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
change, yes we can close them. I do not have a gitlab account. Should
I
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 1 line
have one? Is there special permissions needed to handle these tickets?
Since you are listed in the
MAINTAINERSfile, long-term you'll eventually use it anyway (i.e. to run the CI pipelines before sending patches, to subscribe to the 'ACPI' label to get notifications or comment ACPI-related issues).The process is quite straight-forward, once having an account you simply request to be member of the project via the WebUI then you can help triaging the issues (and closing these two).
Quoted 5 lines
Quoted 2 lines
Hmm. I created an account and added a comment to the tickets. However I am unable to close them. I requested access to the project.
I could be wrong, but I think only reporters can open and close bugs like yourself on gitlab.
Quoted 6 lines
Hmm it is unclear who can close an issue, per:
https://docs.gitlab.com/ee/user/permissions.html#project-members-permissions
Let's wait until you get added to the project as a member: I assume you are currently 'guest' and would become 'reporter'.
Ok will ping people on IRC today. Btw the gitlab issue list is a goldmine for people like me to work on my spare time :-)
Quoted 2 lines
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 68 lines · Ani Sinha
Quoted 64 lines · Philippe Mathieu-Daudé
Quoted 61 lines · Ani Sinha
Quoted 51 lines · Ani Sinha
Quoted 49 lines · Philippe Mathieu-Daudé
Quoted 34 lines · Ani Sinha
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 17 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Quoted 7 lines
Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193Quoted 6 lines
FYI per https://docs.gitlab.com/ee/administration/issue_closing_pattern.html
this should have been:Resolves: https://gitlab.com/qemu-project/qemu/-/issues/193
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/221Quoted 7 lines
Ah my apologies. Will do this next time.
Quoted 1 line
Can we close these issues manually?
Since both you and I have verified that those issues gets fixed with my change, yes we can close them. I do not have a gitlab account. Should I have one? Is there special permissions needed to handle these tickets?
Since you are listed in the
MAINTAINERSfile, long-term you'll eventually use it anyway (i.e. to run the CI pipelines before sending patches, to subscribe to the 'ACPI' label to get notifications or comment ACPI-related issues).Quoted 6 lines
Quoted 3 lines
The process is quite straight-forward, once having an account you simply request to be member of the project via the WebUI then you can help triaging the issues (and closing these two).
Hmm. I created an account and added a comment to the tickets. However I am unable to close them. I requested access to the project.
I could be wrong, but I think only reporters can open and close bugs like yourself on gitlab.
Quoted 8 lines
Quoted 5 lines
Hmm it is unclear who can close an issue, per:
https://docs.gitlab.com/ee/user/permissions.html#project-members-permissionsLet's wait until you get added to the project as a member: I assume you are currently 'guest' and would become 'reporter'.
Ok will ping people on IRC today.
Bonzini helped. I have closed both tickets.
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
In reply to Michael S. TsirkinQuoted 22 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.
Quoted 8 lines
This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193Signed-off-by Ani Sinha <[email protected]>Message-Id: <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
Hi; I'm trying to track down the fix for a bug that I think
was introduced by this change. Specifically, if you
configure with a target list of
'--target-list=mips-linux-user,mips64-linux-user,mipsel-linux-user,mipsn32-linux-user,mipsn32el-linux-user,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu'
(ie "just mips"), then run 'make check', the iotest 267 fails because QEMU segfaults trying to do a VM save/restore on qemu-system-mips. (You can run just that iotest by cd'ing into the build dir's tests/qemu-iotests/ subdir and running
./check -qcow2 -gdb 267
if you like).
This is because hw/acpi/piix4.c (used by the MIPS malta board) has a vmstate that includes use of the VMSTATE_PCI_HOTPLUG() macro. This macro uses the vmstate_acpi_pcihp_pci_status vmstate struct. If the MIPS target is built along with some other targets which require CONFIG_ACPI_PCIHP then we correctly get the real definition of that vmstate struct from pcihp.c. However, if we are only building the MIPS targets then CONFIG_ACPI_PCIHP is false, and we get the dummy definition of the struct from acpi-pci-hotplug-stub.c. The dummy definition obviously doesn't actually work for migrating anything, and in fact the migration code ends up segfaulting because the 'name' field in the struct is NULL. (MIPS builds and uses hw/acpi/piix4.c because configs/devices/mips-softmmu/common.mak sets CONFIG_ACPI_PIIX4=y, and it needs this because piix4_init() unconditionally creates a TYPE_PIIX4_PM device. It's possible this is a bug revealed/introduced by the recent piix4 refactoring, but I had a look at the code at the time this change was committed and afaict back then it also created the PIIX4_PM device, just in a different place. Indeed it is this commit which adds the CONFIG_ACPI_PIIX4=y to the config!)
How is this intended to work? The obvious fix from my point of view would just be to say "piix4.c requires pcihp.c" and cause CONFIG_ACPI_PIIX4 to pull in CONFIG_ACPI_PCIHP, but that seems like it would be rather undoing the point of this change. But if Malta requires ACPI_PIIX4 and it creates the PIIX4_PM device, it needs the real pcihp.c and not the stubs, doesn't it ?
thanks
-- PMM
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 10 lines · Peter Maydell
Hi; I'm trying to track down the fix for a bug that I think
was introduced by this change. Specifically, if you
configure with a target list of
'--target-list=mips-linux-user,mips64-linux-user,mipsel-linux-user,mipsn32-linux-user,mipsn32el-linux-user,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu'(ie "just mips"), then run 'make check', the iotest 267 fails because QEMU segfaults trying to do a VM save/restore on qemu-system-mips. (You can run just that iotest by cd'ing into the build dir's tests/qemu-iotests/ subdir and running
./check -qcow2 -gdb 267
I mean just "./check -qcow2 267" here (the -gdb starts a gdbserver, which is what I was doing while trying to debug.)
-- PMM
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
In reply to Peter MaydellQuoted 66 lines · Peter Maydell
Quoted 22 lines · Michael S. Tsirkin
From: Ani Sinha <[email protected]>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci hotplug, nvdimm hotplug are all pulled in when
CONFIG_ACPI_X86is turned on. This brings in support for whole lot of subsystems that some targets like mips does not need. They are added just to satisfy symbol dependencies. This is ugly and should be avoided. Targets should be able to pull in just what they need and no more. For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug support etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug subsystems. Targets like mips can only enable PIIX4 support and not the rest of all the other modules which were being previously pulled in as a part ofCONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but are not required by mips (for example, symbols specific to pci hotplug etc) are available to satisfy the dependencies.Currently, this change only addresses issues with mips malta targets. In future we might be able to clean up other targets which are similarly pulling in lot of unnecessary hotplug modules by enabling
ACPI_X86.Quoted 8 lines
This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193Signed-off-by Ani Sinha <[email protected]>Message-Id: <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Hi; I'm trying to track down the fix for a bug that I think
was introduced by this change. Specifically, if you
configure with a target list of
'--target-list=mips-linux-user,mips64-linux-user,mipsel-linux-user,mipsn32-linux-user,mipsn32el-linux-user,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu'(ie "just mips"), then run 'make check', the iotest 267 fails because QEMU segfaults trying to do a VM save/restore on qemu-system-mips. (You can run just that iotest by cd'ing into the build dir's tests/qemu-iotests/ subdir and running
./check -qcow2 -gdb 267
if you like).This is because
hw/acpi/piix4.c(used by the MIPS malta board) has a vmstate that includes use of theVMSTATE_PCI_HOTPLUG()macro. This macro uses thevmstate_acpi_pcihp_pci_statusvmstate struct. If the MIPS target is built along with some other targets which requireCONFIG_ACPI_PCIHPthen we correctly get the real definition of that vmstate struct frompcihp.c. However, if we are only building the MIPS targets thenCONFIG_ACPI_PCIHPis false, and we get the dummy definition of the struct fromacpi-pci-hotplug-stub.c. The dummy definition obviously doesn't actually work for migrating anything, and in fact the migration code ends up segfaulting because the 'name' field in the struct is NULL. (MIPS builds and useshw/acpi/piix4.cbecause configs/devices/mips-softmmu/common.mak setsCONFIG_ACPI_PIIX4=y, and it needs this becausepiix4_init()unconditionally creates aTYPE_PIIX4_PMdevice. It's possible this is a bug revealed/introduced by the recent piix4 refactoring, but I had a look at the code at the time this change was committed and afaict back then it also created thePIIX4_PMdevice, just in a different place. Indeed it is this commit which adds theCONFIG_ACPI_PIIX4=yto the config!)
Quoted 5 lines
How is this intended to work? The obvious fix from my point of view would just be to say "
piix4.crequirespcihp.c" and causeCONFIG_ACPI_PIIX4to pull inCONFIG_ACPI_PCIHP, but that seems like it would be rather undoing the point of this change.
Yes. From the commit log and the vague recollection I have about this change :
Quoted 2 lines
For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug
support
Quoted 1 line
etc
So does malta really need acpi hotplug? If not, then the stubbing out of the vmstate struct is correct.
But if Malta requires ACPI_PIIX4 and it
Quoted 6 lines
creates the
PIIX4_PMdevice, it needs the realpcihp.cand not the stubs, doesn't it ?thanks
-- PMM
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 15 lines · Ani Sinha
Quoted 6 lines · Peter Maydell
On Sat, 4 Sept 2021 at 22:36, Michael S. Tsirkin <[email protected]> wrote:
How is this intended to work? The obvious fix from my point of view would just be to say "piix4.crequirespcihp.c"
and causeCONFIG_ACPI_PIIX4to pull inCONFIG_ACPI_PCIHP, but that seems like it would be rather undoing the point
of this change.Yes. From the commit log and the vague recollection I have about this change :
Quoted 7 lines
Quoted 2 lines
For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug
support
Quoted 1 line
etc
So does malta really need acpi hotplug? If not, then the stubbing out of the vmstate struct is correct.
It's not, because the vmstate struct is actually used when you savevm/loadvm a malta machine. If the malta shouldn't have acpi hotplug then we need to arrange for the hotplug code to be avoided at an earlier point, not just stub in the vmstate struct field.
-- PMM
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 21 lines · Peter Maydell
Quoted 20 lines · Ani Sinha
Quoted 6 lines · Peter Maydell
On Sat, 4 Sept 2021 at 22:36, Michael S. Tsirkin <[email protected]> wrote:
How is this intended to work? The obvious fix from my point of view would just be to say "piix4.crequirespcihp.c"
and causeCONFIG_ACPI_PIIX4to pull inCONFIG_ACPI_PCIHP, but that seems like it would be rather undoing the point
of this change.Yes. From the commit log and the vague recollection I have about this change :
Quoted 2 lines
For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug
support
Quoted 1 line
etc
Quoted 8 lines
Quoted 2 lines
So does malta really need acpi hotplug? If not, then the stubbing out of the vmstate struct is correct.
It's not, because the vmstate struct is actually used when you savevm/loadvm a malta machine. If the malta shouldn't have acpi hotplug then we need to arrange for the hotplug code to be avoided at an earlier point, not just stub in the vmstate struct field.
yes I think that would be more appropriate fix, I agree. Since mst added that vmstate, maybe he can comment on this.
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 28 lines · Ani Sinha
Quoted 24 lines · Peter Maydell
Quoted 22 lines · Ani Sinha
Quoted 6 lines · Peter Maydell
On Sat, 4 Sept 2021 at 22:36, Michael S. Tsirkin <[email protected]> wrote:
How is this intended to work? The obvious fix from my point of view would just be to say "piix4.crequirespcihp.c"
and causeCONFIG_ACPI_PIIX4to pull inCONFIG_ACPI_PCIHP, but that seems like it would be rather undoing the point
of this change.Yes. From the commit log and the vague recollection I have about this change :
Quoted 2 lines
For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug
support
Quoted 1 line
etc
So does malta really need acpi hotplug? If not, then the stubbing out of the vmstate struct is correct.
Quoted 9 lines
Quoted 5 lines
It's not, because the vmstate struct is actually used when you savevm/loadvm a malta machine. If the malta shouldn't have acpi hotplug then we need to arrange for the hotplug code to be avoided at an earlier point, not just stub in the vmstate struct field.
yes I think that would be more appropriate fix, I agree. Since mst added that vmstate, maybe he can comment on this.
Despite its name, ACPI_PIIX4 is also used by PIIX3, which is required by the "pc" machines. These machines support migration etc. which may explain why ACPI_PIIX4 has the vmstate struct field. To me it just looks like an oversight that the Malta board doesn't support all ACPI_PIIX4 features.
Best regards,
Bernhard
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
In reply to Ani SinhaQuoted 28 lines · * Ani Sinha ([email protected]) wrote:
Quoted 24 lines · Peter Maydell
Quoted 22 lines · Ani Sinha
Quoted 6 lines · Peter Maydell
On Sat, 4 Sept 2021 at 22:36, Michael S. Tsirkin <[email protected]> wrote:
How is this intended to work? The obvious fix from my point of view would just be to say "piix4.crequirespcihp.c"
and causeCONFIG_ACPI_PIIX4to pull inCONFIG_ACPI_PCIHP, but that seems like it would be rather undoing the point
of this change.Yes. From the commit log and the vague recollection I have about this change :
Quoted 2 lines
For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug
support
Quoted 1 line
etc
So does malta really need acpi hotplug? If not, then the stubbing out of the vmstate struct is correct.
Quoted 8 lines
Quoted 5 lines
It's not, because the vmstate struct is actually used when you savevm/loadvm a malta machine. If the malta shouldn't have acpi hotplug then we need to arrange for the hotplug code to be avoided at an earlier point, not just stub in the vmstate struct field.
yes I think that would be more appropriate fix, I agree. Since mst added that vmstate, maybe he can comment on this.
Can't we just change the stub to be a valid vmstate structure?
Dave
(I coincidentally found this today because I'd been cc'd on
https://gitlab.com/qemu-project/qemu/-/issues/995 a few months back and only just noticed)
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Quoted 35 lines · Dr. David Alan Gilbert
Quoted 34 lines · * Ani Sinha ([email protected]) wrote:
Quoted 29 lines · Peter Maydell
Quoted 15 lines · Ani Sinha
Quoted 6 lines · Peter Maydell
On Sat, 4 Sept 2021 at 22:36, Michael S. Tsirkin <[email protected]> wrote:
How is this intended to work? The obvious fix from my point of view would just be to say "piix4.crequirespcihp.c"
and causeCONFIG_ACPI_PIIX4to pull inCONFIG_ACPI_PCIHP, but that seems like it would be rather undoing the point
of this change.Yes. From the commit log and the vague recollection I have about this change :
Quoted 7 lines
Quoted 2 lines
For example, mips only needs support for PIIX4 and does not need acpi pci hotplug support or cpu hotplug support or memory hotplug
support
Quoted 1 line
etc
So does malta really need acpi hotplug? If not, then the stubbing out of the vmstate struct is correct.
It's not, because the vmstate struct is actually used when you savevm/loadvm a malta machine. If the malta shouldn't have acpi hotplug then we need to arrange for the hotplug code to be avoided at an earlier point, not just stub in the vmstate struct field.
Quoted 4 lines
Quoted 2 lines
yes I think that would be more appropriate fix, I agree. Since mst added that vmstate, maybe he can comment on this.
Can't we just change the stub to be a valid vmstate structure?
This would be only a short term solution until we can re-org the code so that Malta does not use acpi hotplug anymore.
Quoted 6 lines
Dave
(I coincidentally found this today because I'd been cc'd on
https://gitlab.com/qemu-project/qemu/-/issues/995 a few months back and only just noticed)
[PULL 14/35] virtio-pci: implement iommu_enabled()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
This patch implements the PCI transport version of iommu_enabled. This is done by comparing the address space returned by pci_device_iommu_address_space() against address_space_memory.
Note that an ideal approach is to use pci_device_iommu_address_space() in get_dma_as(), but it might not work well since the IOMMU could be initialized after the virtio-pci device is initialized.
Message-Id: <[email protected]>
--- hw/virtio/virtio-pci.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
hw/virtio/virtio-pci.c +14 -0
@@ -1121,6 +1121,19 @@ static AddressSpace *virtio_pci_get_dma_as(DeviceState *d)return pci_get_address_space (dev); } +static bool virtio_pci_iommu_enabled (DeviceState *d) +{ +VirtIOPCIProxy *proxy =VIRTIO_PCI (d); +PCIDevice *dev = &proxy->pci_dev; +AddressSpace *dma_as =pci_device_iommu_address_space (dev); + +if (dma_as == &address_space_memory) { +return false; + } + +return true; +} +static bool virtio_pci_queue_enabled (DeviceState *d,int n) {VirtIOPCIProxy *proxy =VIRTIO_PCI (d);
@@ -2202,6 +2215,7 @@ static void virtio_pci_bus_class_init(ObjectClass *klass, void *data) k->ioeventfd_enabled = virtio_pci_ioeventfd_enabled; k->ioeventfd_assign = virtio_pci_ioeventfd_assign; k->get_dma_as = virtio_pci_get_dma_as; + k->iommu_enabled = virtio_pci_iommu_enabled; k->queue_enabled = virtio_pci_queue_enabled; }
Signature · 1 line
MST
[PULL 12/35] virtio-balloon: free page hinting cleanups
In reply to Michael S. TsirkinFrom: David Hildenbrand <[email protected]>
Let's compress the code a bit to improve readability. We can drop the vm_running check in virtio_balloon_free_page_start() as it's already properly checked in the single caller.
Message-Id: <[email protected]>
--- hw/virtio/virtio-balloon.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-)
hw/virtio/virtio-balloon.c +8 -20
@@ -534,22 +534,18 @@ static bool get_free_page_hints(VirtIOBalloon *dev)if (dev->free_page_hint_status ==FREE_PAGE_HINT_S_REQUESTED && id == dev->free_page_hint_cmd_id) { dev->free_page_hint_status =FREE_PAGE_HINT_S_START ; - }else { + }else if (dev->free_page_hint_status ==FREE_PAGE_HINT_S_START ) {/* * Stop the optimization only when it has started. This * avoids a stale stop sign for the previous command. */ -if (dev->free_page_hint_status ==FREE_PAGE_HINT_S_START ) { - dev->free_page_hint_status =FREE_PAGE_HINT_S_STOP ; - } + dev->free_page_hint_status =FREE_PAGE_HINT_S_STOP ; } } -if (elem->in_num) { -if (dev->free_page_hint_status ==FREE_PAGE_HINT_S_START ) { -qemu_guest_free_page_hint (elem->in_sg[0 ].iov_base, - elem->in_sg[0 ].iov_len); - } +if (elem->in_num && dev->free_page_hint_status ==FREE_PAGE_HINT_S_START ) { +qemu_guest_free_page_hint (elem->in_sg[0 ].iov_base, + elem->in_sg[0 ].iov_len); } out:
@@ -592,16 +588,10 @@ static void virtio_balloon_free_page_start(VirtIOBalloon *s) {VirtIODevice *vdev =VIRTIO_DEVICE (s); -/* For the stop and copy phase, we don't need to start the optimization */ -if (!vdev->vm_running) { -return ; - } -qemu_mutex_lock (&s->free_page_lock);if (s->free_page_hint_cmd_id ==UINT_MAX ) { - s->free_page_hint_cmd_id = -VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN ; + s->free_page_hint_cmd_id =VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN ; }else { s->free_page_hint_cmd_id++; }
@@ -649,8 +639,7 @@ static void virtio_balloon_free_page_done(VirtIOBalloon *s)static int virtio_balloon_free_page_hint_notify (NotifierWithReturn *n,void *data) { -VirtIOBalloon *dev =container_of (n, VirtIOBalloon, - free_page_hint_notify); +VirtIOBalloon *dev =container_of (n, VirtIOBalloon, free_page_hint_notify);VirtIODevice *vdev =VIRTIO_DEVICE (dev);PrecopyNotifyData *pnd = data;
@@ -919,8 +908,7 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp) s->dvq =virtio_add_queue (vdev,128 , virtio_balloon_handle_output); s->svq =virtio_add_queue (vdev,128 , virtio_balloon_receive_stats); -if (virtio_has_feature (s->host_features, -VIRTIO_BALLOON_F_FREE_PAGE_HINT )) { +if (virtio_has_feature (s->host_features,VIRTIO_BALLOON_F_FREE_PAGE_HINT )) { s->free_page_vq =virtio_add_queue (vdev,VIRTQUEUE_MAX_SIZE , virtio_balloon_handle_free_page_vq);precopy_add_notifier (&s->free_page_hint_notify);
Signature · 1 line
MST
[PULL 20/35] hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
While virtio_queue_packed_empty_rcu() uses the '_rcu' suffix, it is not obvious it is called within rcu_read_lock(). All other functions from this file called with the RCU locked have a comment describing it. Document this one similarly for consistency.
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+)
hw/virtio/virtio.c +1 -0
@@ -634,6 +634,7 @@ static int virtio_queue_split_empty(VirtQueue *vq)return empty; } +/* Called within rcu_read_lock(). */ static int virtio_queue_packed_empty_rcu (VirtQueue *vq) {struct VRingPackedDesc desc;
Signature · 1 line
MST
[PULL 10/35] Use PCI_HOST_BRIDGE macro
In reply to Michael S. TsirkinFrom: Eduardo Habkost <[email protected]>
OBJECT_CHECK(PciHostState, ..., TYPE_PCI_HOST_BRIDGE) is exactly what the PCI_HOST_BRIDGE macro does. We can just use the macro instead of using OBJECT_CHECK manually.
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 8 ++------ hw/pci-host/i440fx.c | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-)
hw/i386/acpi-build.c +2 -6
@@ -303,13 +303,9 @@ Object *acpi_get_i386_pci_host(void) {PCIHostState *host; - host =OBJECT_CHECK (PCIHostState, -object_resolve_path ("/machine/i440fx" ,NULL ), -TYPE_PCI_HOST_BRIDGE ); + host =PCI_HOST_BRIDGE (object_resolve_path ("/machine/i440fx" ,NULL ));if (!host) { - host =OBJECT_CHECK (PCIHostState, -object_resolve_path ("/machine/q35" ,NULL ), -TYPE_PCI_HOST_BRIDGE ); + host =PCI_HOST_BRIDGE (object_resolve_path ("/machine/q35" ,NULL )); }return OBJECT (host);
hw/pci-host/i440fx.c +1 -3
@@ -316,9 +316,7 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,PCIBus *find_i440fx (void ) { -PCIHostState *s =OBJECT_CHECK (PCIHostState, -object_resolve_path ("/machine/i440fx" ,NULL ), -TYPE_PCI_HOST_BRIDGE ); +PCIHostState *s =PCI_HOST_BRIDGE (object_resolve_path ("/machine/i440fx" ,NULL ));return s ? s->bus :NULL ; }
Signature · 1 line
MST
[PULL 19/35] MAINTAINERS: Added myself as a reviewer for acpi/smbios subsystem
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
I have developed an interest in this space and hopefully can lend some helping hand to Igor and Michael in reviewing simpler patches.
Message-Id: <[email protected]>
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -1751,6 +1751,7 @@ F: docs/specs/*pci* ACPI/SMBIOS M: Michael S. Tsirkin <[email protected]> M: Igor Mammedov <[email protected]> +R: Ani Sinha <[email protected]> S: Supported F: include/hw/acpi/* F: include/hw/firmware/smbios.h
Signature · 1 line
MST
[PULL 16/35] hw/i386/acpi-build: Get NUMA information from struct NumaState
In reply to Michael S. TsirkinFrom: Jingqi Liu <[email protected]>
Since commits aa57020774b ("numa: move numa global variable nb_numa_nodes into MachineState") and 7e721e7b10e ("numa: move numa global variable numa_info into MachineState"), we can get NUMA information completely from MachineState::numa_state.
Remove PCMachineState::numa_nodes and PCMachineState::node_mem, since they are just copied from MachineState::numa_state.
Message-Id: <[email protected]>
--- include/hw/i386/pc.h | 4 ---- hw/i386/acpi-build.c | 12 +++++++----- hw/i386/pc.c | 9 --------- 3 files changed, 7 insertions(+), 18 deletions(-)
include/hw/i386/pc.h +0 -4
@@ -47,10 +47,6 @@ typedef struct PCMachineState {bool default_bus_bypass_iommu;uint64_t max_fw_size; -/* NUMA information: */ -uint64_t numa_nodes; -uint64_t *node_mem; -/* ACPI Memory hotplug IO base address */ hwaddr memhp_io_base; } PCMachineState;
hw/i386/acpi-build.c +7 -5
@@ -1914,6 +1914,8 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)X86MachineState *x86ms =X86_MACHINE (machine);const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (machine);PCMachineState *pcms =PC_MACHINE (machine); +int nb_numa_nodes = machine->numa_state->num_nodes; +NodeInfo *numa_info = machine->numa_state->nodes;ram_addr_t hotplugabble_address_space_size =object_property_get_int (OBJECT (pcms),PC_MACHINE_DEVMEM_REGION_SIZE ,NULL );
@@ -1957,9 +1959,9 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) next_base =0 ; numa_start = table_data->len; -for (i =1 ; i < pcms->numa_nodes +1 ; ++i) { +for (i =1 ; i < nb_numa_nodes +1 ; ++i) { mem_base = next_base; - mem_len = pcms->node_mem[i -1 ]; + mem_len = numa_info[i -1 ].node_mem; next_base = mem_base + mem_len;/* Cut out the 640K hole */
@@ -2007,7 +2009,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) } slots = (table_data->len - numa_start) /sizeof *numamem; -for (; slots < pcms->numa_nodes +2 ; slots++) { +for (; slots < nb_numa_nodes +2 ; slots++) { numamem =acpi_data_push (table_data,sizeof *numamem);build_srat_memory (numamem,0 ,0 ,0 ,MEM_AFFINITY_NOFLAGS ); }
@@ -2023,7 +2025,7 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)if (hotplugabble_address_space_size) { numamem =acpi_data_push (table_data,sizeof *numamem);build_srat_memory (numamem, machine->device_memory->base, - hotplugabble_address_space_size, pcms->numa_nodes -1 , + hotplugabble_address_space_size, nb_numa_nodes -1 ,MEM_AFFINITY_HOTPLUGGABLE |MEM_AFFINITY_ENABLED ); }
@@ -2525,7 +2527,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine) } }#endif -if (pcms->numa_nodes) { +if (machine->numa_state->num_nodes) {acpi_add_table (table_offsets, tables_blob);build_srat (tables_blob, tables->linker, machine);if (machine->numa_state->have_numa_distance) {
hw/i386/pc.c +0 -9
@@ -802,18 +802,9 @@ void pc_machine_done(Notifier *notifier, void *data)void pc_guest_info_init (PCMachineState *pcms) { -int i; -MachineState *ms =MACHINE (pcms);X86MachineState *x86ms =X86_MACHINE (pcms); x86ms->apic_xrupt_override = true; - pcms->numa_nodes = ms->numa_state->num_nodes; - pcms->node_mem =g_malloc0 (pcms->numa_nodes * -sizeof *pcms->node_mem); -for (i =0 ; i < ms->numa_state->num_nodes; i++) { - pcms->node_mem[i] = ms->numa_state->nodes[i].node_mem; - } - pcms->machine_done.notify = pc_machine_done;qemu_add_machine_init_done_notifier (&pcms->machine_done); }
Signature · 1 line
MST
[PULL 23/35] tests/vhost-user-bridge.c: Sanity check socket path length
In reply to Michael S. TsirkinFrom: Peter Maydell <[email protected]>
The vhost-user-bridge binary accepts a UNIX socket path on the command line. Sanity check that this is short enough to fit into a sockaddr_un before copying it in.
Message-Id: <[email protected]>
--- tests/vhost-user-bridge.c | 5 +++++ 1 file changed, 5 insertions(+)
tests/vhost-user-bridge.c +5 -0
@@ -540,6 +540,11 @@ vubr_new(const char *path, bool client)CallbackFunc cb;size_t len; +if (strlen (path) >=sizeof (un.sun_path)) { +fprintf (stderr,"unix domain socket path '%s' is too long\n" , path); +exit (1 ); + } +/* Get a UNIX socket. */ dev->sock =socket (AF_UNIX ,SOCK_STREAM ,0 );if (dev->sock ==-1 ) {
Signature · 1 line
MST
[PULL 11/35] virtio-balloon: don't start free page hinting if postcopy is possible
In reply to Michael S. TsirkinFrom: David Hildenbrand <[email protected]>
Postcopy never worked properly with 'free-page-hint=on', as there are at least two issues:
1) With postcopy, the guest will never receive a VIRTIO_BALLOON_CMD_ID_DONE and consequently won't release free pages back to the OS once migration finishes.
The issue is that for postcopy, we won't do a final bitmap sync while the guest is stopped on the source and virtio_balloon_free_page_hint_notify() will only call virtio_balloon_free_page_done() on the source during PRECOPY_NOTIFY_CLEANUP, after the VM state was already migrated to the destination.
2) Once the VM touches a page on the destination that has been excluded from migration on the source via qemu_guest_free_page_hint() while postcopy is active, that thread will stall until postcopy finishes and all threads are woken up. (with older Linux kernels that won't retry faults when woken up via userfaultfd, we might actually get a SEGFAULT)
The issue is that the source will refuse to migrate any pages that are not marked as dirty in the dirty bmap -- for example, because the page might just have been sent. Consequently, the faulting thread will stall, waiting for the page to be migrated -- which could take quite a while and result in guest OS issues.
While we could fix 1) comparatively easily, 2) is harder to get right and might require more involved RAM migration changes on source and destination [1].
As it never worked properly, let's not start free page hinting in the precopy notifier if the postcopy migration capability was enabled to fix it easily. Capabilities cannot be enabled once migration is already running.
Note 1: in the future we might either adjust migration code on the source
to track pages that have actually been sent or adjust migration code on source and destination to eventually send pages multiple times from the source and and deal with pages that are sent multiple times on the destination.
Note 2: virtio-mem has similar issues, however, access to "unplugged"
memory by the guest is very rare and we would have to be very lucky for it to happen during migration. The spec states "The driver SHOULD NOT read from unplugged memory blocks ..." and "The driver MUST NOT write to unplugged memory blocks". virtio-mem will move away from virtio_balloon_free_page_done() soon and handle this case explicitly on the destination.
[1] https://lkml.kernel.org/r/[email protected]
Message-Id: <[email protected]>
--- hw/virtio/virtio-balloon.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
hw/virtio/virtio-balloon.c +13 -0
@@ -30,6 +30,7 @@#include "trace.h" #include "qemu/error-report.h" #include "migration/misc.h" +#include "migration/migration.h" #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h"
@@ -662,6 +663,18 @@ virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data)return 0 ; } +/* +* Pages hinted via qemu_guest_free_page_hint() are cleared from the dirty +* bitmap and will not get migrated, especially also not when the postcopy +* destination starts using them and requests migration from the source; the +* faulting thread will stall until postcopy migration finishes and +* all threads are woken up. Let's not start free page hinting if postcopy +* is possible. +*/ +if (migrate_postcopy_ram ()) { +return 0 ; + } +switch (pnd->reason) {case PRECOPY_NOTIFY_BEFORE_BITMAP_SYNC :virtio_balloon_free_page_stop (dev);
Signature · 1 line
MST
[PULL 18/35] hw/acpi: use existing references to pci device struct within functions
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
There is no need to use fresh typecasts to get references to pci device structs when there is an existing reference to pci device struct. Use existing reference. Minor cleanup.
Message-Id: <[email protected]>
--- hw/acpi/pcihp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/acpi/pcihp.c +3 -3
@@ -283,7 +283,7 @@ void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev,/* Only hotplugged devices need the hotplug capability. */ if (dev->hotplugged && -acpi_pcihp_get_bsel (pci_get_bus (PCI_DEVICE (dev))) <0 ) { +acpi_pcihp_get_bsel (pci_get_bus (pdev)) <0 ) {error_setg (errp,"Unsupported bus. Bus doesn't have property '" ACPI_PCIHP_PROP_BSEL "' set" );return ;
@@ -363,8 +363,8 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, {PCIDevice *pdev =PCI_DEVICE (dev); -trace_acpi_pci_unplug (PCI_SLOT (PCI_DEVICE (dev)->devfn), -acpi_pcihp_get_bsel (pci_get_bus (PCI_DEVICE (dev)))); +trace_acpi_pci_unplug (PCI_SLOT (pdev->devfn), +acpi_pcihp_get_bsel (pci_get_bus (pdev)));/* * clean up acpi-index so it could reused by another device
Signature · 1 line
MST
[PULL 17/35] hw/pci: remove all references to find_i440fx function
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
commit c0e427d6eb5fefc538 ("hw/acpi/ich9: Enable ACPI PCI hot-plug") removed all uses of find_i440fx() function. This has been replaced by the more generic call acpi_get_i386_pci_host() which maybe able to find the root bus both for i440fx machine type as well as for the q35 machine type. There seems to be no more any need to maintain a i440fx specific version of the api call. Remove it.
Tested by building from a clean tree successfully.
Message-Id: <[email protected]>
--- include/hw/pci-host/i440fx.h | 1 - hw/pci-host/i440fx.c | 6 ------ stubs/pci-host-piix.c | 7 ------- stubs/meson.build | 1 - 4 files changed, 15 deletions(-) delete mode 100644 stubs/pci-host-piix.c
include/hw/pci-host/i440fx.h +0 -1
@@ -45,6 +45,5 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type, MemoryRegion *pci_memory, MemoryRegion *ram_memory); -PCIBus *find_i440fx (void );#endif
hw/pci-host/i440fx.c +0 -6
@@ -314,12 +314,6 @@ PCIBus *i440fx_init(const char *host_type, const char *pci_type,return b; } -PCIBus *find_i440fx (void ) -{ -PCIHostState *s =PCI_HOST_BRIDGE (object_resolve_path ("/machine/i440fx" ,NULL )); -return s ? s->bus :NULL ; -} -static void i440fx_class_init (ObjectClass *klass,void *data) {DeviceClass *dc =DEVICE_CLASS (klass);
stubs/pci-host-piix.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include "qemu/osdep.h" -#include "hw/pci-host/i440fx.h" - -PCIBus *find_i440fx (void ) -{ -return NULL ; -}
stubs/meson.build +0 -1
@@ -26,7 +26,6 @@ stub_ss.add(files('module-opts.c')) stub_ss.add(files('monitor.c')) stub_ss.add(files('monitor-core.c')) stub_ss.add(files('pci-bus.c')) -stub_ss.add(files('pci-host-piix.c')) stub_ss.add(files('qemu-timer-notify-cb.c')) stub_ss.add(files('qmp_memory_device.c')) stub_ss.add(files('qmp-command-available.c'))
Signature · 1 line
MST
[PULL 27/35] vhost_net: remove the meaningless assignment in vhost_net_start_one()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
The nvqs and vqs have been initialized during vhost_net_init() and are not expected to change during the life cycle of vhost_net structure. So this patch removes the meaningless assignment.
Message-Id: <[email protected]>
--- hw/net/vhost_net.c | 3 --- 1 file changed, 3 deletions(-)
hw/net/vhost_net.c +0 -3
@@ -242,9 +242,6 @@ static int vhost_net_start_one(struct vhost_net *net,struct vhost_vring_file file = { };int r; - net->dev.nvqs =2 ; - net->dev.vqs = net->vqs; - r =vhost_dev_enable_notifiers (&net->dev, dev);if (r <0 ) { goto fail_notifiers;
Signature · 1 line
MST
[PULL 13/35] virtio-bus: introduce iommu_enabled()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
This patch introduce a new method for the virtio-bus for the transport to report whether or not the IOMMU is enabled for the device.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-bus.h | 4 +++- hw/virtio/virtio-bus.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-)
include/hw/virtio/virtio-bus.h +3 -1
@@ -93,6 +93,7 @@ struct VirtioBusClass {*/ bool has_variable_vring_alignment; AddressSpace *(*get_dma_as)(DeviceState *d); +bool (*iommu_enabled)(DeviceState *d); };struct VirtioBusState {
@@ -154,5 +155,6 @@ void virtio_bus_release_ioeventfd(VirtioBusState *bus);int virtio_bus_set_host_notifier (VirtioBusState *bus,int n,bool assign);/* Tell the bus that the ioeventfd handler is no longer required. */ void virtio_bus_cleanup_host_notifier (VirtioBusState *bus,int n); - +/* Whether the IOMMU is enabled for this device */ +bool virtio_bus_device_iommu_enabled (VirtIODevice *vdev);#endif /* VIRTIO_BUS_H */
hw/virtio/virtio-bus.c +14 -0
@@ -325,6 +325,20 @@ static char *virtio_bus_get_fw_dev_path(DeviceState *dev)return NULL ; } +bool virtio_bus_device_iommu_enabled (VirtIODevice *vdev) +{ +DeviceState *qdev =DEVICE (vdev); +BusState *qbus =BUS (qdev_get_parent_bus (qdev)); +VirtioBusState *bus =VIRTIO_BUS (qbus); +VirtioBusClass *klass =VIRTIO_BUS_GET_CLASS (bus); + +if (!klass->iommu_enabled) { +return false; + } + +return klass->iommu_enabled (qbus->parent); +} +static void virtio_bus_class_init (ObjectClass *klass,void *data) {BusClass *bus_class =BUS_CLASS (klass);
Signature · 1 line
MST
[PULL 21/35] hw/virtio: Remove NULL check in virtio_free_region_cache()
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
virtio_free_region_cache() is called within call_rcu(), always with a non-NULL argument. Ensure new code keep it that way by replacing the NULL check by an assertion. Add a comment this function is called within call_rcu().
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/virtio/virtio.c +2 -4
@@ -133,12 +133,10 @@ struct VirtQueueQLIST_ENTRY (VirtQueue) node; }; +/* Called within call_rcu(). */ static void virtio_free_region_cache (VRingMemoryRegionCaches *caches) { -if (!caches) { -return ; - } - +assert (caches !=NULL );address_space_cache_destroy (&caches->desc);address_space_cache_destroy (&caches->avail);address_space_cache_destroy (&caches->used);
Signature · 1 line
MST
[PULL 24/35] tests/vhost-user-bridge.c: Fix typo in help message
In reply to Michael S. TsirkinFrom: Peter Maydell <[email protected]>
Fix a typo in the help message printed by vhost-user-bridge.
Message-Id: <[email protected]>
--- tests/vhost-user-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/vhost-user-bridge.c +1 -1
@@ -831,7 +831,7 @@ main(int argc, char *argv[]) out:fprintf (stderr,"Usage: %s " , argv[0 ]);fprintf (stderr,"[-c] [-H] [-u ud_socket_path] [-l lhost:lport] [-r rhost:rport]\n" ); -fprintf (stderr,"\t-u path to unix doman socket. default: %s\n" , +fprintf (stderr,"\t-u path to unix domain socket. default: %s\n" ,DEFAULT_UD_SOCKET );fprintf (stderr,"\t-l local host and port. default: %s:%s\n" ,DEFAULT_LHOST ,DEFAULT_LPORT );
Signature · 1 line
MST
[PULL 28/35] vhost: use unsigned int for nvqs
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
Switch to use unsigned int for nvqs since it's not expected to be negative.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/virtio/vhost.h +1 -1
@@ -71,7 +71,7 @@ struct vhost_dev {int n_tmp_sections;MemoryRegionSection *tmp_sections;struct vhost_virtqueue *vqs; -int nvqs; +unsigned int nvqs;/* the first virtqueue which would be used by this vhost dev */ int vq_index;/* if non-zero, minimum required value for max_queues */
Signature · 1 line
MST
[PULL 22/35] hw/virtio: Add flatview update in vhost_user_cleanup()
In reply to Michael S. TsirkinFrom: Yuwei Zhang <[email protected]>
Qemu will crash on vhost backend unexpected exit and re-connect │
in some case due to access released memory.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/vhost-user.c +2 -1
@@ -2480,7 +2480,7 @@ void vhost_user_cleanup(VhostUserState *user)if (!user->chr) {return ; } - +memory_region_transaction_begin ();for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) {if (user->notifier[i].addr) {object_unparent (OBJECT (&user->notifier[i].mr));
@@ -2488,6 +2488,7 @@ void vhost_user_cleanup(VhostUserState *user) user->notifier[i].addr =NULL ; } } +memory_region_transaction_commit (); user->chr =NULL ; }
Signature · 1 line
MST
[PULL 25/35] vhost-vdpa: remove unused variable "acked_features"
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
"acked_features" is unused, let's remove that.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 1 - 1 file changed, 1 deletion(-)
net/vhost-vdpa.c +0 -1
@@ -29,7 +29,6 @@ typedef struct VhostVDPAState {NetClientState nc;struct vhost_vdpa vhost_vdpa;VHostNetState *vhost_net; -uint64_t acked_features;bool started; } VhostVDPAState;
Signature · 1 line
MST
[PULL 30/35] vhost-vdpa: remove the unnecessary check in vhost_vdpa_add()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
The VhostVDPAState is just allocated by qemu_new_net_client() via g_malloc0() in net_vhost_vdpa_init(). So s->vhost_net is NULL for sure, let's remove this unnecessary check in vhost_vdpa_add().
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 4 ---- 1 file changed, 4 deletions(-)
net/vhost-vdpa.c +0 -4
@@ -111,10 +111,6 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be)error_report ("failed to init vhost_net for queue" ); goto err; } -if (s->vhost_net) { -vhost_net_cleanup (s->vhost_net); -g_free (s->vhost_net); - } s->vhost_net = net; ret =vhost_vdpa_net_check_device_id (net);if (ret) {
Signature · 1 line
MST
[PULL 26/35] vhost-vdpa: correctly return err in vhost_vdpa_set_backend_cap()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
We should return error code instead of zero, otherwise there's no way for the caller to detect the failure.
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/vhost-vdpa.c +2 -2
@@ -443,13 +443,13 @@ static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev)int r;if (vhost_vdpa_call (dev,VHOST_GET_BACKEND_FEATURES , &features)) { -return 0 ; +return -EFAULT ; } features &= f; r =vhost_vdpa_call (dev,VHOST_SET_BACKEND_FEATURES , &features);if (r) { -return 0 ; +return -EFAULT ; } dev->backend_cap = features;
Signature · 1 line
MST
[PULL 29/35] vhost_net: do not assume nvqs is always 2
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
This patch switches to initialize dev.nvqs from the VhostNetOptions instead of assuming it was 2. This is useful for implementing control virtqueue support which will be a single vhost_net structure with a single cvq.
Note that nvqs is still set to 2 for all users and this patch does not change functionality.
Message-Id: <[email protected]>
--- include/net/vhost_net.h | 1 + hw/net/vhost_net.c | 2 +- net/tap.c | 1 + net/vhost-user.c | 1 + net/vhost-vdpa.c | 1 + 5 files changed, 5 insertions(+), 1 deletion(-)
include/net/vhost_net.h +1 -0
@@ -14,6 +14,7 @@ typedef struct VhostNetOptions {VhostBackendType backend_type;NetClientState *net_backend;uint32_t busyloop_timeout; +unsigned int nvqs;void *opaque; } VhostNetOptions;
hw/net/vhost_net.c +1 -1
@@ -165,9 +165,9 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) goto fail; } net->nc = options->net_backend; + net->dev.nvqs = options->nvqs; net->dev.max_queues =1 ; - net->dev.nvqs =2 ; net->dev.vqs = net->vqs;if (backend_kernel) {
net/tap.c +1 -0
@@ -749,6 +749,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,qemu_set_nonblock (vhostfd); } options.opaque = (void *)(uintptr_t )vhostfd; + options.nvqs =2 ; s->vhost_net =vhost_net_init (&options);if (!s->vhost_net) {
net/vhost-user.c +1 -0
@@ -85,6 +85,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[], options.net_backend = ncs[i]; options.opaque = be; options.busyloop_timeout =0 ; + options.nvqs =2 ; net =vhost_net_init (&options);if (!net) {error_report ("failed to init vhost_net for queue %d" , i);
net/vhost-vdpa.c +1 -0
@@ -104,6 +104,7 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be) options.net_backend = ncs; options.opaque = be; options.busyloop_timeout =0 ; + options.nvqs =2 ; net =vhost_net_init (&options);if (!net) {
Signature · 1 line
MST
[PULL 34/35] vhost-vdpa: fix the wrong assertion in vhost_vdpa_init()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
Vhost_vdpa_add() can fail for various reasons, so the assertion of the succeed is wrong. Instead, we should free the NetClientState and propagate the error to the caller
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/vhost-vdpa.c +4 -1
@@ -173,7 +173,10 @@ static int net_vhost_vdpa_init(NetClientState *peer, const char *device, } s->vhost_vdpa.device_fd = vdpa_device_fd; ret =vhost_vdpa_add (nc, (void *)&s->vhost_vdpa); -assert (s->vhost_net); +if (ret) { +qemu_close (vdpa_device_fd); +qemu_del_net_client (nc); + }return ret; }
Signature · 1 line
MST
[PULL 31/35] vhost-vdpa: don't cleanup twice in vhost_vdpa_add()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
The previous vhost_net_cleanup is sufficient for freeing, calling vhost_vdpa_del() in this case will lead an extra round of free. Note that this kind of "double free" is safe since vhost_dev_cleanup() zero the whole structure.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 11 ----------- 1 file changed, 11 deletions(-)
net/vhost-vdpa.c +0 -11
@@ -81,16 +81,6 @@ static int vhost_vdpa_net_check_device_id(struct vhost_net *net)return ret; } -static void vhost_vdpa_del (NetClientState *ncs) -{ -VhostVDPAState *s; -assert (ncs->info->type ==NET_CLIENT_DRIVER_VHOST_VDPA ); - s =DO_UPCAST (VhostVDPAState, nc, ncs); -if (s->vhost_net) { -vhost_net_cleanup (s->vhost_net); - } -} -static int vhost_vdpa_add (NetClientState *ncs,void *be) {VhostNetOptions options;
@@ -121,7 +111,6 @@ err:if (net) {vhost_net_cleanup (net); } -vhost_vdpa_del (ncs);return -1 ; }
Signature · 1 line
MST
[PULL 32/35] vhost-vdpa: fix leaking of vhost_net in vhost_vdpa_add()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+)
net/vhost-vdpa.c +1 -0
@@ -110,6 +110,7 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be) err:if (net) {vhost_net_cleanup (net); +g_free (net); }return -1 ; }
Signature · 1 line
MST
[PULL 33/35] vhost-vdpa: tweak the error label in vhost_vdpa_add()
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
Introduce new error label to avoid the unnecessary checking of net pointer.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
net/vhost-vdpa.c +6 -7
@@ -99,19 +99,18 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be) net =vhost_net_init (&options);if (!net) {error_report ("failed to init vhost_net for queue" ); - goto err; + goto err_init; } s->vhost_net = net; ret =vhost_vdpa_net_check_device_id (net);if (ret) { - goto err; + goto err_check; }return 0 ; -err: -if (net) { -vhost_net_cleanup (net); -g_free (net); - } +err_check: +vhost_net_cleanup (net); +g_free (net); +err_init:return -1 ; }
Signature · 1 line
MST
[PULL 35/35] vhost-vdpa: remove the unncessary queue_index assignment
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
The queue_index of NetClientState should be assigned in set_netdev() afterwards, so trying to net_vhost_vdpa_init() is meaningless. This patch removes this.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 1 - 1 file changed, 1 deletion(-)
net/vhost-vdpa.c +0 -1
@@ -165,7 +165,6 @@ static int net_vhost_vdpa_init(NetClientState *peer, const char *device,assert (name); nc =qemu_new_net_client (&net_vhost_vdpa_info, peer, device, name);snprintf (nc->info_str,sizeof (nc->info_str),TYPE_VHOST_VDPA ); - nc->queue_index =0 ; s =DO_UPCAST (VhostVDPAState, nc, nc); vdpa_device_fd =qemu_open_old (vhostdev,O_RDWR );if (vdpa_device_fd ==-1 ) {
Signature · 1 line
MST
[PULL 08/35] vhost-user: add missing space in error message
In reply to Michael S. TsirkinFrom: Alyssa Ross <[email protected]>
This would previously give error messages like
Quoted 1 line
Received unexpected msg type.Expected 0 received 1
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
@@ -429,7 +429,7 @@ static int process_message_reply(struct vhost_dev *dev, }if (msg_reply.hdr.request != msg->hdr.request) { -error_report ("Received unexpected msg type." +error_report ("Received unexpected msg type. " "Expected %d received %d" , msg->hdr.request, msg_reply.hdr.request);return -1 ;
Signature · 1 line
MST
[PULL 15/35] vhost: correctly detect the enabling IOMMU
In reply to Michael S. TsirkinFrom: Jason Wang <[email protected]>
Vhost used to compare the dma_as against the address_space_memory to detect whether the IOMMU is enabled or not. This might not work well since the virito-bus may call get_dma_as if VIRTIO_F_IOMMU_PLATFORM is set without an actual IOMMU enabled when device is plugged. In the case of PCI where pci_get_address_space() is used, the bus master as is returned. So vhost actually tries to enable device IOTLB even if the IOMMU is not enabled. This will lead a lots of unnecessary transactions between vhost and Qemu and will introduce a huge drop of the performance.
For PCI, an ideal approach is to use pci_device_iommu_address_space() just for get_dma_as. But Qemu may choose to initialize the IOMMU after the virtio-pci which lead a wrong address space is returned during device plugged. So this patch switch to use transport specific way via iommu_enabled() to detect the IOMMU during vhost start. In this case, we are fine since we know the IOMMU is initialized correctly.
Message-Id: <[email protected]>
--- hw/virtio/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost.c +1 -1
@@ -315,7 +315,7 @@ static int vhost_dev_has_iommu(struct vhost_dev *dev)* does not have IOMMU, there's no need to enable this feature * which may cause unnecessary IOTLB miss/update trnasactions. */ -return vdev->dma_as != &address_space_memory && +return virtio_bus_device_iommu_enabled (vdev) &&virtio_host_has_feature (vdev,VIRTIO_F_IOMMU_PLATFORM ); }
Signature · 1 line
MST
Peter Maydell
AppliedQuoted 11 lines · Michael S. Tsirkin
The following changes since commit
8880cc4362fde4ecdac0b2092318893118206fcf:Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20210902' into staging (2021-09-03 08:27:38 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.gittags/for_upstreamfor you to fetch changes up to
499c8b4de96eecc554a03e452226f79f169a233b:
Quoted 9 lines
vhost-vdpa: remove the unncessary
queue_indexassignment (2021-09-04 17:34:05 -0400)----------------------------------------------------------------
pc,pci,virtio: fixes, cleanupsFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.2
for any user-visible changes.
-- PMM