pc,pci,virtio: fixes, cleanups
Subsystems (2)
[PULL 01/66] vhost-user-scsi: Fix memleaks in vus_proc_req()
In reply to Michael S. TsirkinFrom: Alex Chen <[email protected]>
The 'elem' is allocated memory in vu_queue_pop(), and its memory should be freed in all error branches after vu_queue_pop().
In addition, in order to free the 'elem' memory outside of while(1) loop, move the definition of 'elem' to the beginning of vus_proc_req().
Message-Id: <[email protected]>
--- contrib/vhost-user-scsi/vhost-user-scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
contrib/vhost-user-scsi/vhost-user-scsi.c +2 -1
@@ -232,6 +232,7 @@ static void vus_proc_req(VuDev *vu_dev, int idx)VugDev *gdev;VusDev *vdev_scsi;VuVirtq *vq; +VuVirtqElement *elem =NULL ;assert (vu_dev);
@@ -248,7 +249,6 @@ static void vus_proc_req(VuDev *vu_dev, int idx)g_debug ("Got kicked on vq[%d]@%p" , idx, vq);while (1 ) { -VuVirtqElement *elem;VirtIOSCSICmdReq *req;VirtIOSCSICmdResp *rsp;
@@ -288,6 +288,7 @@ static void vus_proc_req(VuDev *vu_dev, int idx)free (elem); } +free (elem); }static void vus_queue_set_started (VuDev *vu_dev,int idx,bool started)
Signature · 1 line
MST
[PULL 04/66] memory: Add IOMMU_NOTIFIER_DEVIOTLB_UNMAP IOMMUTLBNotificationType
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
This allows us to differentiate between regular IOMMU map/unmap events and DEVIOTLB unmap. Doing so, notifiers that only need device IOTLB invalidations will not receive regular IOMMU unmappings.
Adapt intel and vhost to use it.
Message-Id: <[email protected]>
--- include/exec/memory.h | 7 ++++++- hw/i386/intel_iommu.c | 2 +- hw/virtio/vhost.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-)
include/exec/memory.h +6 -1
@@ -97,9 +97,14 @@ typedef enum {IOMMU_NOTIFIER_UNMAP =0x1 ,/* Notify entry changes (newly created entries) */ IOMMU_NOTIFIER_MAP =0x2 , +/* Notify changes on device IOTLB entries */ +IOMMU_NOTIFIER_DEVIOTLB_UNMAP =0x04 , } IOMMUNotifierFlag; -#define IOMMU_NOTIFIER_ALL (IOMMU_NOTIFIER_MAP | IOMMU_NOTIFIER_UNMAP) +#define IOMMU_NOTIFIER_IOTLB_EVENTS (IOMMU_NOTIFIER_MAP | IOMMU_NOTIFIER_UNMAP) +#define IOMMU_NOTIFIER_DEVIOTLB_EVENTS IOMMU_NOTIFIER_DEVIOTLB_UNMAP +#define IOMMU_NOTIFIER_ALL (IOMMU_NOTIFIER_IOTLB_EVENTS | \ + IOMMU_NOTIFIER_DEVIOTLB_EVENTS)struct IOMMUNotifier ; typedef void (*IOMMUNotify)(struct IOMMUNotifier *notifier,
hw/i386/intel_iommu.c +1 -1
@@ -2468,7 +2468,7 @@ static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s, sz =VTD_PAGE_SIZE ; } - event.type =IOMMU_NOTIFIER_UNMAP ; + event.type =IOMMU_NOTIFIER_DEVIOTLB_UNMAP ; event.entry.target_as = &vtd_dev_as->as; event.entry.addr_mask = sz -1 ; event.entry.iova = addr;
hw/virtio/vhost.c +1 -1
@@ -718,7 +718,7 @@ static void vhost_iommu_region_add(MemoryListener *listener, iommu_idx =memory_region_iommu_attrs_to_index (iommu_mr,MEMTXATTRS_UNSPECIFIED );iommu_notifier_init (&iommu->n, vhost_iommu_unmap_notify, -IOMMU_NOTIFIER_UNMAP , +IOMMU_NOTIFIER_DEVIOTLB_UNMAP , section->offset_within_region,int128_get64 (end), iommu_idx);
Signature · 1 line
MST
[PULL 02/66] memory: Rename memory_region_notify_one to memory_region_notify_iommu_one
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Previous name didn't reflect the iommu operation.
Message-Id: <[email protected]>
--- include/exec/memory.h | 6 +++--- hw/arm/smmu-common.c | 2 +- hw/arm/smmuv3.c | 2 +- hw/i386/intel_iommu.c | 4 ++-- softmmu/memory.c | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-)
include/exec/memory.h +3 -3
@@ -236,7 +236,7 @@ enum IOMMUMemoryRegionAttr {* The IOMMU implementation must use the IOMMU notifier infrastructure * to report whenever mappings are changed, by calling * memory_region_notify_iommu() (or, if necessary, by calling -* memory_region_notify_one() for each registered notifier). +* memory_region_notify_iommu_one() for each registered notifier). * * Conceptually an IOMMU provides a mapping from input address * to an output TLB entry. If the IOMMU is aware of memory transaction
@@ -1346,7 +1346,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr, IOMMUTLBEntry entry);/** -* memory_region_notify_one: notify a change in an IOMMU translation +* memory_region_notify_iommu_one: notify a change in an IOMMU translation * entry to a single notifier * * This works just like memory_region_notify_iommu(), but it only
@@ -1357,7 +1357,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,* replaces all old entries for the same virtual I/O address range. * Deleted entries have .@perm == 0. */ -void memory_region_notify_one (IOMMUNotifier *notifier, +void memory_region_notify_iommu_one (IOMMUNotifier *notifier,IOMMUTLBEntry *entry);/**
hw/arm/smmu-common.c +1 -1
@@ -472,7 +472,7 @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n) entry.perm =IOMMU_NONE ; entry.addr_mask = n->end - n->start; -memory_region_notify_one (n, &entry); +memory_region_notify_iommu_one (n, &entry); }/* Unmap all notifiers attached to @mr */
hw/arm/smmuv3.c +1 -1
@@ -828,7 +828,7 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, entry.addr_mask = num_pages * (1 << granule) -1 ; entry.perm =IOMMU_NONE ; -memory_region_notify_one (n, &entry); +memory_region_notify_iommu_one (n, &entry); }/* invalidate an asid/iova range tuple in all mr's */
hw/i386/intel_iommu.c +2 -2
@@ -3497,7 +3497,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)/* This field is meaningless for unmap */ entry.translated_addr =0 ; -memory_region_notify_one (n, &entry); +memory_region_notify_iommu_one (n, &entry); start += mask; remain -= mask;
@@ -3535,7 +3535,7 @@ static void vtd_address_space_refresh_all(IntelIOMMUState *s)static int vtd_replay_hook (IOMMUTLBEntry *entry,void *private) { -memory_region_notify_one ((IOMMUNotifier *)private, entry); +memory_region_notify_iommu_one ((IOMMUNotifier *)private, entry);return 0 ; }
softmmu/memory.c +3 -3
@@ -1942,8 +1942,8 @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr,memory_region_update_iommu_notify_flags (iommu_mr,NULL ); } -void memory_region_notify_one (IOMMUNotifier *notifier, -IOMMUTLBEntry *entry) +void memory_region_notify_iommu_one (IOMMUNotifier *notifier, +IOMMUTLBEntry *entry) {IOMMUNotifierFlag request_flags;hwaddr entry_end = entry->iova + entry->addr_mask;
@@ -1979,7 +1979,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr, IOMMU_NOTIFIER_FOREACH(iommu_notifier, iommu_mr) {if (iommu_notifier->iommu_idx == iommu_idx) { -memory_region_notify_one (iommu_notifier, &entry); +memory_region_notify_iommu_one (iommu_notifier, &entry); } } }
Signature · 1 line
MST
The following changes since commit 553032db17440f8de011390e5a1cfddd13751b0b:
Update version for v5.2.0 release (2020-12-08 15:55:19 +0000)
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 023e57b93a24f2e7901cf460a45cb5058fa23549:
hw/virtio-pci Added AER capability. (2020-12-08 13:48:58 -0500)
----------------------------------------------------------------
pc,pci,virtio: fixes, cleanups
Lots of fixes, cleanups.
CPU hot-unplug improvements.
A new AER property for virtio devices, adding a dummy AER capability.
----------------------------------------------------------------
Alex Chen (1):
vhost-user-scsi: Fix memleaks in vus_proc_req()
Andrew (2):
hw/virtio-pci Added counter for pcie capabilities offsets. hw/virtio-pci Added AER capability.
Cornelia Huck (1):
hw: add compat machines for 6.0
Erich-McMillan (1):
hw/i386/pc: add max combined fw size as machine configuration option
Eugenio Pérez (5):
memory: Rename memory_region_notify_one to memory_region_notify_iommu_one
memory: Add IOMMUTLBEvent
memory: Add IOMMU_NOTIFIER_DEVIOTLB_UNMAP IOMMUTLBNotificationType
intel_iommu: Skip page walking on device iotlb invalidations
memory: Skip bad range assertion if notifier is DEVIOTLB_UNMAP type
Igor Mammedov (7):
acpi: cpuhp: introduce 'firmware performs eject' status/control bits
x86: acpi: introduce AcpiPmInfo::smi_on_cpu_unplug tests/acpi: allow expected files change
x86: acpi: let the firmware handle pending "CPU remove" events in SMM tests/acpi: update expected files
x86: ich9: factor out "guest_cpu_hotplug_features"
x86: ich9: let firmware negotiate 'CPU hot-unplug with SMI' feature
Jiahui Cen (2):
fw_cfg: Refactor extra pci roots addition hw/arm/virt: Write extra pci roots into fw_cfg
John Levon (1):
virtio: reset device on bad guest index in virtio_load()
Juan Quintela (26):
failover: fix indentantion
failover: Use always atomics for primary_should_be_hidden
failover: primary bus is only used once, and where it is set
failover: Remove unused parameter
failover: Remove external partially_hotplugged property
failover: qdev_device_add() returns err or dev set
failover: Rename bool to failover_primary_hidden
failover: g_strcmp0() knows how to handle NULL
failover: Remove primary_device_opts
failover: remove standby_id variable
failover: Remove primary_device_dict
failover: Remove memory leak
failover: simplify virtio_net_find_primary()
failover: should_be_hidden() should take a bool
failover: Rename function to hide_device()
failover: virtio_net_connect_failover_devices() does nothing
failover: Rename to failover_find_primary_device()
failover: simplify qdev_device_add() failover case
failover: simplify qdev_device_add()
failover: make sure that id always exist
failover: remove failover_find_primary_device() error parameter
failover: split failover_find_primary_device_id()
failover: We don't need to cache primary_device_id anymore
failover: Caller of this two functions already have primary_dev
failover: simplify failover_unplug_primary
failover: Remove primary_dev member
Marc-André Lureau (8):
libvhost-user: replace qemu/bswap.h with glibc endian.h
libvhost-user: replace qemu/memfd.h usage
libvhost-user: remove qemu/compiler.h usage
libvhost-user: drop qemu/osdep.h dependency
libvhost-user: make it a meson subproject
libvhost-user: check memfd API
libvhost-user: add a simple link test without glib .gitlab-ci: add build-libvhost-user
Stefan Hajnoczi (4):
contrib/vhost-user-blk: avoid g_return_val_if() input validation contrib/vhost-user-gpu: avoid g_return_val_if() input validation contrib/vhost-user-input: avoid g_return_val_if() input validation block/export: avoid g_return_val_if() input validation
Yubo Miao (7):
acpi/gpex: Extract two APIs from acpi_dsdt_add_pci
acpi: Extract crs build form acpi_build.c acpi/gpex: Build tables for pxb
acpi: Align the size to 128k
unit-test: The files changed.
unit-test: Add testcase for pxb
unit-test: Add the binary file and clear diff.h
Zenghui Yu (1):
pcie_aer: Fix help message of pcie_aer_inject_error command
docs/specs/acpi_cpu_hotplug.txt | 19 +-
contrib/vhost-user-gpu/vugpu.h | 2 +-
hw/virtio/virtio-pci.h | 4 +
include/exec/memory.h | 40 +--
include/hw/acpi/aml-build.h | 22 ++
include/hw/acpi/cpu.h | 2 +
include/hw/arm/virt.h | 1 +
include/hw/boards.h | 3 +
include/hw/i386/pc.h | 5 +
include/hw/nvram/fw_cfg.h | 9 +
include/hw/pci-host/gpex.h | 1 +
include/hw/qdev-core.h | 28 +-
include/hw/virtio/virtio-net.h | 9 +-
include/qemu/vhost-user-server.h | 2 +-
.../libvhost-user/libvhost-user-glib.h | 0
.../libvhost-user/libvhost-user.h | 0
block/export/vhost-user-blk-server.c | 6 +-
contrib/vhost-user-blk/vhost-user-blk.c | 7 +-
contrib/vhost-user-gpu/vhost-user-gpu.c | 4 +-
contrib/vhost-user-input/main.c | 7 +-
contrib/vhost-user-scsi/vhost-user-scsi.c | 5 +-
hw/acpi/aml-build.c | 285 ++++++++++++++++++++
hw/acpi/cpu.c | 26 +-
hw/arm/smmu-common.c | 13 +-
hw/arm/smmuv3.c | 13 +-
hw/arm/virt-acpi-build.c | 31 ++-
hw/arm/virt.c | 18 +-
hw/core/machine.c | 3 +
hw/core/qdev.c | 19 +-
hw/i386/acpi-build.c | 298 +--------------------
hw/i386/intel_iommu.c | 92 ++++---
hw/i386/pc.c | 74 +++--
hw/i386/pc_piix.c | 14 +-
hw/i386/pc_q35.c | 13 +-
hw/i386/pc_sysfw.c | 15 +-
hw/isa/lpc_ich9.c | 16 +-
hw/misc/tz-mpc.c | 32 ++-
hw/net/virtio-net.c | 298 ++++++++-------------
hw/nvram/fw_cfg.c | 23 ++
hw/pci-host/gpex-acpi.c | 166 ++++++++----
hw/ppc/spapr.c | 17 +-
hw/ppc/spapr_iommu.c | 15 +-
hw/s390x/s390-pci-inst.c | 27 +-
hw/s390x/s390-virtio-ccw.c | 14 +-
hw/virtio/vhost.c | 2 +-
hw/virtio/virtio-iommu.c | 30 ++-
hw/virtio/virtio-pci.c | 20 +-
hw/virtio/virtio.c | 15 +-
softmmu/memory.c | 29 +-
softmmu/qdev-monitor.c | 41 +--
.../libvhost-user/libvhost-user-glib.c | 10 +-
.../libvhost-user/libvhost-user.c | 126 +++++----
subprojects/libvhost-user/link-test.c | 45 ++++
tests/qtest/bios-tables-test.c | 58 +++-
tests/vhost-user-bridge.c | 2 +-
tools/virtiofsd/fuse_virtio.c | 2 +-
.gitlab-ci.yml | 11 +
contrib/libvhost-user/meson.build | 4 -
contrib/vhost-user-blk/meson.build | 3 +-
contrib/vhost-user-gpu/meson.build | 3 +-
contrib/vhost-user-input/meson.build | 3 +-
contrib/vhost-user-scsi/meson.build | 3 +-
hmp-commands.hx | 4 +-
hw/acpi/trace-events | 2 +
meson.build | 7 +-
subprojects/libvhost-user/meson.build | 36 +++
tests/data/acpi/pc/DSDT | Bin 5060 -> 5065 bytes
tests/data/acpi/pc/DSDT.acpihmat | Bin 6385 -> 6390 bytes
tests/data/acpi/pc/DSDT.bridge | Bin 6919 -> 6924 bytes
tests/data/acpi/pc/DSDT.cphp | Bin 5524 -> 5529 bytes
tests/data/acpi/pc/DSDT.dimmpxm | Bin 6714 -> 6719 bytes
tests/data/acpi/pc/DSDT.hpbridge | Bin 5021 -> 5026 bytes
tests/data/acpi/pc/DSDT.hpbrroot | Bin 3079 -> 3084 bytes
tests/data/acpi/pc/DSDT.ipmikcs | Bin 5132 -> 5137 bytes
tests/data/acpi/pc/DSDT.memhp | Bin 6419 -> 6424 bytes
tests/data/acpi/pc/DSDT.numamem | Bin 5066 -> 5071 bytes
tests/data/acpi/pc/DSDT.roothp | Bin 5256 -> 5261 bytes
tests/data/acpi/q35/DSDT | Bin 7796 -> 7801 bytes
tests/data/acpi/q35/DSDT.acpihmat | Bin 9121 -> 9126 bytes
tests/data/acpi/q35/DSDT.bridge | Bin 7814 -> 7819 bytes
tests/data/acpi/q35/DSDT.cphp | Bin 8260 -> 8265 bytes
tests/data/acpi/q35/DSDT.dimmpxm | Bin 9450 -> 9455 bytes
tests/data/acpi/q35/DSDT.ipmibt | Bin 7871 -> 7876 bytes
tests/data/acpi/q35/DSDT.memhp | Bin 9155 -> 9160 bytes
tests/data/acpi/q35/DSDT.mmio64 | Bin 8927 -> 8932 bytes
tests/data/acpi/q35/DSDT.numamem | Bin 7802 -> 7807 bytes
tests/data/acpi/q35/DSDT.tis | Bin 8402 -> 8407 bytes
tests/data/acpi/virt/DSDT.pxb | Bin 0 -> 7802 bytes
tests/meson.build | 3 +-
tools/virtiofsd/meson.build | 3 +-
90 files changed, 1302 insertions(+), 858 deletions(-)
rename {contrib => subprojects}/libvhost-user/libvhost-user-glib.h (100%)
rename {contrib => subprojects}/libvhost-user/libvhost-user.h (100%)
rename {contrib => subprojects}/libvhost-user/libvhost-user-glib.c (93%)
rename {contrib => subprojects}/libvhost-user/libvhost-user.c (96%)
create mode 100644 subprojects/libvhost-user/link-test.c
delete mode 100644 contrib/libvhost-user/meson.build
create mode 100644 subprojects/libvhost-user/meson.build
create mode 100644 tests/data/acpi/virt/DSDT.pxb[PULL 03/66] memory: Add IOMMUTLBEvent
From: Eugenio Pérez <[email protected]>
This way we can tell between regular IOMMUTLBEntry (entry of IOMMU hardware) and notifications.
In the notifications, we set explicitly if it is a MAPs or an UNMAP, instead of trusting in entry permissions to differentiate them.
Message-Id: <[email protected]>
--- include/exec/memory.h | 27 ++++++------ hw/arm/smmu-common.c | 13 +++--- hw/arm/smmuv3.c | 13 +++--- hw/i386/intel_iommu.c | 88 ++++++++++++++++++++++------------------ hw/misc/tz-mpc.c | 32 ++++++++------- hw/ppc/spapr_iommu.c | 15 +++---- hw/s390x/s390-pci-inst.c | 27 +++++++----- hw/virtio/virtio-iommu.c | 30 +++++++------- softmmu/memory.c | 20 ++++----- 9 files changed, 143 insertions(+), 122 deletions(-)
include/exec/memory.h +13 -14
@@ -116,6 +116,11 @@ struct IOMMUNotifier { };typedef struct IOMMUNotifier IOMMUNotifier ; +typedef struct IOMMUTLBEvent { +IOMMUNotifierFlag type; +IOMMUTLBEntry entry; +}IOMMUTLBEvent ; +/* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */ #define RAM_PREALLOC (1 << 0)
@@ -1326,24 +1331,18 @@ uint64_t memory_region_iommu_get_min_page_size(IOMMUMemoryRegion *iommu_mr);/** * memory_region_notify_iommu: notify a change in an IOMMU translation entry. * -* The notification type will be decided by entry.perm bits: -* -* - For UNMAP (cache invalidation) notifies: set entry.perm to IOMMU_NONE. -* - For MAP (newly added entry) notifies: set entry.perm to the -* permission of the page (which is definitely !IOMMU_NONE). -* * Note: for any IOMMU implementation, an in-place mapping change * should be notified with an UNMAP followed by a MAP. * * @iommu_mr: the memory region that was changed * @iommu_idx: the IOMMU index for the translation table which has changed -* @entry: the new entry in the IOMMU translation table. The entry -* replaces all old entries for the same virtual I/O address range. -* Deleted entries have .@perm == 0. +* @event: TLB event with the new entry in the IOMMU translation table. +* The entry replaces all old entries for the same virtual I/O address +* range. */ void memory_region_notify_iommu (IOMMUMemoryRegion *iommu_mr,int iommu_idx, -IOMMUTLBEntry entry); +IOMMUTLBEvent event);/** * memory_region_notify_iommu_one: notify a change in an IOMMU translation
@@ -1353,12 +1352,12 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,* notifies a specific notifier, not all of them. * * @notifier: the notifier to be notified -* @entry: the new entry in the IOMMU translation table. The entry -* replaces all old entries for the same virtual I/O address range. -* Deleted entries have .@perm == 0. +* @event: TLB event with the new entry in the IOMMU translation table. +* The entry replaces all old entries for the same virtual I/O address +* range. */ void memory_region_notify_iommu_one (IOMMUNotifier *notifier, -IOMMUTLBEntry *entry); +IOMMUTLBEvent *event);/** * memory_region_register_iommu_notifier: register a notifier for changes to
hw/arm/smmu-common.c +7 -6
@@ -465,14 +465,15 @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid)/* Unmap the whole notifier's range */ static void smmu_unmap_notifier_range (IOMMUNotifier *n) { -IOMMUTLBEntry entry; +IOMMUTLBEvent event; - entry.target_as = &address_space_memory; - entry.iova = n->start; - entry.perm =IOMMU_NONE ; - entry.addr_mask = n->end - n->start; + event.type =IOMMU_NOTIFIER_UNMAP ; + event.entry.target_as = &address_space_memory; + event.entry.iova = n->start; + event.entry.perm =IOMMU_NONE ; + event.entry.addr_mask = n->end - n->start; -memory_region_notify_iommu_one (n, &entry); +memory_region_notify_iommu_one (n, &event); }/* Unmap all notifiers attached to @mr */
hw/arm/smmuv3.c +7 -6
@@ -800,7 +800,7 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, uint8_t tg, uint64_t num_pages) {SMMUDevice *sdev =container_of (mr, SMMUDevice, iommu); -IOMMUTLBEntry entry; +IOMMUTLBEvent event;uint8_t granule = tg;if (!tg) {
@@ -823,12 +823,13 @@ static void smmuv3_notify_iova(IOMMUMemoryRegion *mr, granule = tt->granule_sz; } - entry.target_as = &address_space_memory; - entry.iova = iova; - entry.addr_mask = num_pages * (1 << granule) -1 ; - entry.perm =IOMMU_NONE ; + event.type =IOMMU_NOTIFIER_UNMAP ; + event.entry.target_as = &address_space_memory; + event.entry.iova = iova; + event.entry.addr_mask = num_pages * (1 << granule) -1 ; + event.entry.perm =IOMMU_NONE ; -memory_region_notify_iommu_one (n, &entry); +memory_region_notify_iommu_one (n, &event); }/* invalidate an asid/iova range tuple in all mr's */
hw/i386/intel_iommu.c +49 -39
198 lines not on this page · raw message
hw/misc/tz-mpc.c +18 -14
@@ -82,8 +82,10 @@ static void tz_mpc_iommu_notify(TZMPC *s, uint32_t lutidx,/* Called when the LUT word at lutidx has changed from oldlut to newlut; * must call the IOMMU notifiers for the changed blocks. */ -IOMMUTLBEntry entry = { - .addr_mask = s->blocksize -1 , +IOMMUTLBEvent event = { + .entry = { + .addr_mask = s->blocksize -1 , + } };hwaddr addr = lutidx * s->blocksize *32 ;int i;
@@ -100,26 +102,28 @@ static void tz_mpc_iommu_notify(TZMPC *s, uint32_t lutidx, block_is_ns = newlut & (1 << i);trace_tz_mpc_iommu_notify (addr); - entry.iova = addr; - entry.translated_addr = addr; + event.entry.iova = addr; + event.entry.translated_addr = addr; - entry.perm =IOMMU_NONE ; -memory_region_notify_iommu (&s->upstream,IOMMU_IDX_S , entry); -memory_region_notify_iommu (&s->upstream,IOMMU_IDX_NS , entry); + event.type =IOMMU_NOTIFIER_UNMAP ; + event.entry.perm =IOMMU_NONE ; +memory_region_notify_iommu (&s->upstream,IOMMU_IDX_S , event); +memory_region_notify_iommu (&s->upstream,IOMMU_IDX_NS , event); - entry.perm =IOMMU_RW ; + event.type =IOMMU_NOTIFIER_MAP ; + event.entry.perm =IOMMU_RW ;if (block_is_ns) { - entry.target_as = &s->blocked_io_as; + event.entry.target_as = &s->blocked_io_as; }else { - entry.target_as = &s->downstream_as; + event.entry.target_as = &s->downstream_as; } -memory_region_notify_iommu (&s->upstream,IOMMU_IDX_S , entry); +memory_region_notify_iommu (&s->upstream,IOMMU_IDX_S , event);if (block_is_ns) { - entry.target_as = &s->downstream_as; + event.entry.target_as = &s->downstream_as; }else { - entry.target_as = &s->blocked_io_as; + event.entry.target_as = &s->blocked_io_as; } -memory_region_notify_iommu (&s->upstream,IOMMU_IDX_NS , entry); +memory_region_notify_iommu (&s->upstream,IOMMU_IDX_NS , event); } }
hw/ppc/spapr_iommu.c +8 -7
@@ -445,7 +445,7 @@ static void spapr_tce_reset(DeviceState *dev)static target_ulong put_tce_emu (SpaprTceTable *tcet,target_ulong ioba,target_ulong tce) { -IOMMUTLBEntry entry; +IOMMUTLBEvent event;hwaddr page_mask =IOMMU_PAGE_MASK (tcet->page_shift);unsigned long index = (ioba - tcet->bus_offset) >> tcet->page_shift;
@@ -457,12 +457,13 @@ static target_ulong put_tce_emu(SpaprTceTable *tcet, target_ulong ioba, tcet->table[index] = tce; - entry.target_as = &address_space_memory, - entry.iova = (ioba - tcet->bus_offset) & page_mask; - entry.translated_addr = tce & page_mask; - entry.addr_mask = ~page_mask; - entry.perm =spapr_tce_iommu_access_flags (tce); -memory_region_notify_iommu (&tcet->iommu,0 , entry); + event.entry.target_as = &address_space_memory, + event.entry.iova = (ioba - tcet->bus_offset) & page_mask; + event.entry.translated_addr = tce & page_mask; + event.entry.addr_mask = ~page_mask; + event.entry.perm =spapr_tce_iommu_access_flags (tce); + event.type = event.entry.perm ?IOMMU_NOTIFIER_MAP :IOMMU_NOTIFIER_UNMAP ; +memory_region_notify_iommu (&tcet->iommu,0 , event);return H_SUCCESS ; }
hw/s390x/s390-pci-inst.c +16 -11
@@ -602,15 +602,18 @@ static uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, S390IOTLBEntry *entry) {S390IOTLBEntry *cache =g_hash_table_lookup (iommu->iotlb, &entry->iova); -IOMMUTLBEntry notify = { - .target_as = &address_space_memory, - .iova = entry->iova, - .translated_addr = entry->translated_addr, - .perm = entry->perm, - .addr_mask = ~PAGE_MASK , +IOMMUTLBEvent event = { + .type = entry->perm ?IOMMU_NOTIFIER_MAP :IOMMU_NOTIFIER_UNMAP , + .entry = { + .target_as = &address_space_memory, + .iova = entry->iova, + .translated_addr = entry->translated_addr, + .perm = entry->perm, + .addr_mask = ~PAGE_MASK , + }, }; -if (entry->perm ==IOMMU_NONE ) { +if (event.type ==IOMMU_NOTIFIER_UNMAP ) {if (!cache) { goto out; }
@@ -623,9 +626,11 @@ static uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu, goto out; } - notify.perm =IOMMU_NONE ; -memory_region_notify_iommu (&iommu->iommu_mr,0 , notify); - notify.perm = entry->perm; + event.type =IOMMU_NOTIFIER_UNMAP ; + event.entry.perm =IOMMU_NONE ; +memory_region_notify_iommu (&iommu->iommu_mr,0 , event); + event.type =IOMMU_NOTIFIER_MAP ; + event.entry.perm = entry->perm; } cache =g_new (S390IOTLBEntry,1 );
@@ -637,7 +642,7 @@ static uint32_t s390_pci_update_iotlb(S390PCIIOMMU *iommu,dec_dma_avail (iommu); } -memory_region_notify_iommu (&iommu->iommu_mr,0 , notify); +memory_region_notify_iommu (&iommu->iommu_mr,0 , event); out:return iommu->dma_limit ? iommu->dma_limit->avail :1 ;
hw/virtio/virtio-iommu.c +16 -14
@@ -129,7 +129,7 @@ static void virtio_iommu_notify_map(IOMMUMemoryRegion *mr, hwaddr virt_start, hwaddr virt_end, hwaddr paddr, uint32_t flags) { - IOMMUTLBEntry entry; + IOMMUTLBEvent event;IOMMUAccessFlags perm =IOMMU_ACCESS_FLAG (flags &VIRTIO_IOMMU_MAP_F_READ , flags &VIRTIO_IOMMU_MAP_F_WRITE );
@@ -141,19 +141,20 @@ static void virtio_iommu_notify_map(IOMMUMemoryRegion *mr, hwaddr virt_start,trace_virtio_iommu_notify_map (mr->parent_obj.name, virt_start, virt_end, paddr, perm); - entry.target_as = &address_space_memory; - entry.addr_mask = virt_end - virt_start; - entry.iova = virt_start; - entry.perm = perm; - entry.translated_addr = paddr; + event.type =IOMMU_NOTIFIER_MAP ; + event.entry.target_as = &address_space_memory; + event.entry.addr_mask = virt_end - virt_start; + event.entry.iova = virt_start; + event.entry.perm = perm; + event.entry.translated_addr = paddr; -memory_region_notify_iommu (mr,0 , entry); +memory_region_notify_iommu (mr,0 , event); }static void virtio_iommu_notify_unmap (IOMMUMemoryRegion *mr,hwaddr virt_start,hwaddr virt_end) { -IOMMUTLBEntry entry; +IOMMUTLBEvent event;if (!(mr->iommu_notify_flags &IOMMU_NOTIFIER_UNMAP )) {return ;
@@ -161,13 +162,14 @@ static void virtio_iommu_notify_unmap(IOMMUMemoryRegion *mr, hwaddr virt_start,trace_virtio_iommu_notify_unmap (mr->parent_obj.name, virt_start, virt_end); - entry.target_as = &address_space_memory; - entry.addr_mask = virt_end - virt_start; - entry.iova = virt_start; - entry.perm =IOMMU_NONE ; - entry.translated_addr =0 ; + event.type =IOMMU_NOTIFIER_UNMAP ; + event.entry.target_as = &address_space_memory; + event.entry.addr_mask = virt_end - virt_start; + event.entry.iova = virt_start; + event.entry.perm =IOMMU_NONE ; + event.entry.translated_addr =0 ; -memory_region_notify_iommu (mr,0 , entry); +memory_region_notify_iommu (mr,0 , event); } static gboolean virtio_iommu_notify_unmap_cb(gpointer key, gpointer value,
softmmu/memory.c +9 -11
@@ -1943,11 +1943,15 @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr, }void memory_region_notify_iommu_one (IOMMUNotifier *notifier, -IOMMUTLBEntry *entry) +IOMMUTLBEvent *event) { -IOMMUNotifierFlag request_flags; +IOMMUTLBEntry *entry = &event->entry;hwaddr entry_end = entry->iova + entry->addr_mask; +if (event->type ==IOMMU_NOTIFIER_UNMAP ) { +assert (entry->perm ==IOMMU_NONE ); + } +/* * Skip the notification if the notification does not overlap * with registered range.
@@ -1958,20 +1962,14 @@ void memory_region_notify_iommu_one(IOMMUNotifier *notifier,assert (entry->iova >= notifier->start && entry_end <= notifier->end); -if (entry->perm &IOMMU_RW ) { - request_flags =IOMMU_NOTIFIER_MAP ; - }else { - request_flags =IOMMU_NOTIFIER_UNMAP ; - } - -if (notifier->notifier_flags & request_flags) { +if (event->type & notifier->notifier_flags) { notifier->notify (notifier, entry); } }void memory_region_notify_iommu (IOMMUMemoryRegion *iommu_mr,int iommu_idx, -IOMMUTLBEntry entry) +IOMMUTLBEvent event) {IOMMUNotifier *iommu_notifier;
@@ -1979,7 +1977,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr, IOMMU_NOTIFIER_FOREACH(iommu_notifier, iommu_mr) {if (iommu_notifier->iommu_idx == iommu_idx) { -memory_region_notify_iommu_one (iommu_notifier, &entry); +memory_region_notify_iommu_one (iommu_notifier, &event); } } }
Signature · 1 line
MST
[PULL 07/66] virtio: reset device on bad guest index in virtio_load()
In reply to Michael S. TsirkinFrom: John Levon <[email protected]>
If we find a queue with an inconsistent guest index value, explicitly mark the device as needing a reset - and broken - via virtio_error().
There's at least one driver implementation - the virtio-win NetKVM driver - that is able to handle a VIRTIO_CONFIG_S_NEEDS_RESET notification and successfully restore the device to a working state. Other implementations do not correctly handle this, but as the VQ is not in a functional state anyway, this is still worth doing.
Message-Id: <20201120185103.GA442386@sent>
--- hw/virtio/virtio.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
hw/virtio/virtio.c +9 -6
@@ -3161,12 +3161,15 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) nheads =vring_avail_idx (&vdev->vq[i]) - vdev->vq[i].last_avail_idx;/* Check it isn't doing strange things with descriptor numbers. */ if (nheads > vdev->vq[i].vring.num) { -qemu_log_mask (LOG_GUEST_ERROR , -"VQ %d size 0x%x Guest index 0x%x " -"inconsistent with Host index 0x%x: delta 0x%x" , - i, vdev->vq[i].vring.num, -vring_avail_idx (&vdev->vq[i]), - vdev->vq[i].last_avail_idx, nheads); +virtio_error (vdev,"VQ %d size 0x%x Guest index 0x%x " +"inconsistent with Host index 0x%x: delta 0x%x" , + i, vdev->vq[i].vring.num, +vring_avail_idx (&vdev->vq[i]), + vdev->vq[i].last_avail_idx, nheads); + vdev->vq[i].used_idx =0 ; + vdev->vq[i].shadow_avail_idx =0 ; + vdev->vq[i].inuse =0 ; +continue ; } vdev->vq[i].used_idx =vring_used_idx (&vdev->vq[i]); vdev->vq[i].shadow_avail_idx =vring_avail_idx (&vdev->vq[i]);
Signature · 1 line
MST
[PULL 05/66] intel_iommu: Skip page walking on device iotlb invalidations
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Although they didn't reach the notifier because of the filtering in memory_region_notify_iommu_one, the vt-d was still splitting huge memory invalidations in chunks. Skipping it.
This improves performance in case of netperf with vhost-net:
* TCP_STREAM: From 1923.6Mbit/s to 2175.13Mbit/s (13%)
* TCP_RR: From 8464.73 trans/s to 8932.703333 trans/s (5.5%)
* UDP_RR: From 8562.08 trans/s to 9005.62/s (5.1%)
* UDP_STREAM: No change observed (insignificant 0.1% improvement)
Message-Id: <[email protected]>
--- hw/i386/intel_iommu.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/i386/intel_iommu.c +4 -0
@@ -1478,6 +1478,10 @@ static int vtd_sync_shadow_page_table(VTDAddressSpace *vtd_as)VTDContextEntry ce;IOMMUNotifier *n; +if (!(vtd_as->iommu.iommu_notify_flags &IOMMU_NOTIFIER_IOTLB_EVENTS )) { +return 0 ; + } + ret =vtd_dev_to_context_entry (vtd_as->iommu_state,pci_bus_num (vtd_as->bus), vtd_as->devfn, &ce);
Signature · 1 line
MST
[PULL 06/66] memory: Skip bad range assertion if notifier is DEVIOTLB_UNMAP type
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Device IOTLB invalidations can unmap arbitrary ranges, eiter outside of the memory region or even [0, ~0ULL] for all the space. The assertion could be hit by a guest, and rhel7 guest effectively hit it.
Message-Id: <[email protected]>
--- softmmu/memory.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
softmmu/memory.c +9 -2
@@ -1947,6 +1947,7 @@ void memory_region_notify_iommu_one(IOMMUNotifier *notifier, {IOMMUTLBEntry *entry = &event->entry;hwaddr entry_end = entry->iova + entry->addr_mask; +IOMMUTLBEntry tmp = *entry;if (event->type ==IOMMU_NOTIFIER_UNMAP ) {assert (entry->perm ==IOMMU_NONE );
@@ -1960,10 +1961,16 @@ void memory_region_notify_iommu_one(IOMMUNotifier *notifier,return ; } -assert (entry->iova >= notifier->start && entry_end <= notifier->end); +if (notifier->notifier_flags &IOMMU_NOTIFIER_DEVIOTLB_UNMAP ) { +/* Crop (iova, addr_mask) to range */ + tmp.iova =MAX (tmp.iova, notifier->start); + tmp.addr_mask =MIN (entry_end, notifier->end) - tmp.iova; + }else { +assert (entry->iova >= notifier->start && entry_end <= notifier->end); + }if (event->type & notifier->notifier_flags) { - notifier->notify (notifier, entry); + notifier->notify (notifier, &tmp); } }
Signature · 1 line
MST
[PULL 10/66] hw/arm/virt: Write extra pci roots into fw_cfg
In reply to Michael S. TsirkinFrom: Jiahui Cen <[email protected]>
Add bus property to virt machine for primary PCI root bus and use it to add extra pci roots behind it.
Message-Id: <[email protected]>
--- include/hw/arm/virt.h | 1 + hw/arm/virt.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
include/hw/arm/virt.h +1 -0
@@ -163,6 +163,7 @@ struct VirtMachineState {DeviceState *gic;DeviceState *acpi_dev;Notifier powerdown_notifier; +PCIBus *bus; };#define VIRT_ECAM_ID (high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
hw/arm/virt.c +5 -2
@@ -1289,7 +1289,8 @@ static void create_pcie(VirtMachineState *vms) } pci =PCI_HOST_BRIDGE (dev); -if (pci->bus) { + vms->bus = pci->bus; +if (vms->bus) {for (i =0 ; i < nb_nics; i++) {NICInfo *nd = &nd_table[i];
@@ -1346,7 +1347,7 @@ static void create_pcie(VirtMachineState *vms)switch (vms->iommu) {case VIRT_IOMMU_SMMUV3 : -create_smmu (vms, pci->bus); +create_smmu (vms, vms->bus);qemu_fdt_setprop_cells (vms->fdt, nodename,"iommu-map" ,0x0 , vms->iommu_phandle,0x0 ,0x10000 );break ;
@@ -1481,6 +1482,8 @@ void virt_machine_done(Notifier *notifier, void *data)exit (1 ); } +fw_cfg_add_extra_pci_roots (vms->bus, vms->fw_cfg); +virt_acpi_setup (vms);virt_build_smbios (vms); }
Signature · 1 line
MST
[PULL 11/66] acpi: Extract crs build form acpi_build.c
In reply to Michael S. TsirkinFrom: Yubo Miao <[email protected]>
Extract crs build form acpi_build.c, the function could also be used to build the crs for pxbs for arm. The resources are composed by two parts:
1. The bar space of pci-bridge/pcie-root-ports
2. The resources needed by devices behind PXBs.
The base and limit of memory/io are obtained from the config via two APIs:pci_bridge_get_base and pci_bridge_get_limit
Message-Id: <[email protected]>
--- include/hw/acpi/aml-build.h | 22 +++ hw/acpi/aml-build.c | 285 +++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 293 ------------------------------------ 3 files changed, 307 insertions(+), 293 deletions(-)
include/hw/acpi/aml-build.h +22 -0
@@ -224,6 +224,20 @@ struct AcpiBuildTables {BIOSLinker *linker; } AcpiBuildTables; +typedef +struct CrsRangeEntry { +uint64_t base; +uint64_t limit; +}CrsRangeEntry ; + +typedef +struct CrsRangeSet { +GPtrArray *io_ranges; +GPtrArray *mem_ranges; +GPtrArray *mem_64bit_ranges; +}CrsRangeSet ; + +/* * ACPI 5.0: 6.4.3.8.2 Serial Bus Connection Descriptors * Serial Bus Type
@@ -432,6 +446,14 @@ build_append_gas_from_struct(GArray *table, const struct AcpiGenericAddress *s) s->access_width, s->address); } +void crs_range_insert (GPtrArray *ranges,uint64_t base,uint64_t limit); +void crs_replace_with_free_ranges (GPtrArray *ranges, +uint64_t start,uint64_t end); +void crs_range_set_init (CrsRangeSet *range_set); +void crs_range_set_free (CrsRangeSet *range_set); + +Aml *build_crs (PCIHostState *host,CrsRangeSet *range_set); +void build_srat_memory (AcpiSratMemoryAffinity *numamem,uint64_t base,uint64_t len,int node,MemoryAffinityFlags flags);
hw/acpi/aml-build.c +285 -0
303 lines not on this page · raw message
hw/i386/acpi-build.c +0 -293
299 lines not on this page · raw message
Signature · 1 line
MST
[PULL 08/66] acpi/gpex: Extract two APIs from acpi_dsdt_add_pci
In reply to Michael S. TsirkinFrom: Yubo Miao <[email protected]>
Extract two APIs acpi_dsdt_add_pci_route_table and acpi_dsdt_add_pci_osc from acpi_dsdt_add_pci. The first API is used to specify the pci route table and the second API is used to declare the operation system capabilities. These two APIs would be used to specify the pxb-pcie in DSDT.
Message-Id: <[email protected]>
--- hw/pci-host/gpex-acpi.c | 112 ++++++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 49 deletions(-)
hw/pci-host/gpex-acpi.c +63 -49
@@ -2,21 +2,11 @@#include "hw/acpi/aml-build.h" #include "hw/pci-host/gpex.h" -void acpi_dsdt_add_gpex (Aml *scope,struct GPEXConfig *cfg) +static void acpi_dsdt_add_pci_route_table (Aml *dev,uint32_t irq) { -int nr_pcie_buses = cfg->ecam.size /PCIE_MMCFG_SIZE_MIN ; -Aml *method, *crs, *ifctx, *UUID , *ifctx1, *elsectx, *buf; +Aml *method, *crs;int i, slot_no; -Aml *dev =aml_device ("%s" ,"PCI0" ); -aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0A08" ))); -aml_append (dev,aml_name_decl ("_CID" ,aml_string ("PNP0A03" ))); -aml_append (dev,aml_name_decl ("_SEG" ,aml_int (0 ))); -aml_append (dev,aml_name_decl ("_BBN" ,aml_int (0 ))); -aml_append (dev,aml_name_decl ("_UID" ,aml_int (0 ))); -aml_append (dev,aml_name_decl ("_STR" ,aml_unicode ("PCIe 0 Device" ))); -aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); -/* Declare the PCI Routing Table. */ Aml *rt_pkg =aml_varpackage (PCI_SLOT_MAX *PCI_NUM_PINS );for (slot_no =0 ; slot_no <PCI_SLOT_MAX ; slot_no++) {
@@ -34,7 +24,7 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg)/* Create GSI link device */ for (i =0 ; i <PCI_NUM_PINS ; i++) { -uint32_t irqs = cfg->irq + i; +uint32_t irqs = irq + i;Aml *dev_gsi =aml_device ("GSI%d" , i);aml_append (dev_gsi,aml_name_decl ("_HID" ,aml_string ("PNP0C0F" )));aml_append (dev_gsi,aml_name_decl ("_UID" ,aml_int (i)));
@@ -52,43 +42,11 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg)aml_append (dev_gsi, method);aml_append (dev, dev_gsi); } +} - method =aml_method ("_CBA" ,0 ,AML_NOTSERIALIZED ); -aml_append (method,aml_return (aml_int (cfg->ecam.base))); -aml_append (dev, method); - -Aml *rbuf =aml_resource_template (); -aml_append (rbuf, -aml_word_bus_number (AML_MIN_FIXED ,AML_MAX_FIXED ,AML_POS_DECODE , -0x0000 ,0x0000 , nr_pcie_buses -1 ,0x0000 , - nr_pcie_buses)); -if (cfg->mmio32.size) { -aml_append (rbuf, -aml_dword_memory (AML_POS_DECODE ,AML_MIN_FIXED ,AML_MAX_FIXED , -AML_NON_CACHEABLE ,AML_READ_WRITE ,0x0000 , - cfg->mmio32.base, - cfg->mmio32.base + cfg->mmio32.size -1 , -0x0000 , - cfg->mmio32.size)); - } -if (cfg->pio.size) { -aml_append (rbuf, -aml_dword_io (AML_MIN_FIXED ,AML_MAX_FIXED ,AML_POS_DECODE , -AML_ENTIRE_RANGE ,0x0000 ,0x0000 , - cfg->pio.size -1 , - cfg->pio.base, - cfg->pio.size)); - } -if (cfg->mmio64.size) { -aml_append (rbuf, -aml_qword_memory (AML_POS_DECODE ,AML_MIN_FIXED ,AML_MAX_FIXED , -AML_NON_CACHEABLE ,AML_READ_WRITE ,0x0000 , - cfg->mmio64.base, - cfg->mmio64.base + cfg->mmio64.size -1 , -0x0000 , - cfg->mmio64.size)); - } -aml_append (dev,aml_name_decl ("_CRS" , rbuf)); +static void acpi_dsdt_add_pci_osc (Aml *dev) +{ +Aml *method, *UUID , *ifctx, *ifctx1, *elsectx, *buf;/* Declare an _OSC (OS Control Handoff) method */ aml_append (dev,aml_name_decl ("SUPP" ,aml_int (0 )));
@@ -160,6 +118,62 @@ void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg) buf =aml_buffer (1 , byte_list);aml_append (method,aml_return (buf));aml_append (dev, method); +} + +void acpi_dsdt_add_gpex (Aml *scope,struct GPEXConfig *cfg) +{ +int nr_pcie_buses = cfg->ecam.size /PCIE_MMCFG_SIZE_MIN ; +Aml *method, *crs, *dev, *rbuf; + + dev =aml_device ("%s" ,"PCI0" ); +aml_append (dev,aml_name_decl ("_HID" ,aml_string ("PNP0A08" ))); +aml_append (dev,aml_name_decl ("_CID" ,aml_string ("PNP0A03" ))); +aml_append (dev,aml_name_decl ("_SEG" ,aml_int (0 ))); +aml_append (dev,aml_name_decl ("_BBN" ,aml_int (0 ))); +aml_append (dev,aml_name_decl ("_UID" ,aml_int (0 ))); +aml_append (dev,aml_name_decl ("_STR" ,aml_unicode ("PCIe 0 Device" ))); +aml_append (dev,aml_name_decl ("_CCA" ,aml_int (1 ))); + +acpi_dsdt_add_pci_route_table (dev, cfg->irq); + + method =aml_method ("_CBA" ,0 ,AML_NOTSERIALIZED ); +aml_append (method,aml_return (aml_int (cfg->ecam.base))); +aml_append (dev, method); + + rbuf =aml_resource_template (); +aml_append (rbuf, +aml_word_bus_number (AML_MIN_FIXED ,AML_MAX_FIXED ,AML_POS_DECODE , +0x0000 ,0x0000 , nr_pcie_buses -1 ,0x0000 , + nr_pcie_buses)); +if (cfg->mmio32.size) { +aml_append (rbuf, +aml_dword_memory (AML_POS_DECODE ,AML_MIN_FIXED ,AML_MAX_FIXED , +AML_NON_CACHEABLE ,AML_READ_WRITE ,0x0000 , + cfg->mmio32.base, + cfg->mmio32.base + cfg->mmio32.size -1 , +0x0000 , + cfg->mmio32.size)); + } +if (cfg->pio.size) { +aml_append (rbuf, +aml_dword_io (AML_MIN_FIXED ,AML_MAX_FIXED ,AML_POS_DECODE , +AML_ENTIRE_RANGE ,0x0000 ,0x0000 , + cfg->pio.size -1 , + cfg->pio.base, + cfg->pio.size)); + } +if (cfg->mmio64.size) { +aml_append (rbuf, +aml_qword_memory (AML_POS_DECODE ,AML_MIN_FIXED ,AML_MAX_FIXED , +AML_NON_CACHEABLE ,AML_READ_WRITE ,0x0000 , + cfg->mmio64.base, + cfg->mmio64.base + cfg->mmio64.size -1 , +0x0000 , + cfg->mmio64.size)); + } +aml_append (dev,aml_name_decl ("_CRS" , rbuf)); + +acpi_dsdt_add_pci_osc (dev);Aml *dev_res0 =aml_device ("%s" ,"RES0" );aml_append (dev_res0,aml_name_decl ("_HID" ,aml_string ("PNP0C02" )));
Signature · 1 line
MST
[PULL 15/66] unit-test: Add testcase for pxb
In reply to Michael S. TsirkinFrom: Yubo Miao <[email protected]>
Add testcase for pxb to make sure the ACPI table is correct for guest.
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 6 deletions(-)
tests/qtest/bios-tables-test.c +52 -6
@@ -671,12 +671,21 @@ static void test_acpi_one(const char *params, test_data *data)* TODO: convert '-drive if=pflash' to new syntax (see e33763be7cd3) * when arm/virt boad starts to support it. */ - args =g_strdup_printf ("-machine %s %s -accel tcg -nodefaults -nographic " -"-drive if=pflash,format=raw,file=%s,readonly " -"-drive if=pflash,format=raw,file=%s,snapshot=on -cdrom %s %s" , - data->machine, data->tcg_only ?"" :"-accel kvm" , - data->uefi_fl1, data->uefi_fl2, data->cd, params ? params :"" ); - +if (data->cd) { + args =g_strdup_printf ("-machine %s %s -accel tcg " +"-nodefaults -nographic " +"-drive if=pflash,format=raw,file=%s,readonly " +"-drive if=pflash,format=raw,file=%s,snapshot=on -cdrom %s %s" , + data->machine, data->tcg_only ?"" :"-accel kvm" , + data->uefi_fl1, data->uefi_fl2, data->cd, params ? params :"" ); + }else { + args =g_strdup_printf ("-machine %s %s -accel tcg " +"-nodefaults -nographic " +"-drive if=pflash,format=raw,file=%s,readonly " +"-drive if=pflash,format=raw,file=%s,snapshot=on %s" , + data->machine, data->tcg_only ?"" :"-accel kvm" , + data->uefi_fl1, data->uefi_fl2, params ? params :"" ); + } }else { args =g_strdup_printf ("-machine %s %s -accel tcg " "-net none -display none %s "
@@ -1176,6 +1185,40 @@ static void test_acpi_virt_tcg_numamem(void) } +#ifdef CONFIG_PXB +static void test_acpi_virt_tcg_pxb (void ) +{ +test_data data = { + .machine ="virt" , + .tcg_only = true, + .uefi_fl1 ="pc-bios/edk2-aarch64-code.fd" , + .uefi_fl2 ="pc-bios/edk2-arm-vars.fd" , + .ram_start =0x40000000ULL , + .scan_len =128ULL *1024 *1024 , + }; +/* +* While using -cdrom, the cdrom would auto plugged into pxb-pcie, +* the reason is the bus of pxb-pcie is also root bus, it would lead +* to the error only PCI/PCIE bridge could plug onto pxb. +* Therefore,thr cdrom is defined and plugged onto the scsi controller +* to solve the conflicts. +*/ + data.variant =".pxb" ; +test_acpi_one (" -device pcie-root-port,chassis=1,id=pci.1" +" -device virtio-scsi-pci,id=scsi0,bus=pci.1" +" -drive file=" +"tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2," +"if=none,media=cdrom,id=drive-scsi0-0-0-1,readonly=on" +" -device scsi-cd,bus=scsi0.0,scsi-id=0," +"drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1" +" -cpu cortex-a57" +" -device pxb-pcie,bus_nr=128" , + &data); + +free_test_data (&data); +} +#endif +static void test_acpi_tcg_acpi_hmat (const char *machine) {test_data data;
@@ -1287,6 +1330,9 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/virt" , test_acpi_virt_tcg);qtest_add_func ("acpi/virt/numamem" , test_acpi_virt_tcg_numamem);qtest_add_func ("acpi/virt/memhp" , test_acpi_virt_tcg_memhp); +#ifdef CONFIG_PXB +qtest_add_func ("acpi/virt/pxb" , test_acpi_virt_tcg_pxb); +#endif } ret =g_test_run ();boot_sector_cleanup (disk);
Signature · 1 line
MST
[PULL 09/66] fw_cfg: Refactor extra pci roots addition
In reply to Michael S. TsirkinFrom: Jiahui Cen <[email protected]>
Extract extra pci roots addition from pc machine, which could be used by other machines.
In order to make uefi get the extra roots, it is necessary to write extra roots into fw_cfg. And only if the uefi knows there are extra roots, the config spaces of devices behind the root could be obtained.
Message-Id: <[email protected]>
--- include/hw/nvram/fw_cfg.h | 9 +++++++++ hw/i386/pc.c | 18 +----------------- hw/nvram/fw_cfg.c | 23 +++++++++++++++++++++++ 3 files changed, 33 insertions(+), 17 deletions(-)
include/hw/nvram/fw_cfg.h +9 -0
@@ -308,6 +308,15 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data,bool fw_cfg_add_from_generator (FWCfgState *s,const char *filename,const char *gen_id,Error **errp); +/** +* fw_cfg_add_extra_pci_roots: +* @bus: main pci root bus to be scanned from +* @s: fw_cfg device being modified +* +* Add a new fw_cfg item... +*/ +void fw_cfg_add_extra_pci_roots (PCIBus *bus,FWCfgState *s); +FWCfgState *fw_cfg_init_io_dma (uint32_t iobase,uint32_t dma_iobase,AddressSpace *dma_as);FWCfgState *fw_cfg_init_io (uint32_t iobase);
hw/i386/pc.c +1 -17
@@ -777,27 +777,11 @@ void pc_machine_done(Notifier *notifier, void *data)PCMachineState *pcms =container_of (notifier, PCMachineState, machine_done);X86MachineState *x86ms =X86_MACHINE (pcms); -PCIBus *bus = pcms->bus;/* set the number of CPUs */ x86_rtc_set_cpus_count (x86ms->rtc, x86ms->boot_cpus); -if (bus) { -int extra_hosts =0 ; - - QLIST_FOREACH(bus, &bus->child, sibling) { -/* look for expander root buses */ -if (pci_bus_is_root (bus)) { - extra_hosts++; - } - } -if (extra_hosts && x86ms->fw_cfg) { -uint64_t *val =g_malloc (sizeof (*val)); - *val =cpu_to_le64 (extra_hosts); -fw_cfg_add_file (x86ms->fw_cfg, -"etc/extra-pci-roots" , val,sizeof (*val)); - } - } +fw_cfg_add_extra_pci_roots (pcms->bus, x86ms->fw_cfg);acpi_setup ();if (x86ms->fw_cfg) {
hw/nvram/fw_cfg.c +23 -0
@@ -40,6 +40,7 @@#include "qemu/cutils.h" #include "qapi/error.h" #include "hw/acpi/aml-build.h" +#include "hw/pci/pci_bus.h" #define FW_CFG_FILE_SLOTS_DFLT 0x20
@@ -1061,6 +1062,28 @@ bool fw_cfg_add_from_generator(FWCfgState *s, const char *filename,return true; } +void fw_cfg_add_extra_pci_roots (PCIBus *bus,FWCfgState *s) +{ +int extra_hosts =0 ; + +if (!bus) { +return ; + } + + QLIST_FOREACH(bus, &bus->child, sibling) { +/* look for expander root buses */ +if (pci_bus_is_root (bus)) { + extra_hosts++; + } + } + +if (extra_hosts && s) { +uint64_t *val =g_malloc (sizeof (*val)); + *val =cpu_to_le64 (extra_hosts); +fw_cfg_add_file (s,"etc/extra-pci-roots" , val,sizeof (*val)); + } +} +static void fw_cfg_machine_reset (void *opaque) {MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ());
Signature · 1 line
MST
[PULL 14/66] unit-test: The files changed.
In reply to Michael S. TsirkinFrom: Yubo Miao <[email protected]>
The unit-test is seperated into three patches:
1. The files changed and list in bios-tables-test-allowed-diff.h
2. The unit-test
3. The binary file and clear bios-tables-test-allowed-diff.h
The ASL diff would also be listed.
Sice there are 1000+lines diff, some changes would be omitted.
* Original Table Header:
* Signature "DSDT" - * Length 0x000014BB (5307) + * Length 0x00001E7A (7802) * Revision 0x02 - * Checksum 0xD1 + * Checksum 0x57 * OEM ID "BOCHS " * OEM Table ID "BXPCDSDT" * OEM Revision 0x00000001 (1)
+ Device (PC80)
+ {
+ Name (_HID, "PNP0A08" /* PCI Express Bus */) // _HID: Hardware ID
+ Name (_CID, "PNP0A03" /* PCI Bus */) // _CID: Compatible ID
+ Name (_ADR, Zero) // _ADR: Address
+ Name (_CCA, One) // _CCA: Cache Coherency Attribute
+ Name (_SEG, Zero) // _SEG: PCI Segment
+ Name (_BBN, 0x80) // _BBN: BIOS Bus Number
+ Name (_UID, 0x80) // _UID: Unique ID
+ Name (_STR, Unicode ("pxb Device")) // _STR: Description String
+ Name (_PRT, Package (0x80) // _PRT: PCI Routing Table
+ {
+ Package (0x04)
+ {
+ 0xFFFF,
+ Zero,
+ GSI0,
+ Zero+ },
+
Packages are omitted.
+ Package (0x04)
+ {
+ 0x001FFFFF,
+ 0x03,
+ GSI2,
+ Zero
+ }
+ })
+ Device (GSI0)
+ {
+ Name (_HID, "PNP0C0F" /* PCI Interrupt Link Device */) // _HID: Hardware ID
+ Name (_UID, Zero) // _UID: Unique ID
+ Name (_PRS, ResourceTemplate () // _PRS: Possible Resource Settings
+ {+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, )
+ {
+ 0x00000023,
+ }
+ })
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {+ Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, )
+ {
+ 0x00000023,
+ }
+ })
+ Method (_SRS, 1, NotSerialized) // _SRS: Set Resource Settings
+ {
+ }+ }
GSI1,2,3 are omitted.
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ 0x0000, // Granularity
+ 0x0080, // Range Minimum
+ 0x0080, // Range Maximum
+ 0x0000, // Translation Offset
+ 0x0001, // Length
+ ,, )
+ })
+ Name (SUPP, Zero)
+ Name (CTRL, Zero)
+ Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
+ {
+ CreateDWordField (Arg3, Zero, CDW1)
+ If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
+ {
+ CreateDWordField (Arg3, 0x04, CDW2)
+ CreateDWordField (Arg3, 0x08, CDW3)
+ SUPP = CDW2 /* \_SB_.PC80._OSC.CDW2 */
+ CTRL = CDW3 /* \_SB_.PC80._OSC.CDW3 */
+ CTRL &= 0x1F
+ If ((Arg1 != One))
+ {+ CDW1 |= 0x08
+ }
+
+ If ((CDW3 != CTRL))
+ {
+ CDW1 |= 0x10
+ }
+
+ CDW3 = CTRL /* \_SB_.PC80.CTRL */
+ Return (Arg3)
+ }
+ Else
+ {+ CDW1 |= 0x04
+ Return (Arg3)
+ }
+ }
DSM is are omitted
Device (PCI0)
{
Name (_HID, "PNP0A08" /* PCI Express Bus */) // _HID: Hardware ID
WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
0x0000, // Granularity
0x0000, // Range Minimum
- 0x00FF, // Range Maximum
+ 0x007F, // Range Maximum
0x0000, // Translation Offset
- 0x0100, // Length
+ 0x0080, // LengthMessage-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+)
tests/qtest/bios-tables-test-allowed-diff.h +1 -0
@@ -1 +1,2 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/virt/DSDT.pxb",
Signature · 1 line
MST
[PULL 18/66] failover: Use always atomics for primary_should_be_hidden
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/virtio-net.c +1 -1
@@ -3136,7 +3136,7 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp)return false; }qdev_set_parent_bus (n->primary_dev, n->primary_bus, &error_abort); - n->primary_should_be_hidden = false; +qatomic_set (&n->primary_should_be_hidden, false);if (!qemu_opt_set_bool (n->primary_device_opts,"partially_hotplugged" , true, errp)) {return false;
Signature · 1 line
MST
[PULL 13/66] acpi: Align the size to 128k
In reply to Michael S. TsirkinFrom: Yubo Miao <[email protected]>
If table size is changed between virt_acpi_build and virt_acpi_build_update, the table size would not be updated to UEFI, therefore, just align the size to 128kb, which is enough and same with x86. It would warn if 64k is not enough and the align size should be updated.
Message-Id: <[email protected]>
--- hw/arm/virt-acpi-build.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
hw/arm/virt-acpi-build.c +25 -0
@@ -57,6 +57,8 @@#define ARM_SPI_BASE 32 +#define ACPI_BUILD_TABLE_SIZE 0x20000 +static void acpi_dsdt_add_cpus (Aml *scope,int smp_cpus) {uint16_t i;
@@ -656,6 +658,15 @@ struct AcpiBuildState {bool patched; } AcpiBuildState; +static void acpi_align_size (GArray *blob,unsigned align) +{ +/* +* Align size to multiple of given size. This reduces the chance +* we need to change size in the future (breaking cross version migration). +*/ +g_array_set_size (blob,ROUND_UP (acpi_data_len (blob), align)); +} +static void virt_acpi_build (VirtMachineState *vms,AcpiBuildTables *tables) {
@@ -743,6 +754,20 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables)build_rsdp (tables->rsdp, tables->linker, &rsdp_data); } +/* +* The align size is 128, warn if 64k is not enough therefore +* the align size could be resized. +*/ +if (tables_blob->len >ACPI_BUILD_TABLE_SIZE /2 ) { +warn_report ("ACPI table size %u exceeds %d bytes," +" migration may not work" , + tables_blob->len,ACPI_BUILD_TABLE_SIZE /2 ); +error_printf ("Try removing CPUs, NUMA nodes, memory slots" +" or PCI bridges." ); + } +acpi_align_size (tables_blob,ACPI_BUILD_TABLE_SIZE ); + +/* Cleanup memory that's no longer used. */ g_array_free (table_offsets, true); }
Signature · 1 line
MST
[PULL 19/66] failover: primary bus is only used once, and where it is set
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Just remove the struct member.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-net.h | 1 - hw/net/virtio-net.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
@@ -205,7 +205,6 @@ struct VirtIONet {QemuOpts *primary_device_opts;QDict *primary_device_dict;DeviceState *primary_dev; -BusState *primary_bus;char *primary_device_id;char *standby_id;bool primary_should_be_hidden;
hw/net/virtio-net.c +4 -4
@@ -804,7 +804,6 @@ static void failover_add_primary(VirtIONet *n, Error **errp)qemu_opts_del (n->primary_device_opts); }if (n->primary_dev) { - n->primary_bus = n->primary_dev->parent_bus;if (err) {qdev_unplug (n->primary_dev, &err);qdev_set_id (n->primary_dev,"" );
@@ -3118,6 +3117,7 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp)Error *err =NULL ;HotplugHandler *hotplug_ctrl;PCIDevice *pdev =PCI_DEVICE (n->primary_dev); +BusState *primary_bus;if (!pdev->partially_hotplugged) {return true;
@@ -3130,12 +3130,12 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp)return false; } } - n->primary_bus = n->primary_dev->parent_bus; -if (!n->primary_bus) { + primary_bus = n->primary_dev->parent_bus; +if (!primary_bus) {error_setg (errp,"virtio_net: couldn't find primary bus" );return false; } -qdev_set_parent_bus (n->primary_dev, n->primary_bus, &error_abort); +qdev_set_parent_bus (n->primary_dev, primary_bus, &error_abort);qatomic_set (&n->primary_should_be_hidden, false);if (!qemu_opt_set_bool (n->primary_device_opts,"partially_hotplugged" , true, errp)) {
Signature · 1 line
MST
[PULL 12/66] acpi/gpex: Build tables for pxb
In reply to Michael S. TsirkinFrom: Yubo Miao <[email protected]>
The resources of pxbs are obtained by crs_build and the resources used by pxbs would be moved from the resources defined for host-bridge.
The resources for pxb are composed of following two parts:
1. The bar space of the pci-bridge/pcie-root-port behined it
2. The config space of devices behind it.
Message-Id: <[email protected]>
--- include/hw/pci-host/gpex.h | 1 + hw/arm/virt-acpi-build.c | 6 +++-- hw/pci-host/gpex-acpi.c | 54 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-)
include/hw/pci-host/gpex.h +1 -0
@@ -59,6 +59,7 @@ struct GPEXConfig {MemMapEntry mmio64;MemMapEntry pio;int irq; +PCIBus *bus; };int gpex_set_irq_num (GPEXHost *s,int index,int gsi);
hw/arm/virt-acpi-build.c +4 -2
@@ -153,7 +153,8 @@ static void acpi_dsdt_add_virtio(Aml *scope, }static void acpi_dsdt_add_pci (Aml *scope,const MemMapEntry *memmap, -uint32_t irq,bool use_highmem,bool highmem_ecam) +uint32_t irq,bool use_highmem,bool highmem_ecam, +VirtMachineState *vms) {int ecam_id =VIRT_ECAM_ID (highmem_ecam);struct GPEXConfig cfg = {
@@ -161,6 +162,7 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap, .pio = memmap[VIRT_PCIE_PIO], .ecam = memmap[ecam_id], .irq = irq, + .bus = vms->bus, };if (use_highmem) {
@@ -609,7 +611,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)acpi_dsdt_add_virtio (scope, &memmap[VIRT_MMIO ], (irqmap[VIRT_MMIO ] +ARM_SPI_BASE ),NUM_VIRTIO_TRANSPORTS );acpi_dsdt_add_pci (scope, memmap, (irqmap[VIRT_PCIE ] +ARM_SPI_BASE ), - vms->highmem, vms->highmem_ecam); + vms->highmem, vms->highmem_ecam, vms);if (vms->acpi_dev) { build_ged_aml(scope, "\\_SB."GED_DEVICE, HOTPLUG_HANDLER(vms->acpi_dev),
hw/pci-host/gpex-acpi.c +54 -0
67 lines not on this page · raw message
Signature · 1 line
MST
[PULL 24/66] failover: g_strcmp0() knows how to handle NULL
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/virtio-net.c +1 -1
@@ -818,7 +818,7 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp)int ret =0 ;const char *standby_id =qemu_opt_get (opts,"failover_pair_id" ); -if (standby_id !=NULL && (g_strcmp0 (standby_id, n->netclient_name) ==0 )) { +if (g_strcmp0 (standby_id, n->netclient_name) ==0 ) { n->primary_device_id =g_strdup (opts->id); ret =1 ; }
Signature · 1 line
MST
[PULL 21/66] failover: Remove external partially_hotplugged property
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
It was only set "once", and with the wrong value. As far as I can see, libvirt still don't use it.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 4 ---- 1 file changed, 4 deletions(-)
hw/net/virtio-net.c +0 -4
@@ -3135,10 +3135,6 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp) }qdev_set_parent_bus (n->primary_dev, primary_bus, &error_abort);qatomic_set (&n->primary_should_be_hidden, false); -if (!qemu_opt_set_bool (n->primary_device_opts, -"partially_hotplugged" , true, errp)) { -return false; - } hotplug_ctrl =qdev_get_hotplug_handler (n->primary_dev);if (hotplug_ctrl) {hotplug_handler_pre_plug (hotplug_ctrl, n->primary_dev, &err);
Signature · 1 line
MST
[PULL 17/66] failover: fix indentantion
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Once there, remove not needed cast.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 33 +++++++++++++++------------------ softmmu/qdev-monitor.c | 4 ++-- 2 files changed, 17 insertions(+), 20 deletions(-)
hw/net/virtio-net.c +15 -18
@@ -797,7 +797,7 @@ static void failover_add_primary(VirtIONet *n, Error **errp) } n->primary_device_opts =qemu_opts_find (qemu_find_opts ("device" ), - n->primary_device_id); + n->primary_device_id);if (n->primary_device_opts) { n->primary_dev =qdev_device_add (n->primary_device_opts, &err);if (err) {
@@ -814,9 +814,9 @@ static void failover_add_primary(VirtIONet *n, Error **errp) }else {error_setg (errp,"Primary device not found" );error_append_hint (errp,"Virtio-net failover will not work. Make " -"sure primary device has parameter" -" failover_pair_id=<virtio-net-id>\n" ); -} +"sure primary device has parameter" +" failover_pair_id=<virtio-net-id>\n" ); + }error_propagate (errp, err); }
@@ -824,7 +824,6 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp) {VirtIONet *n = opaque;int ret =0 ; -const char *standby_id =qemu_opt_get (opts,"failover_pair_id" );if (standby_id !=NULL && (g_strcmp0 (standby_id, n->netclient_name) ==0 )) {
@@ -841,14 +840,14 @@ static DeviceState *virtio_net_find_primary(VirtIONet *n, Error **errp)Error *err =NULL ;if (qemu_opts_foreach (qemu_find_opts ("device" ), - is_my_primary, n, &err)) { + is_my_primary, n, &err)) {if (err) {error_propagate (errp, err);return NULL ; }if (n->primary_device_id) { dev =qdev_find_recursive (sysbus_get_default (), - n->primary_device_id); + n->primary_device_id); }else {error_setg (errp,"Primary device id not found" );return NULL ;
@@ -857,8 +856,6 @@ static DeviceState *virtio_net_find_primary(VirtIONet *n, Error **errp)return dev; } - -static DeviceState *virtio_connect_failover_devices (VirtIONet *n,DeviceState *dev,Error **errp)
@@ -3126,9 +3123,9 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp)return true; }if (!n->primary_device_opts) { - n->primary_device_opts =qemu_opts_from_qdict ( -qemu_find_opts ("device" ), - n->primary_device_dict, errp); + n->primary_device_opts =qemu_opts_from_qdict (qemu_find_opts ("device" ), + n->primary_device_dict, + errp);if (!n->primary_device_opts) {return false; }
@@ -3176,8 +3173,8 @@ static void virtio_net_handle_migration_primary(VirtIONet *n,if (migration_in_setup (s) && !should_be_hidden) {if (failover_unplug_primary (n)) {vmstate_unregister (VMSTATE_IF (n->primary_dev), -qdev_get_vmsd (n->primary_dev), - n->primary_dev); +qdev_get_vmsd (n->primary_dev), + n->primary_dev);qapi_event_send_unplug_primary (n->primary_device_id);qatomic_set (&n->primary_should_be_hidden, true); }else {
@@ -3201,7 +3198,7 @@ static void virtio_net_migration_state_notifier(Notifier *notifier, void *data) }static int virtio_net_primary_should_be_hidden (DeviceListener *listener, -QemuOpts *device_opts) +QemuOpts *device_opts) {VirtIONet *n =container_of (listener, VirtIONet, primary_listener);bool match_found = false;
@@ -3211,11 +3208,11 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener,return -1 ; } n->primary_device_dict =qemu_opts_to_qdict (device_opts, - n->primary_device_dict); + n->primary_device_dict);if (n->primary_device_dict) {g_free (n->standby_id); n->standby_id =g_strdup (qdict_get_try_str (n->primary_device_dict, -"failover_pair_id" )); +"failover_pair_id" )); }if (g_strcmp0 (n->standby_id, n->netclient_name) ==0 ) { match_found = true;
@@ -3235,7 +3232,7 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener,if (n->primary_device_dict) {g_free (n->primary_device_id); n->primary_device_id =g_strdup (qdict_get_try_str ( - n->primary_device_dict,"id" )); + n->primary_device_dict,"id" ));if (!n->primary_device_id) {warn_report ("primary_device_id not set" ); }
softmmu/qdev-monitor.c +2 -2
@@ -573,10 +573,10 @@ void qdev_set_id(DeviceState *dev, const char *id) }static int is_failover_device (void *opaque,const char *name,const char *value, -Error **errp) +Error **errp) {if (strcmp (name,"failover_pair_id" ) ==0 ) { -QemuOpts *opts = (QemuOpts *)opaque; +QemuOpts *opts = opaque;if (qdev_should_hide_device (opts)) {return 1 ;
Signature · 1 line
MST
[PULL 29/66] failover: simplify virtio_net_find_primary()
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
a - is_my_primary() never sets one error
b - If we return 1, primary_device_id is always set
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
hw/net/virtio-net.c +3 -15
@@ -828,24 +828,12 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp)static DeviceState *virtio_net_find_primary (VirtIONet *n,Error **errp) { -DeviceState *dev =NULL ;Error *err =NULL ; -if (qemu_opts_foreach (qemu_find_opts ("device" ), - is_my_primary, n, &err)) { -if (err) { -error_propagate (errp, err); -return NULL ; - } -if (n->primary_device_id) { - dev =qdev_find_recursive (sysbus_get_default (), - n->primary_device_id); - }else { -error_setg (errp,"Primary device id not found" ); -return NULL ; - } +if (!qemu_opts_foreach (qemu_find_opts ("device" ), is_my_primary, n, &err)) { +return NULL ; } -return dev; +return qdev_find_recursive (sysbus_get_default (), n->primary_device_id); }static DeviceState *virtio_connect_failover_devices (VirtIONet *n,Error **errp)
Signature · 1 line
MST
[PULL 26/66] failover: remove standby_id variable
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
We can calculate it, and we only use it once anyways.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-net.h | 1 - hw/net/virtio-net.c | 11 +++-------- 2 files changed, 3 insertions(+), 9 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
@@ -205,7 +205,6 @@ struct VirtIONet {QDict *primary_device_dict;DeviceState *primary_dev;char *primary_device_id; -char *standby_id;/* primary failover device is hidden*/ bool failover_primary_hidden;bool failover;
hw/net/virtio-net.c +3 -8
@@ -3181,23 +3181,19 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener,VirtIONet *n =container_of (listener, VirtIONet, primary_listener);bool match_found = false;bool hide = false; +const char *standby_id;if (!device_opts) {return -1 ; } n->primary_device_dict =qemu_opts_to_qdict (device_opts, n->primary_device_dict); -if (n->primary_device_dict) { -g_free (n->standby_id); - n->standby_id =g_strdup (qdict_get_try_str (n->primary_device_dict, -"failover_pair_id" )); - } -if (g_strcmp0 (n->standby_id, n->netclient_name) ==0 ) { + standby_id =qemu_opt_get (device_opts,"failover_pair_id" ); +if (g_strcmp0 (standby_id, n->netclient_name) ==0 ) { match_found = true; }else { match_found = false; hide = false; -g_free (n->standby_id); n->primary_device_dict =NULL ; goto out; }
@@ -3400,7 +3396,6 @@ static void virtio_net_device_unrealize(DeviceState *dev)if (n->failover) {device_listener_unregister (&n->primary_listener);g_free (n->primary_device_id); -g_free (n->standby_id);qobject_unref (n->primary_device_dict); n->primary_device_dict =NULL ; }
Signature · 1 line
MST
[PULL 16/66] unit-test: Add the binary file and clear diff.h
In reply to Michael S. TsirkinFrom: Yubo Miao <[email protected]>
Add the binary file DSDT.pxb and clear bios-tables-test-allowed-diff.h
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/virt/DSDT.pxb | Bin 0 -> 7802 bytes 2 files changed, 1 deletion(-) create mode 100644 tests/data/acpi/virt/DSDT.pxb
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
@@ -1,2 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/virt/DSDT.pxb",
tests/data/acpi/virt/DSDT.pxb new file binary +0 -0
Signature · 1 line
MST
[PULL 31/66] failover: Rename function to hide_device()
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
You should not use pasive.
Message-Id: <[email protected]>
--- include/hw/qdev-core.h | 28 +++++++++++++++------------- hw/core/qdev.c | 4 ++-- hw/net/virtio-net.c | 7 +++---- 3 files changed, 20 insertions(+), 19 deletions(-)
include/hw/qdev-core.h +15 -13
@@ -81,16 +81,17 @@ typedef void (*BusUnrealize)(BusState *bus);* </note> * * # Hiding a device # -* To hide a device, a DeviceListener function should_be_hidden() needs to +* To hide a device, a DeviceListener function hide_device() needs to * be registered. -* It can be used to defer adding a device and therefore hide it from the -* guest. The handler registering to this DeviceListener can save the QOpts -* passed to it for re-using it later and must return that it wants the device -* to be/remain hidden or not. When the handler function decides the device -* shall not be hidden it will be added in qdev_device_add() and -* realized as any other device. Otherwise qdev_device_add() will return early -* without adding the device. The guest will not see a "hidden" device -* until it was marked don't hide and qdev_device_add called again. +* It can be used to defer adding a device and therefore hide it from +* the guest. The handler registering to this DeviceListener can save +* the QOpts passed to it for re-using it later. It must return if it +* wants the device to be hidden or visible. When the handler function +* decides the device shall be visible it will be added with +* qdev_device_add() and realized as any other device. Otherwise +* qdev_device_add() will return early without adding the device. The +* guest will not see a "hidden" device until it was marked visible +* and qdev_device_add called again. * */ struct DeviceClass {
@@ -196,11 +197,12 @@ struct DeviceListener {void (*realize)(DeviceListener *listener,DeviceState *dev);void (*unrealize)(DeviceListener *listener,DeviceState *dev);/* -* This callback is called upon init of the DeviceState and allows to -* inform qdev that a device should be hidden, depending on the device -* opts, for example, to hide a standby device. +* This callback is called upon init of the DeviceState and +* informs qdev if a device should be visible or hidden. We can +* hide a failover device depending for example on the device +* opts. */ -bool (*should_be_hidden)(DeviceListener *listener,QemuOpts *device_opts); +bool (*hide_device)(DeviceListener *listener,QemuOpts *device_opts);QTAILQ_ENTRY (DeviceListener) link; };
hw/core/qdev.c +2 -2
@@ -217,8 +217,8 @@ bool qdev_should_hide_device(QemuOpts *opts)DeviceListener *listener; QTAILQ_FOREACH(listener, &device_listeners, link) { -if (listener->should_be_hidden) { -if (listener->should_be_hidden (listener, opts)) { +if (listener->hide_device) { +if (listener->hide_device (listener, opts)) {return true; } }
hw/net/virtio-net.c +3 -4
@@ -3161,8 +3161,8 @@ static void virtio_net_migration_state_notifier(Notifier *notifier, void *data)virtio_net_handle_migration_primary (n, s); } -static bool virtio_net_primary_should_be_hidden (DeviceListener *listener, -QemuOpts *device_opts) +static bool failover_hide_primary_device (DeviceListener *listener, +QemuOpts *device_opts) {VirtIONet *n =container_of (listener, VirtIONet, primary_listener);bool hide;
@@ -3220,8 +3220,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) }if (n->failover) { - n->primary_listener.should_be_hidden = - virtio_net_primary_should_be_hidden; + n->primary_listener.hide_device = failover_hide_primary_device;qatomic_set (&n->failover_primary_hidden, true);device_listener_register (&n->primary_listener); n->migration_state.notify = virtio_net_migration_state_notifier;
Signature · 1 line
MST
[PULL 30/66] failover: should_be_hidden() should take a bool
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
We didn't use at all the -1 value, and we don't really care. It was only used for the cases when this is not the device that we are searching for. And in that case we should not hide the device.
Once there, simplify virtio-Snet_primary_should_be_hidden.
Message-Id: <[email protected]>
--- include/hw/qdev-core.h | 2 +- hw/core/qdev.c | 19 +++++-------------- hw/net/virtio-net.c | 27 +++++++-------------------- 3 files changed, 13 insertions(+), 35 deletions(-)
include/hw/qdev-core.h +1 -1
@@ -200,7 +200,7 @@ struct DeviceListener {* inform qdev that a device should be hidden, depending on the device * opts, for example, to hide a standby device. */ -int (*should_be_hidden)(DeviceListener *listener,QemuOpts *device_opts); +bool (*should_be_hidden)(DeviceListener *listener,QemuOpts *device_opts);QTAILQ_ENTRY (DeviceListener) link; };
hw/core/qdev.c +5 -14
@@ -214,26 +214,17 @@ void device_listener_unregister(DeviceListener *listener)bool qdev_should_hide_device (QemuOpts *opts) { -int rc =-1 ;DeviceListener *listener; QTAILQ_FOREACH(listener, &device_listeners, link) { -if (listener->should_be_hidden) { -/* -* should_be_hidden_will return -* 1 if device matches opts and it should be hidden -* 0 if device matches opts and should not be hidden -* -1 if device doesn't match ops -*/ - rc = listener->should_be_hidden (listener, opts); - } - -if (rc >0 ) { -break ; +if (listener->should_be_hidden) { +if (listener->should_be_hidden (listener, opts)) { +return true; + } } } -return rc >0 ; +return false; } void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
hw/net/virtio-net.c +7 -20
@@ -3161,24 +3161,19 @@ static void virtio_net_migration_state_notifier(Notifier *notifier, void *data)virtio_net_handle_migration_primary (n, s); } -static int virtio_net_primary_should_be_hidden (DeviceListener *listener, -QemuOpts *device_opts) +static bool virtio_net_primary_should_be_hidden (DeviceListener *listener, +QemuOpts *device_opts) {VirtIONet *n =container_of (listener, VirtIONet, primary_listener); -bool match_found = false; -bool hide = false; +bool hide;const char *standby_id;if (!device_opts) { -return -1 ; +return false; } standby_id =qemu_opt_get (device_opts,"failover_pair_id" ); -if (g_strcmp0 (standby_id, n->netclient_name) ==0 ) { - match_found = true; - }else { - match_found = false; - hide = false; - goto out; +if (g_strcmp0 (standby_id, n->netclient_name) !=0 ) { +return false; }/* failover_primary_hidden is set during feature negotiation */
@@ -3188,15 +3183,7 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener,if (!n->primary_device_id) {warn_report ("primary_device_id not set" ); } - -out: -if (match_found && hide) { -return 1 ; - }else if (match_found && !hide) { -return 0 ; - }else { -return -1 ; - } +return hide; }static void virtio_net_device_realize (DeviceState *dev,Error **errp)
Signature · 1 line
MST
[PULL 28/66] failover: Remove memory leak
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Two things, at this point:
* n->primary_device_id has to be set, otherwise virtio_net_find_primary don't work. So we have a leak here.
* it has to be exactly the same that prim_dev->id because what qdev_find_recursive() does is just compare this two values.
So remove the unneeded assignment and leaky bits.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/net/virtio-net.c +1 -3
@@ -854,9 +854,7 @@ static DeviceState *virtio_connect_failover_devices(VirtIONet *n, Error **errp)Error *err =NULL ; prim_dev =virtio_net_find_primary (n, &err); -if (prim_dev) { - n->primary_device_id =g_strdup (prim_dev->id); - }else { +if (!prim_dev) {error_propagate (errp, err); }
Signature · 1 line
MST
[PULL 20/66] failover: Remove unused parameter
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
hw/net/virtio-net.c +3 -5
@@ -855,9 +855,7 @@ static DeviceState *virtio_net_find_primary(VirtIONet *n, Error **errp)return dev; } -static DeviceState *virtio_connect_failover_devices (VirtIONet *n, -DeviceState *dev, -Error **errp) +static DeviceState *virtio_connect_failover_devices (VirtIONet *n,Error **errp) {DeviceState *prim_dev =NULL ;Error *err =NULL ;
@@ -928,7 +926,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)qatomic_set (&n->primary_should_be_hidden, false);failover_add_primary (n, &err);if (err) { - n->primary_dev =virtio_connect_failover_devices (n, n->qdev, &err); + n->primary_dev =virtio_connect_failover_devices (n, &err);if (err) { goto out_err; }
@@ -3164,7 +3162,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, should_be_hidden =qatomic_read (&n->primary_should_be_hidden);if (!n->primary_dev) { - n->primary_dev =virtio_connect_failover_devices (n, n->qdev, &err); + n->primary_dev =virtio_connect_failover_devices (n, &err);if (!n->primary_dev) {return ; }
Signature · 1 line
MST
[PULL 33/66] failover: Rename to failover_find_primary_device()
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
This commit:
* Rename them to failover_find_primary_devices() so
- it starts with failover_
- it don't connect anything, just find the primary device
* Create documentation for the function
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
hw/net/virtio-net.c +9 -3
@@ -826,7 +826,13 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp)return ret; } -static DeviceState *virtio_net_find_primary (VirtIONet *n,Error **errp) +/** +* Find the primary device for this failover virtio-net +* +* @n: VirtIONet device +* @errp: returns an error if this function fails +*/ +static DeviceState *failover_find_primary_device (VirtIONet *n,Error **errp) {Error *err =NULL ;
@@ -891,7 +897,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)qatomic_set (&n->failover_primary_hidden, false);failover_add_primary (n, &err);if (err) { - n->primary_dev =virtio_net_find_primary (n, &err); + n->primary_dev =failover_find_primary_device (n, &err);if (err) { goto out_err; }
@@ -3115,7 +3121,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, should_be_hidden =qatomic_read (&n->failover_primary_hidden);if (!n->primary_dev) { - n->primary_dev =virtio_net_find_primary (n, &err); + n->primary_dev =failover_find_primary_device (n, &err);if (!n->primary_dev) {return ; }
Signature · 1 line
MST
[PULL 38/66] failover: split failover_find_primary_device_id()
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
So we can calculate the device id when we need it.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 63 +++++++++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 16 deletions(-)
hw/net/virtio-net.c +47 -16
@@ -788,6 +788,49 @@ static inline uint64_t virtio_net_supported_guest_offloads(VirtIONet *n)return virtio_net_guest_offloads_by_features (vdev->guest_features); } +typedef struct { +VirtIONet *n; +char *id; +}FailoverId ; + +/** +* Set the id of the failover primary device +* +* @opaque: FailoverId to setup +* @opts: opts for device we are handling +* @errp: returns an error if this function fails +*/ +static int failover_set_primary (void *opaque,QemuOpts *opts,Error **errp) +{ +FailoverId *fid = opaque; +const char *standby_id =qemu_opt_get (opts,"failover_pair_id" ); + +if (g_strcmp0 (standby_id, fid->n->netclient_name) ==0 ) { + fid->id =g_strdup (opts->id); +return 1 ; + } + +return 0 ; +} + +/** +* Find the primary device id for this failover virtio-net +* +* @n: VirtIONet device +* @errp: returns an error if this function fails +*/ +static char *failover_find_primary_device_id (VirtIONet *n) +{ +Error *err =NULL ; +FailoverId fid; + +if (!qemu_opts_foreach (qemu_find_opts ("device" ), + failover_set_primary, &fid, &err)) { +return NULL ; + } +return fid.id; +} +static void failover_add_primary (VirtIONet *n,Error **errp) {Error *err =NULL ;
@@ -812,20 +855,6 @@ static void failover_add_primary(VirtIONet *n, Error **errp)error_propagate (errp, err); } -static int is_my_primary (void *opaque,QemuOpts *opts,Error **errp) -{ -VirtIONet *n = opaque; -int ret =0 ; -const char *standby_id =qemu_opt_get (opts,"failover_pair_id" ); - -if (g_strcmp0 (standby_id, n->netclient_name) ==0 ) { - n->primary_device_id =g_strdup (opts->id); - ret =1 ; - } - -return ret; -} -/** * Find the primary device for this failover virtio-net *
@@ -834,11 +863,13 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp)*/ static DeviceState *failover_find_primary_device (VirtIONet *n) { -Error *err =NULL ; +char *id =failover_find_primary_device_id (n); -if (!qemu_opts_foreach (qemu_find_opts ("device" ), is_my_primary, n, &err)) { +if (!id) {return NULL ; } + n->primary_device_id =g_strdup (id); +return qdev_find_recursive (sysbus_get_default (), n->primary_device_id); }
Signature · 1 line
MST
[PULL 35/66] failover: simplify qdev_device_add()
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
We don't need to walk the opts by hand. qmp_opt_get() already does that. And then we can remove the functions that did that walk.
Message-Id: <[email protected]>
--- softmmu/qdev-monitor.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-)
softmmu/qdev-monitor.c +6 -26
@@ -572,28 +572,6 @@ void qdev_set_id(DeviceState *dev, const char *id) } } -static int is_failover_device (void *opaque,const char *name,const char *value, -Error **errp) -{ -if (strcmp (name,"failover_pair_id" ) ==0 ) { -QemuOpts *opts = opaque; - -if (qdev_should_hide_device (opts)) { -return 1 ; - } - } - -return 0 ; -} - -static bool should_hide_device (QemuOpts *opts) -{ -if (qemu_opt_foreach (opts, is_failover_device, opts,NULL ) ==0 ) { -return false; - } -return true; -} -DeviceState *qdev_device_add (QemuOpts *opts,Error **errp) {DeviceClass *dc;
@@ -634,11 +612,13 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) } } -if (should_hide_device (opts)) { -if (bus && !qbus_is_hotpluggable (bus)) { -error_setg (errp,QERR_BUS_NO_HOTPLUG , bus->name); +if (qemu_opt_get (opts,"failover_pair_id" )) { +if (qdev_should_hide_device (opts)) { +if (bus && !qbus_is_hotpluggable (bus)) { +error_setg (errp,QERR_BUS_NO_HOTPLUG , bus->name); + } +return NULL ; } -return NULL ; }if (qdev_hotplug && bus && !qbus_is_hotpluggable (bus)) {
Signature · 1 line
MST
[PULL 22/66] failover: qdev_device_add() returns err or dev set
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Never both.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 7 ------- 1 file changed, 7 deletions(-)
hw/net/virtio-net.c +0 -7
@@ -803,13 +803,6 @@ static void failover_add_primary(VirtIONet *n, Error **errp)if (err) {qemu_opts_del (n->primary_device_opts); } -if (n->primary_dev) { -if (err) { -qdev_unplug (n->primary_dev, &err); -qdev_set_id (n->primary_dev,"" ); - - } - } }else {error_setg (errp,"Primary device not found" ); error_append_hint(errp, "Virtio-net failover will not work. Make "
Signature · 1 line
MST
[PULL 37/66] failover: remove failover_find_primary_device() error parameter
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
It can never give one error.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
hw/net/virtio-net.c +3 -6
@@ -832,7 +832,7 @@ static int is_my_primary(void *opaque, QemuOpts *opts, Error **errp)* @n: VirtIONet device * @errp: returns an error if this function fails */ -static DeviceState *failover_find_primary_device (VirtIONet *n,Error **errp) +static DeviceState *failover_find_primary_device (VirtIONet *n) {Error *err =NULL ;
@@ -897,10 +897,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)qatomic_set (&n->failover_primary_hidden, false);failover_add_primary (n, &err);if (err) { - n->primary_dev =failover_find_primary_device (n, &err); -if (err) { - goto out_err; - } + n->primary_dev =failover_find_primary_device (n);failover_add_primary (n, &err);if (err) { goto out_err;
@@ -3121,7 +3118,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, should_be_hidden =qatomic_read (&n->failover_primary_hidden);if (!n->primary_dev) { - n->primary_dev =failover_find_primary_device (n, &err); + n->primary_dev =failover_find_primary_device (n);if (!n->primary_dev) {return ; }
Signature · 1 line
MST
[PULL 42/66] failover: Remove primary_dev member
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Only three uses remained, and we can remove them on that case.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-net.h | 1 - hw/net/virtio-net.c | 75 +++++++++++++++------------------- 2 files changed, 34 insertions(+), 42 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
@@ -202,7 +202,6 @@ struct VirtIONet {AnnounceTimer announce_timer;bool needs_vnet_hdr_swap;bool mtu_bypass_backend; -DeviceState *primary_dev;/* primary failover device is hidden*/ bool failover_primary_hidden;bool failover;
hw/net/virtio-net.c +34 -41
107 lines not on this page · raw message
Signature · 1 line
MST
[PULL 43/66] hw: add compat machines for 6.0
In reply to Michael S. TsirkinFrom: Cornelia Huck <[email protected]>
Add 6.0 machine types for arm/i440fx/q35/s390x/spapr.
Message-Id: <[email protected]>
--- include/hw/boards.h | 3 +++ include/hw/i386/pc.h | 3 +++ hw/arm/virt.c | 11 +++++++++-- hw/core/machine.c | 3 +++ hw/i386/pc.c | 3 +++ hw/i386/pc_piix.c | 14 +++++++++++++- hw/i386/pc_q35.c | 13 ++++++++++++- hw/ppc/spapr.c | 17 ++++++++++++++--- hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- 9 files changed, 73 insertions(+), 8 deletions(-)
include/hw/boards.h +3 -0
@@ -310,6 +310,9 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) +extern GlobalProperty hw_compat_5_2[]; +extern const size_t hw_compat_5_2_len; +extern GlobalProperty hw_compat_5_1[];extern const size_t hw_compat_5_1_len;
include/hw/i386/pc.h +3 -0
@@ -191,6 +191,9 @@ void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memory);void pc_madt_cpu_entry (AcpiDeviceIf *adev,int uid,const CPUArchIdList *apic_ids,GArray *entry); +extern GlobalProperty pc_compat_5_2[]; +extern const size_t pc_compat_5_2_len; +extern GlobalProperty pc_compat_5_1[];extern const size_t pc_compat_5_1_len;
hw/arm/virt.c +9 -2
@@ -2590,10 +2590,17 @@ static void machvirt_machine_init(void) }type_init (machvirt_machine_init); -static void virt_machine_5_2_options (MachineClass *mc) +static void virt_machine_6_0_options (MachineClass *mc) { } -DEFINE_VIRT_MACHINE_AS_LATEST(5, 2) +DEFINE_VIRT_MACHINE_AS_LATEST(6, 0) + +static void virt_machine_5_2_options (MachineClass *mc) +{ +virt_machine_6_0_options (mc); +compat_props_add (mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); +} +DEFINE_VIRT_MACHINE(5, 2)static void virt_machine_5_1_options (MachineClass *mc) {
hw/core/machine.c +3 -0
@@ -28,6 +28,9 @@#include "hw/mem/nvdimm.h" #include "migration/vmstate.h" +GlobalProperty hw_compat_5_2[] = {}; +const size_t hw_compat_5_2_len =G_N_ELEMENTS (hw_compat_5_2); +GlobalProperty hw_compat_5_1[] = { {"vhost-scsi" ,"num_queues" ,"1" }, {"vhost-user-blk" ,"num-queues" ,"1" },
hw/i386/pc.c +3 -0
@@ -97,6 +97,9 @@#include "trace.h" #include CONFIG_DEVICES +GlobalProperty pc_compat_5_2[] = {}; +const size_t pc_compat_5_2_len =G_N_ELEMENTS (pc_compat_5_2); +GlobalProperty pc_compat_5_1[] = { {"ICH9-LPC" ,"x-smi-cpu-hotplug" ,"off" }, };
hw/i386/pc_piix.c +13 -1
@@ -426,7 +426,7 @@ static void pc_i440fx_machine_options(MachineClass *m)machine_class_allow_dynamic_sysbus_dev (m,TYPE_VMBUS_BRIDGE ); } -static void pc_i440fx_5_2_machine_options (MachineClass *m) +static void pc_i440fx_6_0_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_i440fx_machine_options (m);
@@ -435,6 +435,18 @@ static void pc_i440fx_5_2_machine_options(MachineClass *m) pcmc->default_cpu_version =1 ; } +DEFINE_I440FX_MACHINE (v6_0,"pc-i440fx-6.0" ,NULL , + pc_i440fx_6_0_machine_options); + +static void pc_i440fx_5_2_machine_options (MachineClass *m) +{ +pc_i440fx_6_0_machine_options (m); + m->alias =NULL ; + m->is_default = false; +compat_props_add (m->compat_props, hw_compat_5_2, hw_compat_5_2_len); +compat_props_add (m->compat_props, pc_compat_5_2, pc_compat_5_2_len); +} +DEFINE_I440FX_MACHINE (v5_2,"pc-i440fx-5.2" ,NULL , pc_i440fx_5_2_machine_options);
hw/i386/pc_q35.c +12 -1
@@ -344,7 +344,7 @@ static void pc_q35_machine_options(MachineClass *m) m->max_cpus =288 ; } -static void pc_q35_5_2_machine_options (MachineClass *m) +static void pc_q35_6_0_machine_options (MachineClass *m) {PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_machine_options (m);
@@ -352,6 +352,17 @@ static void pc_q35_5_2_machine_options(MachineClass *m) pcmc->default_cpu_version =1 ; } +DEFINE_Q35_MACHINE (v6_0,"pc-q35-6.0" ,NULL , + pc_q35_6_0_machine_options); + +static void pc_q35_5_2_machine_options (MachineClass *m) +{ +pc_q35_6_0_machine_options (m); + m->alias =NULL ; +compat_props_add (m->compat_props, hw_compat_5_2, hw_compat_5_2_len); +compat_props_add (m->compat_props, pc_compat_5_2, pc_compat_5_2_len); +} +DEFINE_Q35_MACHINE (v5_2,"pc-q35-5.2" ,NULL , pc_q35_5_2_machine_options);
hw/ppc/spapr.c +14 -3
@@ -4510,14 +4510,25 @@ static void spapr_machine_latest_class_options(MachineClass *mc) type_init(spapr_machine_register_##suffix)/* -* pseries-5.2 +* pseries-6.0 */ -static void spapr_machine_5_2_class_options(MachineClass *mc) +static void spapr_machine_6_0_class_options(MachineClass *mc) {/* Defaults for the latest behaviour inherited from the base class */ } -DEFINE_SPAPR_MACHINE(5_2, "5.2", true); +DEFINE_SPAPR_MACHINE(6_0, "6.0", true); + +/* +* pseries-5.2 +*/ +static void spapr_machine_5_2_class_options (MachineClass *mc) +{ +spapr_machine_6_0_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); +} + +DEFINE_SPAPR_MACHINE(5_2, "5.2", false);/* * pseries-5.1
hw/s390x/s390-virtio-ccw.c +13 -1
@@ -789,14 +789,26 @@ bool css_migration_enabled(void) } \ type_init(ccw_machine_register_##suffix) +static void ccw_machine_6_0_instance_options(MachineState *machine) +{ +} + +static void ccw_machine_6_0_class_options (MachineClass *mc) +{ +} +DEFINE_CCW_MACHINE(6_0, "6.0", true); +static void ccw_machine_5_2_instance_options (MachineState *machine) { +ccw_machine_6_0_instance_options (machine); }static void ccw_machine_5_2_class_options (MachineClass *mc) { +ccw_machine_6_0_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); } -DEFINE_CCW_MACHINE(5_2, "5.2", true); +DEFINE_CCW_MACHINE(5_2, "5.2", false);static void ccw_machine_5_1_instance_options (MachineState *machine) {
Signature · 1 line
MST
[PULL 25/66] failover: Remove primary_device_opts
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
It was really only used once, in failover_add_primary(). Just search for it on global opts when it is needed.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-net.h | 1 - hw/net/virtio-net.c | 21 +++++---------------- 2 files changed, 5 insertions(+), 17 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
@@ -202,7 +202,6 @@ struct VirtIONet {AnnounceTimer announce_timer;bool needs_vnet_hdr_swap;bool mtu_bypass_backend; -QemuOpts *primary_device_opts;QDict *primary_device_dict;DeviceState *primary_dev;char *primary_device_id;
hw/net/virtio-net.c +5 -16
@@ -791,17 +791,17 @@ static inline uint64_t virtio_net_supported_guest_offloads(VirtIONet *n)static void failover_add_primary (VirtIONet *n,Error **errp) {Error *err =NULL ; +QemuOpts *opts;if (n->primary_dev) {return ; } - n->primary_device_opts =qemu_opts_find (qemu_find_opts ("device" ), - n->primary_device_id); -if (n->primary_device_opts) { - n->primary_dev =qdev_device_add (n->primary_device_opts, &err); + opts =qemu_opts_find (qemu_find_opts ("device" ), n->primary_device_id); +if (opts) { + n->primary_dev =qdev_device_add (opts, &err);if (err) { -qemu_opts_del (n->primary_device_opts); +qemu_opts_del (opts); } }else {error_setg (errp,"Primary device not found" );
@@ -856,7 +856,6 @@ static DeviceState *virtio_connect_failover_devices(VirtIONet *n, Error **errp) prim_dev =virtio_net_find_primary (n, &err);if (prim_dev) { n->primary_device_id =g_strdup (prim_dev->id); - n->primary_device_opts = prim_dev->opts; }else {error_propagate (errp, err); }
@@ -3113,14 +3112,6 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp)if (!pdev->partially_hotplugged) {return true; } -if (!n->primary_device_opts) { - n->primary_device_opts =qemu_opts_from_qdict (qemu_find_opts ("device" ), - n->primary_device_dict, - errp); -if (!n->primary_device_opts) { -return false; - } - } primary_bus = n->primary_dev->parent_bus;if (!primary_bus) {error_setg (errp,"virtio_net: couldn't find primary bus" );
@@ -3211,8 +3202,6 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener, goto out; } - n->primary_device_opts = device_opts; -/* failover_primary_hidden is set during feature negotiation */ hide =qatomic_read (&n->failover_primary_hidden);
Signature · 1 line
MST
[PULL 39/66] failover: We don't need to cache primary_device_id anymore
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-net.h | 1 - hw/net/virtio-net.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
@@ -203,7 +203,6 @@ struct VirtIONet {bool needs_vnet_hdr_swap;bool mtu_bypass_backend;DeviceState *primary_dev; -char *primary_device_id;/* primary failover device is hidden*/ bool failover_primary_hidden;bool failover;
hw/net/virtio-net.c +10 -10
@@ -824,6 +824,7 @@ static char *failover_find_primary_device_id(VirtIONet *n)Error *err =NULL ;FailoverId fid; + fid.n = n;if (!qemu_opts_foreach (qemu_find_opts ("device" ), failover_set_primary, &fid, &err)) {return NULL ;
@@ -835,12 +836,17 @@ static void failover_add_primary(VirtIONet *n, Error **errp) {Error *err =NULL ;QemuOpts *opts; +char *id;if (n->primary_dev) {return ; } - opts =qemu_opts_find (qemu_find_opts ("device" ), n->primary_device_id); + id =failover_find_primary_device_id (n); +if (!id) { +return ; + } + opts =qemu_opts_find (qemu_find_opts ("device" ), id);if (opts) { n->primary_dev =qdev_device_add (opts, &err);if (err) {
@@ -868,9 +874,8 @@ static DeviceState *failover_find_primary_device(VirtIONet *n)if (!id) {return NULL ; } - n->primary_device_id =g_strdup (id); -return qdev_find_recursive (sysbus_get_default (), n->primary_device_id); +return qdev_find_recursive (sysbus_get_default (), id); }static void virtio_net_set_features (VirtIODevice *vdev,uint64_t features)
@@ -3160,7 +3165,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n,vmstate_unregister (VMSTATE_IF (n->primary_dev),qdev_get_vmsd (n->primary_dev), n->primary_dev); -qapi_event_send_unplug_primary (n->primary_device_id); +qapi_event_send_unplug_primary (n->primary_dev->id);qatomic_set (&n->failover_primary_hidden, true); }else {warn_report ("couldn't unplug primary device" );
@@ -3186,7 +3191,6 @@ static bool failover_hide_primary_device(DeviceListener *listener, QemuOpts *device_opts) {VirtIONet *n =container_of (listener, VirtIONet, primary_listener); -bool hide;const char *standby_id;if (!device_opts) {
@@ -3198,10 +3202,7 @@ static bool failover_hide_primary_device(DeviceListener *listener, }/* failover_primary_hidden is set during feature negotiation */ - hide =qatomic_read (&n->failover_primary_hidden); -g_free (n->primary_device_id); - n->primary_device_id =g_strdup (device_opts->id); -return hide; +return qatomic_read (&n->failover_primary_hidden); }static void virtio_net_device_realize (DeviceState *dev,Error **errp)
@@ -3378,7 +3379,6 @@ static void virtio_net_device_unrealize(DeviceState *dev)if (n->failover) {device_listener_unregister (&n->primary_listener); -g_free (n->primary_device_id); } max_queues = n->multiqueue ? n->max_queues :1 ;
Signature · 1 line
MST
[PULL 44/66] libvhost-user: replace qemu/bswap.h with glibc endian.h
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.c | 77 ++++++++++++++------------- 1 file changed, 40 insertions(+), 37 deletions(-)
contrib/libvhost-user/libvhost-user.c +40 -37
@@ -26,6 +26,7 @@#include <sys/socket.h> #include <sys/eventfd.h> #include <sys/mman.h> +#include <endian.h> #include "qemu/compiler.h" #if defined(__linux__)
@@ -42,7 +43,6 @@#include "qemu/atomic.h" #include "qemu/osdep.h" -#include "qemu/bswap.h" #include "qemu/memfd.h" #include "libvhost-user.h"
@@ -1081,7 +1081,7 @@ vu_set_vring_addr_exec(VuDev *dev, VhostUserMsg *vmsg)return false; } - vq->used_idx =lduw_le_p (&vq->vring.used->idx); + vq->used_idx =le16toh (vq->vring.used->idx);if (vq->last_avail_idx != vq->used_idx) { bool resume = dev->iface->queue_is_processed_in_order &&
@@ -1198,7 +1198,7 @@ vu_check_queue_inflights(VuDev *dev, VuVirtq *vq)return 0 ; } - vq->used_idx =lduw_le_p (&vq->vring.used->idx); + vq->used_idx =le16toh (vq->vring.used->idx); vq->resubmit_num =0 ; vq->resubmit_list =NULL ; vq->counter =0 ;
@@ -2031,13 +2031,13 @@ vu_queue_started(const VuDev *dev, const VuVirtq *vq)static inline uint16_t vring_avail_flags (VuVirtq *vq) { -return lduw_le_p (&vq->vring.avail->flags); +return le16toh (vq->vring.avail->flags); }static inline uint16_t vring_avail_idx (VuVirtq *vq) { - vq->shadow_avail_idx =lduw_le_p (&vq->vring.avail->idx); + vq->shadow_avail_idx =le16toh (vq->vring.avail->idx);return vq->shadow_avail_idx; }
@@ -2045,7 +2045,7 @@ vring_avail_idx(VuVirtq *vq)static inline uint16_t vring_avail_ring (VuVirtq *vq,int i) { -return lduw_le_p (&vq->vring.avail->ring[i]); +return le16toh (vq->vring.avail->ring[i]); } static inline uint16_t
@@ -2133,12 +2133,12 @@ virtqueue_read_next_desc(VuDev *dev, struct vring_desc *desc, int i, unsigned int max, unsigned int *next) { /* If this descriptor says it doesn't chain, we're done. */ - if (!(lduw_le_p(&desc[i].flags) & VRING_DESC_F_NEXT)) { + if (!(le16toh(desc[i].flags) & VRING_DESC_F_NEXT)) { return VIRTQUEUE_READ_DESC_DONE; }/* Check they're not leading us off end of descriptors. */ - *next =lduw_le_p (&desc[i].next); + *next =le16toh (desc[i].next);/* Make sure compiler knows to grab that: we don't want it changing! */ smp_wmb ();
@@ -2181,8 +2181,8 @@ vu_queue_get_avail_bytes(VuDev *dev, VuVirtq *vq, unsigned int *in_bytes, } desc = vq->vring.desc; -if (lduw_le_p (&desc[i].flags) &VRING_DESC_F_INDIRECT ) { -if (ldl_le_p (&desc[i].len) %sizeof (struct vring_desc )) { +if (le16toh (desc[i].flags) &VRING_DESC_F_INDIRECT ) { +if (le32toh (desc[i].len) %sizeof (struct vring_desc )) {vu_panic (dev,"Invalid size for indirect buffer table" ); goto err; }
@@ -2195,8 +2195,8 @@ vu_queue_get_avail_bytes(VuDev *dev, VuVirtq *vq, unsigned int *in_bytes,/* loop over the indirect descriptor table */ indirect =1 ; - desc_addr =ldq_le_p (&desc[i].addr); - desc_len =ldl_le_p (&desc[i].len); + desc_addr =le64toh (desc[i].addr); + desc_len =le32toh (desc[i].len); max = desc_len /sizeof (struct vring_desc ); read_len = desc_len; desc =vu_gpa_to_va (dev, &read_len, desc_addr);
@@ -2223,10 +2223,10 @@ vu_queue_get_avail_bytes(VuDev *dev, VuVirtq *vq, unsigned int *in_bytes, goto err; } -if (lduw_le_p (&desc[i].flags) &VRING_DESC_F_WRITE ) { - in_total +=ldl_le_p (&desc[i].len); +if (le16toh (desc[i].flags) &VRING_DESC_F_WRITE ) { + in_total +=le32toh (desc[i].len); }else { - out_total +=ldl_le_p (&desc[i].len); + out_total +=le32toh (desc[i].len); }if (in_total >= max_in_bytes && out_total >= max_out_bytes) { goto done;
@@ -2377,7 +2377,7 @@ vring_used_flags_set_bit(VuVirtq *vq, int mask) flags = (uint16_t *)((char *)vq->vring.used + offsetof(struct vring_used , flags)); -stw_le_p (flags,lduw_le_p (flags) | mask); + *flags =htole16 (le16toh (*flags) | mask); } static inline void
@@ -2387,17 +2387,20 @@ vring_used_flags_unset_bit(VuVirtq *vq, int mask) flags = (uint16_t *)((char *)vq->vring.used + offsetof(struct vring_used , flags)); -stw_le_p (flags,lduw_le_p (flags) & ~mask); + *flags =htole16 (le16toh (*flags) & ~mask); }static inline void vring_set_avail_event (VuVirtq *vq,uint16_t val) { +uint16_t *avail; +if (!vq->notification) {return ; } -stw_le_p (&vq->vring.used->ring[vq->vring.num], val); + avail = (uint16_t *)&vq->vring.used->ring[vq->vring.num]; + *avail =htole16 (val); }void
@@ -2487,15 +2490,15 @@ vu_queue_map_desc(VuDev *dev, VuVirtq *vq, unsigned int idx, size_t sz)struct vring_desc desc_buf[VIRTQUEUE_MAX_SIZE ];int rc; -if (lduw_le_p (&desc[i].flags) &VRING_DESC_F_INDIRECT ) { -if (ldl_le_p (&desc[i].len) %sizeof (struct vring_desc )) { +if (le16toh (desc[i].flags) &VRING_DESC_F_INDIRECT ) { +if (le32toh (desc[i].len) %sizeof (struct vring_desc )) {vu_panic (dev,"Invalid size for indirect buffer table" );return NULL ; }/* loop over the indirect descriptor table */ - desc_addr =ldq_le_p (&desc[i].addr); - desc_len =ldl_le_p (&desc[i].len); + desc_addr =le64toh (desc[i].addr); + desc_len =le32toh (desc[i].len); max = desc_len /sizeof (struct vring_desc ); read_len = desc_len; desc =vu_gpa_to_va (dev, &read_len, desc_addr);
@@ -2517,11 +2520,11 @@ vu_queue_map_desc(VuDev *dev, VuVirtq *vq, unsigned int idx, size_t sz)/* Collect all the descriptors */ do { - if (lduw_le_p(&desc[i].flags) & VRING_DESC_F_WRITE) { + if (le16toh(desc[i].flags) & VRING_DESC_F_WRITE) { if (!virtqueue_map_desc(dev, &in_num, iov + out_num, VIRTQUEUE_MAX_SIZE - out_num, true, - ldq_le_p(&desc[i].addr), - ldl_le_p(&desc[i].len))) { + le64toh(desc[i].addr), + le32toh(desc[i].len))) { return NULL; } } else {
@@ -2531,8 +2534,8 @@ vu_queue_map_desc(VuDev *dev, VuVirtq *vq, unsigned int idx, size_t sz) }if (!virtqueue_map_desc (dev, &out_num, iov,VIRTQUEUE_MAX_SIZE , false, -ldq_le_p (&desc[i].addr), -ldl_le_p (&desc[i].len))) { +le64toh (desc[i].addr), +le32toh (desc[i].len))) {return NULL ; } }
@@ -2731,15 +2734,15 @@ vu_log_queue_fill(VuDev *dev, VuVirtq *vq, max = vq->vring.num; i = elem->index; -if (lduw_le_p (&desc[i].flags) &VRING_DESC_F_INDIRECT ) { -if (ldl_le_p (&desc[i].len) %sizeof (struct vring_desc )) { +if (le16toh (desc[i].flags) &VRING_DESC_F_INDIRECT ) { +if (le32toh (desc[i].len) %sizeof (struct vring_desc )) {vu_panic (dev,"Invalid size for indirect buffer table" );return ; }/* loop over the indirect descriptor table */ - desc_addr =ldq_le_p (&desc[i].addr); - desc_len =ldl_le_p (&desc[i].len); + desc_addr =le64toh (desc[i].addr); + desc_len =le32toh (desc[i].len); max = desc_len /sizeof (struct vring_desc ); read_len = desc_len; desc =vu_gpa_to_va (dev, &read_len, desc_addr);
@@ -2765,9 +2768,9 @@ vu_log_queue_fill(VuDev *dev, VuVirtq *vq,return ; } -if (lduw_le_p (&desc[i].flags) &VRING_DESC_F_WRITE ) { - min =MIN (ldl_le_p (&desc[i].len), len); -vu_log_write (dev,ldq_le_p (&desc[i].addr), min); +if (le16toh (desc[i].flags) &VRING_DESC_F_WRITE ) { + min =MIN (le32toh (desc[i].len), len); +vu_log_write (dev,le64toh (desc[i].addr), min); len -= min; }
@@ -2792,15 +2795,15 @@ vu_queue_fill(VuDev *dev, VuVirtq *vq, idx = (idx + vq->used_idx) % vq->vring.num; -stl_le_p (&uelem.id, elem->index); -stl_le_p (&uelem.len, len); + uelem.id =htole32 (elem->index); + uelem.len =htole32 (len);vring_used_write (dev, vq, &uelem, idx); }static inline void vring_used_idx_set (VuDev *dev,VuVirtq *vq,uint16_t val) { -stw_le_p (&vq->vring.used->idx, val); + vq->vring.used->idx =htole16 (val);vu_log_write (dev, vq->vring.log_guest_addr + offsetof(struct vring_used , idx),sizeof (vq->vring.used->idx));
Signature · 1 line
MST
[PULL 48/66] libvhost-user: make it a meson subproject
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
By making libvhost-user a subproject, check it builds standalone (without the global QEMU cflags etc).
Note that the library still relies on QEMU include/qemu/atomic.h and linux_headers/.
Message-Id: <[email protected]>
---
contrib/vhost-user-gpu/vugpu.h | 2 +-
include/qemu/vhost-user-server.h | 2 +-
.../libvhost-user/libvhost-user-glib.h | 0
.../libvhost-user/libvhost-user.h | 0
block/export/vhost-user-blk-server.c | 2 +-
contrib/vhost-user-blk/vhost-user-blk.c | 3 +--
contrib/vhost-user-input/main.c | 3 +--
contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +-
.../libvhost-user/libvhost-user-glib.c | 0
.../libvhost-user/libvhost-user.c | 0
tests/vhost-user-bridge.c | 2 +-
tools/virtiofsd/fuse_virtio.c | 2 +-
contrib/libvhost-user/meson.build | 4 ----
contrib/vhost-user-blk/meson.build | 3 +--
contrib/vhost-user-gpu/meson.build | 3 +--
contrib/vhost-user-input/meson.build | 3 +--
contrib/vhost-user-scsi/meson.build | 3 +--
meson.build | 7 ++++++-
subprojects/libvhost-user/meson.build | 20 +++++++++++++++++++
tests/meson.build | 3 +--
tools/virtiofsd/meson.build | 3 +--
21 files changed, 40 insertions(+), 27 deletions(-)
rename {contrib => subprojects}/libvhost-user/libvhost-user-glib.h (100%)
rename {contrib => subprojects}/libvhost-user/libvhost-user.h (100%)
rename {contrib => subprojects}/libvhost-user/libvhost-user-glib.c (100%)
rename {contrib => subprojects}/libvhost-user/libvhost-user.c (100%)
delete mode 100644 contrib/libvhost-user/meson.build
create mode 100644 subprojects/libvhost-user/meson.buildcontrib/vhost-user-gpu/vugpu.h +1 -1
@@ -17,7 +17,7 @@#include "qemu/osdep.h" -#include "contrib/libvhost-user/libvhost-user-glib.h" +#include "libvhost-user-glib.h" #include "standard-headers/linux/virtio_gpu.h" #include "qemu/queue.h"
include/qemu/vhost-user-server.h +1 -1
@@ -11,7 +11,7 @@#ifndef VHOST_USER_SERVER_H #define VHOST_USER_SERVER_H -#include "contrib/libvhost-user/libvhost-user.h" +#include "subprojects/libvhost-user/libvhost-user.h" /* only for the type definitions */ #include "io/channel-socket.h" #include "io/channel-file.h" #include "io/net-listener.h"
subprojects/libvhost-user/libvhost-user-glib.h renamed from contrib/libvhost-user/libvhost-user-glib.h +0 -0
subprojects/libvhost-user/libvhost-user.h renamed from contrib/libvhost-user/libvhost-user.h +0 -0
block/export/vhost-user-blk-server.c +1 -1
@@ -11,7 +11,7 @@*/ #include "qemu/osdep.h" #include "block/block.h" -#include "contrib/libvhost-user/libvhost-user.h" +#include "subprojects/libvhost-user/libvhost-user.h" /* only for the type definitions */ #include "standard-headers/linux/virtio_blk.h" #include "qemu/vhost-user-server.h" #include "vhost-user-blk-server.h"
contrib/vhost-user-blk/vhost-user-blk.c +1 -2
@@ -17,8 +17,7 @@#include "qemu/osdep.h" #include "standard-headers/linux/virtio_blk.h" -#include "contrib/libvhost-user/libvhost-user-glib.h" -#include "contrib/libvhost-user/libvhost-user.h" +#include "libvhost-user-glib.h" #if defined(__linux__)#include <linux/fs.h>
contrib/vhost-user-input/main.c +1 -2
@@ -12,8 +12,7 @@#include "qemu/iov.h" #include "qemu/bswap.h" #include "qemu/sockets.h" -#include "contrib/libvhost-user/libvhost-user.h" -#include "contrib/libvhost-user/libvhost-user-glib.h" +#include "libvhost-user-glib.h" #include "standard-headers/linux/virtio_input.h" #include "qapi/error.h"
contrib/vhost-user-scsi/vhost-user-scsi.c +1 -1
@@ -15,7 +15,7 @@#define inline __attribute__((gnu_inline))/* required for libiscsi v1.9.0 */ #include <iscsi/scsi-lowlevel.h> #undef inline -#include "contrib/libvhost-user/libvhost-user-glib.h" +#include "libvhost-user-glib.h" #include "standard-headers/linux/virtio_scsi.h"
subprojects/libvhost-user/libvhost-user-glib.c renamed from contrib/libvhost-user/libvhost-user-glib.c +0 -0
subprojects/libvhost-user/libvhost-user.c renamed from contrib/libvhost-user/libvhost-user.c +0 -0
tests/vhost-user-bridge.c +1 -1
@@ -34,7 +34,7 @@#include "qemu/ctype.h" #include "qemu/iov.h" #include "standard-headers/linux/virtio_net.h" -#include "contrib/libvhost-user/libvhost-user.h" +#include "libvhost-user.h" #define VHOST_USER_BRIDGE_DEBUG 1
tools/virtiofsd/fuse_virtio.c +1 -1
@@ -35,7 +35,7 @@#include <grp.h> #include <unistd.h> -#include "contrib/libvhost-user/libvhost-user.h" +#include "libvhost-user.h" struct fv_VuDev ;struct fv_QueueInfo {
contrib/libvhost-user/meson.build deleted +0 -4
@@ -1,4 +0,0 @@ -libvhost_user = static_library('vhost-user', - files('libvhost-user.c', 'libvhost-user-glib.c'), - build_by_default: false) -vhost_user = declare_dependency(link_with: libvhost_user)
contrib/vhost-user-blk/meson.build +1 -2
@@ -1,6 +1,5 @@ # FIXME: broken on 32-bit architectures executable('vhost-user-blk', files('vhost-user-blk.c'), - link_with: libvhost_user, - dependencies: qemuutil, + dependencies: [qemuutil, vhost_user], build_by_default: false, install: false)
contrib/vhost-user-gpu/meson.build +1 -2
@@ -2,8 +2,7 @@ if 'CONFIG_TOOLS' in config_host and 'CONFIG_VIRGL' in config_host \ and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host \ and pixman.found() executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'), - link_with: libvhost_user, - dependencies: [qemuutil, pixman, gbm, virgl], + dependencies: [qemuutil, pixman, gbm, virgl, vhost_user], install: true, install_dir: get_option('libexecdir'))
contrib/vhost-user-input/meson.build +1 -2
@@ -1,5 +1,4 @@ executable('vhost-user-input', files('main.c'), - link_with: libvhost_user, - dependencies: qemuutil, + dependencies: [qemuutil, vhost_user], build_by_default: targetos == 'linux', install: false)
contrib/vhost-user-scsi/meson.build +1 -2
@@ -1,7 +1,6 @@ if 'CONFIG_LIBISCSI' in config_host executable('vhost-user-scsi', files('vhost-user-scsi.c'), - link_with: libvhost_user, - dependencies: [qemuutil, libiscsi], + dependencies: [qemuutil, libiscsi, vhost_user], build_by_default: targetos == 'linux', install: false) endif
meson.build +6 -1
@@ -1475,7 +1475,12 @@ trace_events_subdirs += [ 'util', ] -subdir('contrib/libvhost-user') +vhost_user = not_found +if 'CONFIG_VHOST_USER' in config_host + libvhost_user = subproject('libvhost-user') + vhost_user = libvhost_user.get_variable('vhost_user_dep') +endif + subdir('qapi') subdir('qobject') subdir('stubs')
subprojects/libvhost-user/meson.build new file +20 -0
@@ -0,0 +1,20 @@ +project('libvhost-user', 'c', + license: 'GPL-2.0-or-later', + default_options: ['c_std=gnu99']) + +glib = dependency('glib-2.0') +inc = include_directories('../../include', '../../linux-headers') + +vhost_user = static_library('vhost-user', + files('libvhost-user.c'), + include_directories: inc, + c_args: '-D_GNU_SOURCE') + +vhost_user_glib = static_library('vhost-user-glib', + files('libvhost-user-glib.c'), + include_directories: inc, + link_with: vhost_user, + dependencies: glib) + +vhost_user_dep = declare_dependency(link_with: vhost_user_glib, + include_directories: include_directories('.'))
tests/meson.build +1 -2
@@ -264,8 +264,7 @@ endforeach if have_tools and 'CONFIG_VHOST_USER' in config_host and 'CONFIG_LINUX' in config_host executable('vhost-user-bridge', sources: files('vhost-user-bridge.c'), - link_with: [libvhost_user], - dependencies: [qemuutil]) + dependencies: [qemuutil, vhost_user]) endif if have_system and 'CONFIG_POSIX' in config_host
tools/virtiofsd/meson.build +1 -2
@@ -8,8 +8,7 @@ executable('virtiofsd', files( 'helper.c', 'passthrough_ll.c', 'passthrough_seccomp.c'), - link_with: libvhost_user, - dependencies: [seccomp, qemuutil, libcap_ng], + dependencies: [seccomp, qemuutil, libcap_ng, vhost_user], install: true, install_dir: get_option('libexecdir'))
Signature · 1 line
MST
[PULL 27/66] failover: Remove primary_device_dict
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
It was only used once. And we have there opts->id, so no need for it.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-net.h | 1 - hw/net/virtio-net.c | 17 ++++------------- 2 files changed, 4 insertions(+), 14 deletions(-)
include/hw/virtio/virtio-net.h +0 -1
@@ -202,7 +202,6 @@ struct VirtIONet {AnnounceTimer announce_timer;bool needs_vnet_hdr_swap;bool mtu_bypass_backend; -QDict *primary_device_dict;DeviceState *primary_dev;char *primary_device_id;/* primary failover device is hidden*/
hw/net/virtio-net.c +4 -13
@@ -3186,28 +3186,21 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener,if (!device_opts) {return -1 ; } - n->primary_device_dict =qemu_opts_to_qdict (device_opts, - n->primary_device_dict); standby_id =qemu_opt_get (device_opts,"failover_pair_id" );if (g_strcmp0 (standby_id, n->netclient_name) ==0 ) { match_found = true; }else { match_found = false; hide = false; - n->primary_device_dict =NULL ; goto out; }/* failover_primary_hidden is set during feature negotiation */ hide =qatomic_read (&n->failover_primary_hidden); - -if (n->primary_device_dict) { -g_free (n->primary_device_id); - n->primary_device_id =g_strdup (qdict_get_try_str ( - n->primary_device_dict,"id" )); -if (!n->primary_device_id) { -warn_report ("primary_device_id not set" ); - } +g_free (n->primary_device_id); + n->primary_device_id =g_strdup (device_opts->id); +if (!n->primary_device_id) { +warn_report ("primary_device_id not set" ); } out:
@@ -3396,8 +3389,6 @@ static void virtio_net_device_unrealize(DeviceState *dev)if (n->failover) {device_listener_unregister (&n->primary_listener);g_free (n->primary_device_id); -qobject_unref (n->primary_device_dict); - n->primary_device_dict =NULL ; } max_queues = n->multiqueue ? n->max_queues :1 ;
Signature · 1 line
MST
[PULL 47/66] libvhost-user: drop qemu/osdep.h dependency
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user-glib.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
contrib/libvhost-user/libvhost-user-glib.c +8 -2
@@ -12,10 +12,16 @@* later. See the COPYING file in the top-level directory. */ -#include "qemu/osdep.h" -#include "libvhost-user-glib.h" +#ifndef container_of +#define container_of (ptr, type, member) \ + __extension__({ \ + void *__mptr = (void *)(ptr); \ + ((type *)(__mptr - offsetof(type, member))); \ + }) +#endif +/* glib event loop integration for libvhost-user and misc callbacks */ G_STATIC_ASSERT ((int )G_IO_IN == (int )VU_WATCH_IN );
Signature · 1 line
MST
[PULL 45/66] libvhost-user: replace qemu/memfd.h usage
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Undo the damage from commit 5f9ff1eff3 ("libvhost-user: Support tracking inflight I/O in shared memory") which introduced glib dependency through osdep.h inclusion.
libvhost-user.c tries to stay free from glib usage.
Use glibc memfd_create directly when available (assumed so when MFD_ALLOW_SEALING is defined). A following commit will make the project standalone and check for memfd API at configure time, instead of a panic at runtime.
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.c | 50 +++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 7 deletions(-)
contrib/libvhost-user/libvhost-user.c +43 -7
@@ -42,8 +42,6 @@#endif #include "qemu/atomic.h" -#include "qemu/osdep.h" -#include "qemu/memfd.h" #include "libvhost-user.h"
@@ -1615,11 +1613,45 @@ vu_inflight_queue_size(uint16_t queue_size) sizeof(uint16_t), INFLIGHT_ALIGNMENT); } +#ifdef MFD_ALLOW_SEALING +static void * +memfd_alloc (const char *name,size_t size,unsigned int flags,int *fd) +{ +void *ptr; +int ret; + + *fd =memfd_create (name,MFD_ALLOW_SEALING ); +if (*fd <0 ) { +return NULL ; + } + + ret =ftruncate (*fd, size); +if (ret <0 ) { +close (*fd); +return NULL ; + } + + ret =fcntl (*fd,F_ADD_SEALS , flags); +if (ret <0 ) { +close (*fd); +return NULL ; + } + + ptr =mmap (0 , size,PROT_READ |PROT_WRITE ,MAP_SHARED , *fd,0 ); +if (ptr ==MAP_FAILED ) { +close (*fd); +return NULL ; + } + +return ptr; +} +#endif +static bool vu_get_inflight_fd (VuDev *dev,VhostUserMsg *vmsg) { -int fd; -void *addr; +int fd =-1 ; +void *addr =NULL ;uint64_t mmap_size;uint16_t num_queues, queue_size;
@@ -1637,9 +1669,13 @@ vu_get_inflight_fd(VuDev *dev, VhostUserMsg *vmsg) mmap_size =vu_inflight_queue_size (queue_size) * num_queues; - addr =qemu_memfd_alloc ("vhost-inflight" , mmap_size, -F_SEAL_GROW |F_SEAL_SHRINK |F_SEAL_SEAL , - &fd,NULL ); +#ifdef MFD_ALLOW_SEALING + addr =memfd_alloc ("vhost-inflight" , mmap_size, +F_SEAL_GROW |F_SEAL_SHRINK |F_SEAL_SEAL , + &fd); +#else +vu_panic (dev,"Not implemented: memfd support is missing" ); +#endif if (!addr) {vu_panic (dev,"Failed to alloc vhost inflight area" );
Signature · 1 line
MST
[PULL 52/66] contrib/vhost-user-blk: avoid g_return_val_if() input validation
In reply to Michael S. TsirkinFrom: Stefan Hajnoczi <[email protected]>
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS.
Use an explicit if statement for input validation so it cannot accidentally be compiled out.
Message-Id: <[email protected]>
--- contrib/vhost-user-blk/vhost-user-blk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
contrib/vhost-user-blk/vhost-user-blk.c +3 -1
@@ -403,7 +403,9 @@ vub_get_config(VuDev *vu_dev, uint8_t *config, uint32_t len)VugDev *gdev;VubDev *vdev_blk; -g_return_val_if_fail (len <=sizeof (struct virtio_blk_config ),-1 ); +if (len >sizeof (struct virtio_blk_config )) { +return -1 ; + } gdev =container_of (vu_dev, VugDev, parent); vdev_blk =container_of (gdev, VubDev, parent);
Signature · 1 line
MST
[PULL 23/66] failover: Rename bool to failover_primary_hidden
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
You should not use passive naming variables.
And once there, be able to search for them.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-net.h | 3 ++- hw/net/virtio-net.c | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-)
include/hw/virtio/virtio-net.h +2 -1
@@ -207,7 +207,8 @@ struct VirtIONet {DeviceState *primary_dev;char *primary_device_id;char *standby_id; -bool primary_should_be_hidden; +/* primary failover device is hidden*/ +bool failover_primary_hidden;bool failover;DeviceListener primary_listener;Notifier migration_state;
hw/net/virtio-net.c +7 -7
@@ -916,7 +916,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)if (virtio_has_feature (features,VIRTIO_NET_F_STANDBY )) {qapi_event_send_failover_negotiated (n->netclient_name); -qatomic_set (&n->primary_should_be_hidden, false); +qatomic_set (&n->failover_primary_hidden, false);failover_add_primary (n, &err);if (err) { n->primary_dev =virtio_connect_failover_devices (n, &err);
@@ -3127,7 +3127,7 @@ static bool failover_replug_primary(VirtIONet *n, Error **errp)return false; }qdev_set_parent_bus (n->primary_dev, primary_bus, &error_abort); -qatomic_set (&n->primary_should_be_hidden, false); +qatomic_set (&n->failover_primary_hidden, false); hotplug_ctrl =qdev_get_hotplug_handler (n->primary_dev);if (hotplug_ctrl) {hotplug_handler_pre_plug (hotplug_ctrl, n->primary_dev, &err);
@@ -3148,7 +3148,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n,bool should_be_hidden;Error *err =NULL ; - should_be_hidden =qatomic_read (&n->primary_should_be_hidden); + should_be_hidden =qatomic_read (&n->failover_primary_hidden);if (!n->primary_dev) { n->primary_dev =virtio_connect_failover_devices (n, &err);
@@ -3163,7 +3163,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n,qdev_get_vmsd (n->primary_dev), n->primary_dev);qapi_event_send_unplug_primary (n->primary_device_id); -qatomic_set (&n->primary_should_be_hidden, true); +qatomic_set (&n->failover_primary_hidden, true); }else {warn_report ("couldn't unplug primary device" ); }
@@ -3213,8 +3213,8 @@ static int virtio_net_primary_should_be_hidden(DeviceListener *listener, n->primary_device_opts = device_opts; -/* primary_should_be_hidden is set during feature negotiation */ - hide =qatomic_read (&n->primary_should_be_hidden); +/* failover_primary_hidden is set during feature negotiation */ + hide =qatomic_read (&n->failover_primary_hidden);if (n->primary_device_dict) {g_free (n->primary_device_id);
@@ -3271,7 +3271,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)if (n->failover) { n->primary_listener.should_be_hidden = virtio_net_primary_should_be_hidden; -qatomic_set (&n->primary_should_be_hidden, true); +qatomic_set (&n->failover_primary_hidden, true);device_listener_register (&n->primary_listener); n->migration_state.notify = virtio_net_migration_state_notifier;add_migration_state_change_notifier (&n->migration_state);
Signature · 1 line
MST
[PULL 50/66] libvhost-user: add a simple link test without glib
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- subprojects/libvhost-user/link-test.c | 45 +++++++++++++++++++++++++++ subprojects/libvhost-user/meson.build | 4 +++ 2 files changed, 49 insertions(+) create mode 100644 subprojects/libvhost-user/link-test.c
subprojects/libvhost-user/link-test.c new file +45 -0
@@ -0,0 +1,45 @@ +/* +* A trivial unit test to check linking without glib. A real test suite should +* probably based off libvhost-user-glib instead. +*/ +#include <assert.h> +#include <stdlib.h> +#include "libvhost-user.h" + +static void +panic (VuDev *dev,const char *err) +{ +abort (); +} + +static void +set_watch (VuDev *dev,int fd,int condition, +vu_watch_cb cb,void *data) +{ +abort (); +} + +static void +remove_watch (VuDev *dev,int fd) +{ +abort (); +} + +static const VuDevIface iface = { +0 , +}; + +int +main (int argc,const char *argv[]) +{ +bool rc; +uint16_t max_queues =2 ; +int socket =0 ; +VuDev dev = {0 , }; + + rc =vu_init (&dev, max_queues, socket, panic,NULL , set_watch, remove_watch, &iface); +assert (rc == true); +vu_deinit (&dev); + +return 0 ; +}
subprojects/libvhost-user/meson.build +4 -0
@@ -22,6 +22,10 @@ vhost_user = static_library('vhost-user', include_directories: inc, c_args: '-D_GNU_SOURCE') +executable('link-test', files('link-test.c'), + link_whole: vhost_user, + include_directories: inc) + vhost_user_glib = static_library('vhost-user-glib', files('libvhost-user-glib.c'), include_directories: inc,
Signature · 1 line
MST
[PULL 53/66] contrib/vhost-user-gpu: avoid g_return_val_if() input validation
In reply to Michael S. TsirkinFrom: Stefan Hajnoczi <[email protected]>
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS.
Use an explicit if statement for input validation so it cannot accidentally be compiled out.
Message-Id: <[email protected]>
--- contrib/vhost-user-gpu/vhost-user-gpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
contrib/vhost-user-gpu/vhost-user-gpu.c +3 -1
@@ -1044,7 +1044,9 @@ vg_get_config(VuDev *dev, uint8_t *config, uint32_t len) {VuGpu *g =container_of (dev, VuGpu, dev.parent); -g_return_val_if_fail (len <=sizeof (struct virtio_gpu_config ),-1 ); +if (len >sizeof (struct virtio_gpu_config )) { +return -1 ; + }if (opt_virgl) { g->virtio_config.num_capsets =vg_virgl_get_num_capsets ();
Signature · 1 line
MST
[PULL 32/66] failover: virtio_net_connect_failover_devices() does nothing
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
It just calls virtio_net_find_primary(), so just update the callers.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
hw/net/virtio-net.c +2 -15
@@ -836,19 +836,6 @@ static DeviceState *virtio_net_find_primary(VirtIONet *n, Error **errp)return qdev_find_recursive (sysbus_get_default (), n->primary_device_id); } -static DeviceState *virtio_connect_failover_devices (VirtIONet *n,Error **errp) -{ -DeviceState *prim_dev =NULL ; -Error *err =NULL ; - - prim_dev =virtio_net_find_primary (n, &err); -if (!prim_dev) { -error_propagate (errp, err); - } - -return prim_dev; -} -static void virtio_net_set_features (VirtIODevice *vdev,uint64_t features) {VirtIONet *n =VIRTIO_NET (vdev);
@@ -904,7 +891,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)qatomic_set (&n->failover_primary_hidden, false);failover_add_primary (n, &err);if (err) { - n->primary_dev =virtio_connect_failover_devices (n, &err); + n->primary_dev =virtio_net_find_primary (n, &err);if (err) { goto out_err; }
@@ -3128,7 +3115,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, should_be_hidden =qatomic_read (&n->failover_primary_hidden);if (!n->primary_dev) { - n->primary_dev =virtio_connect_failover_devices (n, &err); + n->primary_dev =virtio_net_find_primary (n, &err);if (!n->primary_dev) {return ; }
Signature · 1 line
MST
[PULL 51/66] .gitlab-ci: add build-libvhost-user
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- .gitlab-ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+)
.gitlab-ci.yml +11 -0
@@ -455,6 +455,17 @@ check-dco: variables: GIT_DEPTH: 1000 +build-libvhost-user: + stage: build + image: $CI_REGISTRY_IMAGE/qemu/fedora:latest + before_script: + - dnf install -y meson ninja-build + script: + - mkdir subprojects/libvhost-user/build + - cd subprojects/libvhost-user/build + - meson + - ninja + pages: image: $CI_REGISTRY_IMAGE/qemu/ubuntu2004:latest stage: test
Signature · 1 line
MST
[PULL 56/66] hw/i386/pc: add max combined fw size as machine configuration option
In reply to Michael S. TsirkinFrom: Erich-McMillan <[email protected]>
At Hewlett Packard Inc. we have a need for increased fw size to enable testing of our custom fw.
Rebase v6 patch to d73c46e4
Message-Id: <[email protected]>
--- include/hw/i386/pc.h | 2 ++ hw/i386/pc.c | 51 ++++++++++++++++++++++++++++++++++++++++++++ hw/i386/pc_sysfw.c | 15 +++---------- 3 files changed, 56 insertions(+), 12 deletions(-)
include/hw/i386/pc.h +2 -0
@@ -44,6 +44,7 @@ typedef struct PCMachineState {bool sata_enabled;bool pit_enabled;bool hpet_enabled; +uint64_t max_fw_size;/* NUMA information: */ uint64_t numa_nodes;
@@ -60,6 +61,7 @@ typedef struct PCMachineState {#define PC_MACHINE_SMBUS "smbus"#define PC_MACHINE_SATA "sata"#define PC_MACHINE_PIT "pit" +#define PC_MACHINE_MAX_FW_SIZE "max-fw-size"/** * PCMachineClass:
hw/i386/pc.c +51 -0
69 lines not on this page · raw message
hw/i386/pc_sysfw.c +3 -12
@@ -39,15 +39,6 @@#include "hw/block/flash.h" #include "sysemu/kvm.h" -/* -* We don't have a theoretically justifiable exact lower bound on the base -* address of any flash mapping. In practice, the IO-APIC MMIO range is -* [0xFEE00000..0xFEE01000] -- see IO_APIC_DEFAULT_ADDRESS --, leaving free -* only 18MB-4KB below 4G. For now, restrict the cumulative mapping to 8MB in -* size. -*/ -#define FLASH_SIZE_LIMIT (8 * MiB) -#define FLASH_SECTOR_SIZE 4096 static void pc_isa_bios_init(MemoryRegion *rom_memory,
@@ -140,7 +131,7 @@ void pc_system_flash_cleanup_unused(PCMachineState *pcms)* Stop at the first pcms->flash[0] lacking a block backend. * Set each flash's size from its block backend. Fatal error if the * size isn't a non-zero multiple of 4KiB, or the total size exceeds -* FLASH_SIZE_LIMIT. +* pcms->max_fw_size. * * If pcms->flash[0] has a block backend, its memory is passed to * pc_isa_bios_init(). Merging several flash devices for isa-bios is
@@ -182,10 +173,10 @@ static void pc_system_flash_map(PCMachineState *pcms, }if ((hwaddr )size != size || total_size >HWADDR_MAX - size - || total_size + size >FLASH_SIZE_LIMIT ) { + || total_size + size > pcms->max_fw_size) {error_report ("combined size of system firmware exceeds " "%" PRIu64" bytes" , -FLASH_SIZE_LIMIT ); + pcms->max_fw_size);exit (1 ); }
Signature · 1 line
MST
[PULL 55/66] block/export: avoid g_return_val_if() input validation
In reply to Michael S. TsirkinFrom: Stefan Hajnoczi <[email protected]>
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS.
Use an explicit if statement for input validation so it cannot accidentally be compiled out.
Message-Id: <[email protected]>
--- block/export/vhost-user-blk-server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
block/export/vhost-user-blk-server.c +3 -1
@@ -267,7 +267,9 @@ vu_blk_get_config(VuDev *vu_dev, uint8_t *config, uint32_t len)VuServer *server =container_of (vu_dev, VuServer, vu_dev);VuBlkExport *vexp =container_of (server, VuBlkExport, vu_server); -g_return_val_if_fail (len <=sizeof (struct virtio_blk_config ),-1 ); +if (len >sizeof (struct virtio_blk_config )) { +return -1 ; + }memcpy (config, &vexp->blkcfg, len);return 0 ;
Signature · 1 line
MST
[PULL 49/66] libvhost-user: check memfd API
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Do not compile potentially panicking code, instead check memfd API is present during configure time.
Message-Id: <[email protected]>
--- subprojects/libvhost-user/libvhost-user.c | 6 ------ subprojects/libvhost-user/meson.build | 12 ++++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-)
subprojects/libvhost-user/libvhost-user.c +0 -6
@@ -1616,7 +1616,6 @@ vu_inflight_queue_size(uint16_t queue_size) sizeof(uint16_t), INFLIGHT_ALIGNMENT); } -#ifdef MFD_ALLOW_SEALING static void *memfd_alloc (const char *name,size_t size,unsigned int flags,int *fd) {
@@ -1648,7 +1647,6 @@ memfd_alloc(const char *name, size_t size, unsigned int flags, int *fd)return ptr; } -#endif static bool vu_get_inflight_fd (VuDev *dev,VhostUserMsg *vmsg)
@@ -1672,13 +1670,9 @@ vu_get_inflight_fd(VuDev *dev, VhostUserMsg *vmsg) mmap_size =vu_inflight_queue_size (queue_size) * num_queues; -#ifdef MFD_ALLOW_SEALING addr =memfd_alloc ("vhost-inflight" , mmap_size,F_SEAL_GROW |F_SEAL_SHRINK |F_SEAL_SEAL , &fd); -#else -vu_panic (dev,"Not implemented: memfd support is missing" ); -#endif if (!addr) {vu_panic (dev,"Failed to alloc vhost inflight area" );
subprojects/libvhost-user/meson.build +12 -0
@@ -2,7 +2,19 @@ project('libvhost-user', 'c', license: 'GPL-2.0-or-later', default_options: ['c_std=gnu99']) +cc = meson.get_compiler('c') + glib = dependency('glib-2.0') +foreach h, syms: { + 'sys/mman.h': ['memfd_create', 'MFD_ALLOW_SEALING'], + 'sys/fcntl.h': ['F_SEAL_GROW', 'F_SEAL_SHRINK', 'F_SEAL_SEAL'] } + foreach sym: syms + cc.has_header_symbol(h, sym, + args: ['-D_GNU_SOURCE'], + required: true) + endforeach +endforeach + inc = include_directories('../../include', '../../linux-headers') vhost_user = static_library('vhost-user',
Signature · 1 line
MST
[PULL 58/66] x86: acpi: introduce AcpiPmInfo::smi_on_cpu_unplug
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/i386/acpi-build.c +4 -0
@@ -96,6 +96,7 @@ typedef struct AcpiPmInfo {bool s4_disabled;bool pcihp_bridge_en;bool smi_on_cpuhp; +bool smi_on_cpu_unplug;bool pcihp_root_en;uint8_t s4_val;AcpiFadtData fadt;
@@ -197,6 +198,7 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) pm->pcihp_io_base =0 ; pm->pcihp_io_len =0 ; pm->smi_on_cpuhp = false; + pm->smi_on_cpu_unplug = false;assert (obj);init_common_fadt_data (machine, obj, &pm->fadt);
@@ -220,6 +222,8 @@ static void acpi_get_pm_info(MachineState *machine, AcpiPmInfo *pm) pm->cpu_hp_io_base =ICH9_CPU_HOTPLUG_IO_BASE ; pm->smi_on_cpuhp = !!(smi_features &BIT_ULL (ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT )); + pm->smi_on_cpu_unplug = + !!(smi_features &BIT_ULL (ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT )); }/* The above need not be conditional on machine type because the reset port
Signature · 1 line
MST
[PULL 34/66] failover: simplify qdev_device_add() failover case
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Just put allthe logic inside the same if.
Message-Id: <[email protected]>
--- softmmu/qdev-monitor.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
softmmu/qdev-monitor.c +6 -5
@@ -600,7 +600,6 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)const char *driver, *path;DeviceState *dev =NULL ;BusState *bus =NULL ; -bool hide; driver =qemu_opt_get (opts,"driver" );if (!driver) {
@@ -634,14 +633,16 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)return NULL ; } } - hide =should_hide_device (opts); -if ((hide || qdev_hotplug) && bus && !qbus_is_hotpluggable (bus)) { -error_setg (errp,QERR_BUS_NO_HOTPLUG , bus->name); +if (should_hide_device (opts)) { +if (bus && !qbus_is_hotpluggable (bus)) { +error_setg (errp,QERR_BUS_NO_HOTPLUG , bus->name); + }return NULL ; } -if (hide) { +if (qdev_hotplug && bus && !qbus_is_hotpluggable (bus)) { +error_setg (errp,QERR_BUS_NO_HOTPLUG , bus->name);return NULL ; }
Signature · 1 line
MST
[PULL 64/66] pcie_aer: Fix help message of pcie_aer_inject_error command
In reply to Michael S. TsirkinFrom: Zenghui Yu <[email protected]>
There is an interesting typo in the help message of pcie_aer_inject_error command. Use 'tlp' instead of 'tlb' to match the PCIe AER term.
Message-Id: <[email protected]>
--- hmp-commands.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hmp-commands.hx +2 -2
@@ -1302,8 +1302,8 @@ ERST " -c for correctable error\n\t\t\t" "<id> = qdev device id\n\t\t\t" "<error_status> = error string or 32bit\n\t\t\t" - "<tlb header> = 32bit x 4\n\t\t\t" - "<tlb header prefix> = 32bit x 4", + "<tlp header> = 32bit x 4\n\t\t\t" + "<tlp header prefix> = 32bit x 4", .cmd = hmp_pcie_aer_inject_error, },
Signature · 1 line
MST
[PULL 54/66] contrib/vhost-user-input: avoid g_return_val_if() input validation
In reply to Michael S. TsirkinFrom: Stefan Hajnoczi <[email protected]>
Do not validate input with g_return_val_if(). This API is intended for checking programming errors and is compiled out with -DG_DISABLE_CHECKS.
Use an explicit if statement for input validation so it cannot accidentally be compiled out.
Message-Id: <[email protected]>
--- contrib/vhost-user-input/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
contrib/vhost-user-input/main.c +3 -1
@@ -211,7 +211,9 @@ static int vi_get_config(VuDev *dev, uint8_t *config, uint32_t len) {VuInput *vi =container_of (dev, VuInput, dev.parent); -g_return_val_if_fail (len <=sizeof (*vi->sel_config),-1 ); +if (len >sizeof (*vi->sel_config)) { +return -1 ; + }if (vi->sel_config) {memcpy (config, vi->sel_config, len);
Signature · 1 line
MST
[PULL 65/66] hw/virtio-pci Added counter for pcie capabilities offsets.
In reply to Michael S. TsirkinFrom: Andrew <[email protected]>
Removed hardcoded offset for ats. Added cap offset counter for future capabilities like AER.
Message-Id: <[email protected]>
--- hw/virtio/virtio-pci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/virtio/virtio-pci.c +3 -1
@@ -1798,6 +1798,7 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)if (pcie_port &&pci_is_express (pci_dev)) {int pos; +uint16_t last_pcie_cap_offset =PCI_CONFIG_SPACE_SIZE ; pos =pcie_endpoint_cap_init (pci_dev,0 );assert (pos >0 );
@@ -1833,7 +1834,8 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp) }if (proxy->flags &VIRTIO_PCI_FLAG_ATS ) { -pcie_ats_init (pci_dev,256 ); +pcie_ats_init (pci_dev, last_pcie_cap_offset); + last_pcie_cap_offset +=PCI_EXT_CAP_ATS_SIZEOF ; }if (proxy->flags &VIRTIO_PCI_FLAG_INIT_FLR ) {
Signature · 1 line
MST
[PULL 36/66] failover: make sure that id always exist
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
We check that it exist at device creation time, so we don't have to check anywhere else.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 3 --- softmmu/qdev-monitor.c | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-)
hw/net/virtio-net.c +0 -3
@@ -3173,9 +3173,6 @@ static bool failover_hide_primary_device(DeviceListener *listener, hide =qatomic_read (&n->failover_primary_hidden);g_free (n->primary_device_id); n->primary_device_id =g_strdup (device_opts->id); -if (!n->primary_device_id) { -warn_report ("primary_device_id not set" ); - }return hide; }
softmmu/qdev-monitor.c +4 -0
@@ -613,6 +613,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp) }if (qemu_opt_get (opts,"failover_pair_id" )) { +if (!opts->id) { +error_setg (errp,"Device with failover_pair_id don't have id" ); +return NULL ; + }if (qdev_should_hide_device (opts)) {if (bus && !qbus_is_hotpluggable (bus)) {error_setg (errp,QERR_BUS_NO_HOTPLUG , bus->name);
Signature · 1 line
MST
[PULL 62/66] x86: ich9: factor out "guest_cpu_hotplug_features"
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
it will be reused by next patch to check validity of unplug feature.
Message-Id: <[email protected]>
--- hw/isa/lpc_ich9.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
hw/isa/lpc_ich9.c +6 -2
@@ -366,6 +366,7 @@ static void smi_features_ok_callback(void *opaque) {ICH9LPCState *lpc = opaque;uint64_t guest_features; +uint64_t guest_cpu_hotplug_features;if (lpc->smi_features_ok) {/* negotiation already complete, features locked */
@@ -378,9 +379,12 @@ static void smi_features_ok_callback(void *opaque)/* guest requests invalid features, leave @features_ok at zero */ return ; } + + guest_cpu_hotplug_features = guest_features & + (BIT_ULL (ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT ) | +BIT_ULL (ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT ));if (!(guest_features &BIT_ULL (ICH9_LPC_SMI_F_BROADCAST_BIT )) && - guest_features & (BIT_ULL (ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT ) | -BIT_ULL (ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT ))) { + guest_cpu_hotplug_features) {/* * cpu hot-[un]plug with SMI requires SMI broadcast, * leave @features_ok at zero
Signature · 1 line
MST
[PULL 66/66] hw/virtio-pci Added AER capability.
In reply to Michael S. TsirkinFrom: Andrew <[email protected]>
Added AER capability for virtio-pci devices.
Also added property for devices, by default AER is disabled.
Message-Id: <[email protected]>
--- hw/virtio/virtio-pci.h | 4 ++++ hw/virtio/virtio-pci.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+)
hw/virtio/virtio-pci.h +4 -0
@@ -41,6 +41,7 @@ enum {VIRTIO_PCI_FLAG_INIT_LNKCTL_BIT ,VIRTIO_PCI_FLAG_INIT_PM_BIT ,VIRTIO_PCI_FLAG_INIT_FLR_BIT , + VIRTIO_PCI_FLAG_AER_BIT, };/* Need to activate work-arounds for buggy guests at vmstate load. */
@@ -80,6 +81,9 @@ enum {/* Init Function Level Reset capability */ #define VIRTIO_PCI_FLAG_INIT_FLR (1 << VIRTIO_PCI_FLAG_INIT_FLR_BIT) +/* Advanced Error Reporting capability */ +#define VIRTIO_PCI_FLAG_AER (1 << VIRTIO_PCI_FLAG_AER_BIT) + typedef struct { MSIMessage msg; int virq;
hw/virtio/virtio-pci.c +16 -0
@@ -1817,6 +1817,12 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)*/ pci_set_word (pci_dev->config + pos +PCI_PM_PMC ,0x3 ); +if (proxy->flags &VIRTIO_PCI_FLAG_AER ) { +pcie_aer_init (pci_dev,PCI_ERR_VER , last_pcie_cap_offset, +PCI_ERR_SIZEOF ,NULL ); + last_pcie_cap_offset +=PCI_ERR_SIZEOF ; + } +if (proxy->flags &VIRTIO_PCI_FLAG_INIT_DEVERR ) {/* Init error enabling flags */ pcie_cap_deverr_init (pci_dev);
@@ -1858,7 +1864,15 @@ static void virtio_pci_realize(PCIDevice *pci_dev, Error **errp)static void virtio_pci_exit (PCIDevice *pci_dev) { +VirtIOPCIProxy *proxy =VIRTIO_PCI (pci_dev); +bool pcie_port =pci_bus_is_express (pci_get_bus (pci_dev)) && + !pci_bus_is_root (pci_get_bus (pci_dev)); +msix_uninit_exclusive_bar (pci_dev); +if (proxy->flags &VIRTIO_PCI_FLAG_AER && pcie_port && +pci_is_express (pci_dev)) { +pcie_aer_exit (pci_dev); + } }static void virtio_pci_reset (DeviceState *qdev)
@@ -1911,6 +1925,8 @@ static Property virtio_pci_properties[] = { VIRTIO_PCI_FLAG_INIT_PM_BIT, true),DEFINE_PROP_BIT ("x-pcie-flr-init" , VirtIOPCIProxy, flags,VIRTIO_PCI_FLAG_INIT_FLR_BIT , true), +DEFINE_PROP_BIT ("aer" , VirtIOPCIProxy, flags, +VIRTIO_PCI_FLAG_AER_BIT , false), DEFINE_PROP_END_OF_LIST(), };
Signature · 1 line
MST
[PULL 40/66] failover: Caller of this two functions already have primary_dev
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
Pass it as an argument.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
hw/net/virtio-net.c +14 -13
@@ -3093,17 +3093,17 @@ void virtio_net_set_netclient_name(VirtIONet *n, const char *name, n->netclient_type =g_strdup (type); } -static bool failover_unplug_primary (VirtIONet *n) +static bool failover_unplug_primary (VirtIONet *n,DeviceState *dev) {HotplugHandler *hotplug_ctrl;PCIDevice *pci_dev;Error *err =NULL ; - hotplug_ctrl =qdev_get_hotplug_handler (n->primary_dev); + hotplug_ctrl =qdev_get_hotplug_handler (dev);if (hotplug_ctrl) { - pci_dev =PCI_DEVICE (n->primary_dev); + pci_dev =PCI_DEVICE (dev); pci_dev->partially_hotplugged = true; -hotplug_handler_unplug_request (hotplug_ctrl, n->primary_dev, &err); +hotplug_handler_unplug_request (hotplug_ctrl, dev, &err);if (err) {error_report_err (err);return false;
@@ -3114,30 +3114,31 @@ static bool failover_unplug_primary(VirtIONet *n)return true; } -static bool failover_replug_primary (VirtIONet *n,Error **errp) +static bool failover_replug_primary (VirtIONet *n,DeviceState *dev, +Error **errp) {Error *err =NULL ;HotplugHandler *hotplug_ctrl; -PCIDevice *pdev =PCI_DEVICE (n->primary_dev); +PCIDevice *pdev =PCI_DEVICE (dev);BusState *primary_bus;if (!pdev->partially_hotplugged) {return true; } - primary_bus = n->primary_dev->parent_bus; + primary_bus = dev->parent_bus;if (!primary_bus) {error_setg (errp,"virtio_net: couldn't find primary bus" );return false; } -qdev_set_parent_bus (n->primary_dev, primary_bus, &error_abort); +qdev_set_parent_bus (dev, primary_bus, &error_abort);qatomic_set (&n->failover_primary_hidden, false); - hotplug_ctrl =qdev_get_hotplug_handler (n->primary_dev); + hotplug_ctrl =qdev_get_hotplug_handler (dev);if (hotplug_ctrl) { -hotplug_handler_pre_plug (hotplug_ctrl, n->primary_dev, &err); +hotplug_handler_pre_plug (hotplug_ctrl, dev, &err);if (err) { goto out; } -hotplug_handler_plug (hotplug_ctrl, n->primary_dev, &err); +hotplug_handler_plug (hotplug_ctrl, dev, &err); } out:
@@ -3161,7 +3162,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, }if (migration_in_setup (s) && !should_be_hidden) { -if (failover_unplug_primary (n)) { +if (failover_unplug_primary (n, n->primary_dev)) {vmstate_unregister (VMSTATE_IF (n->primary_dev),qdev_get_vmsd (n->primary_dev), n->primary_dev);
@@ -3172,7 +3173,7 @@ static void virtio_net_handle_migration_primary(VirtIONet *n, } }else if (migration_has_failed (s)) {/* We already unplugged the device let's plug it back */ -if (!failover_replug_primary (n, &err)) { +if (!failover_replug_primary (n, n->primary_dev, &err)) {if (err) {error_report_err (err); }
Signature · 1 line
MST
[PULL 63/66] x86: ich9: let firmware negotiate 'CPU hot-unplug with SMI' feature
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
Keep CPU hotunplug with SMI disabled on 5.2 and older and enable it by default on newer machine types.
Message-Id: <[email protected]>
--- hw/i386/pc.c | 4 +++- hw/isa/lpc_ich9.c | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-)
hw/i386/pc.c +3 -1
@@ -97,7 +97,9 @@#include "trace.h" #include CONFIG_DEVICES -GlobalProperty pc_compat_5_2[] = {}; +GlobalProperty pc_compat_5_2[] = { + {"ICH9-LPC" ,"x-smi-cpu-hotunplug" ,"off" }, +};const size_t pc_compat_5_2_len =G_N_ELEMENTS (pc_compat_5_2);GlobalProperty pc_compat_5_1[] = {
hw/isa/lpc_ich9.c +7 -1
@@ -392,6 +392,12 @@ static void smi_features_ok_callback(void *opaque)return ; } +if (guest_cpu_hotplug_features == +BIT_ULL (ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT )) { +/* cpu hot-unplug is unsupported without cpu-hotplug */ +return ; + } +/* valid feature subset requested, lock it down, report success */ lpc->smi_negotiated_features = guest_features; lpc->smi_features_ok =1 ;
@@ -774,7 +780,7 @@ static Property ich9_lpc_properties[] = {DEFINE_PROP_BIT64 ("x-smi-cpu-hotplug" , ICH9LPCState, smi_host_features,ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT , true),DEFINE_PROP_BIT64 ("x-smi-cpu-hotunplug" , ICH9LPCState, smi_host_features, -ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT , false), +ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT , true), DEFINE_PROP_END_OF_LIST(), };
Signature · 1 line
MST
[PULL 60/66] x86: acpi: let the firmware handle pending "CPU remove" events in SMM
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
if firmware and QEMU negotiated CPU hotunplug support, generate _EJ0 method so that it will mark CPU for removal by firmware and pass control to it by triggering SMI.
Message-Id: <[email protected]>
--- include/hw/acpi/cpu.h | 1 + hw/acpi/cpu.c | 14 ++++++++++++-- hw/i386/acpi-build.c | 1 + 3 files changed, 14 insertions(+), 2 deletions(-)
include/hw/acpi/cpu.h +1 -0
@@ -51,6 +51,7 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner,typedef struct CPUHotplugFeatures {bool acpi_1_compatible;bool has_legacy_cphp; +bool fw_unplugs_cpu;const char *smi_path; }CPUHotplugFeatures ;
hw/acpi/cpu.c +12 -2
@@ -342,6 +342,7 @@ const VMStateDescription vmstate_cpu_hotplug = {#define CPU_INSERT_EVENT "CINS"#define CPU_REMOVE_EVENT "CRMV"#define CPU_EJECT_EVENT "CEJ0" +#define CPU_FW_EJECT_EVENT "CEJF" void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, hwaddr io_base,
@@ -394,7 +395,9 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,aml_append (field,aml_named_field (CPU_REMOVE_EVENT ,1 ));/* initiates device eject, write only */ aml_append (field,aml_named_field (CPU_EJECT_EVENT ,1 )); -aml_append (field,aml_reserved_field (4 )); +/* tell firmware to do device eject, write only */ +aml_append (field,aml_named_field (CPU_FW_EJECT_EVENT ,1 )); +aml_append (field,aml_reserved_field (3 ));aml_append (field,aml_named_field (CPU_COMMAND ,8 ));aml_append (cpu_ctrl_dev, field);
@@ -429,6 +432,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,Aml *ins_evt =aml_name ("%s.%s" , cphp_res_path,CPU_INSERT_EVENT );Aml *rm_evt =aml_name ("%s.%s" , cphp_res_path,CPU_REMOVE_EVENT );Aml *ej_evt =aml_name ("%s.%s" , cphp_res_path,CPU_EJECT_EVENT ); +Aml *fw_ej_evt =aml_name ("%s.%s" , cphp_res_path,CPU_FW_EJECT_EVENT );aml_append (cpus_dev,aml_name_decl ("_HID" ,aml_string ("ACPI0010" )));aml_append (cpus_dev,aml_name_decl ("_CID" ,aml_eisaid ("PNP0A05" )));
@@ -471,7 +475,13 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,aml_append (method,aml_acquire (ctrl_lock,0xFFFF ));aml_append (method,aml_store (idx, cpu_selector)); -aml_append (method,aml_store (one, ej_evt)); +if (opts.fw_unplugs_cpu) { +aml_append (method,aml_store (one, fw_ej_evt)); +aml_append (method,aml_store (aml_int (OVMF_CPUHP_SMI_CMD ), +aml_name ("%s" , opts.smi_path))); + }else { +aml_append (method,aml_store (one, ej_evt)); + }aml_append (method,aml_release (ctrl_lock)); }aml_append (cpus_dev, method);
hw/i386/acpi-build.c +1 -0
@@ -1293,6 +1293,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,CPUHotplugFeatures opts = { .acpi_1_compatible = true, .has_legacy_cphp = true, .smi_path = pm->smi_on_cpuhp ?"\\_SB.PCI0.SMI0.SMIC" :NULL , + .fw_unplugs_cpu = pm->smi_on_cpu_unplug, };build_cpus_aml (dsdt, machine, opts, pm->cpu_hp_io_base,"\\_SB.PCI0" ,"\\_GPE._E02" );
Signature · 1 line
MST
[PULL 46/66] libvhost-user: remove qemu/compiler.h usage
In reply to Michael S. TsirkinFrom: Marc-André Lureau <[email protected]>
Message-Id: <[email protected]>
--- contrib/libvhost-user/libvhost-user.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
contrib/libvhost-user/libvhost-user.c +4 -1
@@ -27,7 +27,6 @@#include <sys/eventfd.h> #include <sys/mman.h> #include <endian.h> -#include "qemu/compiler.h" #if defined(__linux__)#include <sys/syscall.h>
@@ -60,6 +59,10 @@/* Round number up to multiple */ #define ALIGN_UP (n, m) ALIGN_DOWN((n) + (m) - 1, (m)) +#ifndef unlikely +#define unlikely (x) __builtin_expect(!!(x), 0) +#endif +/* Align each region to cache line size in inflight buffer */ #define INFLIGHT_ALIGNMENT 64
Signature · 1 line
MST
[PULL 41/66] failover: simplify failover_unplug_primary
In reply to Michael S. TsirkinFrom: Juan Quintela <[email protected]>
We can calculate device just once.
Message-Id: <[email protected]>
--- hw/net/virtio-net.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-)
hw/net/virtio-net.c +10 -15
@@ -3146,34 +3146,29 @@ out:return !err; } -static void virtio_net_handle_migration_primary (VirtIONet *n, -MigrationState *s) +static void virtio_net_handle_migration_primary (VirtIONet *n,MigrationState *s) {bool should_be_hidden;Error *err =NULL ; +DeviceState *dev =failover_find_primary_device (n); + +if (!dev) { +return ; + } should_be_hidden =qatomic_read (&n->failover_primary_hidden); -if (!n->primary_dev) { - n->primary_dev =failover_find_primary_device (n); -if (!n->primary_dev) { -return ; - } - } -if (migration_in_setup (s) && !should_be_hidden) { -if (failover_unplug_primary (n, n->primary_dev)) { -vmstate_unregister (VMSTATE_IF (n->primary_dev), -qdev_get_vmsd (n->primary_dev), - n->primary_dev); -qapi_event_send_unplug_primary (n->primary_dev->id); +if (failover_unplug_primary (n, dev)) { +vmstate_unregister (VMSTATE_IF (dev),qdev_get_vmsd (dev), dev); +qapi_event_send_unplug_primary (dev->id);qatomic_set (&n->failover_primary_hidden, true); }else {warn_report ("couldn't unplug primary device" ); } }else if (migration_has_failed (s)) {/* We already unplugged the device let's plug it back */ -if (!failover_replug_primary (n, n->primary_dev, &err)) { +if (!failover_replug_primary (n, dev, &err)) {if (err) {error_report_err (err); }
Signature · 1 line
MST
[PULL 57/66] acpi: cpuhp: introduce 'firmware performs eject' status/control bits
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
Adds bit #4 to status/control field of CPU hotplug MMIO interface. New bit will be used OSPM to mark CPUs as pending for removal by firmware, when it calls _EJ0 method on CPU device node. Later on, when firmware sees this bit set, it will perform CPU eject which will clear bit #4 as well.
Message-Id: <[email protected]>
--- docs/specs/acpi_cpu_hotplug.txt | 19 ++++++++++++++----- include/hw/acpi/cpu.h | 1 + hw/acpi/cpu.c | 12 +++++++++++- hw/acpi/trace-events | 2 ++ 4 files changed, 28 insertions(+), 6 deletions(-)
docs/specs/acpi_cpu_hotplug.txt +14 -5
@@ -56,8 +56,11 @@ read access: no device check event to OSPM was issued. It's valid only when bit 0 is set. 2: Device remove event, used to distinguish device for which - no device eject request to OSPM was issued. - 3-7: reserved and should be ignored by OSPM + no device eject request to OSPM was issued. Firmware must + ignore this bit. + 3: reserved and should be ignored by OSPM + 4: if set to 1, OSPM requests firmware to perform device eject. + 5-7: reserved and should be ignored by OSPM [0x5-0x7] reserved [0x8] Command data: (DWORD access) contains 0 unless value last stored in 'Command field' is one of:
@@ -79,10 +82,16 @@ write access: selected CPU device 2: if set to 1 clears device remove event, set by OSPM after it has emitted device eject request for the - selected CPU device + selected CPU device. 3: if set to 1 initiates device eject, set by OSPM when it - triggers CPU device removal and calls _EJ0 method - 4-7: reserved, OSPM must clear them before writing to register + triggers CPU device removal and calls _EJ0 method or by firmware + when bit #4 is set. In case bit #4 were set, it's cleared as + part of device eject. + 4: if set to 1, OSPM hands over device eject to firmware. + Firmware shall issue device eject request as described above + (bit #3) and OSPM should not touch device eject bit (#3) in case + it's asked firmware to perform CPU device eject. + 5-7: reserved, OSPM must clear them before writing to register [0x5] Command field: (1 byte access) value: 0: selects a CPU device with inserting/removing events and
include/hw/acpi/cpu.h +1 -0
@@ -22,6 +22,7 @@ typedef struct AcpiCpuStatus {uint64_t arch_id;bool is_inserting;bool is_removing; +bool fw_remove;uint32_t ost_event;uint32_t ost_status; } AcpiCpuStatus;
hw/acpi/cpu.c +11 -1
@@ -71,6 +71,7 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size) val |= cdev->cpu ?1 :0 ; val |= cdev->is_inserting ?2 :0 ; val |= cdev->is_removing ?4 :0 ; + val |= cdev->fw_remove ?16 :0 ;trace_cpuhp_acpi_read_flags (cpu_st->selector, val);break ;case ACPI_CPU_CMD_DATA_OFFSET_RW :
@@ -148,6 +149,14 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data, hotplug_ctrl =qdev_get_hotplug_handler (dev);hotplug_handler_unplug (hotplug_ctrl, dev,NULL );object_unparent (OBJECT (dev)); + cdev->fw_remove = false; + }else if (data &16 ) { +if (!cdev->cpu || cdev->cpu == first_cpu) { +trace_cpuhp_acpi_fw_remove_invalid_cpu (cpu_st->selector); +break ; + } +trace_cpuhp_acpi_fw_remove_cpu (cpu_st->selector); + cdev->fw_remove = true; }break ;case ACPI_CPU_CMD_OFFSET_WR :
@@ -159,7 +168,8 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, uint64_t data, do { cdev = &cpu_st->devs[iter]; - if (cdev->is_inserting || cdev->is_removing) { + if (cdev->is_inserting || cdev->is_removing || + cdev->fw_remove) { cpu_st->selector = iter; trace_cpuhp_acpi_cpu_has_events(cpu_st->selector, cdev->is_inserting, cdev->is_removing);
hw/acpi/trace-events +2 -0
@@ -29,6 +29,8 @@ cpuhp_acpi_clear_inserting_evt(uint32_t idx) "idx[0x%"PRIx32"]" cpuhp_acpi_clear_remove_evt(uint32_t idx) "idx[0x%"PRIx32"]" cpuhp_acpi_ejecting_invalid_cpu(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_ejecting_cpu(uint32_t idx) "0x%"PRIx32 +cpuhp_acpi_fw_remove_invalid_cpu(uint32_t idx) "0x%"PRIx32 +cpuhp_acpi_fw_remove_cpu(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_write_ost_ev(uint32_t slot, uint32_t ev) "idx[0x%"PRIx32"] OST EVENT: 0x%"PRIx32 cpuhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "idx[0x%"PRIx32"] OST STATUS: 0x%"PRIx32
Signature · 1 line
MST
[PULL 59/66] tests/acpi: allow expected files change
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
Change that will be introduced by following patch:
@@ -557,6 +557,7 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPCDSDT", 0x00000001)
CINS, 1,
CRMV, 1,
CEJ0, 1,
+ CEJF, 1,
Offset (0x05),
CCMD, 8
}Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tests/qtest/bios-tables-test-allowed-diff.h +21 -0
@@ -1 +1,22 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT" , +"tests/data/acpi/q35/DSDT" , +"tests/data/acpi/q35/DSDT.tis" , +"tests/data/acpi/q35/DSDT.bridge" , +"tests/data/acpi/q35/DSDT.mmio64" , +"tests/data/acpi/q35/DSDT.ipmibt" , +"tests/data/acpi/q35/DSDT.cphp" , +"tests/data/acpi/q35/DSDT.memhp" , +"tests/data/acpi/q35/DSDT.numamem" , +"tests/data/acpi/q35/DSDT.dimmpxm" , +"tests/data/acpi/q35/DSDT.acpihmat" , +"tests/data/acpi/pc/DSDT.bridge" , +"tests/data/acpi/pc/DSDT.ipmikcs" , +"tests/data/acpi/pc/DSDT.cphp" , +"tests/data/acpi/pc/DSDT.memhp" , +"tests/data/acpi/pc/DSDT.numamem" , +"tests/data/acpi/pc/DSDT.dimmpxm" , +"tests/data/acpi/pc/DSDT.acpihmat" , +"tests/data/acpi/pc/DSDT.roothp" , +"tests/data/acpi/pc/DSDT.hpbridge" , +"tests/data/acpi/pc/DSDT.hpbrroot",
Signature · 1 line
MST
[PULL 61/66] tests/acpi: update expected files
In reply to Michael S. TsirkinFrom: Igor Mammedov <[email protected]>
update expected files with following change:
@@ -557,6 +557,7 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPCDSDT", 0x00000001)
CINS, 1,
CRMV, 1,
CEJ0, 1,
+ CEJF, 1,
Offset (0x05),
CCMD, 8
}Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 21 -------------------- tests/data/acpi/pc/DSDT | Bin 5060 -> 5065 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 6385 -> 6390 bytes tests/data/acpi/pc/DSDT.bridge | Bin 6919 -> 6924 bytes tests/data/acpi/pc/DSDT.cphp | Bin 5524 -> 5529 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 6714 -> 6719 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 5021 -> 5026 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3079 -> 3084 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 5132 -> 5137 bytes tests/data/acpi/pc/DSDT.memhp | Bin 6419 -> 6424 bytes tests/data/acpi/pc/DSDT.numamem | Bin 5066 -> 5071 bytes tests/data/acpi/pc/DSDT.roothp | Bin 5256 -> 5261 bytes tests/data/acpi/q35/DSDT | Bin 7796 -> 7801 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9121 -> 9126 bytes tests/data/acpi/q35/DSDT.bridge | Bin 7814 -> 7819 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8260 -> 8265 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9450 -> 9455 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 7871 -> 7876 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9155 -> 9160 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 8927 -> 8932 bytes tests/data/acpi/q35/DSDT.numamem | Bin 7802 -> 7807 bytes tests/data/acpi/q35/DSDT.tis | Bin 8402 -> 8407 bytes 22 files changed, 21 deletions(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -21
@@ -1,22 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT" , -"tests/data/acpi/q35/DSDT" , -"tests/data/acpi/q35/DSDT.tis" , -"tests/data/acpi/q35/DSDT.bridge" , -"tests/data/acpi/q35/DSDT.mmio64" , -"tests/data/acpi/q35/DSDT.ipmibt" , -"tests/data/acpi/q35/DSDT.cphp" , -"tests/data/acpi/q35/DSDT.memhp" , -"tests/data/acpi/q35/DSDT.numamem" , -"tests/data/acpi/q35/DSDT.dimmpxm" , -"tests/data/acpi/q35/DSDT.acpihmat" , -"tests/data/acpi/pc/DSDT.bridge" , -"tests/data/acpi/pc/DSDT.ipmikcs" , -"tests/data/acpi/pc/DSDT.cphp" , -"tests/data/acpi/pc/DSDT.memhp" , -"tests/data/acpi/pc/DSDT.numamem" , -"tests/data/acpi/pc/DSDT.dimmpxm" , -"tests/data/acpi/pc/DSDT.acpihmat" , -"tests/data/acpi/pc/DSDT.roothp" , -"tests/data/acpi/pc/DSDT.hpbridge" , -"tests/data/acpi/pc/DSDT.hpbrroot",
tests/data/acpi/pc/DSDT binary +0 -0
tests/data/acpi/pc/DSDT.acpihmat binary +0 -0
tests/data/acpi/pc/DSDT.bridge binary +0 -0
tests/data/acpi/pc/DSDT.cphp binary +0 -0
tests/data/acpi/pc/DSDT.dimmpxm binary +0 -0
tests/data/acpi/pc/DSDT.hpbridge binary +0 -0
tests/data/acpi/pc/DSDT.hpbrroot binary +0 -0
tests/data/acpi/pc/DSDT.ipmikcs binary +0 -0
tests/data/acpi/pc/DSDT.memhp binary +0 -0
tests/data/acpi/pc/DSDT.numamem binary +0 -0
tests/data/acpi/pc/DSDT.roothp binary +0 -0
tests/data/acpi/q35/DSDT binary +0 -0
tests/data/acpi/q35/DSDT.acpihmat binary +0 -0
tests/data/acpi/q35/DSDT.bridge binary +0 -0
tests/data/acpi/q35/DSDT.cphp binary +0 -0
tests/data/acpi/q35/DSDT.dimmpxm binary +0 -0
tests/data/acpi/q35/DSDT.ipmibt binary +0 -0
tests/data/acpi/q35/DSDT.memhp binary +0 -0
tests/data/acpi/q35/DSDT.mmio64 binary +0 -0
tests/data/acpi/q35/DSDT.numamem binary +0 -0
tests/data/acpi/q35/DSDT.tis binary +0 -0
Signature · 1 line
MST
Quoted 21 lines · Michael S. Tsirkin
The following changes since commit
553032db17440f8de011390e5a1cfddd13751b0b:Update version for v5.2.0 release (2020-12-08 15:55:19 +0000)
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
023e57b93a24f2e7901cf460a45cb5058fa23549:hw/virtio-pci Added AER capability. (2020-12-08 13:48:58 -0500)
----------------------------------------------------------------
pc,pci,virtio: fixes, cleanupsLots of fixes, cleanups.
CPU hot-unplug improvements.
A new AER property for virtio devices, adding a dummy AER capability.Signed-off-by Michael S. Tsirkin <[email protected]>
Quoted 7 lines
----------------------------------------------------------------
Alex Chen (1):
vhost-user-scsi: Fix memleaks invus_proc_req()Andrew (2):
hw/virtio-pci Added counter for pcie capabilities offsets. hw/virtio-pci Added AER capability.
Something got wrong with Andrew patches, as the S-o-b tag is:
Andrew Melnychenko <[email protected]>
Quoted 26 lines · Philippe Mathieu-Daudé
Quoted 25 lines · Michael S. Tsirkin
The following changes since commit
553032db17440f8de011390e5a1cfddd13751b0b:Update version for v5.2.0 release (2020-12-08 15:55:19 +0000)
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
023e57b93a24f2e7901cf460a45cb5058fa23549:hw/virtio-pci Added AER capability. (2020-12-08 13:48:58 -0500)
----------------------------------------------------------------
pc,pci,virtio: fixes, cleanupsLots of fixes, cleanups.
CPU hot-unplug improvements.
A new AER property for virtio devices, adding a dummy AER capability.Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Alex Chen (1):
vhost-user-scsi: Fix memleaks invus_proc_req()
Quoted 7 lines
Quoted 3 lines
Andrew (2):
hw/virtio-pci Added counter for pcie capabilities offsets. hw/virtio-pci Added AER capability.Something got wrong with Andrew patches, as the S-o-b tag is:
Andrew Melnychenko <[email protected]>
Yea I guess email had a bad From line. Fixed up. New hash: 46018ba26c794bf7b9113b0707b9d420c30c56a6
Same code just a different author.
Signature · 1 line
MST
Quoted 13 lines · Michael S. Tsirkin
The following changes since commit
553032db17440f8de011390e5a1cfddd13751b0b:Update version for v5.2.0 release (2020-12-08 15:55:19 +0000)
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
023e57b93a24f2e7901cf460a45cb5058fa23549:hw/virtio-pci Added AER capability. (2020-12-08 13:48:58 -0500)
Quoted 8 lines
----------------------------------------------------------------
pc,pci,virtio: fixes, cleanupsLots of fixes, cleanups.
CPU hot-unplug improvements.
A new AER property for virtio devices, adding a dummy AER capability.Signed-off-by Michael S. Tsirkin <[email protected]>
Fails to compile on ppc64:
Run-time dependency capstone found: NO (tried pkgconfig) Configuring capstone-defs.h using configuration Run-time dependency slirp found: NO (tried pkgconfig) Configuring libslirp-version.h using configuration Library fdt found: YES
Configuring config-host.h using configuration Program scripts/hxtool found: YES
Program scripts/shaderinclude.pl found: YES Program scripts/qapi-gen.py found: YES
Program scripts/qemu-version.sh found: YES
|Executing subproject libvhost-user method meson | |Project name: libvhost-user |Project version: undefined |C compiler for the host machine: cc (gcc 4.8.5 "cc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-39)")
|C linker for the host machine: cc ld.bfd 2.27-43
|Run-time dependency glib-2.0 found: YES 2.56.1
../../subprojects/libvhost-user/meson.build:12:7: ERROR: C symbol memfd_create not found in header sys/mman.h
A full log can be found at /home/pm215/qemu/build/all/meson-logs/meson-log.txt
FAILED: build.ninja/usr/bin/python3 /home/pm215/qemu/meson/meson.py --internal regenerate /home/pm215/qemu /home/pm215/qemu/build/all --backend ninja
ninja: error: rebuilding 'build.ninja': subcommand failed
make: *** [run-ninja] Error 1
make: Leaving directory `/home/pm215/qemu/build/all'
thanks
-- PMM
Quoted 18 lines · Peter Maydell
Quoted 16 lines · Michael S. Tsirkin
The following changes since commit
553032db17440f8de011390e5a1cfddd13751b0b:Update version for v5.2.0 release (2020-12-08 15:55:19 +0000)
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
023e57b93a24f2e7901cf460a45cb5058fa23549:hw/virtio-pci Added AER capability. (2020-12-08 13:48:58 -0500)
----------------------------------------------------------------
pc,pci,virtio: fixes, cleanups
Quoted 7 lines
Quoted 5 lines
Lots of fixes, cleanups.
CPU hot-unplug improvements.
A new AER property for virtio devices, adding a dummy AER capability.Signed-off-by Michael S. Tsirkin <[email protected]>Fails to compile on ppc64:
You can see the same failure also if you run it through the gitlab CI:
https://gitlab.com/qemu-project/qemu/-/jobs/900063570
-- PMM
Quoted 23 lines · Peter Maydell
Quoted 22 lines · Peter Maydell
Quoted 20 lines · Michael S. Tsirkin
The following changes since commit
553032db17440f8de011390e5a1cfddd13751b0b:Update version for v5.2.0 release (2020-12-08 15:55:19 +0000)
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
023e57b93a24f2e7901cf460a45cb5058fa23549:hw/virtio-pci Added AER capability. (2020-12-08 13:48:58 -0500)
----------------------------------------------------------------
pc,pci,virtio: fixes, cleanupsLots of fixes, cleanups.
CPU hot-unplug improvements.
A new AER property for virtio devices, adding a dummy AER capability.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Michael S. Tsirkin <[email protected]>Fails to compile on ppc64:
You can see the same failure also if you run it through the gitlab CI:
https://gitlab.com/qemu-project/qemu/-/jobs/900063570-- PMM
Dropped the offending patch.