Skip to contentSkip to conversation

virtio: features,fixes

GIT PULL Michael S. Tsirkin 1 participant 20 messages Jul 2, 2024 Networking

lore
Share & tools
lore
#0 lore raw

The following changes since commit 1152a0414944f03231f3177207d379d58125890e:

Merge tag 'pull-xen-20240701' of https://xenbits.xen.org/git-http/people/aperard/qemu-dm into staging (2024-07-01 09:06:25 -0700)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to ec21270229dfef883383402f7f300864295874a5:

hw/pci: Replace -1 with UINT32_MAX for romsize (2024-07-02 10:33:35 -0400)

----------------------------------------------------------------
virtio: features,fixes

A bunch of improvements:
- vhost dirty log is now only scanned once, not once per device
- virtio and vhost now support VIRTIO_F_NOTIFICATION_DATA
- cxl gained DCD emulation support
- pvpanic gained shutdown support
- beginning of patchset for Generic Port Affinity Structure
- s3 support
- friendlier error messages when boot fails on some illegal configs
- for vhost-user, VHOST_USER_SET_LOG_BASE is now only sent once
- vhost-user now works on any POSIX system
- sr-iov VF setup code has been reworked significantly
- new tests, particularly for risc-v ACPI
- bugfixes

----------------------------------------------------------------
Akihiko Odaki (11):
hw/virtio: Free vqs after vhost_dev_cleanup() hw/pci: Rename has_power to enabled hw/ppc/spapr_pci: Do not create DT for disabled PCI device hw/ppc/spapr_pci: Do not reject VFs created after a PF
pcie_sriov: Do not manually unrealize
pcie_sriov: Ensure VF function number does not overflow
pcie_sriov: Reuse SR-IOV VF device instances
pcie_sriov: Release VFs failed to realize
pcie_sriov: Remove num_vfs from PCIESriovPF
pcie_sriov: Register VFs after migration
hw/pci: Replace -1 with UINT32_MAX for romsize

Alejandro Jimenez (1):
pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal

BillXiang (1):
vhost-user: Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests

Christian Pötzsch (1):
Fix vhost user assertion when sending more than one fd

Cindy Lu (1):
virtio-pci: Fix the failure process in kvm_virtio_pci_vector_use_one()

Cédric Le Goater (1):
virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged

David Woodhouse (1):

      hw/i386/fw_cfg: Add etc/e820 to fw_cfg late

Dmitry Frolov (1):
hw/net/virtio-net.c: fix crash in iov_copy()

Fan Ni (12):
hw/cxl/cxl-mailbox-utils: Add dc_event_log_size field to output payload of identify memory device command hw/cxl/cxl-mailbox-utils: Add dynamic capacity region representative and mailbox command support include/hw/cxl/cxl_device: Rename mem_size as static_mem_size for type3 memory devices hw/mem/cxl_type3: Add support to create DC regions to type3 memory devices hw/mem/cxl-type3: Refactor ct3_build_cdat_entries_for_mr to take mr size instead of mr as argument hw/mem/cxl_type3: Add host backend and address space handling for DC regions hw/mem/cxl_type3: Add DC extent list representative and get DC extent list mailbox support hw/cxl/cxl-mailbox-utils: Add mailbox commands to support add/release dynamic capacity response hw/cxl/events: Add qmp interfaces to add/release dynamic capacity extents hw/mem/cxl_type3: Add DPA range validation for accesses to DC regions hw/cxl/cxl-mailbox-utils: Add superset extent release mailbox support
hw/mem/cxl_type3: Allow to release extent superset in QMP interface

Gregory Price (2):
hw/cxl/mailbox: change CCI cmd set structure to be a member, not a reference hw/cxl/mailbox: interface to add CCI commands to an existing CCI

Halil Pasic (1):
vhost-vsock: add VIRTIO_F_RING_PACKED to feature_bits

Ira Weiny (1):
hw/cxl: Fix read from bogus memory

Jiqian Chen (2):
virtio-pci: only reset pm state during resetting
virtio-pci: implement No_Soft_Reset bit

Jonah Palmer (5):
virtio/virtio-pci: Handle extra notification data
virtio: Prevent creation of device using notification-data with ioeventfd
virtio-mmio: Handle extra notification data
virtio-ccw: Handle extra notification data
vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits

Jonathan Cameron (2):
hw/cxl/events: Improve QMP interfaces and documentation for add/release dynamic capacity. hw/cxl/events: Mark cxl-add-dynamic-capacity and cxl-release-dynamic-capcity unstable

Li Feng (2):
Revert "vhost-user: fix lost reconnect"
vhost-user: fix lost reconnect again

Manos Pitsidianakis (1):
virtio-iommu: add error check before assert

Marc-André Lureau (1):
vhost-user-gpu: fix import of DMABUF

Nicolin Chen (2):
hw/arm/virt-acpi-build: Drop local iort_node_offset hw/arm/virt-acpi-build: Fix id_count in build_iort_id_mapping

Si-Wei Liu (2):
vhost: dirty log should be per backend type
vhost: Perform memory section dirty scans once per iteration

Stefano Garzarella (15):
vhost-vdpa: check vhost_vdpa_set_vring_ready() return value
qapi: clarify that the default is backend dependent
libvhost-user: set msg.msg_control to NULL when it is empty
libvhost-user: fail vu_message_write() if sendmsg() is failing
libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported
vhost-user-server: do not set memory fd non-blocking contrib/vhost-user-blk: fix bind() using the right size of the address contrib/vhost-user-*: use QEMU bswap helper functions
vhost-user: enable frontends on any POSIX system
libvhost-user: enable it on any POSIX system contrib/vhost-user-blk: enable it on any POSIX system
hostmem: add a new memory backend based on POSIX shm_open() tests/qtest/vhost-user-blk-test: use memory-backend-shm tests/qtest/vhost-user-test: add a test case for memory-backend-shm
virtio: remove virtio_tswap16s() call in vring_packed_event_read()

Sunil V L (15):
uefi-test-tools/UefiTestToolsPkg: Add RISC-V support
uefi-test-tools: Add support for python based build script tests/data/uefi-boot-images: Add RISC-V ISO image
qtest: bios-tables-test: Rename aarch64 tests with aarch64 in them tests/qtest/bios-tables-test.c: Add support for arch in path tests/qtest/bios-tables-test.c: Set "arch" for aarch64 tests tests/qtest/bios-tables-test.c: Set "arch" for x86 tests tests/data/acpi: Move x86 ACPI tables under x86/${machine} path tests/data/acpi/virt: Move ARM64 ACPI tables under aarch64/${machine} path meson.build: Add RISC-V to the edk2-target list pc-bios/meson.build: Add support for RISC-V in unpack_edk2_blobs tests/data/acpi/rebuild-expected-aml.sh: Add RISC-V tests/qtest/bios-tables-test: Add empty ACPI data files for RISC-V tests/qtest/bios-tables-test.c: Enable basic testing for RISC-V tests/qtest/bios-tables-test: Add expected ACPI data files for RISC-V

Thomas Huth (1):
hw/virtio: Fix the de-initialization of vhost-user devices

Thomas Weißschuh (6):
linux-headers: update to 6.10-rc1
hw/misc/pvpanic: centralize definition of supported events tests/qtest/pvpanic: use centralized definition of supported events hw/misc/pvpanic: add support for normal shutdowns tests/qtest/pvpanic: add tests for pvshutdown event Revert "docs/specs/pvpanic: mark shutdown event as not implemented"

Wafer (1):
hw/virtio: Fix obtain the buffer id from the last descriptor

Yuxue Liu (1):
vhost-user-test: no set non-blocking for cal fd less than 0.

Zhao Liu (1):
i386/apic: Add hint on boot failure because of disabling x2APIC

 docs/pcie_sriov.txt                                |   8 +-
 qapi/cxl.json                                      | 189 ++++++
 qapi/qom.json                                      |  27 +-
 qapi/run-state.json                                |  14 +
 hw/i386/e820_memory_layout.h                       |   8 +-
 hw/i386/fw_cfg.h                                   |   1 +
 include/hw/cxl/cxl_device.h                        |  85 ++-
 include/hw/cxl/cxl_events.h                        |  18 +
 include/hw/misc/pvpanic.h                          |   6 +
 include/hw/pci/pci.h                               |   2 +-
 include/hw/pci/pci_device.h                        |  17 +-
 include/hw/pci/pcie_sriov.h                        |   9 +-
 include/hw/virtio/vhost-user.h                     |   3 +-
 include/hw/virtio/vhost.h                          |   1 +
 include/hw/virtio/virtio-pci.h                     |   5 +
 include/hw/virtio/virtio.h                         |  10 +-
 include/standard-headers/linux/ethtool.h           |  55 ++
 include/standard-headers/linux/pci_regs.h          |   6 +
 include/standard-headers/linux/virtio_bt.h         |   1 -
 include/standard-headers/linux/virtio_mem.h        |   2 +
 include/standard-headers/linux/virtio_net.h        | 143 +++++
 include/standard-headers/misc/pvpanic.h            |   7 +-
 include/sysemu/runstate.h                          |   1 +
 linux-headers/asm-generic/unistd.h                 |   5 +-
 linux-headers/asm-mips/unistd_n32.h                |   1 +
 linux-headers/asm-mips/unistd_n64.h                |   1 +
 linux-headers/asm-mips/unistd_o32.h                |   1 +
 linux-headers/asm-powerpc/unistd_32.h              |   1 +
 linux-headers/asm-powerpc/unistd_64.h              |   1 +
 linux-headers/asm-s390/unistd_32.h                 |   1 +
 linux-headers/asm-s390/unistd_64.h                 |   1 +
 linux-headers/asm-x86/unistd_32.h                  |   1 +
 linux-headers/asm-x86/unistd_64.h                  |   1 +
 linux-headers/asm-x86/unistd_x32.h                 |   2 +
 linux-headers/linux/kvm.h                          |   4 +-
 linux-headers/linux/stddef.h                       |   8 +
 subprojects/libvhost-user/libvhost-user.h          |   2 +-
 backends/hostmem-shm.c                             | 123 ++++
 contrib/vhost-user-blk/vhost-user-blk.c            |  27 +-
 contrib/vhost-user-input/main.c                    |  16 +-
 hw/arm/virt-acpi-build.c                           |  22 +-
 hw/block/vhost-user-blk.c                          |   6 +-
 hw/core/machine.c                                  |   1 +
 hw/cxl/cxl-mailbox-utils.c                         | 658 ++++++++++++++++++++-
 hw/display/vhost-user-gpu.c                        |   5 +-
 hw/i386/e820_memory_layout.c                       |  17 +-
 hw/i386/fw_cfg.c                                   |  18 +-
 hw/i386/microvm.c                                  |   4 +-
 hw/i386/pc.c                                       |   1 +
 hw/intc/apic_common.c                              |   7 +-
 hw/mem/cxl_type3.c                                 | 637 ++++++++++++++++++--
 hw/mem/cxl_type3_stubs.c                           |  25 +
 hw/misc/pvpanic-isa.c                              |   3 +-
 hw/misc/pvpanic-pci.c                              |   2 +-
 hw/misc/pvpanic.c                                  |   7 +-
 hw/net/igb.c                                       |  13 +-
 hw/net/vhost_net.c                                 |   7 +
 hw/net/virtio-net.c                                |   4 +
 hw/nvme/ctrl.c                                     |  24 +-
 hw/pci/pci.c                                       |  29 +-
 hw/pci/pci_host.c                                  |   4 +-
 hw/pci/pcie_sriov.c                                | 149 ++---
 hw/ppc/spapr_pci.c                                 |   8 +-
 hw/s390x/s390-virtio-ccw.c                         |  17 +-
 hw/scsi/vhost-scsi.c                               |   1 +
 hw/scsi/vhost-user-scsi.c                          |   7 +-
 hw/virtio/vhost-user-base.c                        |   7 +-
 hw/virtio/vhost-user-fs.c                          |   2 +-
 hw/virtio/vhost-user-vsock.c                       |   1 +
 hw/virtio/vhost-user.c                             |  19 +-
 hw/virtio/vhost-vsock-common.c                     |   1 +
 hw/virtio/vhost.c                                  | 112 +++-
 hw/virtio/virtio-iommu.c                           |  43 ++
 hw/virtio/virtio-mmio.c                            |  11 +-
 hw/virtio/virtio-pci.c                             |  67 ++-
 hw/virtio/virtio.c                                 |  46 +-
 hw/xen/xen_pt_load_rom.c                           |   2 +-
 net/vhost-vdpa.c                                   |  16 +-
 subprojects/libvhost-user/libvhost-user.c          |  79 ++-
 system/runstate.c                                  |   6 +
 target/i386/kvm/kvm.c                              |   6 +-
 target/i386/kvm/xen-emu.c                          |   7 +-
 tests/qtest/bios-tables-test.c                     | 169 +++++-
 tests/qtest/pvpanic-pci-test.c                     |  44 +-
 tests/qtest/pvpanic-test.c                         |  34 +-
 tests/qtest/vhost-user-blk-test.c                  |   2 +-
 tests/qtest/vhost-user-test.c                      |  28 +-
 util/vhost-user-server.c                           |  12 +
 backends/meson.build                               |   1 +
 docs/specs/pvpanic.rst                             |   2 +-
 docs/system/devices/vhost-user.rst                 |   5 +-
 hw/block/Kconfig                                   |   2 +-
 hw/pci/trace-events                                |   2 +-
 meson.build                                        |   7 +-
 pc-bios/meson.build                                |   2 +
 qemu-options.hx                                    |  16 +
 tests/data/acpi/{ => aarch64}/virt/APIC            | Bin
 .../data/acpi/{ => aarch64}/virt/APIC.acpihmatvirt | Bin
 tests/data/acpi/{ => aarch64}/virt/APIC.topology   | Bin
 tests/data/acpi/{ => aarch64}/virt/DBG2            | Bin
 tests/data/acpi/{ => aarch64}/virt/DSDT            | Bin
 .../data/acpi/{ => aarch64}/virt/DSDT.acpihmatvirt | Bin
 tests/data/acpi/{ => aarch64}/virt/DSDT.memhp      | Bin
 tests/data/acpi/{ => aarch64}/virt/DSDT.pxb        | Bin
 tests/data/acpi/{ => aarch64}/virt/DSDT.topology   | Bin
 tests/data/acpi/{ => aarch64}/virt/FACP            | Bin
 tests/data/acpi/{ => aarch64}/virt/GTDT            | Bin
 .../data/acpi/{ => aarch64}/virt/HMAT.acpihmatvirt | Bin
 tests/data/acpi/{ => aarch64}/virt/IORT            | Bin
 tests/data/acpi/{ => aarch64}/virt/MCFG            | Bin
 tests/data/acpi/{ => aarch64}/virt/NFIT.memhp      | Bin
 tests/data/acpi/{ => aarch64}/virt/PPTT            | Bin
 .../data/acpi/{ => aarch64}/virt/PPTT.acpihmatvirt | Bin
 tests/data/acpi/{ => aarch64}/virt/PPTT.topology   | Bin
 tests/data/acpi/{pc => aarch64/virt}/SLIT.memhp    | Bin
 tests/data/acpi/{ => aarch64}/virt/SPCR            | Bin
 .../data/acpi/{ => aarch64}/virt/SRAT.acpihmatvirt | Bin
 tests/data/acpi/{ => aarch64}/virt/SRAT.memhp      | Bin
 tests/data/acpi/{ => aarch64}/virt/SRAT.numamem    | Bin
 tests/data/acpi/{ => aarch64}/virt/SSDT.memhp      | Bin
 tests/data/acpi/{ => aarch64}/virt/VIOT            | Bin
 tests/data/acpi/rebuild-expected-aml.sh            |   5 +-
 tests/data/acpi/riscv64/virt/APIC                  | Bin 0 -> 116 bytes
 tests/data/acpi/riscv64/virt/DSDT                  | Bin 0 -> 3518 bytes
 tests/data/acpi/riscv64/virt/FACP                  | Bin 0 -> 276 bytes
 tests/data/acpi/riscv64/virt/MCFG                  | Bin 0 -> 60 bytes
 tests/data/acpi/riscv64/virt/RHCT                  | Bin 0 -> 314 bytes
 tests/data/acpi/riscv64/virt/SPCR                  | Bin 0 -> 80 bytes
 tests/data/acpi/{ => x86}/microvm/APIC             | Bin
 tests/data/acpi/{ => x86}/microvm/APIC.ioapic2     | Bin
 tests/data/acpi/{ => x86}/microvm/APIC.pcie        | Bin
 tests/data/acpi/{ => x86}/microvm/DSDT             | Bin
 tests/data/acpi/{ => x86}/microvm/DSDT.ioapic2     | Bin
 tests/data/acpi/{ => x86}/microvm/DSDT.pcie        | Bin
 tests/data/acpi/{ => x86}/microvm/DSDT.rtc         | Bin
 tests/data/acpi/{ => x86}/microvm/DSDT.usb         | Bin
 tests/data/acpi/{ => x86}/microvm/ERST.pcie        | Bin
 tests/data/acpi/{ => x86}/microvm/FACP             | Bin
 tests/data/acpi/{ => x86}/pc/APIC                  | Bin
 tests/data/acpi/{ => x86}/pc/APIC.acpihmat         | Bin
 tests/data/acpi/{ => x86}/pc/APIC.cphp             | Bin
 tests/data/acpi/{ => x86}/pc/APIC.dimmpxm          | Bin
 tests/data/acpi/{ => x86}/pc/DSDT                  | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.acpierst         | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.acpihmat         | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.bridge           | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.cphp             | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.dimmpxm          | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.hpbridge         | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.hpbrroot         | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.ipmikcs          | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.memhp            | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.nohpet           | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.numamem          | Bin
 tests/data/acpi/{ => x86}/pc/DSDT.roothp           | Bin
 tests/data/acpi/{ => x86}/pc/ERST.acpierst         | Bin
 tests/data/acpi/{ => x86}/pc/FACP                  | Bin
 tests/data/acpi/{ => x86}/pc/FACP.nosmm            | Bin
 tests/data/acpi/{ => x86}/pc/FACS                  | Bin
 tests/data/acpi/{ => x86}/pc/HMAT.acpihmat         | Bin
 tests/data/acpi/{ => x86}/pc/HPET                  | Bin
 tests/data/acpi/{ => x86}/pc/NFIT.dimmpxm          | Bin
 tests/data/acpi/{ => x86}/pc/SLIT.cphp             | Bin
 tests/data/acpi/{q35 => x86/pc}/SLIT.memhp         | Bin
 tests/data/acpi/{ => x86}/pc/SRAT.acpihmat         | Bin
 tests/data/acpi/{ => x86}/pc/SRAT.cphp             | Bin
 tests/data/acpi/{ => x86}/pc/SRAT.dimmpxm          | Bin
 tests/data/acpi/{ => x86}/pc/SRAT.memhp            | Bin
 tests/data/acpi/{ => x86}/pc/SRAT.numamem          | Bin
 tests/data/acpi/{ => x86}/pc/SSDT.dimmpxm          | Bin
 tests/data/acpi/{ => x86}/pc/WAET                  | Bin
 tests/data/acpi/{ => x86}/q35/APIC                 | Bin
 tests/data/acpi/{ => x86}/q35/APIC.acpihmat        | Bin
 .../acpi/{ => x86}/q35/APIC.acpihmat-noinitiator   | Bin
 tests/data/acpi/{ => x86}/q35/APIC.core-count      | Bin
 tests/data/acpi/{ => x86}/q35/APIC.core-count2     | Bin
 tests/data/acpi/{ => x86}/q35/APIC.cphp            | Bin
 tests/data/acpi/{ => x86}/q35/APIC.dimmpxm         | Bin
 tests/data/acpi/{ => x86}/q35/APIC.thread-count    | Bin
 tests/data/acpi/{ => x86}/q35/APIC.thread-count2   | Bin
 tests/data/acpi/{ => x86}/q35/APIC.type4-count     | Bin
 tests/data/acpi/{ => x86}/q35/APIC.xapic           | Bin
 tests/data/acpi/{ => x86}/q35/CEDT.cxl             | Bin
 tests/data/acpi/{ => x86}/q35/DMAR.dmar            | Bin
 tests/data/acpi/{ => x86}/q35/DSDT                 | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.acpierst        | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.acpihmat        | Bin
 .../acpi/{ => x86}/q35/DSDT.acpihmat-noinitiator   | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.applesmc        | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.bridge          | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.core-count      | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.core-count2     | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.cphp            | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.cxl             | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.dimmpxm         | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.ipmibt          | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.ipmismbus       | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.ivrs            | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.memhp           | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.mmio64          | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.multi-bridge    | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.noacpihp        | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.nohpet          | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.numamem         | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.pvpanic-isa     | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.thread-count    | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.thread-count2   | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm12       | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm2        | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.type4-count     | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.viot            | Bin
 tests/data/acpi/{ => x86}/q35/DSDT.xapic           | Bin
 tests/data/acpi/{ => x86}/q35/ERST.acpierst        | Bin
 tests/data/acpi/{ => x86}/q35/FACP                 | Bin
 tests/data/acpi/{ => x86}/q35/FACP.core-count      | Bin
 tests/data/acpi/{ => x86}/q35/FACP.core-count2     | Bin
 tests/data/acpi/{ => x86}/q35/FACP.nosmm           | Bin
 tests/data/acpi/{ => x86}/q35/FACP.slic            | Bin
 tests/data/acpi/{ => x86}/q35/FACP.thread-count    | Bin
 tests/data/acpi/{ => x86}/q35/FACP.thread-count2   | Bin
 tests/data/acpi/{ => x86}/q35/FACP.type4-count     | Bin
 tests/data/acpi/{ => x86}/q35/FACP.xapic           | Bin
 tests/data/acpi/{ => x86}/q35/FACS                 | Bin
 tests/data/acpi/{ => x86}/q35/HMAT.acpihmat        | Bin
 .../acpi/{ => x86}/q35/HMAT.acpihmat-noinitiator   | Bin
 tests/data/acpi/{ => x86}/q35/HPET                 | Bin
 tests/data/acpi/{ => x86}/q35/IVRS.ivrs            | Bin
 tests/data/acpi/{ => x86}/q35/MCFG                 | Bin
 tests/data/acpi/{ => x86}/q35/NFIT.dimmpxm         | Bin
 tests/data/acpi/{ => x86}/q35/SLIC.slic            | Bin
 tests/data/acpi/{ => x86}/q35/SLIT.cphp            | Bin
 tests/data/acpi/{virt => x86/q35}/SLIT.memhp       | Bin
 tests/data/acpi/{ => x86}/q35/SRAT.acpihmat        | Bin
 .../acpi/{ => x86}/q35/SRAT.acpihmat-noinitiator   | Bin
 tests/data/acpi/{ => x86}/q35/SRAT.cphp            | Bin
 tests/data/acpi/{ => x86}/q35/SRAT.dimmpxm         | Bin
 tests/data/acpi/{ => x86}/q35/SRAT.memhp           | Bin
 tests/data/acpi/{ => x86}/q35/SRAT.mmio64          | Bin
 tests/data/acpi/{ => x86}/q35/SRAT.numamem         | Bin
 tests/data/acpi/{ => x86}/q35/SRAT.xapic           | Bin
 tests/data/acpi/{ => x86}/q35/SSDT.dimmpxm         | Bin
 tests/data/acpi/{ => x86}/q35/TCPA.tis.tpm12       | Bin
 tests/data/acpi/{ => x86}/q35/TPM2.tis.tpm2        | Bin
 tests/data/acpi/{ => x86}/q35/VIOT.viot            | Bin
 tests/data/acpi/{ => x86}/q35/WAET                 | Bin
 .../bios-tables-test.riscv64.iso.qcow2             | Bin 0 -> 16896 bytes
 tests/qtest/meson.build                            |   3 +
 tests/uefi-test-tools/Makefile                     |  19 +-
 .../UefiTestToolsPkg/UefiTestToolsPkg.dsc          |   6 +-
 tests/uefi-test-tools/uefi-test-build.config       |  52 ++
 util/meson.build                                   |   4 +-
 251 files changed, 2959 insertions(+), 371 deletions(-)
 create mode 100644 backends/hostmem-shm.c
 rename tests/data/acpi/{ => aarch64}/virt/APIC (100%)
 rename tests/data/acpi/{ => aarch64}/virt/APIC.acpihmatvirt (100%)
 rename tests/data/acpi/{ => aarch64}/virt/APIC.topology (100%)
 rename tests/data/acpi/{ => aarch64}/virt/DBG2 (100%)
 rename tests/data/acpi/{ => aarch64}/virt/DSDT (100%)
 rename tests/data/acpi/{ => aarch64}/virt/DSDT.acpihmatvirt (100%)
 rename tests/data/acpi/{ => aarch64}/virt/DSDT.memhp (100%)
 rename tests/data/acpi/{ => aarch64}/virt/DSDT.pxb (100%)
 rename tests/data/acpi/{ => aarch64}/virt/DSDT.topology (100%)
 rename tests/data/acpi/{ => aarch64}/virt/FACP (100%)
 rename tests/data/acpi/{ => aarch64}/virt/GTDT (100%)
 rename tests/data/acpi/{ => aarch64}/virt/HMAT.acpihmatvirt (100%)
 rename tests/data/acpi/{ => aarch64}/virt/IORT (100%)
 rename tests/data/acpi/{ => aarch64}/virt/MCFG (100%)
 rename tests/data/acpi/{ => aarch64}/virt/NFIT.memhp (100%)
 rename tests/data/acpi/{ => aarch64}/virt/PPTT (100%)
 rename tests/data/acpi/{ => aarch64}/virt/PPTT.acpihmatvirt (100%)
 rename tests/data/acpi/{ => aarch64}/virt/PPTT.topology (100%)
 rename tests/data/acpi/{pc => aarch64/virt}/SLIT.memhp (100%)
 rename tests/data/acpi/{ => aarch64}/virt/SPCR (100%)
 rename tests/data/acpi/{ => aarch64}/virt/SRAT.acpihmatvirt (100%)
 rename tests/data/acpi/{ => aarch64}/virt/SRAT.memhp (100%)
 rename tests/data/acpi/{ => aarch64}/virt/SRAT.numamem (100%)
 rename tests/data/acpi/{ => aarch64}/virt/SSDT.memhp (100%)
 rename tests/data/acpi/{ => aarch64}/virt/VIOT (100%)
 create mode 100644 tests/data/acpi/riscv64/virt/APIC
 create mode 100644 tests/data/acpi/riscv64/virt/DSDT
 create mode 100644 tests/data/acpi/riscv64/virt/FACP
 create mode 100644 tests/data/acpi/riscv64/virt/MCFG
 create mode 100644 tests/data/acpi/riscv64/virt/RHCT
 create mode 100644 tests/data/acpi/riscv64/virt/SPCR
 rename tests/data/acpi/{ => x86}/microvm/APIC (100%)
 rename tests/data/acpi/{ => x86}/microvm/APIC.ioapic2 (100%)
 rename tests/data/acpi/{ => x86}/microvm/APIC.pcie (100%)
 rename tests/data/acpi/{ => x86}/microvm/DSDT (100%)
 rename tests/data/acpi/{ => x86}/microvm/DSDT.ioapic2 (100%)
 rename tests/data/acpi/{ => x86}/microvm/DSDT.pcie (100%)
 rename tests/data/acpi/{ => x86}/microvm/DSDT.rtc (100%)
 rename tests/data/acpi/{ => x86}/microvm/DSDT.usb (100%)
 rename tests/data/acpi/{ => x86}/microvm/ERST.pcie (100%)
 rename tests/data/acpi/{ => x86}/microvm/FACP (100%)
 rename tests/data/acpi/{ => x86}/pc/APIC (100%)
 rename tests/data/acpi/{ => x86}/pc/APIC.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/pc/APIC.cphp (100%)
 rename tests/data/acpi/{ => x86}/pc/APIC.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.acpierst (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.bridge (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.cphp (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.hpbridge (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.hpbrroot (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.ipmikcs (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.memhp (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.nohpet (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.numamem (100%)
 rename tests/data/acpi/{ => x86}/pc/DSDT.roothp (100%)
 rename tests/data/acpi/{ => x86}/pc/ERST.acpierst (100%)
 rename tests/data/acpi/{ => x86}/pc/FACP (100%)
 rename tests/data/acpi/{ => x86}/pc/FACP.nosmm (100%)
 rename tests/data/acpi/{ => x86}/pc/FACS (100%)
 rename tests/data/acpi/{ => x86}/pc/HMAT.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/pc/HPET (100%)
 rename tests/data/acpi/{ => x86}/pc/NFIT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/pc/SLIT.cphp (100%)
 rename tests/data/acpi/{q35 => x86/pc}/SLIT.memhp (100%)
 rename tests/data/acpi/{ => x86}/pc/SRAT.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/pc/SRAT.cphp (100%)
 rename tests/data/acpi/{ => x86}/pc/SRAT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/pc/SRAT.memhp (100%)
 rename tests/data/acpi/{ => x86}/pc/SRAT.numamem (100%)
 rename tests/data/acpi/{ => x86}/pc/SSDT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/pc/WAET (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.acpihmat-noinitiator (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.core-count (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.core-count2 (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.cphp (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.thread-count (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.thread-count2 (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.type4-count (100%)
 rename tests/data/acpi/{ => x86}/q35/APIC.xapic (100%)
 rename tests/data/acpi/{ => x86}/q35/CEDT.cxl (100%)
 rename tests/data/acpi/{ => x86}/q35/DMAR.dmar (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.acpierst (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.acpihmat-noinitiator (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.applesmc (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.bridge (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.core-count (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.core-count2 (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.cphp (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.cxl (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.ipmibt (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.ipmismbus (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.ivrs (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.memhp (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.mmio64 (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.multi-bridge (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.noacpihp (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.nohpet (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.numamem (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.pvpanic-isa (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.thread-count (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.thread-count2 (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm12 (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.tis.tpm2 (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.type4-count (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.viot (100%)
 rename tests/data/acpi/{ => x86}/q35/DSDT.xapic (100%)
 rename tests/data/acpi/{ => x86}/q35/ERST.acpierst (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.core-count (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.core-count2 (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.nosmm (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.slic (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.thread-count (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.thread-count2 (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.type4-count (100%)
 rename tests/data/acpi/{ => x86}/q35/FACP.xapic (100%)
 rename tests/data/acpi/{ => x86}/q35/FACS (100%)
 rename tests/data/acpi/{ => x86}/q35/HMAT.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/q35/HMAT.acpihmat-noinitiator (100%)
 rename tests/data/acpi/{ => x86}/q35/HPET (100%)
 rename tests/data/acpi/{ => x86}/q35/IVRS.ivrs (100%)
 rename tests/data/acpi/{ => x86}/q35/MCFG (100%)
 rename tests/data/acpi/{ => x86}/q35/NFIT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/q35/SLIC.slic (100%)
 rename tests/data/acpi/{ => x86}/q35/SLIT.cphp (100%)
 rename tests/data/acpi/{virt => x86/q35}/SLIT.memhp (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.acpihmat (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.acpihmat-noinitiator (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.cphp (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.memhp (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.mmio64 (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.numamem (100%)
 rename tests/data/acpi/{ => x86}/q35/SRAT.xapic (100%)
 rename tests/data/acpi/{ => x86}/q35/SSDT.dimmpxm (100%)
 rename tests/data/acpi/{ => x86}/q35/TCPA.tis.tpm12 (100%)
 rename tests/data/acpi/{ => x86}/q35/TPM2.tis.tpm2 (100%)
 rename tests/data/acpi/{ => x86}/q35/VIOT.viot (100%)
 rename tests/data/acpi/{ => x86}/q35/WAET (100%)
 create mode 100644 tests/data/uefi-boot-images/bios-tables-test.riscv64.iso.qcow2
 create mode 100644 tests/uefi-test-tools/uefi-test-build.config
#1 lore raw

[PULL v2 08/91] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits

From: Jonah Palmer <[email protected]>

Add support for the VIRTIO_F_NOTIFICATION_DATA feature across a variety of vhost devices.

The inclusion of VIRTIO_F_NOTIFICATION_DATA in the feature bits arrays for these devices ensures that the backend is capable of offering and providing support for this feature, and that it can be disabled if the backend does not support it.

Message-Id: <[email protected]>

---
 hw/block/vhost-user-blk.c    | 1 +
 hw/net/vhost_net.c           | 2 ++
 hw/scsi/vhost-scsi.c         | 1 +
 hw/scsi/vhost-user-scsi.c    | 1 +
 hw/virtio/vhost-user-fs.c    | 2 +-
 hw/virtio/vhost-user-vsock.c | 1 +
 net/vhost-vdpa.c             | 1 +
 7 files changed, 8 insertions(+), 1 deletion(-)
hw/block/vhost-user-blk.c +1 -0
index 9e6bbc6950..bc2677dbef 100644
@@ -51,6 +51,7 @@ static const int user_feature_bits[] = {
     VIRTIO_F_RING_PACKED,
     VIRTIO_F_IOMMU_PLATFORM,
     VIRTIO_F_RING_RESET,
+    VIRTIO_F_NOTIFICATION_DATA,
     VHOST_INVALID_FEATURE_BIT
 };
 
hw/net/vhost_net.c +2 -0
index fd1a93701a..18898afe81 100644
@@ -48,6 +48,7 @@ static const int kernel_feature_bits[] = {
     VIRTIO_F_IOMMU_PLATFORM,
     VIRTIO_F_RING_PACKED,
     VIRTIO_F_RING_RESET,
+    VIRTIO_F_NOTIFICATION_DATA,
     VIRTIO_NET_F_HASH_REPORT,
     VHOST_INVALID_FEATURE_BIT
 };
@@ -55,6 +56,7 @@ static const int kernel_feature_bits[] = {
 /* Features supported by others. */
 static const int user_feature_bits[] = {
     VIRTIO_F_NOTIFY_ON_EMPTY,
+    VIRTIO_F_NOTIFICATION_DATA,
     VIRTIO_RING_F_INDIRECT_DESC,
     VIRTIO_RING_F_EVENT_IDX,
 
hw/scsi/vhost-scsi.c +1 -0
index ae26bc19a4..3d5fe0994d 100644
@@ -38,6 +38,7 @@ static const int kernel_feature_bits[] = {
     VIRTIO_RING_F_EVENT_IDX,
     VIRTIO_SCSI_F_HOTPLUG,
     VIRTIO_F_RING_RESET,
+    VIRTIO_F_NOTIFICATION_DATA,
     VHOST_INVALID_FEATURE_BIT
 };
 
hw/scsi/vhost-user-scsi.c +1 -0
index a63b1f4948..0b050805a8 100644
@@ -36,6 +36,7 @@ static const int user_feature_bits[] = {
     VIRTIO_RING_F_EVENT_IDX,
     VIRTIO_SCSI_F_HOTPLUG,
     VIRTIO_F_RING_RESET,
+    VIRTIO_F_NOTIFICATION_DATA,
     VHOST_INVALID_FEATURE_BIT
 };
 
hw/virtio/vhost-user-fs.c +1 -1
index cca2cd41be..ae48cc1c96 100644
@@ -33,7 +33,7 @@ static const int user_feature_bits[] = {
     VIRTIO_F_RING_PACKED,
     VIRTIO_F_IOMMU_PLATFORM,
     VIRTIO_F_RING_RESET,
-
+    VIRTIO_F_NOTIFICATION_DATA,
     VHOST_INVALID_FEATURE_BIT
 };
 
hw/virtio/vhost-user-vsock.c +1 -0
index 9431b9792c..802b44a07d 100644
@@ -21,6 +21,7 @@ static const int user_feature_bits[] = {
     VIRTIO_RING_F_INDIRECT_DESC,
     VIRTIO_RING_F_EVENT_IDX,
     VIRTIO_F_NOTIFY_ON_EMPTY,
+    VIRTIO_F_NOTIFICATION_DATA,
     VHOST_INVALID_FEATURE_BIT
 };
 
net/vhost-vdpa.c +1 -0
index eda714d1a4..daa38428c5 100644
@@ -62,6 +62,7 @@ const int vdpa_feature_bits[] = {
     VIRTIO_F_RING_PACKED,
     VIRTIO_F_RING_RESET,
     VIRTIO_F_VERSION_1,
+    VIRTIO_F_NOTIFICATION_DATA,
     VIRTIO_NET_F_CSUM,
     VIRTIO_NET_F_CTRL_GUEST_OFFLOADS,
     VIRTIO_NET_F_CTRL_MAC_ADDR,
Signature · 1 line
MST
#2 lore raw

[PULL v2 01/91] vhost: dirty log should be per backend type

In reply to Michael S. Tsirkin

From: Si-Wei Liu <[email protected]>

There could be a mix of both vhost-user and vhost-kernel clients in the same QEMU process, where separate vhost loggers for the specific vhost type have to be used. Make the vhost logger per backend type, and have them properly reference counted.

Message-Id: <[email protected]>

---
 hw/virtio/vhost.c | 45 +++++++++++++++++++++++++++++++++------------
 1 file changed, 33 insertions(+), 12 deletions(-)
hw/virtio/vhost.c +33 -12
index 4acd77e890..a1e8b79e1a 100644
@@ -43,8 +43,8 @@
     do { } while (0)
 #endif
 
-static struct vhost_log *vhost_log;
-static struct vhost_log *vhost_log_shm;
+static struct vhost_log *vhost_log[VHOST_BACKEND_TYPE_MAX];
+static struct vhost_log *vhost_log_shm[VHOST_BACKEND_TYPE_MAX];
 
 /* Memslots used by backends that support private memslots (without an fd). */
 static unsigned int used_memslots;
@@ -287,6 +287,10 @@ static int vhost_set_backend_type(struct vhost_dev *dev,
         r = -1;
     }
 
+    if (r == 0) {
+        assert(dev->vhost_ops->backend_type == backend_type);
+    }
+
     return r;
 }
 
@@ -319,16 +323,22 @@ static struct vhost_log *vhost_log_alloc(uint64_t size, bool share)
     return log;
 }
 
-static struct vhost_log *vhost_log_get(uint64_t size, bool share)
+static struct vhost_log *vhost_log_get(VhostBackendType backend_type,
+                                       uint64_t size, bool share)
 {
-    struct vhost_log *log = share ? vhost_log_shm : vhost_log;
+    struct vhost_log *log;
+
+    assert(backend_type > VHOST_BACKEND_TYPE_NONE);
+    assert(backend_type < VHOST_BACKEND_TYPE_MAX);
+
+    log = share ? vhost_log_shm[backend_type] : vhost_log[backend_type];
 
     if (!log || log->size != size) {
         log = vhost_log_alloc(size, share);
         if (share) {
-            vhost_log_shm = log;
+            vhost_log_shm[backend_type] = log;
         } else {
-            vhost_log = log;
+            vhost_log[backend_type] = log;
         }
     } else {
         ++log->refcnt;
@@ -340,11 +350,20 @@ static struct vhost_log *vhost_log_get(uint64_t size, bool share)
 static void vhost_log_put(struct vhost_dev *dev, bool sync)
 {
     struct vhost_log *log = dev->log;
+    VhostBackendType backend_type;
 
     if (!log) {
         return;
     }
 
+    assert(dev->vhost_ops);
+    backend_type = dev->vhost_ops->backend_type;
+
+    if (backend_type == VHOST_BACKEND_TYPE_NONE ||
+        backend_type >= VHOST_BACKEND_TYPE_MAX) {
+        return;
+    }
+
     --log->refcnt;
     if (log->refcnt == 0) {
         /* Sync only the range covered by the old log */
@@ -352,13 +371,13 @@ static void vhost_log_put(struct vhost_dev *dev, bool sync)
             vhost_log_sync_range(dev, 0, dev->log_size * VHOST_LOG_CHUNK - 1);
         }
 
-        if (vhost_log == log) {
+        if (vhost_log[backend_type] == log) {
             g_free(log->log);
-            vhost_log = NULL;
-        } else if (vhost_log_shm == log) {
+            vhost_log[backend_type] = NULL;
+        } else if (vhost_log_shm[backend_type] == log) {
             qemu_memfd_free(log->log, log->size * sizeof(*(log->log)),
                             log->fd);
-            vhost_log_shm = NULL;
+            vhost_log_shm[backend_type] = NULL;
         }
 
         g_free(log);
@@ -376,7 +395,8 @@ static bool vhost_dev_log_is_shared(struct vhost_dev *dev)
 
 static inline void vhost_dev_log_resize(struct vhost_dev *dev, uint64_t size)
 {
-    struct vhost_log *log = vhost_log_get(size, vhost_dev_log_is_shared(dev));
+    struct vhost_log *log = vhost_log_get(dev->vhost_ops->backend_type,
+                                          size, vhost_dev_log_is_shared(dev));
     uint64_t log_base = (uintptr_t)log->log;
     int r;
 
@@ -2044,7 +2064,8 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings)
         uint64_t log_base;
 
         hdev->log_size = vhost_get_log_size(hdev);
-        hdev->log = vhost_log_get(hdev->log_size,
+        hdev->log = vhost_log_get(hdev->vhost_ops->backend_type,
+                                  hdev->log_size,
                                   vhost_dev_log_is_shared(hdev));
         log_base = (uintptr_t)hdev->log->log;
         r = hdev->vhost_ops->vhost_set_log_base(hdev,
Signature · 1 line
MST
#3 lore raw

[PULL v2 05/91] virtio: Prevent creation of device using notification-data with ioeventfd

In reply to Michael S. Tsirkin

From: Jonah Palmer <[email protected]>

Prevent the realization of a virtio device that attempts to use the VIRTIO_F_NOTIFICATION_DATA transport feature without disabling ioeventfd.

Due to ioeventfd not being able to carry the extra data associated with this feature, having both enabled is a functional mismatch and therefore Qemu should not continue the device's realization process.

Although the device does not yet know if the feature will be successfully negotiated, many devices using this feature wont actually work without this extra data and would fail FEATURES_OK anyway.

If ioeventfd is able to work with the extra notification data in the future, this compatibility check can be removed.

Message-Id: <[email protected]>

---
 hw/virtio/virtio.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
hw/virtio/virtio.c +22 -0
index f7c99e3a96..28cd406e16 100644
@@ -2980,6 +2980,20 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
     return ret;
 }
 
+static void virtio_device_check_notification_compatibility(VirtIODevice *vdev,
+                                                           Error **errp)
+{
+    VirtioBusState *bus = VIRTIO_BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(bus);
+    DeviceState *proxy = DEVICE(BUS(bus)->parent);
+
+    if (virtio_host_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA) &&
+        k->ioeventfd_enabled(proxy)) {
+        error_setg(errp,
+                   "notification_data=on without ioeventfd=off is not supported");
+    }
+}
+
 size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
                               uint64_t host_features)
 {
@@ -3740,6 +3754,14 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)
         }
     }
 
+    /* Devices should not use both ioeventfd and notification data feature */
+    virtio_device_check_notification_compatibility(vdev, &err);
+    if (err != NULL) {
+        error_propagate(errp, err);
+        vdc->unrealize(dev);
+        return;
+    }
+
     virtio_bus_device_plugged(vdev, &err);
     if (err != NULL) {
         error_propagate(errp, err);
Signature · 1 line
MST
#4 lore raw

[PULL v2 02/91] vhost: Perform memory section dirty scans once per iteration

In reply to Michael S. Tsirkin

From: Si-Wei Liu <[email protected]>

On setups with one or more virtio-net devices with vhost on, dirty tracking iteration increases cost the bigger the number amount of queues are set up e.g. on idle guests migration the following is observed with virtio-net with vhost=on:

48 queues -> 78.11%  [.] vhost_dev_sync_region.isra.13
8 queues -> 40.50%   [.] vhost_dev_sync_region.isra.13
1 queue -> 6.89%     [.] vhost_dev_sync_region.isra.13

2 devices, 1 queue -> 18.60% [.] vhost_dev_sync_region.isra.14

With high memory rates the symptom is lack of convergence as soon as it has a vhost device with a sufficiently high number of queues, the sufficient number of vhost devices.

On every migration iteration (every 100msecs) it will redundantly query the *shared log* the number of queues configured with vhost that exist in the guest. For the virtqueue data, this is necessary, but not for the memory sections which are the same. So essentially we end up scanning the dirty log too often.

To fix that, select a vhost device responsible for scanning the log with regards to memory sections dirty tracking. It is selected when we enable the logger (during migration) and cleared when we disable the logger. If the vhost logger device goes away for some reason, the logger will be re-selected from the rest of vhost devices.

After making mem-section logger a singleton instance, constant cost of 7%-9% (like the 1 queue report) will be seen, no matter how many queues or how many vhost devices are configured:

48 queues -> 8.71% [.] vhost_dev_sync_region.isra.13
2 devices, 8 queues -> 7.97% [.] vhost_dev_sync_region.isra.14

Message-Id: <[email protected]>

---
 include/hw/virtio/vhost.h |  1 +
 hw/virtio/vhost.c         | 67 +++++++++++++++++++++++++++++++++++----
 2 files changed, 62 insertions(+), 6 deletions(-)
include/hw/virtio/vhost.h +1 -0
index 02477788df..d75faf46e9 100644
@@ -129,6 +129,7 @@ struct vhost_dev {
     void *opaque;
     struct vhost_log *log;
     QLIST_ENTRY(vhost_dev) entry;
+    QLIST_ENTRY(vhost_dev) logdev_entry;
     QLIST_HEAD(, vhost_iommu) iommu_list;
     IOMMUNotifier n;
     const VhostDevConfigOps *config_ops;
hw/virtio/vhost.c +61 -6

103 lines not on this page · raw message

Signature · 1 line
MST
#5 lore raw

[PULL v2 04/91] virtio/virtio-pci: Handle extra notification data

In reply to Michael S. Tsirkin

From: Jonah Palmer <[email protected]>

Add support to virtio-pci devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated.

The extra data that's passed to the virtio-pci device when this feature is enabled varies depending on the device's virtqueue layout.

In a split virtqueue layout, this data includes:
- upper 16 bits: shadow_avail_idx
- lower 16 bits: virtqueue index

In a packed virtqueue layout, this data includes:
- upper 16 bits: 1-bit wrap counter & 15-bit shadow_avail_idx
- lower 16 bits: virtqueue index

Message-Id: <[email protected]>

---
 include/hw/virtio/virtio.h |  2 ++
 hw/virtio/virtio-pci.c     | 12 +++++++++---
 hw/virtio/virtio.c         | 18 ++++++++++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)
include/hw/virtio/virtio.h +2 -0
index 7d5ffdc145..1451926a13 100644
@@ -307,6 +307,8 @@ int virtio_queue_ready(VirtQueue *vq);
 
 int virtio_queue_empty(VirtQueue *vq);
 
+void virtio_queue_set_shadow_avail_idx(VirtQueue *vq, uint16_t idx);
+
 /* Host binding interface.  */
 
 uint32_t virtio_config_readb(VirtIODevice *vdev, uint32_t addr);
hw/virtio/virtio-pci.c +9 -3
index b1d02f4b3d..cffc7efcae 100644
@@ -384,7 +384,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
 {
     VirtIOPCIProxy *proxy = opaque;
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
-    uint16_t vector;
+    uint16_t vector, vq_idx;
     hwaddr pa;
 
     switch (addr) {
@@ -408,8 +408,14 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
             vdev->queue_sel = val;
         break;
     case VIRTIO_PCI_QUEUE_NOTIFY:
-        if (val < VIRTIO_QUEUE_MAX) {
-            virtio_queue_notify(vdev, val);
+        vq_idx = val;
+        if (vq_idx < VIRTIO_QUEUE_MAX && virtio_queue_get_num(vdev, vq_idx)) {
+            if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) {
+                VirtQueue *vq = virtio_get_queue(vdev, vq_idx);
+
+                virtio_queue_set_shadow_avail_idx(vq, val >> 16);
+            }
+            virtio_queue_notify(vdev, vq_idx);
         }
         break;
     case VIRTIO_PCI_STATUS:
hw/virtio/virtio.c +18 -0
index 893a072c9d..f7c99e3a96 100644
@@ -2264,6 +2264,24 @@ void virtio_queue_set_align(VirtIODevice *vdev, int n, int align)
     }
 }
 
+void virtio_queue_set_shadow_avail_idx(VirtQueue *vq, uint16_t shadow_avail_idx)
+{
+    if (!vq->vring.desc) {
+        return;
+    }
+
+    /*
+     * 16-bit data for packed VQs include 1-bit wrap counter and
+     * 15-bit shadow_avail_idx.
+     */
+    if (virtio_vdev_has_feature(vq->vdev, VIRTIO_F_RING_PACKED)) {
+        vq->shadow_avail_wrap_counter = (shadow_avail_idx >> 15) & 0x1;
+        vq->shadow_avail_idx = shadow_avail_idx & 0x7FFF;
+    } else {
+        vq->shadow_avail_idx = shadow_avail_idx;
+    }
+}
+
 static void virtio_queue_notify_vq(VirtQueue *vq)
 {
     if (vq->vring.desc && vq->handle_output) {
Signature · 1 line
MST
#6 lore raw

[PULL v2 07/91] virtio-ccw: Handle extra notification data

In reply to Michael S. Tsirkin

From: Jonah Palmer <[email protected]>

Add support to virtio-ccw devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated.

The extra data that's passed to the virtio-ccw device when this feature is enabled varies depending on the device's virtqueue layout.

That data passed to the virtio-ccw device is in the same format as the data passed to virtio-pci devices.

Message-Id: <[email protected]>

---
 hw/s390x/s390-virtio-ccw.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
hw/s390x/s390-virtio-ccw.c +13 -4
index cd063f8b64..8cd912f20e 100644
@@ -126,9 +126,11 @@ static void subsystem_reset(void)
 static int virtio_ccw_hcall_notify(const uint64_t *args)
 {
     uint64_t subch_id = args[0];
-    uint64_t queue = args[1];
+    uint64_t data = args[1];
     SubchDev *sch;
+    VirtIODevice *vdev;
     int cssid, ssid, schid, m;
+    uint16_t vq_idx = data;
 
     if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) {
         return -EINVAL;
@@ -137,12 +139,19 @@ static int virtio_ccw_hcall_notify(const uint64_t *args)
     if (!sch || !css_subch_visible(sch)) {
         return -EINVAL;
     }
-    if (queue >= VIRTIO_QUEUE_MAX) {
+
+    vdev = virtio_ccw_get_vdev(sch);
+    if (vq_idx >= VIRTIO_QUEUE_MAX || !virtio_queue_get_num(vdev, vq_idx)) {
         return -EINVAL;
     }
-    virtio_queue_notify(virtio_ccw_get_vdev(sch), queue);
-    return 0;
 
+    if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) {
+        virtio_queue_set_shadow_avail_idx(virtio_get_queue(vdev, vq_idx),
+                                          (data >> 16) & 0xFFFF);
+    }
+
+    virtio_queue_notify(vdev, vq_idx);
+    return 0;
 }
 
 static int virtio_ccw_hcall_early_printk(const uint64_t *args)
Signature · 1 line
MST
#7 lore raw

[PULL v2 15/91] vhost-user: fix lost reconnect again

In reply to Michael S. Tsirkin

From: Li Feng <[email protected]>

When the vhost-user is reconnecting to the backend, and if the vhost-user fails at the get_features in vhost_dev_init(), then the reconnect will fail and it will not be retriggered forever.

The reason is:
When the vhost-user fail at get_features, the vhost_dev_cleanup will be called immediately.

vhost_dev_cleanup calls 'memset(hdev, 0, sizeof(struct vhost_dev))'.

The reconnect path is:
vhost_user_blk_event
vhost_user_async_close(.. vhost_user_blk_disconnect ..)
qemu_chr_fe_set_handlers <----- clear the notifier callback
schedule vhost_user_async_close_bh

The vhost->vdev is null, so the vhost_user_blk_disconnect will not be called, then the event fd callback will not be reinstalled.

We need to ensure that even if vhost_dev_init initialization fails, the event handler still needs to be reinstalled when s->connected is false.

All vhost-user devices have this issue, including vhost-user-blk/scsi.

Fixes 71e076a07d ("hw/virtio: generalise CHR_EVENT_CLOSED handling")

Message-Id: <[email protected]>

---
 hw/block/vhost-user-blk.c   |  3 ++-
 hw/scsi/vhost-user-scsi.c   |  3 ++-
 hw/virtio/vhost-user-base.c |  3 ++-
 hw/virtio/vhost-user.c      | 10 +---------
 4 files changed, 7 insertions(+), 12 deletions(-)
hw/block/vhost-user-blk.c +2 -1
index 15cc24d017..fdbc30b9ce 100644
@@ -354,7 +354,7 @@ static void vhost_user_blk_disconnect(DeviceState *dev)
     VHostUserBlk *s = VHOST_USER_BLK(vdev);
 
     if (!s->connected) {
-        return;
+        goto done;
     }
     s->connected = false;
 
@@ -362,6 +362,7 @@ static void vhost_user_blk_disconnect(DeviceState *dev)
 
     vhost_dev_cleanup(&s->dev);
 
+done:
     /* Re-instate the event handler for new connections */
     qemu_chr_fe_set_handlers(&s->chardev, NULL, NULL, vhost_user_blk_event,
                              NULL, dev, NULL, true);
hw/scsi/vhost-user-scsi.c +2 -1
index 421cd654f8..cc91ade525 100644
@@ -182,7 +182,7 @@ static void vhost_user_scsi_disconnect(DeviceState *dev)
     VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
 
     if (!s->connected) {
-        return;
+        goto done;
     }
     s->connected = false;
 
@@ -190,6 +190,7 @@ static void vhost_user_scsi_disconnect(DeviceState *dev)
 
     vhost_dev_cleanup(&vsc->dev);
 
+done:
     /* Re-instate the event handler for new connections */
     qemu_chr_fe_set_handlers(&vs->conf.chardev, NULL, NULL,
                              vhost_user_scsi_event, NULL, dev, NULL, true);
hw/virtio/vhost-user-base.c +2 -1
index 4b54255682..11e72b1e3b 100644
@@ -225,13 +225,14 @@ static void vub_disconnect(DeviceState *dev)
     VHostUserBase *vub = VHOST_USER_BASE(vdev);
 
     if (!vub->connected) {
-        return;
+        goto done;
     }
     vub->connected = false;
 
     vub_stop(vdev);
     vhost_dev_cleanup(&vub->vhost_dev);
 
+done:
     /* Re-instate the event handler for new connections */
     qemu_chr_fe_set_handlers(&vub->chardev,
                              NULL, NULL, vub_event,
hw/virtio/vhost-user.c +1 -9
index c929097e87..c407ea8939 100644
@@ -2781,16 +2781,8 @@ typedef struct {
 static void vhost_user_async_close_bh(void *opaque)
 {
     VhostAsyncCallback *data = opaque;
-    struct vhost_dev *vhost = data->vhost;
 
-    /*
-     * If the vhost_dev has been cleared in the meantime there is
-     * nothing left to do as some other path has completed the
-     * cleanup.
-     */
-    if (vhost->vdev) {
-        data->cb(data->dev);
-    }
+    data->cb(data->dev);
 
     g_free(data);
 }
Signature · 1 line
MST
#8 lore raw

[PULL v2 16/91] hw/cxl/mailbox: change CCI cmd set structure to be a member, not a reference

In reply to Michael S. Tsirkin

From: Gregory Price <[email protected]>

This allows devices to have fully customized CCIs, along with complex devices where wrapper devices can override or add additional CCI commands without having to replicate full command structures or pollute a base device with every command that might ever be used.

Message-Id: <[email protected]>

---
 include/hw/cxl/cxl_device.h |  2 +-
 hw/cxl/cxl-mailbox-utils.c  | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)
include/hw/cxl/cxl_device.h +1 -1
index 279b276bda..ccc4611875 100644
@@ -164,7 +164,7 @@ typedef struct CXLEventLog {
 } CXLEventLog;
 
 typedef struct CXLCCI {
-    const struct cxl_cmd (*cxl_cmd_set)[256];
+    struct cxl_cmd cxl_cmd_set[256][256];
     struct cel_log {
         uint16_t opcode;
         uint16_t effect;
hw/cxl/cxl-mailbox-utils.c +15 -4
index e5eb97cb91..2c9f50f0f9 100644
@@ -1447,10 +1447,21 @@ void cxl_init_cci(CXLCCI *cci, size_t payload_max)
                                  bg_timercb, cci);
 }
 
+static void cxl_copy_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmds)[256])
+{
+    for (int set = 0; set < 256; set++) {
+        for (int cmd = 0; cmd < 256; cmd++) {
+            if (cxl_cmds[set][cmd].handler) {
+                cci->cxl_cmd_set[set][cmd] = cxl_cmds[set][cmd];
+            }
+        }
+    }
+}
+
 void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf,
                                   DeviceState *d, size_t payload_max)
 {
-    cci->cxl_cmd_set = cxl_cmd_set_sw;
+    cxl_copy_cci_commands(cci, cxl_cmd_set_sw);
     cci->d = d;
     cci->intf = intf;
     cxl_init_cci(cci, payload_max);
@@ -1458,7 +1469,7 @@ void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf,
 
 void cxl_initialize_mailbox_t3(CXLCCI *cci, DeviceState *d, size_t payload_max)
 {
-    cci->cxl_cmd_set = cxl_cmd_set;
+    cxl_copy_cci_commands(cci, cxl_cmd_set);
     cci->d = d;
 
     /* No separation for PCI MB as protocol handled in PCI device */
@@ -1476,7 +1487,7 @@ static const struct cxl_cmd cxl_cmd_set_t3_ld[256][256] = {
 void cxl_initialize_t3_ld_cci(CXLCCI *cci, DeviceState *d, DeviceState *intf,
                                size_t payload_max)
 {
-    cci->cxl_cmd_set = cxl_cmd_set_t3_ld;
+    cxl_copy_cci_commands(cci, cxl_cmd_set_t3_ld);
     cci->d = d;
     cci->intf = intf;
     cxl_init_cci(cci, payload_max);
@@ -1496,7 +1507,7 @@ void cxl_initialize_t3_fm_owned_ld_mctpcci(CXLCCI *cci, DeviceState *d,
                                            DeviceState *intf,
                                            size_t payload_max)
 {
-    cci->cxl_cmd_set = cxl_cmd_set_t3_fm_owned_ld_mctp;
+    cxl_copy_cci_commands(cci, cxl_cmd_set_t3_fm_owned_ld_mctp);
     cci->d = d;
     cci->intf = intf;
     cxl_init_cci(cci, payload_max);
Signature · 1 line
MST
#9 lore raw

[PULL v2 13/91] vhost-user-gpu: fix import of DMABUF

In reply to Michael S. Tsirkin

From: Marc-André Lureau <[email protected]>

When using vhost-user-gpu with GL, qemu -display gtk doesn't show output and prints: qemu: eglCreateImageKHR failed

Since commit 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties"), egl_dmabuf_import_texture() uses backing_{width,height} for the texture dimension.

Fixes 9ac06df8b ("virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties")

Message-Id: <[email protected]>

---
 hw/display/vhost-user-gpu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/display/vhost-user-gpu.c +3 -2
index e4b398d26c..63c64ddde6 100644
@@ -281,8 +281,9 @@ vhost_user_gpu_handle_display(VhostUserGPU *g, VhostUserGpuMsg *msg)
             modifier = m2->modifier;
         }
 
-        dmabuf = qemu_dmabuf_new(m->fd_width, m->fd_height,
-                                 m->fd_stride, 0, 0, 0, 0,
+        dmabuf = qemu_dmabuf_new(m->width, m->height,
+                                 m->fd_stride, 0, 0,
+                                 m->fd_width, m->fd_height,
                                  m->fd_drm_fourcc, modifier,
                                  fd, false, m->fd_flags &
                                  VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP);
Signature · 1 line
MST
#10 lore raw

[PULL v2 18/91] hw/cxl/cxl-mailbox-utils: Add dc_event_log_size field to output payload of identify memory device command

In reply to Michael S. Tsirkin

From: Fan Ni <[email protected]>

Based on CXL spec r3.1 Table 8-127 (Identify Memory Device Output Payload), dynamic capacity event log size should be part of output of the Identify command.
Add dc_event_log_size to the output payload for the host to get the info.

Message-Id: <[email protected]>

---
 hw/cxl/cxl-mailbox-utils.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/cxl/cxl-mailbox-utils.c +4 -1
index 2a64c58e2f..626acc1d0d 100644
@@ -21,6 +21,7 @@
 #include "sysemu/hostmem.h"
 
 #define CXL_CAPACITY_MULTIPLIER   (256 * MiB)
+#define CXL_DC_EVENT_LOG_SIZE 8
 
 /*
  * How to add a new command, example. The command set FOO, with cmd BAR.
@@ -780,8 +781,9 @@ static CXLRetCode cmd_identify_memory_device(const struct cxl_cmd *cmd,
         uint16_t inject_poison_limit;
         uint8_t poison_caps;
         uint8_t qos_telemetry_caps;
+        uint16_t dc_event_log_size;
     } QEMU_PACKED *id;
-    QEMU_BUILD_BUG_ON(sizeof(*id) != 0x43);
+    QEMU_BUILD_BUG_ON(sizeof(*id) != 0x45);
     CXLType3Dev *ct3d = CXL_TYPE3(cci->d);
     CXLType3Class *cvc = CXL_TYPE3_GET_CLASS(ct3d);
     CXLDeviceState *cxl_dstate = &ct3d->cxl_dstate;
@@ -807,6 +809,7 @@ static CXLRetCode cmd_identify_memory_device(const struct cxl_cmd *cmd,
     st24_le_p(id->poison_list_max_mer, 256);
     /* No limit - so limited by main poison record limit */
     stw_le_p(&id->inject_poison_limit, 0);
+    stw_le_p(&id->dc_event_log_size, CXL_DC_EVENT_LOG_SIZE);
 
     *len_out = sizeof(*id);
     return CXL_MBOX_SUCCESS;
Signature · 1 line
MST
#11 lore raw

[PULL v2 09/91] Fix vhost user assertion when sending more than one fd

In reply to Michael S. Tsirkin

From: Christian Pötzsch <[email protected]>

If the client sends more than one region this assert triggers. The reason is that two fd's are 8 bytes and VHOST_MEMORY_BASELINE_NREGIONS is exactly 8.

The assert is wrong because it should not test for the size of the fd array, but for the numbers of regions.

Message-Id: <[email protected]>

---
 subprojects/libvhost-user/libvhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.c +1 -1
index a879149fef..8adb277d54 100644
@@ -568,7 +568,7 @@ vu_message_read_default(VuDev *dev, int conn_fd, VhostUserMsg *vmsg)
         if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
             fd_size = cmsg->cmsg_len - CMSG_LEN(0);
             vmsg->fd_num = fd_size / sizeof(int);
-            assert(fd_size < VHOST_MEMORY_BASELINE_NREGIONS);
+            assert(vmsg->fd_num <= VHOST_MEMORY_BASELINE_NREGIONS);
             memcpy(vmsg->fds, CMSG_DATA(cmsg), fd_size);
             break;
         }
Signature · 1 line
MST
#12 lore raw

[PULL v2 19/91] hw/cxl/cxl-mailbox-utils: Add dynamic capacity region representative and mailbox command support

In reply to Michael S. Tsirkin

From: Fan Ni <[email protected]>

Per cxl spec r3.1, add dynamic capacity (DC) region representative based on Table 8-165 and extend the cxl type3 device definition to include DC region information. Also, based on info in 8.2.9.9.9.1, add 'Get Dynamic Capacity Configuration' mailbox support.

Note: we store region decode length as byte-wise length on the device, which should be divided by 256 * MiB before being returned to the host for "Get Dynamic Capacity Configuration" mailbox command per specification.

Message-Id: <[email protected]>

---
 include/hw/cxl/cxl_device.h | 16 +++++++
 hw/cxl/cxl-mailbox-utils.c  | 96 +++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+)
include/hw/cxl/cxl_device.h +16 -0
index a5f8e25020..e839370266 100644
@@ -422,6 +422,17 @@ typedef struct CXLPoison {
 typedef QLIST_HEAD(, CXLPoison) CXLPoisonList;
 #define CXL_POISON_LIST_LIMIT 256
 
+#define DCD_MAX_NUM_REGION 8
+
+typedef struct CXLDCRegion {
+    uint64_t base;       /* aligned to 256*MiB */
+    uint64_t decode_len; /* aligned to 256*MiB */
+    uint64_t len;
+    uint64_t block_size;
+    uint32_t dsmadhandle;
+    uint8_t flags;
+} CXLDCRegion;
+
 struct CXLType3Dev {
     /* Private */
     PCIDevice parent_obj;
@@ -454,6 +465,11 @@ struct CXLType3Dev {
     unsigned int poison_list_cnt;
     bool poison_list_overflowed;
     uint64_t poison_list_overflow_ts;
+
+    struct dynamic_capacity {
+        uint8_t num_regions; /* 0-8 regions */
+        CXLDCRegion regions[DCD_MAX_NUM_REGION];
+    } dc;
 };
 
 #define TYPE_CXL_TYPE3 "cxl-type3"
hw/cxl/cxl-mailbox-utils.c +96 -0

127 lines not on this page · raw message

Signature · 1 line
MST
#13 lore raw

[PULL v2 14/91] Revert "vhost-user: fix lost reconnect"

In reply to Michael S. Tsirkin

From: Li Feng <[email protected]>

This reverts commit f02a4b8e6431598612466f76aac64ab492849abf.

Since the current patch cannot completely fix the lost reconnect problem, there is a scenario that is not considered:
- When the virtio-blk driver is removed from the guest os, s->connected has no chance to be set to false, resulting in subsequent reconnection not being executed.

The next patch will completely fix this issue with a better approach.

Message-Id: <[email protected]>

---
 include/hw/virtio/vhost-user.h |  3 +--
 hw/block/vhost-user-blk.c      |  2 +-
 hw/scsi/vhost-user-scsi.c      |  3 +--
 hw/virtio/vhost-user-base.c    |  2 +-
 hw/virtio/vhost-user.c         | 10 ++--------
 5 files changed, 6 insertions(+), 14 deletions(-)
include/hw/virtio/vhost-user.h +1 -2
index d7c09ffd34..324cd8663a 100644
@@ -108,7 +108,6 @@ typedef void (*vu_async_close_fn)(DeviceState *cb);
 
 void vhost_user_async_close(DeviceState *d,
                             CharBackend *chardev, struct vhost_dev *vhost,
-                            vu_async_close_fn cb,
-                            IOEventHandler *event_cb);
+                            vu_async_close_fn cb);
 
 #endif
hw/block/vhost-user-blk.c +1 -1
index bc2677dbef..15cc24d017 100644
@@ -385,7 +385,7 @@ static void vhost_user_blk_event(void *opaque, QEMUChrEvent event)
     case CHR_EVENT_CLOSED:
         /* defer close until later to avoid circular close */
         vhost_user_async_close(dev, &s->chardev, &s->dev,
-                               vhost_user_blk_disconnect, vhost_user_blk_event);
+                               vhost_user_blk_disconnect);
         break;
     case CHR_EVENT_BREAK:
     case CHR_EVENT_MUX_IN:
hw/scsi/vhost-user-scsi.c +1 -2
index 0b050805a8..421cd654f8 100644
@@ -215,8 +215,7 @@ static void vhost_user_scsi_event(void *opaque, QEMUChrEvent event)
     case CHR_EVENT_CLOSED:
         /* defer close until later to avoid circular close */
         vhost_user_async_close(dev, &vs->conf.chardev, &vsc->dev,
-                               vhost_user_scsi_disconnect,
-                               vhost_user_scsi_event);
+                               vhost_user_scsi_disconnect);
         break;
     case CHR_EVENT_BREAK:
     case CHR_EVENT_MUX_IN:
hw/virtio/vhost-user-base.c +1 -1
index a83167191e..4b54255682 100644
@@ -254,7 +254,7 @@ static void vub_event(void *opaque, QEMUChrEvent event)
     case CHR_EVENT_CLOSED:
         /* defer close until later to avoid circular close */
         vhost_user_async_close(dev, &vub->chardev, &vub->vhost_dev,
-                               vub_disconnect, vub_event);
+                               vub_disconnect);
         break;
     case CHR_EVENT_BREAK:
     case CHR_EVENT_MUX_IN:
hw/virtio/vhost-user.c +2 -8
index cdf9af4a4b..c929097e87 100644
@@ -2776,7 +2776,6 @@ typedef struct {
     DeviceState *dev;
     CharBackend *cd;
     struct vhost_dev *vhost;
-    IOEventHandler *event_cb;
 } VhostAsyncCallback;
 
 static void vhost_user_async_close_bh(void *opaque)
@@ -2791,10 +2790,7 @@ static void vhost_user_async_close_bh(void *opaque)
      */
     if (vhost->vdev) {
         data->cb(data->dev);
-    } else if (data->event_cb) {
-        qemu_chr_fe_set_handlers(data->cd, NULL, NULL, data->event_cb,
-                                 NULL, data->dev, NULL, true);
-   }
+    }
 
     g_free(data);
 }
@@ -2806,8 +2802,7 @@ static void vhost_user_async_close_bh(void *opaque)
  */
 void vhost_user_async_close(DeviceState *d,
                             CharBackend *chardev, struct vhost_dev *vhost,
-                            vu_async_close_fn cb,
-                            IOEventHandler *event_cb)
+                            vu_async_close_fn cb)
 {
     if (!runstate_check(RUN_STATE_SHUTDOWN)) {
         /*
@@ -2823,7 +2818,6 @@ void vhost_user_async_close(DeviceState *d,
         data->dev = d;
         data->cd = chardev;
         data->vhost = vhost;
-        data->event_cb = event_cb;
 
         /* Disable any further notifications on the chardev */
         qemu_chr_fe_set_handlers(chardev,
Signature · 1 line
MST
#14 lore raw

[PULL v2 12/91] virtio-pci: only reset pm state during resetting

In reply to Michael S. Tsirkin

From: Jiqian Chen <[email protected]>

Fix bug imported by 27ce0f3afc9dd ("fix Power Management Control Register for PCI Express virtio devices" After this change, observe that QEMU may erroneously clear the power status of the device, or may erroneously clear non writable registers, such as NO_SOFT_RESET, etc.

Only state of PM_CTRL is writable.
Only when flag VIRTIO_PCI_FLAG_INIT_PM is set, need to reset state.

Fixes 27ce0f3afc9dd ("fix Power Management Control Register for PCI Express virtio devices"

Message-Id: <[email protected]>

---
 hw/virtio/virtio-pci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/virtio/virtio-pci.c +7 -1
index cffc7efcae..7d62e92365 100644
@@ -2306,10 +2306,16 @@ static void virtio_pci_bus_reset_hold(Object *obj, ResetType type)
     virtio_pci_reset(qdev);
 
     if (pci_is_express(dev)) {
+        VirtIOPCIProxy *proxy = VIRTIO_PCI(dev);
+
         pcie_cap_deverr_reset(dev);
         pcie_cap_lnkctl_reset(dev);
 
-        pci_set_word(dev->config + dev->exp.pm_cap + PCI_PM_CTRL, 0);
+        if (proxy->flags & VIRTIO_PCI_FLAG_INIT_PM) {
+            pci_word_test_and_clear_mask(
+                dev->config + dev->exp.pm_cap + PCI_PM_CTRL,
+                PCI_PM_CTRL_STATE_MASK);
+        }
     }
 }
 
Signature · 1 line
MST
#15 lore raw

[PULL v2 03/91] vhost-vdpa: check vhost_vdpa_set_vring_ready() return value

In reply to Michael S. Tsirkin

From: Stefano Garzarella <[email protected]>

vhost_vdpa_set_vring_ready() could already fail, but if Linux's patch [1] will be merged, it may fail with more chance if userspace does not activate virtqueues before DRIVER_OK when VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK is not negotiated.

So better check its return value anyway.

[1] https://lore.kernel.org/virtualization/[email protected]/T/#u

Message-Id: <[email protected]>

---
 net/vhost-vdpa.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
net/vhost-vdpa.c +12 -3
index 85e73dd6a7..eda714d1a4 100644
@@ -399,7 +399,10 @@ static int vhost_vdpa_net_data_load(NetClientState *nc)
     }
 
     for (int i = 0; i < v->dev->nvqs; ++i) {
-        vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index);
+        int ret = vhost_vdpa_set_vring_ready(v, i + v->dev->vq_index);
+        if (ret < 0) {
+            return ret;
+        }
     }
     return 0;
 }
@@ -1238,7 +1241,10 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc)
 
     assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA);
 
-    vhost_vdpa_set_vring_ready(v, v->dev->vq_index);
+    r = vhost_vdpa_set_vring_ready(v, v->dev->vq_index);
+    if (unlikely(r < 0)) {
+        return r;
+    }
 
     if (v->shadow_vqs_enabled) {
         n = VIRTIO_NET(v->dev->vdev);
@@ -1277,7 +1283,10 @@ static int vhost_vdpa_net_cvq_load(NetClientState *nc)
     }
 
     for (int i = 0; i < v->dev->vq_index; ++i) {
-        vhost_vdpa_set_vring_ready(v, i);
+        r = vhost_vdpa_set_vring_ready(v, i);
+        if (unlikely(r < 0)) {
+            return r;
+        }
     }
 
     return 0;
Signature · 1 line
MST
#16 lore raw

[PULL v2 10/91] vhost-vsock: add VIRTIO_F_RING_PACKED to feature_bits

In reply to Michael S. Tsirkin

From: Halil Pasic <[email protected]>

Not having VIRTIO_F_RING_PACKED in feature_bits[] is a problem when the vhost-vsock device does not offer the feature bit VIRTIO_F_RING_PACKED but the in QEMU device is configured to try to use the packed layout (the virtio property "packed" is on).

As of today, the Linux kernel vhost-vsock device does not support the packed queue layout (as vhost does not support packed), and does not offer VIRTIO_F_RING_PACKED. Thus when for example a vhost-vsock-ccw is used with packed=on, VIRTIO_F_RING_PACKED ends up being negotiated, despite the fact that the device does not actually support it, and one gets to keep the pieces.

Fixes 74b3e46630 ("virtio: add property to enable packed virtqueue")

Message-Id: <[email protected]>

---
 hw/virtio/vhost-vsock-common.c | 1 +
 1 file changed, 1 insertion(+)
hw/virtio/vhost-vsock-common.c +1 -0
index 12ea87d7a7..fd88df2560 100644
@@ -22,6 +22,7 @@
 const int feature_bits[] = {
     VIRTIO_VSOCK_F_SEQPACKET,
     VIRTIO_F_RING_RESET,
+    VIRTIO_F_RING_PACKED,
     VHOST_INVALID_FEATURE_BIT
 };
 
Signature · 1 line
MST
#17 lore raw

[PULL v2 06/91] virtio-mmio: Handle extra notification data

In reply to Michael S. Tsirkin

From: Jonah Palmer <[email protected]>

Add support to virtio-mmio devices for handling the extra data sent from the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport feature has been negotiated.

The extra data that's passed to the virtio-mmio device when this feature is enabled varies depending on the device's virtqueue layout.

The data passed to the virtio-mmio device is in the same format as the data passed to virtio-pci devices.

Message-Id: <[email protected]>

---
 hw/virtio/virtio-mmio.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
hw/virtio/virtio-mmio.c +9 -2
index 22f9fbcf5a..320428ac0d 100644
@@ -248,6 +248,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value,
 {
     VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque;
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
+    uint16_t vq_idx;
 
     trace_virtio_mmio_write_offset(offset, value);
 
@@ -407,8 +408,14 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value,
         }
         break;
     case VIRTIO_MMIO_QUEUE_NOTIFY:
-        if (value < VIRTIO_QUEUE_MAX) {
-            virtio_queue_notify(vdev, value);
+        vq_idx = value;
+        if (vq_idx < VIRTIO_QUEUE_MAX && virtio_queue_get_num(vdev, vq_idx)) {
+            if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) {
+                VirtQueue *vq = virtio_get_queue(vdev, vq_idx);
+
+                virtio_queue_set_shadow_avail_idx(vq, (value >> 16) & 0xFFFF);
+            }
+            virtio_queue_notify(vdev, vq_idx);
         }
         break;
     case VIRTIO_MMIO_INTERRUPT_ACK:
Signature · 1 line
MST
#18 lore raw

[PULL v2 11/91] hw/virtio: Fix obtain the buffer id from the last descriptor

In reply to Michael S. Tsirkin

From: Wafer <[email protected]>

The virtio-1.3 specification
<https://docs.oasis-open.org/virtio/virtio/v1.3/virtio-v1.3.html> writes:
2.8.6 Next Flag: Descriptor Chaining
Buffer ID is included in the last descriptor in the list.

If the feature (_F_INDIRECT_DESC) has been negotiated, install only one descriptor in the virtqueue.
Therefor the buffer id should be obtained from the first descriptor.

In descriptor chaining scenarios, the buffer id should be obtained from the last descriptor.

Fixes 86044b24e8 ("virtio: basic packed virtqueue support")

Message-Id: <[email protected]>

---
 hw/virtio/virtio.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/virtio/virtio.c +5 -0
index 28cd406e16..3678ec2f88 100644
@@ -1745,6 +1745,11 @@ static void *virtqueue_packed_pop(VirtQueue *vq, size_t sz)
                                              &indirect_desc_cache);
     } while (rc == VIRTQUEUE_READ_DESC_MORE);
 
+    if (desc_cache != &indirect_desc_cache) {
+        /* Buffer ID is included in the last descriptor in the list. */
+        id = desc.id;
+    }
+
     /* Now copy what we have collected and mapped */
     elem = virtqueue_alloc_element(sz, out_num, in_num);
     for (i = 0; i < out_num; i++) {
Signature · 1 line
MST
#19 lore raw

[PULL v2 17/91] hw/cxl/mailbox: interface to add CCI commands to an existing CCI

In reply to Michael S. Tsirkin

From: Gregory Price <[email protected]>

This enables wrapper devices to customize the base device's CCI (for example, with custom commands outside the specification) without the need to change the base device.

The also enabled the base device to dispatch those commands without requiring additional driver support.

Heavily edited by Jonathan Cameron to increase code reuse

Message-Id: <[email protected]>

---
 include/hw/cxl/cxl_device.h |  2 ++
 hw/cxl/cxl-mailbox-utils.c  | 19 +++++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
include/hw/cxl/cxl_device.h +2 -0
index ccc4611875..a5f8e25020 100644
@@ -301,6 +301,8 @@ void cxl_initialize_mailbox_t3(CXLCCI *cci, DeviceState *d, size_t payload_max);
 void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf,
                                   DeviceState *d, size_t payload_max);
 void cxl_init_cci(CXLCCI *cci, size_t payload_max);
+void cxl_add_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmd_set)[256],
+                          size_t payload_max);
 int cxl_process_cci_message(CXLCCI *cci, uint8_t set, uint8_t cmd,
                             size_t len_in, uint8_t *pl_in,
                             size_t *len_out, uint8_t *pl_out,
hw/cxl/cxl-mailbox-utils.c +17 -2
index 2c9f50f0f9..2a64c58e2f 100644
@@ -1424,9 +1424,9 @@ static void bg_timercb(void *opaque)
     }
 }
 
-void cxl_init_cci(CXLCCI *cci, size_t payload_max)
+static void cxl_rebuild_cel(CXLCCI *cci)
 {
-    cci->payload_max = payload_max;
+    cci->cel_size = 0; /* Reset for a fresh build */
     for (int set = 0; set < 256; set++) {
         for (int cmd = 0; cmd < 256; cmd++) {
             if (cci->cxl_cmd_set[set][cmd].handler) {
@@ -1440,6 +1440,13 @@ void cxl_init_cci(CXLCCI *cci, size_t payload_max)
             }
         }
     }
+}
+
+void cxl_init_cci(CXLCCI *cci, size_t payload_max)
+{
+    cci->payload_max = payload_max;
+    cxl_rebuild_cel(cci);
+
     cci->bg.complete_pct = 0;
     cci->bg.starttime = 0;
     cci->bg.runtime = 0;
@@ -1458,6 +1465,14 @@ static void cxl_copy_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmds)[
     }
 }
 
+void cxl_add_cci_commands(CXLCCI *cci, const struct cxl_cmd (*cxl_cmd_set)[256],
+                                 size_t payload_max)
+{
+    cci->payload_max = MAX(payload_max, cci->payload_max);
+    cxl_copy_cci_commands(cci, cxl_cmd_set);
+    cxl_rebuild_cel(cci);
+}
+
 void cxl_initialize_mailbox_swcci(CXLCCI *cci, DeviceState *intf,
                                   DeviceState *d, size_t payload_max)
 {
Signature · 1 line
MST