virtio,pci: features, cleanups
Subsystems (2)
The following changes since commit 494a6a2cf7f775d2c20fd6df9601e30606cc2014:
Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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 dc1499091ca09db0ac7a5615a592e55f27d4965d:
libvhost-user: handle shared_object msg (2023-10-04 04:28:35 -0400)
----------------------------------------------------------------
virtio,pci: features, cleanups
vdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-buf
Fixes, cleanups all over the place.
----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address check
Albert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: add shared_object msg
libvhost-user: handle shared_object msg
Alex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-device
Ani Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systems
Bernhard Beschow (8):
hw/i386/acpi-build: Use pc_madt_cpu_entry() directly hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundant TYPE_ACPI_GED_X86 hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separately
Dave Jiang (1):
hw/cxl: Add QTG _DSM support for ACPI0017 device
David Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routing
Eugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: export vhost_vdpa_set_vring_ready
vdpa: rename vhost_vdpa_net_load to vhost_vdpa_net_cvq_load
vdpa: move vhost_vdpa_set_vring_ready to the caller
vdpa: remove net cvq migration blocker
vdpa net: zero vhost_vdpa iova_tree pointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probing
Hawkins Jiawei (5):
virtio-net: do not reset vlan filtering at set_features
virtio-net: Expose MAX_VLAN
vdpa: Restore vlan filtering state
vdpa: Allow VIRTIO_NET_F_CTRL_VLAN in SVQ
vhost: Add count argument to vhost_svq_poll()
Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: use shadow_avail_idx while checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument from virtqueue_split_read_next_desc()
Jonah Palmer (3):
qmp: remove virtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header file
Jonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Push cxl_decoder_count_enc() and cxl_decode_ig() into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability support
Laszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously
Michael S. Tsirkin (1):
pci: SLT must be RO
Philippe Mathieu-Daudé (6):
hw/virtio: Propagate page_mask to vhost_vdpa_listener_skipped_section() hw/virtio: Propagate page_mask to vhost_vdpa_section_end() hw/virtio/vhost-vdpa: Inline TARGET_PAGE_ALIGN() macro hw/virtio/vhost-vdpa: Use target-agnostic qemu_target_page_mask() hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]
Stefan Hajnoczi (1):
vdpa: fix gcc cvq_isolated uninitialized variable warning
Vladimir Sementsov-Ogievskiy (2):
pcie_sriov: unregister_vfs(): fix error path libvhost-user.c: add assertion to vu_message_read_default
hw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++ MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytes tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
[PULL 04/63] hw/virtio/vhost-vdpa: Inline TARGET_PAGE_ALIGN() macro
From: Philippe Mathieu-Daudé <[email protected]>
Use TARGET_PAGE_SIZE to calculate TARGET_PAGE_ALIGN (see the rationale in previous commits).
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/vhost-vdpa.c +2 -2
@@ -331,7 +331,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,return ; } - iova =TARGET_PAGE_ALIGN (section->offset_within_address_space); + iova =ROUND_UP (section->offset_within_address_space,TARGET_PAGE_SIZE ); llend =vhost_vdpa_section_end (section,TARGET_PAGE_MASK );if (int128_ge (int128_make64 (iova), llend)) {return ;
@@ -415,7 +415,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,return ; } - iova =TARGET_PAGE_ALIGN (section->offset_within_address_space); + iova =ROUND_UP (section->offset_within_address_space,TARGET_PAGE_SIZE ); llend =vhost_vdpa_section_end (section,TARGET_PAGE_MASK ); trace_vhost_vdpa_listener_region_del(v, iova,
Signature · 1 line
MST
[PULL 03/63] hw/virtio: Propagate page_mask to vhost_vdpa_section_end()
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
Propagate TARGET_PAGE_MASK (see the previous commit for rationale).
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
hw/virtio/vhost-vdpa.c +6 -5
@@ -31,11 +31,12 @@* Return one past the end of the end of section. Be careful with uint64_t * conversions! */ -static Int128 vhost_vdpa_section_end (const MemoryRegionSection *section) +static Int128 vhost_vdpa_section_end (const MemoryRegionSection *section, +int page_mask) {Int128 llend =int128_make64 (section->offset_within_address_space); llend =int128_add (llend, section->size); - llend =int128_and (llend,int128_exts64 (TARGET_PAGE_MASK )); + llend =int128_and (llend,int128_exts64 (page_mask));return llend; }
@@ -69,7 +70,7 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section,*/ if (!memory_region_is_iommu (section->mr)) { - llend =vhost_vdpa_section_end (section); + llend =vhost_vdpa_section_end (section, page_mask);if (int128_gt (llend,int128_make64 (iova_max))) { error_report("RAM section out of device range (max=0x%" PRIx64 ", end addr=0x%" PRIx64 ")",
@@ -331,7 +332,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener, } iova =TARGET_PAGE_ALIGN (section->offset_within_address_space); - llend =vhost_vdpa_section_end (section); + llend =vhost_vdpa_section_end (section,TARGET_PAGE_MASK );if (int128_ge (int128_make64 (iova), llend)) {return ; }
@@ -415,7 +416,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener, } iova =TARGET_PAGE_ALIGN (section->offset_within_address_space); - llend =vhost_vdpa_section_end (section); + llend =vhost_vdpa_section_end (section,TARGET_PAGE_MASK );trace_vhost_vdpa_listener_region_del (v, iova,int128_get64 (int128_sub (llend,int128_one ())));
Signature · 1 line
MST
[PULL 02/63] hw/virtio: Propagate page_mask to vhost_vdpa_listener_skipped_section()
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
In order to make vhost-vdpa.c a target-agnostic source unit, we need to remove the TARGET_PAGE_SIZE / TARGET_PAGE_MASK / TARGET_PAGE_ALIGN uses. TARGET_PAGE_SIZE will be replaced by the runtime qemu_target_page_size(). The other ones will be deduced from TARGET_PAGE_SIZE.
Since the 3 macros are used in 3 related functions (sharing the same call tree), we'll refactor them to only depend on TARGET_PAGE_MASK.
Having the following call tree:
vhost_vdpa_listener_region_del()
-> vhost_vdpa_listener_skipped_section()
-> vhost_vdpa_section_end()The first step is to propagate TARGET_PAGE_MASK to vhost_vdpa_listener_skipped_section().
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/virtio/vhost-vdpa.c +4 -3
@@ -42,7 +42,8 @@ static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section)static bool vhost_vdpa_listener_skipped_section (MemoryRegionSection *section,uint64_t iova_min, -uint64_t iova_max) +uint64_t iova_max, +int page_mask) {Int128 llend;
@@ -313,7 +314,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,int ret;if (vhost_vdpa_listener_skipped_section (section, v->iova_range.first, - v->iova_range.last)) { + v->iova_range.last,TARGET_PAGE_MASK )) {return ; }if (memory_region_is_iommu (section->mr)) {
@@ -398,7 +399,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,int ret;if (vhost_vdpa_listener_skipped_section (section, v->iova_range.first, - v->iova_range.last)) { + v->iova_range.last,TARGET_PAGE_MASK )) {return ; }if (memory_region_is_iommu (section->mr)) {
Signature · 1 line
MST
[PULL 06/63] hw/virtio: Build vhost-vdpa.o once
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
The previous commit removed the dependencies on the target-specific TARGET_PAGE_FOO macros. We can now move vhost-vdpa.c to the 'softmmu_virtio_ss' source set to build it once for all our targets.
Message-Id: <[email protected]>
--- hw/virtio/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/meson.build +2 -1
@@ -18,7 +18,8 @@ if have_vhost specific_virtio_ss.add(files('vhost-user.c')) endif if have_vhost_vdpa - specific_virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c')) + softmmu_virtio_ss.add(files('vhost-vdpa.c')) + specific_virtio_ss.add(files('vhost-shadow-virtqueue.c')) endif else softmmu_virtio_ss.add(files('vhost-stub.c'))
Signature · 1 line
MST
[PULL 05/63] hw/virtio/vhost-vdpa: Use target-agnostic qemu_target_page_mask()
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
Similarly to commit e414ed2c47 ("virtio-iommu: Use target-agnostic qemu_target_page_mask"), Replace the target-specific TARGET_PAGE_SIZE and TARGET_PAGE_MASK definitions by a call to the runtime qemu_target_page_size() helper which is target agnostic.
Message-Id: <[email protected]>
--- hw/virtio/vhost-vdpa.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
hw/virtio/vhost-vdpa.c +19 -15
@@ -14,6 +14,7 @@#include <linux/vfio.h> #include <sys/eventfd.h> #include <sys/ioctl.h> +#include "exec/target_page.h" #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-backend.h" #include "hw/virtio/virtio-net.h"
@@ -23,7 +24,6 @@#include "migration/blocker.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" -#include "cpu.h" #include "trace.h" #include "qapi/error.h"
@@ -313,9 +313,11 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,Int128 llend, llsize;void *vaddr;int ret; +int page_size =qemu_target_page_size (); +int page_mask = -page_size;if (vhost_vdpa_listener_skipped_section (section, v->iova_range.first, - v->iova_range.last,TARGET_PAGE_MASK )) { + v->iova_range.last, page_mask)) {return ; }if (memory_region_is_iommu (section->mr)) {
@@ -323,16 +325,16 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,return ; } -if (unlikely ((section->offset_within_address_space & ~TARGET_PAGE_MASK ) != - (section->offset_within_region & ~TARGET_PAGE_MASK ))) { +if (unlikely ((section->offset_within_address_space & ~page_mask) != + (section->offset_within_region & ~page_mask))) {trace_vhost_vdpa_listener_region_add_unaligned (v, section->mr->name, - section->offset_within_address_space & ~TARGET_PAGE_MASK , - section->offset_within_region & ~TARGET_PAGE_MASK ); + section->offset_within_address_space & ~page_mask, + section->offset_within_region & ~page_mask);return ; } - iova =ROUND_UP (section->offset_within_address_space,TARGET_PAGE_SIZE ); - llend =vhost_vdpa_section_end (section,TARGET_PAGE_MASK ); + iova =ROUND_UP (section->offset_within_address_space, page_size); + llend =vhost_vdpa_section_end (section, page_mask);if (int128_ge (int128_make64 (iova), llend)) {return ; }
@@ -398,25 +400,27 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,hwaddr iova;Int128 llend, llsize;int ret; +int page_size =qemu_target_page_size (); +int page_mask = -page_size;if (vhost_vdpa_listener_skipped_section (section, v->iova_range.first, - v->iova_range.last,TARGET_PAGE_MASK )) { + v->iova_range.last, page_mask)) {return ; }if (memory_region_is_iommu (section->mr)) {vhost_vdpa_iommu_region_del (listener, section); } -if (unlikely ((section->offset_within_address_space & ~TARGET_PAGE_MASK ) != - (section->offset_within_region & ~TARGET_PAGE_MASK ))) { +if (unlikely ((section->offset_within_address_space & ~page_mask) != + (section->offset_within_region & ~page_mask))) {trace_vhost_vdpa_listener_region_del_unaligned (v, section->mr->name, - section->offset_within_address_space & ~TARGET_PAGE_MASK , - section->offset_within_region & ~TARGET_PAGE_MASK ); + section->offset_within_address_space & ~page_mask, + section->offset_within_region & ~page_mask);return ; } - iova =ROUND_UP (section->offset_within_address_space,TARGET_PAGE_SIZE ); - llend =vhost_vdpa_section_end (section,TARGET_PAGE_MASK ); + iova =ROUND_UP (section->offset_within_address_space, page_size); + llend =vhost_vdpa_section_end (section, page_mask);trace_vhost_vdpa_listener_region_del (v, iova,int128_get64 (int128_sub (llend,int128_one ())));
Signature · 1 line
MST
[PULL 13/63] vdpa: Allow VIRTIO_NET_F_CTRL_VLAN in SVQ
In reply to Michael S. TsirkinFrom: Hawkins Jiawei <[email protected]>
Enable SVQ with VIRTIO_NET_F_CTRL_VLAN feature.
Message-Id: <38dc63102a42c31c72fd293d0e6e2828fd54c86e.1690106284.git.yin31149@gmail.com>
--- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+)
net/vhost-vdpa.c +1 -0
@@ -114,6 +114,7 @@ static const uint64_t vdpa_svq_device_features =BIT_ULL (VIRTIO_NET_F_STATUS ) |BIT_ULL (VIRTIO_NET_F_CTRL_VQ ) |BIT_ULL (VIRTIO_NET_F_CTRL_RX ) | +BIT_ULL (VIRTIO_NET_F_CTRL_VLAN ) |BIT_ULL (VIRTIO_NET_F_CTRL_RX_EXTRA ) |BIT_ULL (VIRTIO_NET_F_MQ ) | BIT_ULL(VIRTIO_F_ANY_LAYOUT) |
Signature · 1 line
MST
[PULL 20/63] vhost: Add count argument to vhost_svq_poll()
In reply to Michael S. TsirkinFrom: Hawkins Jiawei <[email protected]>
Next patches in this series will no longer perform an immediate poll and check of the device's used buffers for each CVQ state load command. Instead, they will send CVQ state load commands in parallel by polling multiple pending buffers at once.
To achieve this, this patch refactoring vhost_svq_poll() to accept a new argument num, which allows vhost_svq_poll() to wait for the device to use multiple elements, rather than polling for a single element.
Message-Id: <950b3bfcfc5d446168b9d6a249d554a013a691d4.1693287885.git.yin31149@gmail.com>
--- hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/vhost-shadow-virtqueue.c | 36 ++++++++++++++++++------------ net/vhost-vdpa.c | 2 +- 3 files changed, 24 insertions(+), 16 deletions(-)
hw/virtio/vhost-shadow-virtqueue.h +1 -1
@@ -119,7 +119,7 @@ void vhost_svq_push_elem(VhostShadowVirtqueue *svq,int vhost_svq_add (VhostShadowVirtqueue *svq,const struct iovec *out_sg,size_t out_num,const struct iovec *in_sg,size_t in_num,VirtQueueElement *elem); -size_t vhost_svq_poll (VhostShadowVirtqueue *svq); +size_t vhost_svq_poll (VhostShadowVirtqueue *svq,size_t num);void vhost_svq_set_svq_kick_fd (VhostShadowVirtqueue *svq,int svq_kick_fd);void vhost_svq_set_svq_call_fd (VhostShadowVirtqueue *svq,int call_fd);
hw/virtio/vhost-shadow-virtqueue.c +22 -14
@@ -514,29 +514,37 @@ static void vhost_svq_flush(VhostShadowVirtqueue *svq, }/** -* Poll the SVQ for one device used buffer. +* Poll the SVQ to wait for the device to use the specified number +* of elements and return the total length written by the device. * * This function race with main event loop SVQ polling, so extra * synchronization is needed. * -* Return the length written by the device. +* @svq: The svq +* @num: The number of elements that need to be used */ -size_t vhost_svq_poll (VhostShadowVirtqueue *svq) +size_t vhost_svq_poll (VhostShadowVirtqueue *svq,size_t num) { -int64_t start_us =g_get_monotonic_time (); -uint32_t len =0 ; +size_t len =0 ; +uint32_t r; -do { -if (vhost_svq_more_used (svq)) { -break ; - } +while (num--) { +int64_t start_us =g_get_monotonic_time (); -if (unlikely (g_get_monotonic_time () - start_us >10e6 )) { -return 0 ; - } - }while (true); +do { +if (vhost_svq_more_used (svq)) { +break ; + } + +if (unlikely (g_get_monotonic_time () - start_us >10e6 )) { +return len; + } + }while (true); + +vhost_svq_get_buf (svq, &r); + len += r; + } -vhost_svq_get_buf (svq, &len);return len; }
net/vhost-vdpa.c +1 -1
@@ -645,7 +645,7 @@ static ssize_t vhost_vdpa_net_cvq_add(VhostVDPAState *s, size_t out_len,* descriptor. Also, we need to take the answer before SVQ pulls by itself, * when BQL is released */ -return vhost_svq_poll (svq); +return vhost_svq_poll (svq,1 ); } static ssize_t vhost_vdpa_net_load_cmd(VhostVDPAState *s, uint8_t class,
Signature · 1 line
MST
[PULL 09/63] hw/virtio: add config support to vhost-user-device
In reply to Michael S. TsirkinFrom: Alex Bennée <[email protected]>
To use the generic device the user will need to provide the config region size via the command line. We also add a notifier so the guest can be pinged if the remote daemon updates the config.
With these changes:
-device vhost-user-device-pci,virtio-id=41,num_vqs=2,config_size=8
is equivalent to:
-device vhost-user-gpio-pci
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-user-device.h | 1 + hw/virtio/vhost-user-device.c | 58 ++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-)
include/hw/virtio/vhost-user-device.h +1 -0
@@ -22,6 +22,7 @@ struct VHostUserBase {CharBackend chardev;uint16_t virtio_id;uint32_t num_vqs; +uint32_t config_size;/* State tracking */ VhostUserState vhost_user;struct vhost_virtqueue *vhost_vq;
hw/virtio/vhost-user-device.c +57 -1
98 lines not on this page · raw message
Signature · 1 line
MST
[PULL 10/63] virtio-net: do not reset vlan filtering at set_features
In reply to Michael S. TsirkinFrom: Hawkins Jiawei <[email protected]>
This function is called after virtio_load, so all vlan configuration is lost in migration case.
Just allow all the vlan-tagged packets if vlan is not configured, and trust device reset to clear all filtered vlans.
Message-Id: <95af0d013281282f48ad3f47f6ad1ac4ca9e52eb.1690106284.git.yin31149@gmail.com>
--- hw/net/virtio-net.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/net/virtio-net.c +1 -3
@@ -1029,9 +1029,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features)vhost_net_save_acked_features (nc->peer); } -if (virtio_has_feature (features,VIRTIO_NET_F_CTRL_VLAN )) { -memset (n->vlans,0 ,MAX_VLAN >>3 ); - }else { +if (!virtio_has_feature (features,VIRTIO_NET_F_CTRL_VLAN )) {memset (n->vlans,0xff ,MAX_VLAN >>3 ); }
Signature · 1 line
MST
[PULL 19/63] vdpa: remove net cvq migration blocker
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Now that we have add migration blockers if the device does not support all the needed features, remove the general blocker applied to all net devices with CVQ.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 12 ------------ 1 file changed, 12 deletions(-)
net/vhost-vdpa.c +0 -12
@@ -1465,18 +1465,6 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.shadow_vq_ops = &vhost_vdpa_net_svq_ops; s->vhost_vdpa.shadow_vq_ops_opaque = s; s->cvq_isolated = cvq_isolated; - -/* -* TODO: We cannot migrate devices with CVQ and no x-svq enabled as -* there is no way to set the device state (MAC, MQ, etc) before -* starting the datapath. -* -* Migration blocker ownership now belongs to s->vhost_vdpa. -*/ -if (!svq) { -error_setg (&s->vhost_vdpa.migration_blocker, -"net vdpa cannot migrate with CVQ feature" ); - } } ret =vhost_vdpa_add (nc, (void *)&s->vhost_vdpa, queue_pair_index, nvqs);if (ret) {
Signature · 1 line
MST
[PULL 15/63] vdpa: use first queue SVQ state for CVQ default
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Previous to this patch the only way CVQ would be shadowed is if it does support to isolate CVQ group or if all vqs were shadowed from the beginning. The second condition was checked at the beginning, and no more configuration was done.
After this series we need to check if data queues are shadowed because they are in the middle of the migration. As checking if they are shadowed already covers the previous case, let's just mimic it.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/vhost-vdpa.c +1 -1
@@ -509,7 +509,7 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc) s0 =vhost_vdpa_net_first_nc_vdpa (s); v->shadow_data = s0->vhost_vdpa.shadow_vqs_enabled; - v->shadow_vqs_enabled = s->always_svq; + v->shadow_vqs_enabled = s0->vhost_vdpa.shadow_vqs_enabled; s->vhost_vdpa.address_space_id =VHOST_VDPA_GUEST_PA_ASID ;if (s->vhost_vdpa.shadow_data) {
Signature · 1 line
MST
[PULL 08/63] virtio: add vhost-user-base and a generic vhost-user-device
In reply to Michael S. TsirkinFrom: Alex Bennée <[email protected]>
In theory we shouldn't need to repeat so much boilerplate to support vhost-user backends. This provides a generic vhost-user-base QOM object and a derived vhost-user-device for which the user needs to provide the few bits of information that aren't currently provided by the vhost-user protocol. This should provide a baseline implementation from which the other vhost-user stub can specialise.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-user-device.h | 45 ++++ hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 324 ++++++++++++++++++++++++++ hw/virtio/meson.build | 3 + 4 files changed, 443 insertions(+) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c
include/hw/virtio/vhost-user-device.h new file +45 -0
@@ -0,0 +1,45 @@ +/* +* Vhost-user generic virtio device +* +* Copyright (c) 2023 Linaro Ltd +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef QEMU_VHOST_USER_DEVICE_H +#define QEMU_VHOST_USER_DEVICE_H + +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-user.h" + +#define TYPE_VHOST_USER_BASE "vhost-user-base" + +OBJECT_DECLARE_TYPE(VHostUserBase, VHostUserBaseClass, VHOST_USER_BASE) + +struct VHostUserBase { +VirtIODevice parent; +/* Properties */ +CharBackend chardev; +uint16_t virtio_id; +uint32_t num_vqs; +/* State tracking */ +VhostUserState vhost_user; +struct vhost_virtqueue *vhost_vq; +struct vhost_dev vhost_dev; +GPtrArray *vqs; +bool connected; +}; + +/* needed so we can use the base realize after specialisation +tweaks */ +struct VHostUserBaseClass { +/*< private >*/ +VirtioDeviceClass parent_class; +/*< public >*/ +DeviceRealize parent_realize; +}; + +/* shared for the benefit of the derived pci class */ +#define TYPE_VHOST_USER_DEVICE "vhost-user-device" + +#endif /* QEMU_VHOST_USER_DEVICE_H */
hw/virtio/vhost-user-device-pci.c new file +71 -0
71 lines not on this page · raw message
hw/virtio/vhost-user-device.c new file +324 -0
324 lines not on this page · raw message
hw/virtio/meson.build +3 -0
@@ -15,7 +15,10 @@ if have_vhost system_virtio_ss.add(files('vhost.c')) specific_virtio_ss.add(files('vhost-backend.c', 'vhost-iova-tree.c')) if have_vhost_user + # fixme - this really should be generic specific_virtio_ss.add(files('vhost-user.c')) + system_virtio_ss.add(files('vhost-user-device.c')) + system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('vhost-user-device-pci.c')) endif if have_vhost_vdpa system_virtio_ss.add(files('vhost-vdpa.c'))
Signature · 1 line
MST
[PULL 14/63] virtio: don't zero out memory region cache for indirect descriptors
In reply to Michael S. TsirkinFrom: Ilya Maximets <[email protected]>
Lots of virtio functions that are on a hot path in data transmission are initializing indirect descriptor cache at the point of stack allocation. It's a 112 byte structure that is getting zeroed out on each call adding unnecessary overhead. It's going to be correctly initialized later via special init function. The only reason to actually initialize right away is the ability to safely destruct it. Replacing a designated initializer with a function to only initialize what is necessary.
Removal of the unnecessary stack initializations improves throughput of virtio-net devices in terms of 64B packets per second by 6-14 % depending on the case. Tested with a proposed af-xdp network backend and a dpdk testpmd application in the guest, but should be beneficial for other virtio devices as well.
Message-Id: <[email protected]>
--- include/exec/memory.h | 16 +++++++++++++--- hw/virtio/virtio.c | 20 +++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-)
include/exec/memory.h +13 -3
@@ -2671,9 +2671,6 @@ struct MemoryRegionCache {bool is_write; }; -#define MEMORY_REGION_CACHE_INVALID ((MemoryRegionCache) { .mrs.mr = NULL }) - -/* address_space_ld*_cached: load from a cached #MemoryRegion * address_space_st*_cached: store into a cached #MemoryRegion *
@@ -2762,6 +2759,19 @@ int64_t address_space_cache_init(MemoryRegionCache *cache,hwaddr len, bool is_write); +/** +* address_space_cache_init_empty: Initialize empty #MemoryRegionCache +* +* @cache: The #MemoryRegionCache to operate on. +* +* Initializes #MemoryRegionCache structure without memory region attached. +* Cache initialized this way can only be safely destroyed, but not used. +*/ +static inline void address_space_cache_init_empty (MemoryRegionCache *cache) +{ + cache->mrs.mr =NULL ; +} +/** * address_space_cache_invalidate: complete a write to a #MemoryRegionCache *
hw/virtio/virtio.c +15 -5
@@ -1071,10 +1071,12 @@ static void virtqueue_split_get_avail_bytes(VirtQueue *vq,VirtIODevice *vdev = vq->vdev;unsigned int idx;unsigned int total_bufs, in_total, out_total; -MemoryRegionCache indirect_desc_cache =MEMORY_REGION_CACHE_INVALID ; +MemoryRegionCache indirect_desc_cache;int64_t len =0 ;int rc; +address_space_cache_init_empty (&indirect_desc_cache); + idx = vq->last_avail_idx; total_bufs = in_total = out_total =0 ;
@@ -1207,12 +1209,14 @@ static void virtqueue_packed_get_avail_bytes(VirtQueue *vq,VirtIODevice *vdev = vq->vdev;unsigned int idx;unsigned int total_bufs, in_total, out_total; +MemoryRegionCache indirect_desc_cache;MemoryRegionCache *desc_cache; -MemoryRegionCache indirect_desc_cache =MEMORY_REGION_CACHE_INVALID ;int64_t len =0 ;VRingPackedDesc desc;bool wrap_counter; +address_space_cache_init_empty (&indirect_desc_cache); + idx = vq->last_avail_idx; wrap_counter = vq->last_avail_wrap_counter; total_bufs = in_total = out_total =0 ;
@@ -1487,7 +1491,7 @@ static void *virtqueue_split_pop(VirtQueue *vq, size_t sz) {unsigned int i, head, max;VRingMemoryRegionCaches *caches; -MemoryRegionCache indirect_desc_cache =MEMORY_REGION_CACHE_INVALID ; +MemoryRegionCache indirect_desc_cache;MemoryRegionCache *desc_cache;int64_t len;VirtIODevice *vdev = vq->vdev;
@@ -1498,6 +1502,8 @@ static void *virtqueue_split_pop(VirtQueue *vq, size_t sz)VRingDesc desc;int rc; +address_space_cache_init_empty (&indirect_desc_cache); +RCU_READ_LOCK_GUARD ();if (virtio_queue_empty_rcu (vq)) { goto done;
@@ -1624,7 +1630,7 @@ static void *virtqueue_packed_pop(VirtQueue *vq, size_t sz) {unsigned int i, max;VRingMemoryRegionCaches *caches; -MemoryRegionCache indirect_desc_cache =MEMORY_REGION_CACHE_INVALID ; +MemoryRegionCache indirect_desc_cache;MemoryRegionCache *desc_cache;int64_t len;VirtIODevice *vdev = vq->vdev;
@@ -1636,6 +1642,8 @@ static void *virtqueue_packed_pop(VirtQueue *vq, size_t sz)uint16_t id;int rc; +address_space_cache_init_empty (&indirect_desc_cache); +RCU_READ_LOCK_GUARD ();if (virtio_queue_packed_empty_rcu (vq)) { goto done;
@@ -3970,13 +3978,15 @@ VirtioQueueElement *qmp_x_query_virtio_queue_element(const char *path, }else {unsigned int head, i, max;VRingMemoryRegionCaches *caches; -MemoryRegionCache indirect_desc_cache =MEMORY_REGION_CACHE_INVALID ; +MemoryRegionCache indirect_desc_cache;MemoryRegionCache *desc_cache;VRingDesc desc;VirtioRingDescList *list =NULL ;VirtioRingDescList *node;int rc;int ndescs; +address_space_cache_init_empty (&indirect_desc_cache); +RCU_READ_LOCK_GUARD (); max = vq->vring.num;
Signature · 1 line
MST
[PULL 38/63] hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h"
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
The "hw/boards.h" is unused since the previous commit. Since its removal requires include fixes in various unrelated files to keep the code compiling it has been split in a dedicated commit.
Message-Id: <[email protected]>
--- hw/acpi/hmat.h | 3 ++- include/hw/acpi/acpi_dev_interface.h | 1 - hw/acpi/cpu.c | 1 + hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + 5 files changed, 5 insertions(+), 2 deletions(-)
hw/acpi/hmat.h +2 -1
@@ -27,7 +27,8 @@#ifndef HMAT_H #define HMAT_H -#include "hw/acpi/aml-build.h" +#include "hw/acpi/bios-linker-loader.h" +#include "sysemu/numa.h" /* * ACPI 6.3: 5.2.27.3 Memory Proximity Domain Attributes Structure,
include/hw/acpi/acpi_dev_interface.h +0 -1
@@ -3,7 +3,6 @@#include "qapi/qapi-types-acpi.h" #include "qom/object.h" -#include "hw/boards.h" #include "hw/qdev-core.h" /* These values are part of guest ABI, and can not be changed */
hw/acpi/cpu.c +1 -0
@@ -1,6 +1,7 @@#include "qemu/osdep.h" #include "migration/vmstate.h" #include "hw/acpi/cpu.h" +#include "hw/core/cpu.h" #include "qapi/error.h" #include "qapi/qapi-events-acpi.h" #include "trace.h"
hw/acpi/hmat.c +1 -0
@@ -27,6 +27,7 @@#include "qemu/osdep.h" #include "qemu/units.h" #include "sysemu/numa.h" +#include "hw/acpi/aml-build.h" #include "hw/acpi/hmat.h" /*
hw/acpi/memory_hotplug.c +1 -0
@@ -1,6 +1,7 @@#include "qemu/osdep.h" #include "hw/acpi/memory_hotplug.h" #include "hw/mem/pc-dimm.h" +#include "hw/boards.h" #include "hw/qdev-core.h" #include "migration/vmstate.h" #include "trace.h"
Signature · 1 line
MST
[PULL 01/63] pci: SLT must be RO
In reply to Michael S. Tsirkincurrent code sets PCI_SEC_LATENCY_TIMER to RW, but for
pcie to pcie bridges it must be RO 0 according to
pci express spec which says:
This register does not apply to PCI Express. It must be read-only and hardwired to 00h. For PCI Express to PCI/PCI-X Bridges, refer to the [PCIe-to-PCI-PCI-X-Bridge] for requirements for this register.
also, fix typo in comment where it's made writeable - this typo is likely what prevented us noticing we violate this requirement in the 1st place.
Message-Id: <de9d05366a70172e1789d10591dbe59e39c3849c.1693432039.git.mst@redhat.com>
--- include/hw/pci/pci_bridge.h | 3 +++ hw/core/machine.c | 5 ++++- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-)
include/hw/pci/pci_bridge.h +3 -0
@@ -77,6 +77,9 @@ struct PCIBridge {pci_map_irq_fn map_irq;const char *bus_name; + +/* SLT is RO for PCIE to PCIE bridges, but old QEMU versions had it RW */ +bool pcie_writeable_slt_bug; };#define PCI_BRIDGE_DEV_PROP_CHASSIS_NR "chassis_nr"
hw/core/machine.c +4 -1
@@ -32,6 +32,7 @@#include "qemu/error-report.h" #include "sysemu/qtest.h" #include "hw/pci/pci.h" +#include "hw/pci/pci_bridge.h" #include "hw/mem/nvdimm.h" #include "migration/global_state.h" #include "migration/vmstate.h"
@@ -40,7 +41,9 @@#include "hw/virtio/virtio-pci.h" #include "hw/virtio/virtio-net.h" -GlobalProperty hw_compat_8_1[] = {}; +GlobalProperty hw_compat_8_1[] = { + {TYPE_PCI_BRIDGE ,"x-pci-express-writeable-slt-bug" ,"true" }, +};const size_t hw_compat_8_1_len =G_N_ELEMENTS (hw_compat_8_1);GlobalProperty hw_compat_8_0[] = {
hw/pci/pci.c +1 -1
@@ -893,7 +893,7 @@ static void pci_init_w1cmask(PCIDevice *dev)static void pci_init_mask_bridge (PCIDevice *d) {/* PCI_PRIMARY_BUS, PCI_SECONDARY_BUS, PCI_SUBORDINATE_BUS and -PCI_SEC_LETENCY_TIMER */ +PCI_SEC_LATENCY_TIMER */ memset (d->wmask +PCI_PRIMARY_BUS ,0xff ,4 );/* base and limit */
hw/pci/pci_bridge.c +14 -0
@@ -38,6 +38,7 @@#include "qapi/error.h" #include "hw/acpi/acpi_aml_interface.h" #include "hw/acpi/pci.h" +#include "hw/qdev-properties.h" /* PCI bridge subsystem vendor ID helper functions */ #define PCI_SSVID_SIZEOF 8
@@ -385,6 +386,11 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename)pci_bridge_region_init (br);QLIST_INIT (&sec_bus->child);QLIST_INSERT_HEAD (&parent->child, sec_bus, sibling); + +/* For express secondary buses, secondary latency timer is RO 0 */ +if (pci_bus_is_express (sec_bus) && !br->pcie_writeable_slt_bug) { + dev->wmask[PCI_SEC_LATENCY_TIMER ] =0 ; + } }/* default qdev clean up function for PCI-to-PCI bridge */
@@ -466,10 +472,18 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset,return 0 ; } +static Property pci_bridge_properties[] = { +DEFINE_PROP_BOOL ("x-pci-express-writeable-slt-bug" , PCIBridge, + pcie_writeable_slt_bug, false), +DEFINE_PROP_END_OF_LIST (), +}; +static void pci_bridge_class_init (ObjectClass *klass,void *data) {AcpiDevAmlIfClass *adevc =ACPI_DEV_AML_IF_CLASS (klass); +DeviceClass *k =DEVICE_CLASS (klass); +device_class_set_props (k, pci_bridge_properties); adevc->build_dev_aml = build_pci_bridge_aml; }
Signature · 1 line
MST
[PULL 25/63] vhost-user: tighten "reply_supported" scope in "set_vring_addr"
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
In the vhost_user_set_vring_addr() function, we calculate "reply_supported" unconditionally, even though we'll only need it if "wait_for_reply" is also true.
Restrict the scope of "reply_supported" to the minimum.
This is purely refactoring -- no observable change.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
hw/virtio/vhost-user.c +6 -5
@@ -1310,17 +1310,18 @@ static int vhost_user_set_vring_addr(struct vhost_dev *dev, .hdr.size = sizeof(msg.payload.addr), }; -bool reply_supported =virtio_has_feature (dev->protocol_features, -VHOST_USER_PROTOCOL_F_REPLY_ACK ); -/* * wait for a reply if logging is enabled to make sure * backend is actually logging changes */ bool wait_for_reply = addr->flags & (1 <<VHOST_VRING_F_LOG ); -if (reply_supported && wait_for_reply) { - msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; +if (wait_for_reply) { +bool reply_supported =virtio_has_feature (dev->protocol_features, +VHOST_USER_PROTOCOL_F_REPLY_ACK ); +if (reply_supported) { + msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; + } } ret =vhost_user_write (dev, &msg,NULL ,0 );
Signature · 1 line
MST
[PULL 21/63] qmp: remove virtio_list, search QOM tree instead
In reply to Michael S. TsirkinFrom: Jonah Palmer <[email protected]>
The virtio_list duplicates information about virtio devices that already exist in the QOM composition tree. Instead of creating this list of realized virtio devices, search the QOM composition tree instead.
This patch modifies the QMP command qmp_x_query_virtio to instead recursively search the QOM composition tree for devices of type 'TYPE_VIRTIO_DEVICE'. The device is also checked to ensure it's realized.
Message-Id: <[email protected]>
--- hw/virtio/virtio-qmp.h | 7 ---- hw/virtio/virtio-qmp.c | 85 ++++++++++++++---------------------------- hw/virtio/virtio.c | 6 --- 3 files changed, 29 insertions(+), 69 deletions(-)
hw/virtio/virtio-qmp.h +0 -7
@@ -15,13 +15,6 @@#include "hw/virtio/virtio.h" #include "hw/virtio/vhost.h" -#include "qemu/queue.h" - -typedef QTAILQ_HEAD(QmpVirtIODeviceList, VirtIODevice) QmpVirtIODeviceList; - -/* QAPI list of realized VirtIODevices */ -extern QmpVirtIODeviceList virtio_list; -VirtIODevice *qmp_find_virtio_device (const char *path);VirtioDeviceStatus *qmp_decode_status (uint8_t bitmap);VhostDeviceProtocols *qmp_decode_protocols (uint64_t bitmap);
hw/virtio/virtio-qmp.c +29 -56
106 lines not on this page · raw message
hw/virtio/virtio.c +0 -6
@@ -45,8 +45,6 @@#include "standard-headers/linux/virtio_mem.h" #include "standard-headers/linux/virtio_vsock.h" -QmpVirtIODeviceList virtio_list; -/* * Maximum size of virtio device config space */
@@ -3659,7 +3657,6 @@ static void virtio_device_realize(DeviceState *dev, Error **errp) vdev->listener.commit = virtio_memory_listener_commit; vdev->listener.name ="virtio" ;memory_listener_register (&vdev->listener, vdev->dma_as); -QTAILQ_INSERT_TAIL (&virtio_list, vdev, next); }static void virtio_device_unrealize (DeviceState *dev)
@@ -3674,7 +3671,6 @@ static void virtio_device_unrealize(DeviceState *dev) vdc->unrealize (dev); } -QTAILQ_REMOVE (&virtio_list, vdev, next);g_free (vdev->bus_name); vdev->bus_name =NULL ; }
@@ -3848,8 +3844,6 @@ static void virtio_device_class_init(ObjectClass *klass, void *data) vdc->stop_ioeventfd = virtio_device_stop_ioeventfd_impl; vdc->legacy_features |=VIRTIO_LEGACY_FEATURES ; - -QTAILQ_INIT (&virtio_list); }bool virtio_device_ioeventfd_enabled (VirtIODevice *vdev)
Signature · 1 line
MST
[PULL 26/63] vhost-user: factor out "vhost_user_write_sync"
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
The tails of the "vhost_user_set_vring_addr" and "vhost_user_set_u64" functions are now byte-for-byte identical. Factor the common tail out to a new function called "vhost_user_write_sync".
This is purely refactoring -- no observable change.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 66 ++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 38 deletions(-)
hw/virtio/vhost-user.c +28 -38
@@ -1299,10 +1299,35 @@ static int enforce_reply(struct vhost_dev *dev,return vhost_user_get_features (dev, &dummy); } +/* Note: "msg->hdr.flags" may be modified. */ +static int vhost_user_write_sync (struct vhost_dev *dev,VhostUserMsg *msg, +bool wait_for_reply) +{ +int ret; + +if (wait_for_reply) { +bool reply_supported =virtio_has_feature (dev->protocol_features, +VHOST_USER_PROTOCOL_F_REPLY_ACK ); +if (reply_supported) { + msg->hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; + } + } + + ret =vhost_user_write (dev, msg,NULL ,0 ); +if (ret <0 ) { +return ret; + } + +if (wait_for_reply) { +return enforce_reply (dev, msg); + } + +return 0 ; +} +static int vhost_user_set_vring_addr (struct vhost_dev *dev,struct vhost_vring_addr *addr) { -int ret;VhostUserMsg msg = { .hdr.request =VHOST_USER_SET_VRING_ADDR , .hdr.flags =VHOST_USER_VERSION ,
@@ -1316,24 +1341,7 @@ static int vhost_user_set_vring_addr(struct vhost_dev *dev,*/ bool wait_for_reply = addr->flags & (1 <<VHOST_VRING_F_LOG ); -if (wait_for_reply) { -bool reply_supported =virtio_has_feature (dev->protocol_features, -VHOST_USER_PROTOCOL_F_REPLY_ACK ); -if (reply_supported) { - msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; - } - } - - ret =vhost_user_write (dev, &msg,NULL ,0 ); -if (ret <0 ) { -return ret; - } - -if (wait_for_reply) { -return enforce_reply (dev, &msg); - } - -return 0 ; +return vhost_user_write_sync (dev, &msg, wait_for_reply); } static int vhost_user_set_u64(struct vhost_dev *dev, int request, uint64_t u64,
@@ -1345,26 +1353,8 @@ static int vhost_user_set_u64(struct vhost_dev *dev, int request, uint64_t u64, .payload.u64 = u64, .hdr.size = sizeof(msg.payload.u64), }; -int ret; -if (wait_for_reply) { -bool reply_supported =virtio_has_feature (dev->protocol_features, -VHOST_USER_PROTOCOL_F_REPLY_ACK ); -if (reply_supported) { - msg.hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; - } - } - - ret =vhost_user_write (dev, &msg,NULL ,0 ); -if (ret <0 ) { -return ret; - } - -if (wait_for_reply) { -return enforce_reply (dev, &msg); - } - -return 0 ; +return vhost_user_write_sync (dev, &msg, wait_for_reply); }static int vhost_user_set_status (struct vhost_dev *dev,uint8_t status)
Signature · 1 line
MST
[PULL 33/63] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Michael S. TsirkinFrom: Dave Jiang <[email protected]>
Add a simple _DSM call support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for _DSM plumbing testing from the OS.
Following edited for readbility only
Device (CXLM)
{
Name (_HID, "ACPI0017") // _HID: Hardware ID
...
Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
{
If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52")))
{
If ((Arg2 == Zero))
{
Return (Buffer (One) { 0x01 })
}
If ((Arg2 == One))
{
Return (Package (0x02)
{
Buffer (0x02)
{ 0x01, 0x00 },
Package (0x01)
{
Buffer (0x02)
{ 0x00, 0x00 }
}
})
}
}
}--
v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>
--- include/hw/acpi/cxl.h | 1 + hw/acpi/cxl.c | 57 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + 3 files changed, 59 insertions(+)
include/hw/acpi/cxl.h +1 -0
@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
hw/acpi/cxl.c +57 -0
63 lines not on this page · raw message
hw/i386/acpi-build.c +1 -0
@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);
Signature · 1 line
MST
[PULL 16/63] vdpa: export vhost_vdpa_set_vring_ready
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
The vhost-vdpa net backend needs to enable vrings in a different order than default, so export it.
No functional change intended except for tracing, that now includes the (virtio) index being enabled and the return value of the ioctl.
Still ignoring return value of this function if called from vhost_vdpa_dev_start, as reorganize calling code around it is out of the scope of this series.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 25 +++++++++++++------------ hw/virtio/trace-events | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-)
include/hw/virtio/vhost-vdpa.h +1 -0
@@ -57,6 +57,7 @@ typedef struct vhost_vdpa { } VhostVDPA;int vhost_vdpa_get_iova_range (int fd,struct vhost_vdpa_iova_range *iova_range); +int vhost_vdpa_set_vring_ready (struct vhost_vdpa *v,unsigned idx);int vhost_vdpa_dma_map (struct vhost_vdpa *v,uint32_t asid,hwaddr iova,hwaddr size,void *vaddr,bool readonly);
hw/virtio/vhost-vdpa.c +13 -12
@@ -882,18 +882,17 @@ static int vhost_vdpa_get_vq_index(struct vhost_dev *dev, int idx)return idx; } -static int vhost_vdpa_set_vring_ready (struct vhost_dev *dev) +int vhost_vdpa_set_vring_ready (struct vhost_vdpa *v,unsigned idx) { -int i; -trace_vhost_vdpa_set_vring_ready (dev); -for (i =0 ; i < dev->nvqs; ++i) { -struct vhost_vring_state state = { - .index = dev->vq_index + i, - .num =1 , - }; -vhost_vdpa_call (dev,VHOST_VDPA_SET_VRING_ENABLE , &state); - } -return 0 ; +struct vhost_dev *dev = v->dev; +struct vhost_vring_state state = { + .index = idx, + .num =1 , + }; +int r =vhost_vdpa_call (dev,VHOST_VDPA_SET_VRING_ENABLE , &state); + +trace_vhost_vdpa_set_vring_ready (dev, idx, r); +return r; } static int vhost_vdpa_set_config_call(struct vhost_dev *dev,
@@ -1304,7 +1303,9 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started)if (unlikely (!ok)) {return -1 ; } -vhost_vdpa_set_vring_ready (dev); +for (int i =0 ; i < dev->nvqs; ++i) { +vhost_vdpa_set_vring_ready (v, dev->vq_index + i); + } }else {vhost_vdpa_suspend (dev);vhost_vdpa_svqs_stop (dev);
hw/virtio/trace-events +1 -1
@@ -48,7 +48,7 @@ vhost_vdpa_set_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRI vhost_vdpa_get_device_id(void *dev, uint32_t device_id) "dev: %p device_id %"PRIu32 vhost_vdpa_reset_device(void *dev) "dev: %p" vhost_vdpa_get_vq_index(void *dev, int idx, int vq_idx) "dev: %p idx: %d vq idx: %d" -vhost_vdpa_set_vring_ready(void *dev) "dev: %p" +vhost_vdpa_set_vring_ready(void *dev, unsigned i, int r) "dev: %p, idx: %u, r: %d" vhost_vdpa_dump_config(void *dev, const char *line) "dev: %p %s" vhost_vdpa_set_config(void *dev, uint32_t offset, uint32_t size, uint32_t flags) "dev: %p offset: %"PRIu32" size: %"PRIu32" flags: 0x%"PRIx32 vhost_vdpa_get_config(void *dev, void *config, uint32_t config_len) "dev: %p config: %p config_len: %"PRIu32
Signature · 1 line
MST
[PULL 36/63] hw/acpi/cpu: Have build_cpus_aml() take a build_madt_cpu_fn callback
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
build_cpus_aml() is architecture independent but needs to create architecture- specific CPU AML. So far this was achieved by using a virtual method from TYPE_ACPI_DEVICE_IF. However, build_cpus_aml() would resolve this interface from global (!) state. This makes it quite incomprehensible where this interface comes from (TYPE_PIIX4_PM?, TYPE_ICH9_LPC_DEVICE?, TYPE_ACPI_GED_X86?) an can lead to crashes when the generic code is ported to new architectures.
So far, build_cpus_aml() is only called in architecture-specific code -- and only in x86. We can therefore simply pass pc_madt_cpu_entry() as callback to build_cpus_aml(). This is the same callback that would be used through TYPE_ACPI_DEVICE_IF.
Message-Id: <[email protected]>
--- include/hw/acpi/cpu.h | 6 +++++- hw/acpi/cpu.c | 8 ++------ hw/i386/acpi-build.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-)
include/hw/acpi/cpu.h +5 -1
@@ -15,6 +15,7 @@#include "hw/qdev-core.h" #include "hw/acpi/acpi.h" #include "hw/acpi/aml-build.h" +#include "hw/boards.h" #include "hw/hotplug.h" typedef struct AcpiCpuStatus {
@@ -55,8 +56,11 @@ typedef struct CPUHotplugFeatures {const char *smi_path; } CPUHotplugFeatures; +typedef void (*build_madt_cpu_fn )(int uid,const CPUArchIdList *apic_ids, +GArray *entry,bool force_enabled); +void build_cpus_aml (Aml *table,MachineState *machine,CPUHotplugFeatures opts, -hwaddr io_base, +build_madt_cpu_fn build_madt_cpu,hwaddr io_base,const char *res_root,const char *event_handler_method);
hw/acpi/cpu.c +2 -6
@@ -338,7 +338,7 @@ const VMStateDescription vmstate_cpu_hotplug = {#define CPU_FW_EJECT_EVENT "CEJF"void build_cpus_aml (Aml *table,MachineState *machine,CPUHotplugFeatures opts, -hwaddr io_base, +build_madt_cpu_fn build_madt_cpu,hwaddr io_base,const char *res_root,const char *event_handler_method) {
@@ -353,8 +353,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,MachineClass *mc =MACHINE_GET_CLASS (machine);const CPUArchIdList *arch_ids = mc->possible_cpu_arch_ids (machine);char *cphp_res_path =g_strdup_printf ("%s." CPUHP_RES_DEVICE , res_root); -Object *obj =object_resolve_path_type ("" ,TYPE_ACPI_DEVICE_IF ,NULL ); -AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_GET_CLASS (obj); cpu_ctrl_dev =aml_device ("%s" , cphp_res_path); {
@@ -664,9 +662,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts,aml_append (dev, method);/* build _MAT object */ -assert (adevc && adevc->madt_cpu); - adevc->madt_cpu (i, arch_ids, madt_buf, - true);/* set enabled flag */ +build_madt_cpu (i, arch_ids, madt_buf, true);/* set enabled flag */ aml_append (dev,aml_name_decl ("_MAT" ,aml_buffer (madt_buf->len, (uint8_t *)madt_buf->data)));g_array_free (madt_buf, true);
hw/i386/acpi-build.c +2 -2
@@ -1550,8 +1550,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, .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" ); +build_cpus_aml (dsdt, machine, opts, pc_madt_cpu_entry, + pm->cpu_hp_io_base,"\\_SB.PCI0" ,"\\_GPE._E02" ); }if (pcms->memhp_io_base && nr_mem) {
Signature · 1 line
MST
[PULL 32/63] tests/acpi: Allow update of DSDT.cxl
In reply to Michael S. TsirkinFrom: Jonathan Cameron <[email protected]>
Addition of QTG in following patch requires an update to the test data.
Message-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/q35/DSDT.cxl",
Signature · 1 line
MST
[PULL 07/63] hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]
In reply to Michael S. TsirkinFrom: Philippe Mathieu-Daudé <[email protected]>
Similarly to commit de6cd7599b ("meson: Replace softmmu_ss -> system_ss"), rename the virtio source set common to all system emulation as 'system_virtio_ss[]'. This is clearer because softmmu can be used for user emulation.
Message-Id: <[email protected]>
--- hw/virtio/meson.build | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
hw/virtio/meson.build +12 -12
@@ -1,28 +1,28 @@ -softmmu_virtio_ss = ss.source_set() -softmmu_virtio_ss.add(files('virtio-bus.c')) -softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.c')) -softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c')) -softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c')) -softmmu_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK_COMMON', if_true: files('vhost-vsock-common.c')) -softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c')) -softmmu_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c')) +system_virtio_ss = ss.source_set() +system_virtio_ss.add(files('virtio-bus.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c')) +system_virtio_ss.add(when: 'CONFIG_VHOST_VSOCK_COMMON', if_true: files('vhost-vsock-common.c')) +system_virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c')) +system_virtio_ss.add(when: 'CONFIG_VHOST_VDPA_DEV', if_true: files('vdpa-dev.c')) specific_virtio_ss = ss.source_set() specific_virtio_ss.add(files('virtio.c')) specific_virtio_ss.add(files('virtio-config-io.c', 'virtio-qmp.c')) if have_vhost - softmmu_virtio_ss.add(files('vhost.c')) + system_virtio_ss.add(files('vhost.c')) specific_virtio_ss.add(files('vhost-backend.c', 'vhost-iova-tree.c')) if have_vhost_user specific_virtio_ss.add(files('vhost-user.c')) endif if have_vhost_vdpa - softmmu_virtio_ss.add(files('vhost-vdpa.c')) + system_virtio_ss.add(files('vhost-vdpa.c')) specific_virtio_ss.add(files('vhost-shadow-virtqueue.c')) endif else - softmmu_virtio_ss.add(files('vhost-stub.c')) + system_virtio_ss.add(files('vhost-stub.c')) endif specific_virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c'))
@@ -68,7 +68,7 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MD', if_true: files('virtio-md-pci.c')) specific_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss) -system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss) +system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss) system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c')) system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c')) system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
Signature · 1 line
MST
[PULL 34/63] tests/acpi: Update DSDT.cxl with QTG DSM
In reply to Michael S. TsirkinFrom: Jonathan Cameron <[email protected]>
Description of change in previous patch.
Message-Id: <[email protected]>
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytes 2 files changed, 1 deletion(-)
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/q35/DSDT.cxl",
tests/data/acpi/q35/DSDT.cxl binary +0 -0
Signature · 1 line
MST
[PULL 58/63] virtio: remove unnecessary thread fence while reading next descriptor
In reply to Michael S. TsirkinFrom: Ilya Maximets <[email protected]>
It was supposed to be a compiler barrier and it was a compiler barrier initially called 'wmb' when virtio core support was introduced. Later all the instances of 'wmb' were switched to smp_wmb to fix memory ordering issues on non-x86 platforms. However, this one doesn't need to be an actual barrier, as its only purpose was to ensure that the value is not read twice.
And since commit aa570d6fb6bd ("virtio: combine the read of a descriptor") there is no need for a barrier at all, since we're no longer reading guest memory here, but accessing a local structure.
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 2 -- 1 file changed, 2 deletions(-)
hw/virtio/virtio.c +0 -2
@@ -1060,8 +1060,6 @@ static int virtqueue_split_read_next_desc(VirtIODevice *vdev, VRingDesc *desc,/* Check they're not leading us off end of descriptors. */ *next = desc->next; -/* Make sure compiler knows to grab that: we don't want it changing! */ -smp_wmb ();if (*next >= max) {virtio_error (vdev,"Desc next is %u" , *next);
Signature · 1 line
MST
[PULL 23/63] vhost-user: move VhostUserProtocolFeature definition to header file
In reply to Michael S. TsirkinFrom: Jonah Palmer <[email protected]>
Move the definition of VhostUserProtocolFeature to include/hw/virtio/vhost-user.h.
Remove previous definitions in hw/scsi/vhost-user-scsi.c, hw/virtio/vhost-user.c, and hw/virtio/virtio-qmp.c.
Previously there were 3 separate definitions of this over 3 different files. Now only 1 definition of this will be present for these 3 files.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-user.h | 21 +++++++++++++++++++++ hw/scsi/vhost-user-scsi.c | 4 ---- hw/virtio/vhost-user.c | 21 --------------------- hw/virtio/virtio-qmp.c | 22 +--------------------- 4 files changed, 22 insertions(+), 46 deletions(-)
include/hw/virtio/vhost-user.h +21 -0
@@ -11,6 +11,27 @@#include "chardev/char-fe.h" #include "hw/virtio/virtio.h" +enum VhostUserProtocolFeature { +VHOST_USER_PROTOCOL_F_MQ =0 , +VHOST_USER_PROTOCOL_F_LOG_SHMFD =1 , +VHOST_USER_PROTOCOL_F_RARP =2 , +VHOST_USER_PROTOCOL_F_REPLY_ACK =3 , +VHOST_USER_PROTOCOL_F_NET_MTU =4 , +VHOST_USER_PROTOCOL_F_BACKEND_REQ =5 , +VHOST_USER_PROTOCOL_F_CROSS_ENDIAN =6 , +VHOST_USER_PROTOCOL_F_CRYPTO_SESSION =7 , +VHOST_USER_PROTOCOL_F_PAGEFAULT =8 , +VHOST_USER_PROTOCOL_F_CONFIG =9 , +VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD =10 , +VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =11 , +VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =12 , +VHOST_USER_PROTOCOL_F_RESET_DEVICE =13 , +VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =14 , +VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =15 , +VHOST_USER_PROTOCOL_F_STATUS =16 , +VHOST_USER_PROTOCOL_F_MAX +}; +/** * VhostUserHostNotifier - notifier information for one queue * @rcu: rcu_head for cleanup
hw/scsi/vhost-user-scsi.c +0 -4
@@ -39,10 +39,6 @@ static const int user_feature_bits[] = { VHOST_INVALID_FEATURE_BIT }; -enum VhostUserProtocolFeature { -VHOST_USER_PROTOCOL_F_RESET_DEVICE =13 , -}; -static void vhost_user_scsi_set_status (VirtIODevice *vdev,uint8_t status) {VHostUserSCSI *s = (VHostUserSCSI *)vdev;
hw/virtio/vhost-user.c +0 -21
@@ -56,27 +56,6 @@*/ #define VHOST_USER_MAX_CONFIG_SIZE 256 -enum VhostUserProtocolFeature { -VHOST_USER_PROTOCOL_F_MQ =0 , -VHOST_USER_PROTOCOL_F_LOG_SHMFD =1 , -VHOST_USER_PROTOCOL_F_RARP =2 , -VHOST_USER_PROTOCOL_F_REPLY_ACK =3 , -VHOST_USER_PROTOCOL_F_NET_MTU =4 , -VHOST_USER_PROTOCOL_F_BACKEND_REQ =5 , -VHOST_USER_PROTOCOL_F_CROSS_ENDIAN =6 , -VHOST_USER_PROTOCOL_F_CRYPTO_SESSION =7 , -VHOST_USER_PROTOCOL_F_PAGEFAULT =8 , -VHOST_USER_PROTOCOL_F_CONFIG =9 , -VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD =10 , -VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =11 , -VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =12 , -VHOST_USER_PROTOCOL_F_RESET_DEVICE =13 , -/* Feature 14 reserved for VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS. */ -VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =15 , -VHOST_USER_PROTOCOL_F_STATUS =16 , -VHOST_USER_PROTOCOL_F_MAX -}; -#define VHOST_USER_PROTOCOL_FEATURE_MASK ((1 << VHOST_USER_PROTOCOL_F_MAX) - 1) typedef enum VhostUserRequest {
hw/virtio/virtio-qmp.c +1 -21
@@ -17,6 +17,7 @@#include "qapi/qapi-commands-qom.h" #include "qapi/qmp/qobject.h" #include "qapi/qmp/qjson.h" +#include "hw/virtio/vhost-user.h" #include "standard-headers/linux/virtio_ids.h" #include "standard-headers/linux/vhost_types.h"
@@ -37,27 +38,6 @@#define FEATURE_ENTRY (name, desc) (qmp_virtio_feature_map_t) \ { .virtio_bit = name, .feature_desc = desc } -enum VhostUserProtocolFeature { -VHOST_USER_PROTOCOL_F_MQ =0 , -VHOST_USER_PROTOCOL_F_LOG_SHMFD =1 , -VHOST_USER_PROTOCOL_F_RARP =2 , -VHOST_USER_PROTOCOL_F_REPLY_ACK =3 , -VHOST_USER_PROTOCOL_F_NET_MTU =4 , -VHOST_USER_PROTOCOL_F_BACKEND_REQ =5 , -VHOST_USER_PROTOCOL_F_CROSS_ENDIAN =6 , -VHOST_USER_PROTOCOL_F_CRYPTO_SESSION =7 , -VHOST_USER_PROTOCOL_F_PAGEFAULT =8 , -VHOST_USER_PROTOCOL_F_CONFIG =9 , -VHOST_USER_PROTOCOL_F_BACKEND_SEND_FD =10 , -VHOST_USER_PROTOCOL_F_HOST_NOTIFIER =11 , -VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =12 , -VHOST_USER_PROTOCOL_F_RESET_DEVICE =13 , -VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =14 , -VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =15 , -VHOST_USER_PROTOCOL_F_STATUS =16 , -VHOST_USER_PROTOCOL_F_MAX -}; -/* Virtio transport features mapping */ static const qmp_virtio_feature_map_t virtio_transport_map[] = {/* Virtio device transport features */
Signature · 1 line
MST
[PULL 46/63] hw/cxl: Add utility functions decoder interleave ways and target count.
In reply to Michael S. TsirkinFrom: Jonathan Cameron <[email protected]>
As an encoded version of these key configuration parameters is available in a register, provide functions to extract it again so as to avoid the need for duplicating the storage.
Whilst here update the _enc() function to include additional values as defined in the CXL 3.0 specification. Whilst they are not currently used in the emulation, they may be in future and it is easier to compare with the specification if all values are covered.
Add a spec reference for cxl_interleave_ways_enc() for consistency with the target count equivalent (and because it's nice to know where the magic numbers come from).
Message-Id: <[email protected]>
--- include/hw/cxl/cxl_component.h | 2 ++ hw/cxl/cxl-component-utils.c | 60 ++++++++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 6 deletions(-)
include/hw/cxl/cxl_component.h +2 -0
@@ -226,8 +226,10 @@ void cxl_component_create_dvsec(CXLComponentState *cxl_cstate, uint16_t type, uint8_t rev, uint8_t *body);int cxl_decoder_count_enc (int count); +int cxl_decoder_count_dec (int enc_cnt);uint8_t cxl_interleave_ways_enc (int iw,Error **errp); +int cxl_interleave_ways_dec (uint8_t iw_enc,Error **errp);uint8_t cxl_interleave_granularity_enc (uint64_t gran,Error **errp);hwaddr cxl_decode_ig (int ig);
hw/cxl/cxl-component-utils.c +54 -6
81 lines not on this page · raw message
Signature · 1 line
MST
[PULL 47/63] hw/cxl: Fix and use same calculation for HDM decoder block size everywhere
In reply to Michael S. TsirkinFrom: Jonathan Cameron <[email protected]>
In order to avoid having the size of the per HDM decoder register block repeated in lots of places, create the register definitions for HDM decoder 1 and use the offset between the first registers in HDM decoder 0 and HDM decoder 1 to establish the offset.
Calculate in each function as this is more obvious and leads to shorter line lengths than a single #define which would need a long name to be specific enough.
Note that the code currently only supports one decoder, so the bugs this fixes don't actually affect anything.
--
v3:
New patch to separate this out from the addition of HDM decoders.
Message-Id: <[email protected]>
--- include/hw/cxl/cxl_component.h | 2 ++ hw/cxl/cxl-component-utils.c | 19 +++++++++++-------- hw/cxl/cxl-host.c | 4 +++- hw/mem/cxl_type3.c | 24 +++++++++++++++--------- 4 files changed, 31 insertions(+), 18 deletions(-)
include/hw/cxl/cxl_component.h +2 -0
@@ -148,6 +148,8 @@ REG32(CXL_HDM_DECODER_GLOBAL_CONTROL, CXL_HDM_REGISTERS_OFFSET + 4) FIELD(CXL_HDM_DECODER_GLOBAL_CONTROL, HDM_DECODER_ENABLE, 1, 1)HDM_DECODER_INIT (0 ); +/* Only used for HDM decoder registers block address increment */ +HDM_DECODER_INIT (1 );/* 8.2.5.13 - CXL Extended Security Capability Structure (Root complex only) */ #define EXTSEC_ENTRY_MAX 256
hw/cxl/cxl-component-utils.c +11 -8
@@ -210,6 +210,7 @@ static void hdm_init_common(uint32_t *reg_state, uint32_t *write_msk, enum reg_type type) {int decoder_count =1 ; +int hdm_inc =R_CXL_HDM_DECODER1_BASE_LO -R_CXL_HDM_DECODER0_BASE_LO ;int i; ARRAY_FIELD_DP32(reg_state, CXL_HDM_DECODER_CAPABILITY, DECODER_COUNT,
@@ -222,19 +223,21 @@ static void hdm_init_common(uint32_t *reg_state, uint32_t *write_msk, HDM_DECODER_ENABLE, 0); write_msk[R_CXL_HDM_DECODER_GLOBAL_CONTROL ] =0x3 ;for (i =0 ; i < decoder_count; i++) { - write_msk[R_CXL_HDM_DECODER0_BASE_LO + i *0x20 ] =0xf0000000 ; - write_msk[R_CXL_HDM_DECODER0_BASE_HI + i *0x20 ] =0xffffffff ; - write_msk[R_CXL_HDM_DECODER0_SIZE_LO + i *0x20 ] =0xf0000000 ; - write_msk[R_CXL_HDM_DECODER0_SIZE_HI + i *0x20 ] =0xffffffff ; - write_msk[R_CXL_HDM_DECODER0_CTRL + i *0x20 ] =0x13ff ; + write_msk[R_CXL_HDM_DECODER0_BASE_LO + i * hdm_inc] =0xf0000000 ; + write_msk[R_CXL_HDM_DECODER0_BASE_HI + i * hdm_inc] =0xffffffff ; + write_msk[R_CXL_HDM_DECODER0_SIZE_LO + i * hdm_inc] =0xf0000000 ; + write_msk[R_CXL_HDM_DECODER0_SIZE_HI + i * hdm_inc] =0xffffffff ; + write_msk[R_CXL_HDM_DECODER0_CTRL + i * hdm_inc] =0x13ff ;if (type ==CXL2_DEVICE || type ==CXL2_TYPE3_DEVICE || type ==CXL2_LOGICAL_DEVICE ) { - write_msk[R_CXL_HDM_DECODER0_TARGET_LIST_LO + i *0x20 ] =0xf0000000 ; + write_msk[R_CXL_HDM_DECODER0_TARGET_LIST_LO + i * hdm_inc] = +0xf0000000 ; }else { - write_msk[R_CXL_HDM_DECODER0_TARGET_LIST_LO + i *0x20 ] =0xffffffff ; + write_msk[R_CXL_HDM_DECODER0_TARGET_LIST_LO + i * hdm_inc] = +0xffffffff ; } - write_msk[R_CXL_HDM_DECODER0_TARGET_LIST_HI + i *0x20 ] =0xffffffff ; + write_msk[R_CXL_HDM_DECODER0_TARGET_LIST_HI + i * hdm_inc] =0xffffffff ; } }
hw/cxl/cxl-host.c +3 -1
@@ -101,12 +101,14 @@ void cxl_fmws_link_targets(CXLState *cxl_state, Error **errp)static bool cxl_hdm_find_target (uint32_t *cache_mem,hwaddr addr,uint8_t *target) { +int hdm_inc =R_CXL_HDM_DECODER1_BASE_LO -R_CXL_HDM_DECODER0_BASE_LO ;uint32_t ctrl;uint32_t ig_enc;uint32_t iw_enc;uint32_t target_idx; +int i =0 ; - ctrl = cache_mem[R_CXL_HDM_DECODER0_CTRL ]; + ctrl = cache_mem[R_CXL_HDM_DECODER0_CTRL + i * hdm_inc];if (!FIELD_EX32 (ctrl,CXL_HDM_DECODER0_CTRL ,COMMITTED )) {return false; }
hw/mem/cxl_type3.c +15 -9
@@ -388,34 +388,36 @@ static void build_dvsecs(CXLType3Dev *ct3d)static void hdm_decoder_commit (CXLType3Dev *ct3d,int which) { +int hdm_inc =R_CXL_HDM_DECODER1_BASE_LO -R_CXL_HDM_DECODER0_BASE_LO ;ComponentRegisters *cregs = &ct3d->cxl_cstate.crb;uint32_t *cache_mem = cregs->cache_mem_registers;uint32_t ctrl;assert (which ==0 ); - ctrl =ldl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL ); + ctrl =ldl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL + which * hdm_inc);/* TODO: Sanity checks that the decoder is possible */ ctrl =FIELD_DP32 (ctrl,CXL_HDM_DECODER0_CTRL ,ERR ,0 ); ctrl =FIELD_DP32 (ctrl,CXL_HDM_DECODER0_CTRL ,COMMITTED ,1 ); -stl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL , ctrl); +stl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL + which * hdm_inc, ctrl); }static void hdm_decoder_uncommit (CXLType3Dev *ct3d,int which) { +int hdm_inc =R_CXL_HDM_DECODER1_BASE_LO -R_CXL_HDM_DECODER0_BASE_LO ;ComponentRegisters *cregs = &ct3d->cxl_cstate.crb;uint32_t *cache_mem = cregs->cache_mem_registers;uint32_t ctrl;assert (which ==0 ); - ctrl =ldl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL ); + ctrl =ldl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL + which * hdm_inc); ctrl =FIELD_DP32 (ctrl,CXL_HDM_DECODER0_CTRL ,ERR ,0 ); ctrl =FIELD_DP32 (ctrl,CXL_HDM_DECODER0_CTRL ,COMMITTED ,0 ); -stl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL , ctrl); +stl_le_p (cache_mem +R_CXL_HDM_DECODER0_CTRL + which * hdm_inc, ctrl); }static int ct3d_qmp_uncor_err_to_cxl (CxlUncorErrorType qmp_err)
@@ -772,26 +774,30 @@ static void ct3_exit(PCIDevice *pci_dev)/* TODO: Support multiple HDM decoders and DPA skip */ static bool cxl_type3_dpa (CXLType3Dev *ct3d,hwaddr host_addr,uint64_t *dpa) { +int hdm_inc =R_CXL_HDM_DECODER1_BASE_LO -R_CXL_HDM_DECODER0_BASE_LO ;uint32_t *cache_mem = ct3d->cxl_cstate.crb.cache_mem_registers;uint64_t decoder_base, decoder_size, hpa_offset;uint32_t hdm0_ctrl;int ig, iw; +int i =0 ; - decoder_base = (((uint64_t )cache_mem[R_CXL_HDM_DECODER0_BASE_HI ] <<32 ) | - cache_mem[R_CXL_HDM_DECODER0_BASE_LO ]); + decoder_base = + (((uint64_t )cache_mem[R_CXL_HDM_DECODER0_BASE_HI + i * hdm_inc] <<32 ) | + cache_mem[R_CXL_HDM_DECODER0_BASE_LO + i * hdm_inc]);if ((uint64_t )host_addr < decoder_base) {return false; } hpa_offset = (uint64_t )host_addr - decoder_base; - decoder_size = ((uint64_t )cache_mem[R_CXL_HDM_DECODER0_SIZE_HI ] <<32 ) | - cache_mem[R_CXL_HDM_DECODER0_SIZE_LO ]; + decoder_size = + ((uint64_t )cache_mem[R_CXL_HDM_DECODER0_SIZE_HI + i * hdm_inc] <<32 ) | + cache_mem[R_CXL_HDM_DECODER0_SIZE_LO + i * hdm_inc];if (hpa_offset >= decoder_size) {return false; } - hdm0_ctrl = cache_mem[R_CXL_HDM_DECODER0_CTRL ]; + hdm0_ctrl = cache_mem[R_CXL_HDM_DECODER0_CTRL + i * hdm_inc]; iw =FIELD_EX32 (hdm0_ctrl,CXL_HDM_DECODER0_CTRL ,IW ); ig =FIELD_EX32 (hdm0_ctrl,CXL_HDM_DECODER0_CTRL ,IG );
Signature · 1 line
MST
[PULL 61/63] hw/display: introduce virtio-dmabuf
In reply to Michael S. TsirkinFrom: Albert Esteve <[email protected]>
This API manages objects (in this iteration,
dmabuf fds) that can be shared along different
virtio devices, associated to a UUID.
The API allows the different devices to add,
remove and/or retrieve the objects by simply
invoking the public functions that reside in the
virtio-dmabuf file.
For vhost backends, the API stores the pointer
to the backend holding the object.
Message-Id: <[email protected]>
--- include/hw/virtio/virtio-dmabuf.h | 100 ++++++++++++++++++++++ hw/display/virtio-dmabuf.c | 138 ++++++++++++++++++++++++++++++ tests/unit/test-virtio-dmabuf.c | 137 +++++++++++++++++++++++++++++ MAINTAINERS | 7 ++ hw/display/meson.build | 1 + tests/unit/meson.build | 1 + 6 files changed, 384 insertions(+) create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c create mode 100644 tests/unit/test-virtio-dmabuf.c
include/hw/virtio/virtio-dmabuf.h new file +100 -0
@@ -0,0 +1,100 @@ +/* +* Virtio Shared dma-buf +* +* Copyright Red Hat, Inc. 2023 +* +* Authors: +* Albert Esteve <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2. +* See the COPYING file in the top-level directory. +*/ + +#ifndef VIRTIO_DMABUF_H +#define VIRTIO_DMABUF_H + +#include "qemu/uuid.h" +#include "vhost.h" + +typedef enum SharedObjectType { +TYPE_INVALID =0 , +TYPE_DMABUF , +TYPE_VHOST_DEV , +}SharedObjectType ; + +typedef struct VirtioSharedObject { +SharedObjectType type; +gpointer value; +}VirtioSharedObject ; + +/** +* virtio_add_dmabuf() - Add a new dma-buf resource to the lookup table +* @uuid: new resource's UUID +* @dmabuf_fd: the dma-buf descriptor that will be stored and shared with +* other virtio devices. The caller retains ownership over the +* descriptor and its lifecycle. +* +* Note: @dmabuf_fd must be a valid (non-negative) file descriptor. +* +* Return: true if the UUID did not exist and the resource has been added, +* false if another resource with the same UUID already existed. +* Note that if it finds a repeated UUID, the resource is not inserted in +* the lookup table. +*/ +bool virtio_add_dmabuf (QemuUUID *uuid,int dmabuf_fd); + +/** +* virtio_add_vhost_device() - Add a new exporter vhost device that holds the +* resource with the associated UUID +* @uuid: new resource's UUID +* @dev: the pointer to the vhost device that holds the resource. The caller +* retains ownership over the device struct and its lifecycle. +* +* Return: true if the UUID did not exist and the device has been tracked, +* false if another resource with the same UUID already existed. +* Note that if it finds a repeated UUID, the resource is not inserted in +* the lookup table. +*/ +bool virtio_add_vhost_device (QemuUUID *uuid,struct vhost_dev *dev); + +/** +* virtio_remove_resource() - Removes a resource from the lookup table +* @uuid: resource's UUID +* +* Return: true if the UUID has been found and removed from the lookup table. +*/ +bool virtio_remove_resource (const QemuUUID *uuid); + +/** +* virtio_lookup_dmabuf() - Looks for a dma-buf resource in the lookup table +* @uuid: resource's UUID +* +* Return: the dma-buf file descriptor integer, or -1 if the key is not found. +*/ +int virtio_lookup_dmabuf (const QemuUUID *uuid); + +/** +* virtio_lookup_vhost_device() - Looks for an exporter vhost device in the +* lookup table +* @uuid: resource's UUID +* +* Return: pointer to the vhost_dev struct, or NULL if the key is not found. +*/ +struct vhost_dev *virtio_lookup_vhost_device (const QemuUUID *uuid); + +/** +* virtio_object_type() - Looks for the type of resource in the lookup table +* @uuid: resource's UUID +* +* Return: the type of resource associated with the UUID, or TYPE_INVALID if +* the key is not found. +*/ +SharedObjectType virtio_object_type (const QemuUUID *uuid); + +/** +* virtio_free_resources() - Destroys all keys and values of the shared +* resources lookup table, and frees them +*/ +void virtio_free_resources (void ); + +#endif /* VIRTIO_DMABUF_H */
hw/display/virtio-dmabuf.c new file +138 -0
138 lines not on this page · raw message
tests/unit/test-virtio-dmabuf.c new file +137 -0
137 lines not on this page · raw message
MAINTAINERS +7 -0
@@ -2154,6 +2154,13 @@ T: git https://gitlab.com/cohuck/qemu.git s390-next T: git https://github.com/borntraeger/qemu.git s390-next L: [email protected] +virtio-dmabuf +M: Albert Esteve <[email protected]> +S: Supported +F: hw/display/virtio-dmabuf.c +F: include/hw/virtio/virtio-dmabuf.h +F: tests/unit/test-virtio-dmabuf.c + virtiofs M: Stefan Hajnoczi <[email protected]> S: Supported
hw/display/meson.build +1 -0
@@ -37,6 +37,7 @@ system_ss.add(when: 'CONFIG_MACFB', if_true: files('macfb.c')) system_ss.add(when: 'CONFIG_NEXTCUBE', if_true: files('next-fb.c')) system_ss.add(when: 'CONFIG_VGA', if_true: files('vga.c')) +system_ss.add(when: 'CONFIG_VIRTIO', if_true: files('virtio-dmabuf.c')) if (config_all_devices.has_key('CONFIG_VGA_CIRRUS') or config_all_devices.has_key('CONFIG_VGA_PCI') or
tests/unit/meson.build +1 -0
@@ -50,6 +50,7 @@ tests = { 'test-qapi-util': [], 'test-interval-tree': [], 'test-xs-node': [qom], + 'test-virtio-dmabuf': [meson.project_source_root() / 'hw/display/virtio-dmabuf.c'], } if have_system or have_tools
Signature · 1 line
MST
[PULL 39/63] hw/i386: Remove now redundant TYPE_ACPI_GED_X86
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
Now that TYPE_ACPI_GED_X86 doesn't assign AcpiDeviceIfClass::madt_cpu any more it is the same as TYPE_ACPI_GED.
Message-Id: <[email protected]>
--- include/hw/acpi/generic_event_device.h | 2 -- hw/i386/generic_event_device_x86.c | 27 -------------------------- hw/i386/microvm.c | 2 +- hw/i386/meson.build | 1 - 4 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 hw/i386/generic_event_device_x86.c
include/hw/acpi/generic_event_device.h +0 -2
@@ -69,8 +69,6 @@#define TYPE_ACPI_GED "acpi-ged" OBJECT_DECLARE_SIMPLE_TYPE(AcpiGedState, ACPI_GED) -#define TYPE_ACPI_GED_X86 "acpi-ged-x86" -#define ACPI_GED_EVT_SEL_OFFSET 0x0#define ACPI_GED_EVT_SEL_LEN 0x4
hw/i386/generic_event_device_x86.c deleted +0 -27
@@ -1,27 +0,0 @@ -/* -* x86 variant of the generic event device for hw reduced acpi -* -* This program is free software; you can redistribute it and/or modify it -* under the terms and conditions of the GNU General Public License, -* version 2 or later, as published by the Free Software Foundation. -*/ - -#include "qemu/osdep.h" -#include "hw/acpi/generic_event_device.h" - -static const TypeInfo acpi_ged_x86_info = { - .name =TYPE_ACPI_GED_X86 , - .parent =TYPE_ACPI_GED , - .interfaces = (InterfaceInfo []) { - {TYPE_HOTPLUG_HANDLER }, - {TYPE_ACPI_DEVICE_IF }, - { } - } -}; - -static void acpi_ged_x86_register_types (void ) -{ -type_register_static (&acpi_ged_x86_info); -} - -type_init (acpi_ged_x86_register_types)
hw/i386/microvm.c +1 -1
@@ -204,7 +204,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)/* Optional and legacy devices */ if (x86_machine_is_acpi_enabled (x86ms)) { -DeviceState *dev =qdev_new (TYPE_ACPI_GED_X86 ); +DeviceState *dev =qdev_new (TYPE_ACPI_GED );qdev_prop_set_uint32 (dev,"ged-event" ,ACPI_GED_PWR_DOWN_EVT );sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,GED_MMIO_BASE );/* sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, GED_MMIO_BASE_MEMHP); */
hw/i386/meson.build +0 -1
@@ -20,7 +20,6 @@ i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'), if_false: files('sgx-stub.c')) i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c')) -i386_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device_x86.c')) i386_ss.add(when: 'CONFIG_PC', if_true: files( 'pc.c', 'pc_sysfw.c',
Signature · 1 line
MST
[PULL 22/63] qmp: update virtio feature maps, vhost-user-gpio introspection
In reply to Michael S. TsirkinFrom: Jonah Palmer <[email protected]>
Add new vhost-user protocol feature to vhost-user protocol feature map and enumeration:
- VHOST_USER_PROTOCOL_F_STATUS
Add new virtio device features for several virtio devices to their respective feature mappings:
virtio-blk:
- VIRTIO_BLK_F_SECURE_ERASE
virtio-net:
- VIRTIO_NET_F_NOTF_COAL
- VIRTIO_NET_F_GUEST_USO4
- VIRTIO_NET_F_GUEST_USO6
- VIRTIO_NET_F_HOST_USO
virtio/vhost-user-gpio:
- VIRTIO_GPIO_F_IRQ
- VHOST_USER_F_PROTOCOL_FEATURES
Add support for introspection on vhost-user-gpio devices.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user-gpio.c | 7 +++++++ hw/virtio/virtio-qmp.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-)
hw/virtio/vhost-user-gpio.c +7 -0
@@ -205,6 +205,12 @@ static void vu_gpio_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask)vhost_virtqueue_mask (&gpio->vhost_dev, vdev, idx, mask); } +static struct vhost_dev *vu_gpio_get_vhost (VirtIODevice *vdev) +{ +VHostUserGPIO *gpio =VHOST_USER_GPIO (vdev); +return &gpio->vhost_dev; +} +static void do_vhost_user_cleanup (VirtIODevice *vdev,VHostUserGPIO *gpio) {virtio_delete_queue (gpio->command_vq);
@@ -413,6 +419,7 @@ static void vu_gpio_class_init(ObjectClass *klass, void *data) vdc->get_config = vu_gpio_get_config; vdc->set_status = vu_gpio_set_status; vdc->guest_notifier_mask = vu_gpio_guest_notifier_mask; + vdc->get_vhost = vu_gpio_get_vhost; }static const TypeInfo vu_gpio_info = {
hw/virtio/virtio-qmp.c +33 -1
@@ -30,6 +30,7 @@#include "standard-headers/linux/virtio_iommu.h" #include "standard-headers/linux/virtio_mem.h" #include "standard-headers/linux/virtio_vsock.h" +#include "standard-headers/linux/virtio_gpio.h" #include CONFIG_DEVICES
@@ -53,6 +54,7 @@ enum VhostUserProtocolFeature {VHOST_USER_PROTOCOL_F_RESET_DEVICE =13 ,VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =14 ,VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =15 , +VHOST_USER_PROTOCOL_F_STATUS =16 , VHOST_USER_PROTOCOL_F_MAX };
@@ -136,6 +138,9 @@ static const qmp_virtio_feature_map_t vhost_user_protocol_map[] = {FEATURE_ENTRY (VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS , \"VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS: Configuration for " "memory slots supported" ), +FEATURE_ENTRY (VHOST_USER_PROTOCOL_F_STATUS , \ +"VHOST_USER_PROTOCOL_F_STATUS: Querying and notifying back-end " +"device status supported" ), { -1, "" } };
@@ -178,6 +183,8 @@ static const qmp_virtio_feature_map_t virtio_blk_feature_map[] = { "VIRTIO_BLK_F_DISCARD: Discard command supported"),FEATURE_ENTRY (VIRTIO_BLK_F_WRITE_ZEROES , \"VIRTIO_BLK_F_WRITE_ZEROES: Write zeroes command supported" ), +FEATURE_ENTRY (VIRTIO_BLK_F_SECURE_ERASE , \ +"VIRTIO_BLK_F_SECURE_ERASE: Secure erase supported" ),FEATURE_ENTRY (VIRTIO_BLK_F_ZONED , \"VIRTIO_BLK_F_ZONED: Zoned block devices" ), #ifndef VIRTIO_BLK_NO_LEGACY
@@ -301,6 +308,14 @@ static const qmp_virtio_feature_map_t virtio_net_feature_map[] = {FEATURE_ENTRY (VIRTIO_NET_F_CTRL_MAC_ADDR , \"VIRTIO_NET_F_CTRL_MAC_ADDR: MAC address set through control " "channel" ), +FEATURE_ENTRY (VIRTIO_NET_F_NOTF_COAL , \ +"VIRTIO_NET_F_NOTF_COAL: Device supports coalescing notifications" ), +FEATURE_ENTRY (VIRTIO_NET_F_GUEST_USO4 , \ +"VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv4" ), +FEATURE_ENTRY (VIRTIO_NET_F_GUEST_USO6 , \ +"VIRTIO_NET_F_GUEST_USO4: Driver can receive USOv6" ), +FEATURE_ENTRY (VIRTIO_NET_F_HOST_USO , \ +"VIRTIO_NET_F_HOST_USO: Device can receive USO" ),FEATURE_ENTRY (VIRTIO_NET_F_HASH_REPORT , \"VIRTIO_NET_F_HASH_REPORT: Hash reporting supported" ), FEATURE_ENTRY(VIRTIO_NET_F_RSS, \
@@ -471,6 +486,18 @@ static const qmp_virtio_feature_map_t virtio_rng_feature_map[] = { };#endif +/* virtio/vhost-gpio features mapping */ +#ifdef CONFIG_VHOST_USER_GPIO +static const qmp_virtio_feature_map_t virtio_gpio_feature_map[] = { +FEATURE_ENTRY (VIRTIO_GPIO_F_IRQ , \ +"VIRTIO_GPIO_F_IRQ: Device supports interrupts on GPIO lines" ), +FEATURE_ENTRY (VHOST_USER_F_PROTOCOL_FEATURES , \ +"VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol features " +"negotiation supported" ), + {-1 ,"" } +}; +#endif +#define CONVERT_FEATURES (type, map, is_status, bitmap) \ ({ \ type *list = NULL; \
@@ -627,6 +654,12 @@ VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, uint64_t bitmap) features->dev_features =CONVERT_FEATURES (strList, virtio_rng_feature_map,0 , bitmap);break ; +#endif +#ifdef CONFIG_VHOST_USER_GPIO +case VIRTIO_ID_GPIO : + features->dev_features = +CONVERT_FEATURES (strList, virtio_gpio_feature_map,0 , bitmap); +break ;#endif /* No features */ case VIRTIO_ID_9P :
@@ -653,7 +686,6 @@ VirtioDeviceFeatures *qmp_decode_features(uint16_t device_id, uint64_t bitmap)case VIRTIO_ID_DMABUF :case VIRTIO_ID_PARAM_SERV :case VIRTIO_ID_AUDIO_POLICY : -case VIRTIO_ID_GPIO :break ;default :g_assert_not_reached ();
Signature · 1 line
MST
[PULL 31/63] hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routing
In reply to Michael S. TsirkinFrom: David Woodhouse <[email protected]>
As noted in the comment, the PCI INTx lines are supposed to be routed to *both* the PIC and the I/O APIC. It's just that we don't cope with the concept of an IRQ being asserted to two *different* pins on the two irqchips.
So we have this hack of routing to I/O APIC only if the PIRQ routing to the PIC is disabled. Which seems to work well enough, even when I try hard to break it with kexec. But should be explicitly documented and understood.
Message-Id: <[email protected]>
--- hw/isa/lpc_ich9.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
hw/isa/lpc_ich9.c +15 -0
@@ -304,6 +304,21 @@ static PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin) route.irq =-1 ; } }else { +/* +* Strictly speaking, this is wrong. The PIRQ should be routed +* to *both* the I/O APIC and the PIC, on different pins. The +* I/O APIC has a fixed mapping to IRQ16-23, while the PIC is +* routed according to the PIRQx_ROUT configuration. But QEMU +* doesn't (yet) cope with the concept of pin numbers differing +* between PIC and I/O APIC, and neither does the in-kernel KVM +* irqchip support. So we route to the I/O APIC *only* if the +* routing to the PIC is disabled in the PIRQx_ROUT settings. +* +* This seems to work even if we boot a Linux guest with 'noapic' +* to make it use the legacy PIC, and then kexec directly into a +* new kernel which uses the I/O APIC. The new kernel explicitly +* disables the PIRQ routing even though it doesn't need to care. +*/ route.irq =ich9_pirq_to_gsi (pirq_pin); }
Signature · 1 line
MST
[PULL 41/63] hw/acpi: Trace GPE access in all device models, not just PIIX4
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
Message-Id: <[email protected]>
--- hw/acpi/core.c | 5 +++++ hw/acpi/piix4.c | 3 --- hw/acpi/trace-events | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-)
hw/acpi/core.c +5 -0
@@ -32,6 +32,7 @@#include "qemu/module.h" #include "qemu/option.h" #include "sysemu/runstate.h" +#include "trace.h" struct acpi_table_header {uint16_t _length;/* our length, not actual part of the hdr */
@@ -686,6 +687,8 @@ void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val) {uint8_t *cur; +trace_acpi_gpe_ioport_writeb (addr, val); + cur =acpi_gpe_ioport_get_ptr (ar, addr);if (addr < ar->gpe.len /2 ) {/* GPE_STS */
@@ -709,6 +712,8 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr) val = *cur; } +trace_acpi_gpe_ioport_readb (addr, val); +return val; }
hw/acpi/piix4.c +0 -3
@@ -42,7 +42,6 @@#include "hw/acpi/acpi_dev_interface.h" #include "migration/vmstate.h" #include "hw/core/cpu.h" -#include "trace.h" #include "qom/object.h" #define GPE_BASE 0xafe0
@@ -517,7 +516,6 @@ static uint64_t gpe_readb(void *opaque, hwaddr addr, unsigned width)PIIX4PMState *s = opaque;uint32_t val =acpi_gpe_ioport_readb (&s->ar, addr); -trace_piix4_gpe_readb (addr, width, val);return val; }
@@ -526,7 +524,6 @@ static void gpe_writeb(void *opaque, hwaddr addr, uint64_t val, {PIIX4PMState *s = opaque; -trace_piix4_gpe_writeb (addr, width, val);acpi_gpe_ioport_writeb (&s->ar, addr, val);acpi_update_sci (&s->ar, s->irq); }
hw/acpi/trace-events +4 -4
@@ -17,6 +17,10 @@ mhp_acpi_clear_remove_evt(uint32_t slot) "slot[0x%"PRIx32"] clear remove event" mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted" mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed" +# core.c +acpi_gpe_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8 +acpi_gpe_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8 + # cpu.c cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32 cpuhp_acpi_read_flags(uint32_t idx, uint8_t flags) "idx[0x%"PRIx32"] flags: 0x%"PRIx8
@@ -48,10 +52,6 @@ acpi_pci_sel_read(uint32_t val) "%" PRIu32 acpi_pci_ej_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 acpi_pci_sel_write(uint64_t addr, uint64_t data) "0x%" PRIx64 " <== %" PRIu64 -# piix4.c -piix4_gpe_readb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d ==> 0x%" PRIx64 -piix4_gpe_writeb(uint64_t addr, unsigned width, uint64_t val) "addr: 0x%" PRIx64 " width: %d <== 0x%" PRIx64 - # tco.c tco_timer_reload(int ticks, int msec) "ticks=%d (%d ms)" tco_timer_expired(int timeouts_no, bool strap, bool no_reboot) "timeouts_no=%d no_reboot=%d/%d"
Signature · 1 line
MST
[PULL 12/63] vdpa: Restore vlan filtering state
In reply to Michael S. TsirkinFrom: Hawkins Jiawei <[email protected]>
This patch introduces vhost_vdpa_net_load_single_vlan() and vhost_vdpa_net_load_vlan() to restore the vlan filtering state at device's startup.
Message-Id: <e76a29f77bb3f386e4a643c8af94b77b775d1752.1690106284.git.yin31149@gmail.com>
--- net/vhost-vdpa.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
net/vhost-vdpa.c +48 -0
@@ -968,6 +968,50 @@ static int vhost_vdpa_net_load_rx(VhostVDPAState *s,return 0 ; } +static int vhost_vdpa_net_load_single_vlan (VhostVDPAState *s, +const VirtIONet *n, +uint16_t vid) +{ +const struct iovec data = { + .iov_base = &vid, + .iov_len =sizeof (vid), + }; +ssize_t dev_written =vhost_vdpa_net_load_cmd (s,VIRTIO_NET_CTRL_VLAN , +VIRTIO_NET_CTRL_VLAN_ADD , + &data,1 ); +if (unlikely (dev_written <0 )) { +return dev_written; + } +if (unlikely (*s->status !=VIRTIO_NET_OK )) { +return -EIO ; + } + +return 0 ; +} + +static int vhost_vdpa_net_load_vlan (VhostVDPAState *s, +const VirtIONet *n) +{ +int r; + +if (!virtio_vdev_has_feature (&n->parent_obj,VIRTIO_NET_F_CTRL_VLAN )) { +return 0 ; + } + +for (int i =0 ; i <MAX_VLAN >>5 ; i++) { +for (int j =0 ; n->vlans[i] && j <=0x1f ; j++) { +if (n->vlans[i] & (1U << j)) { + r =vhost_vdpa_net_load_single_vlan (s, n, (i <<5 ) + j); +if (unlikely (r !=0 )) { +return r; + } + } + } + } + +return 0 ; +} +static int vhost_vdpa_net_load (NetClientState *nc) {VhostVDPAState *s =DO_UPCAST (VhostVDPAState, nc, nc);
@@ -998,6 +1042,10 @@ static int vhost_vdpa_net_load(NetClientState *nc)if (unlikely (r)) {return r; } + r =vhost_vdpa_net_load_vlan (s, n); +if (unlikely (r)) { +return r; + }return 0 ; }
Signature · 1 line
MST
[PULL 60/63] util/uuid: add a hash function
In reply to Michael S. TsirkinFrom: Albert Esteve <[email protected]>
Add hash function to uuid module using the
djb2 hash algorithm.
Add a couple simple unit tests for the hash function, checking collisions for similar UUIDs.
Message-Id: <[email protected]>
--- include/qemu/uuid.h | 2 ++ tests/unit/test-uuid.c | 27 +++++++++++++++++++++++++++ util/uuid.c | 14 ++++++++++++++ 3 files changed, 43 insertions(+)
include/qemu/uuid.h +2 -0
@@ -96,4 +96,6 @@ int qemu_uuid_parse(const char *str, QemuUUID *uuid);QemuUUID qemu_uuid_bswap (QemuUUID uuid); +uint32_t qemu_uuid_hash (const void *uuid); +#endif
tests/unit/test-uuid.c +27 -0
@@ -171,6 +171,32 @@ static void test_uuid_unparse_strdup(void) } } +static void test_uuid_hash (void ) +{ +QemuUUID uuid; +int i; + +for (i =0 ; i <100 ; i++) { +qemu_uuid_generate (&uuid); +/* Obtain the UUID hash */ +uint32_t hash_a =qemu_uuid_hash (&uuid); +int data_idx =g_random_int_range (0 ,15 ); +/* Change a single random byte of the UUID */ +if (uuid.data[data_idx] <0xFF ) { + uuid.data[data_idx]++; + }else { + uuid.data[data_idx]--; + } +/* Obtain the UUID hash again */ +uint32_t hash_b =qemu_uuid_hash (&uuid); +/* +* Both hashes shall be different (avoid collision) +* for any change in the UUID fields +*/ + g_assert_cmpint(hash_a, !=, hash_b); + } +} +int main (int argc,char **argv) {g_test_init (&argc, &argv,NULL );
@@ -179,6 +205,7 @@ int main(int argc, char **argv)g_test_add_func ("/uuid/parse" , test_uuid_parse);g_test_add_func ("/uuid/unparse" , test_uuid_unparse);g_test_add_func ("/uuid/unparse_strdup" , test_uuid_unparse_strdup); +g_test_add_func ("/uuid/hash" , test_uuid_hash);return g_test_run (); }
util/uuid.c +14 -0
@@ -116,3 +116,17 @@ QemuUUID qemu_uuid_bswap(QemuUUID uuid)bswap16s (&uuid.fields.time_high_and_version);return uuid; } + +/* djb2 hash algorithm */ +uint32_t qemu_uuid_hash (const void *uuid) +{ +QemuUUID *qid = (QemuUUID *) uuid; +uint32_t h =5381 ; +int i; + +for (i =0 ; i <ARRAY_SIZE (qid->data); i++) { + h = (h <<5 ) + h + qid->data[i]; + } + +return h; +}
Signature · 1 line
MST
[PULL 57/63] virtio: use shadow_avail_idx while checking number of heads
In reply to Michael S. TsirkinFrom: Ilya Maximets <[email protected]>
We do not need the most up to date number of heads, we only want to know if there is at least one.
Use shadow variable as long as it is not equal to the last available index checked. This avoids expensive qatomic dereference of the RCU-protected memory region cache as well as the memory access itself.
The change improves performance of the af-xdp network backend by 2-3%.
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
hw/virtio/virtio.c +15 -3
@@ -997,7 +997,12 @@ void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,/* Called within rcu_read_lock(). */ static int virtqueue_num_heads (VirtQueue *vq,unsigned int idx) { -uint16_t num_heads =vring_avail_idx (vq) - idx; +uint16_t avail_idx, num_heads; + +/* Use shadow index whenever possible. */ + avail_idx = (vq->shadow_avail_idx != idx) ? vq->shadow_avail_idx + :vring_avail_idx (vq); + num_heads = avail_idx - idx;/* Check it isn't doing very strange things with descriptor numbers. */ if (num_heads > vq->vring.num) {
@@ -1005,8 +1010,15 @@ static int virtqueue_num_heads(VirtQueue *vq, unsigned int idx) idx, vq->shadow_avail_idx);return -EINVAL ; } -/* On success, callers read a descriptor at vq->last_avail_idx. -* Make sure descriptor read does not bypass avail index read. */ +/* +* On success, callers read a descriptor at vq->last_avail_idx. +* Make sure descriptor read does not bypass avail index read. +* +* This is necessary even if we are using a shadow index, since +* the shadow index could have been initialized by calling +* vring_avail_idx() outside of this function, i.e., by a guest +* memory read not accompanied by a barrier. +*/ if (num_heads) {smp_rmb (); }
Signature · 1 line
MST
[PULL 17/63] vdpa: rename vhost_vdpa_net_load to vhost_vdpa_net_cvq_load
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Next patches will add the corresponding data load.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/vhost-vdpa.c +2 -2
@@ -1013,7 +1013,7 @@ static int vhost_vdpa_net_load_vlan(VhostVDPAState *s,return 0 ; } -static int vhost_vdpa_net_load (NetClientState *nc) +static int vhost_vdpa_net_cvq_load (NetClientState *nc) {VhostVDPAState *s =DO_UPCAST (VhostVDPAState, nc, nc);struct vhost_vdpa *v = &s->vhost_vdpa;
@@ -1056,7 +1056,7 @@ static NetClientInfo net_vhost_vdpa_cvq_info = { .size = sizeof(VhostVDPAState), .receive = vhost_vdpa_receive, .start = vhost_vdpa_net_cvq_start, - .load = vhost_vdpa_net_load, + .load = vhost_vdpa_net_cvq_load, .stop = vhost_vdpa_net_cvq_stop, .cleanup = vhost_vdpa_cleanup, .has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
Signature · 1 line
MST
[PULL 48/63] hw/cxl: Support 4 HDM decoders at all levels of topology
In reply to Michael S. TsirkinFrom: Jonathan Cameron <[email protected]>
Support these decoders in CXL host bridges (pxb-cxl), CXL Switch USP and CXL Type 3 end points.
Message-Id: <[email protected]>
--- include/hw/cxl/cxl_component.h | 10 +++- hw/cxl/cxl-component-utils.c | 7 ++- hw/cxl/cxl-host.c | 67 +++++++++++++++-------- hw/mem/cxl_type3.c | 98 +++++++++++++++++++++++----------- 4 files changed, 125 insertions(+), 57 deletions(-)
include/hw/cxl/cxl_component.h +9 -1
@@ -135,6 +135,10 @@ REG32(CXL_RAS_ERR_HEADER0, CXL_RAS_REGISTERS_OFFSET + 0x18) REG32(CXL_HDM_DECODER##n##_TARGET_LIST_LO, \ CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x24) \ REG32(CXL_HDM_DECODER##n##_TARGET_LIST_HI, \ + CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x28) \ + REG32(CXL_HDM_DECODER##n##_DPA_SKIP_LO, \ + CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x24) \ + REG32(CXL_HDM_DECODER##n##_DPA_SKIP_HI, \ CXL_HDM_REGISTERS_OFFSET + (0x20 * n) + 0x28)REG32 (CXL_HDM_DECODER_CAPABILITY ,CXL_HDM_REGISTERS_OFFSET )
@@ -147,9 +151,13 @@ REG32(CXL_HDM_DECODER_GLOBAL_CONTROL, CXL_HDM_REGISTERS_OFFSET + 4) FIELD(CXL_HDM_DECODER_GLOBAL_CONTROL, POISON_ON_ERR_EN, 0, 1)FIELD (CXL_HDM_DECODER_GLOBAL_CONTROL ,HDM_DECODER_ENABLE ,1 ,1 ) +/* Support 4 decoders at all levels of topology */ +#define CXL_HDM_DECODER_COUNT 4 +HDM_DECODER_INIT (0 ); -/* Only used for HDM decoder registers block address increment */ HDM_DECODER_INIT (1 ); +HDM_DECODER_INIT (2 ); +HDM_DECODER_INIT (3 );/* 8.2.5.13 - CXL Extended Security Capability Structure (Root complex only) */ #define EXTSEC_ENTRY_MAX 256
hw/cxl/cxl-component-utils.c +5 -2
@@ -90,6 +90,9 @@ static void dumb_hdm_handler(CXLComponentState *cxl_cstate, hwaddr offset,switch (offset) {case A_CXL_HDM_DECODER0_CTRL : +case A_CXL_HDM_DECODER1_CTRL : +case A_CXL_HDM_DECODER2_CTRL : +case A_CXL_HDM_DECODER3_CTRL : should_commit =FIELD_EX32 (value,CXL_HDM_DECODER0_CTRL ,COMMIT ); should_uncommit = !should_commit;break ;
@@ -129,7 +132,7 @@ static void cxl_cache_mem_write_reg(void *opaque, hwaddr offset, uint64_t value, }if (offset >=A_CXL_HDM_DECODER_CAPABILITY && - offset <=A_CXL_HDM_DECODER0_TARGET_LIST_HI ) { + offset <=A_CXL_HDM_DECODER3_TARGET_LIST_HI ) {dumb_hdm_handler (cxl_cstate, offset, value); }else { cregs->cache_mem_registers[offset /sizeof (*cregs->cache_mem_registers)] = value;
@@ -209,7 +212,7 @@ static void ras_init_common(uint32_t *reg_state, uint32_t *write_msk)static void hdm_init_common (uint32_t *reg_state,uint32_t *write_msk,enum reg_type type) { -int decoder_count =1 ; +int decoder_count =CXL_HDM_DECODER_COUNT ;int hdm_inc =R_CXL_HDM_DECODER1_BASE_LO -R_CXL_HDM_DECODER0_BASE_LO ;int i;
hw/cxl/cxl-host.c +45 -22
80 lines not on this page · raw message
hw/mem/cxl_type3.c +66 -32
128 lines not on this page · raw message
Signature · 1 line
MST
[PULL 40/63] hw/i386/acpi-build: Determine SMI command port just once
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
The SMI command port is currently hardcoded by means of the ACPI_PORT_SMI_CMD macro. This hardcoding is Intel specific and doesn't match VIA, for example. There is already the AcpiFadtData::smi_cmd attribute which is used when building the FADT. Let's also use it when building the DSDT which confines SMI command port determination to just one place. This allows it to become a property later, thus resolving the Intel assumption.
Message-Id: <[email protected]>
--- hw/i386/acpi-build.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/i386/acpi-build.c +3 -3
@@ -1496,14 +1496,14 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,aml_append (crs,aml_io (AML_DECODE16 , -ACPI_PORT_SMI_CMD , -ACPI_PORT_SMI_CMD , + pm->fadt.smi_cmd, + pm->fadt.smi_cmd,1 ,2 ) );aml_append (dev,aml_name_decl ("_CRS" , crs));aml_append (dev,aml_operation_region ("SMIR" ,AML_SYSTEM_IO , -aml_int (ACPI_PORT_SMI_CMD ),2 )); +aml_int (pm->fadt.smi_cmd),2 )); field =aml_field ("SMIR" ,AML_BYTE_ACC ,AML_NOLOCK ,AML_WRITE_AS_ZEROS );aml_append (field,aml_named_field ("SMIC" ,8 ));
Signature · 1 line
MST
[PULL 44/63] vdpa net: zero vhost_vdpa iova_tree pointer at cleanup
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Not zeroing it causes a SIGSEGV if the live migration is cancelled, at net device restart.
This is caused because CVQ tries to reuse the iova_tree that is present in the first vhost_vdpa device at the end of vhost_vdpa_net_cvq_start. As a consequence, it tries to access an iova_tree that has been already free.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 2 ++ 1 file changed, 2 insertions(+)
net/vhost-vdpa.c +2 -0
@@ -405,6 +405,8 @@ static void vhost_vdpa_net_client_stop(NetClientState *nc) dev = s->vhost_vdpa.dev;if (dev->vq_index + dev->nvqs == dev->vq_index_end) {g_clear_pointer (&s->vhost_vdpa.iova_tree, vhost_iova_tree_delete); + }else { + s->vhost_vdpa.iova_tree =NULL ; } }
Signature · 1 line
MST
[PULL 51/63] vdpa net: stop probing if cannot set features
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Otherwise it continues the CVQ isolation probing.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+)
net/vhost-vdpa.c +1 -0
@@ -1364,6 +1364,7 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features, r =ioctl (device_fd,VHOST_SET_FEATURES , &features);if (unlikely (r)) {error_setg_errno (errp, errno,"Cannot set features" ); + goto out; } r =ioctl (device_fd,VHOST_VDPA_SET_STATUS , &status);
Signature · 1 line
MST
[PULL 42/63] hw/acpi/core: Trace enable and status registers of GPE separately
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
The bit positions of both registers are related. Tracing the registers independently results in the same offsets across these registers which eases debugging.
Message-Id: <[email protected]>
--- hw/acpi/core.c | 10 +++++++--- hw/acpi/trace-events | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-)
hw/acpi/core.c +7 -3
@@ -687,13 +687,13 @@ void acpi_gpe_ioport_writeb(ACPIREGS *ar, uint32_t addr, uint32_t val) {uint8_t *cur; -trace_acpi_gpe_ioport_writeb (addr, val); - cur =acpi_gpe_ioport_get_ptr (ar, addr);if (addr < ar->gpe.len /2 ) { +trace_acpi_gpe_sts_ioport_writeb (addr, val);/* GPE_STS */ *cur = (*cur) & ~val; }else if (addr < ar->gpe.len) { +trace_acpi_gpe_en_ioport_writeb (addr - (ar->gpe.len /2 ), val);/* GPE_EN */ *cur = val; }else {
@@ -712,7 +712,11 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr) val = *cur; } -trace_acpi_gpe_ioport_readb (addr, val); +if (addr < ar->gpe.len /2 ) { +trace_acpi_gpe_sts_ioport_readb (addr, val); + }else { +trace_acpi_gpe_en_ioport_readb (addr - (ar->gpe.len /2 ), val); + }return val; }
hw/acpi/trace-events +4 -2
@@ -18,8 +18,10 @@ mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted" mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed" # core.c -acpi_gpe_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%" PRIx8 -acpi_gpe_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%" PRIx8 +acpi_gpe_en_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%02" PRIx8 +acpi_gpe_en_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%02" PRIx8 +acpi_gpe_sts_ioport_readb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " ==> 0x%02" PRIx8 +acpi_gpe_sts_ioport_writeb(uint32_t addr, uint8_t val) "addr: 0x%" PRIx32 " <== 0x%02" PRIx8 # cpu.c cpuhp_acpi_invalid_idx_selected(uint32_t idx) "0x%"PRIx32
Signature · 1 line
MST
[PULL 53/63] amd_iommu: Fix APIC address check
In reply to Michael S. TsirkinFrom: Akihiko Odaki <[email protected]>
An MSI from I/O APIC may not exactly equal to APIC_DEFAULT_ADDRESS. In fact, Windows 17763.3650 configures I/O APIC to set the dest_mode bit. Cover the range assigned to APIC.
Message-Id: <[email protected]>
--- hw/i386/amd_iommu.h | 2 -- hw/i386/amd_iommu.c | 9 ++------- 2 files changed, 2 insertions(+), 9 deletions(-)
hw/i386/amd_iommu.h +0 -2
@@ -210,8 +210,6 @@#define AMDVI_INT_ADDR_FIRST 0xfee00000#define AMDVI_INT_ADDR_LAST 0xfeefffff#define AMDVI_INT_ADDR_SIZE (AMDVI_INT_ADDR_LAST - AMDVI_INT_ADDR_FIRST + 1) -#define AMDVI_MSI_ADDR_HI_MASK (0xffffffff00000000ULL) -#define AMDVI_MSI_ADDR_LO_MASK (0x00000000ffffffffULL)/* SB IOAPIC is always on this device in AMD systems */ #define AMDVI_IOAPIC_SB_DEVID PCI_BUILD_BDF(0, PCI_DEVFN(0x14, 0))
hw/i386/amd_iommu.c +2 -7
@@ -1246,13 +1246,8 @@ static int amdvi_int_remap_msi(AMDVIState *iommu,return -AMDVI_IR_ERR ; } -if (origin->address &AMDVI_MSI_ADDR_HI_MASK ) { -trace_amdvi_err ("MSI address high 32 bits non-zero when " -"Interrupt Remapping enabled." ); -return -AMDVI_IR_ERR ; - } - -if ((origin->address &AMDVI_MSI_ADDR_LO_MASK ) !=APIC_DEFAULT_ADDRESS ) { +if (origin->address <AMDVI_INT_ADDR_FIRST || + origin->address +sizeof (origin->data) >AMDVI_INT_ADDR_LAST +1 ) {trace_amdvi_err ("MSI is not from IOAPIC." );return -AMDVI_IR_ERR ; }
Signature · 1 line
MST
[PULL 28/63] vhost-user: hoist "write_sync", "get_features", "get_u64"
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
In order to avoid a forward-declaration for "vhost_user_write_sync" in a subsequent patch, hoist "vhost_user_write_sync" -> "vhost_user_get_features" -> "vhost_user_get_u64" just above "vhost_set_vring".
This is purely code movement -- no observable change.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 170 ++++++++++++++++++++--------------------- 1 file changed, 85 insertions(+), 85 deletions(-)
hw/virtio/vhost-user.c +85 -85
@@ -1062,6 +1062,91 @@ static int vhost_user_set_vring_endian(struct vhost_dev *dev,return vhost_user_write (dev, &msg,NULL ,0 ); } +static int vhost_user_get_u64 (struct vhost_dev *dev,int request,uint64_t *u64) +{ +int ret; +VhostUserMsg msg = { + .hdr.request = request, + .hdr.flags =VHOST_USER_VERSION , + }; + +if (vhost_user_per_device_request (request) && dev->vq_index !=0 ) { +return 0 ; + } + + ret =vhost_user_write (dev, &msg,NULL ,0 ); +if (ret <0 ) { +return ret; + } + + ret =vhost_user_read (dev, &msg); +if (ret <0 ) { +return ret; + } + +if (msg.hdr.request != request) { +error_report ("Received unexpected msg type. Expected %d received %d" , + request, msg.hdr.request); +return -EPROTO ; + } + +if (msg.hdr.size !=sizeof (msg.payload.u64)) { +error_report ("Received bad msg size." ); +return -EPROTO ; + } + + *u64 = msg.payload.u64; + +return 0 ; +} + +static int vhost_user_get_features (struct vhost_dev *dev,uint64_t *features) +{ +if (vhost_user_get_u64 (dev,VHOST_USER_GET_FEATURES , features) <0 ) { +return -EPROTO ; + } + +return 0 ; +} + +/* Note: "msg->hdr.flags" may be modified. */ +static int vhost_user_write_sync (struct vhost_dev *dev,VhostUserMsg *msg, +bool wait_for_reply) +{ +int ret; + +if (wait_for_reply) { +bool reply_supported =virtio_has_feature (dev->protocol_features, +VHOST_USER_PROTOCOL_F_REPLY_ACK ); +if (reply_supported) { + msg->hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; + } + } + + ret =vhost_user_write (dev, msg,NULL ,0 ); +if (ret <0 ) { +return ret; + } + +if (wait_for_reply) { +uint64_t dummy; + +if (msg->hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +return process_message_reply (dev, msg); + } + +/* +* We need to wait for a reply but the backend does not +* support replies for the command we just sent. +* Send VHOST_USER_GET_FEATURES which makes all backends +* send a reply. +*/ +return vhost_user_get_features (dev, &dummy); + } + +return 0 ; +} +static int vhost_set_vring (struct vhost_dev *dev,unsigned long int request,struct vhost_vring_state *ring)
@@ -1234,91 +1319,6 @@ static int vhost_user_set_vring_err(struct vhost_dev *dev,return vhost_set_vring_file (dev,VHOST_USER_SET_VRING_ERR , file); } -static int vhost_user_get_u64 (struct vhost_dev *dev,int request,uint64_t *u64) -{ -int ret; -VhostUserMsg msg = { - .hdr.request = request, - .hdr.flags =VHOST_USER_VERSION , - }; - -if (vhost_user_per_device_request (request) && dev->vq_index !=0 ) { -return 0 ; - } - - ret =vhost_user_write (dev, &msg,NULL ,0 ); -if (ret <0 ) { -return ret; - } - - ret =vhost_user_read (dev, &msg); -if (ret <0 ) { -return ret; - } - -if (msg.hdr.request != request) { -error_report ("Received unexpected msg type. Expected %d received %d" , - request, msg.hdr.request); -return -EPROTO ; - } - -if (msg.hdr.size !=sizeof (msg.payload.u64)) { -error_report ("Received bad msg size." ); -return -EPROTO ; - } - - *u64 = msg.payload.u64; - -return 0 ; -} - -static int vhost_user_get_features (struct vhost_dev *dev,uint64_t *features) -{ -if (vhost_user_get_u64 (dev,VHOST_USER_GET_FEATURES , features) <0 ) { -return -EPROTO ; - } - -return 0 ; -} - -/* Note: "msg->hdr.flags" may be modified. */ -static int vhost_user_write_sync (struct vhost_dev *dev,VhostUserMsg *msg, -bool wait_for_reply) -{ -int ret; - -if (wait_for_reply) { -bool reply_supported =virtio_has_feature (dev->protocol_features, -VHOST_USER_PROTOCOL_F_REPLY_ACK ); -if (reply_supported) { - msg->hdr.flags |=VHOST_USER_NEED_REPLY_MASK ; - } - } - - ret =vhost_user_write (dev, msg,NULL ,0 ); -if (ret <0 ) { -return ret; - } - -if (wait_for_reply) { -uint64_t dummy; - -if (msg->hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { -return process_message_reply (dev, msg); - } - -/* -* We need to wait for a reply but the backend does not -* support replies for the command we just sent. -* Send VHOST_USER_GET_FEATURES which makes all backends -* send a reply. -*/ -return vhost_user_get_features (dev, &dummy); - } - -return 0 ; -} -static int vhost_user_set_vring_addr (struct vhost_dev *dev,struct vhost_vring_addr *addr) {
Signature · 1 line
MST
[PULL 37/63] hw/acpi/acpi_dev_interface: Remove now unused madt_cpu virtual method
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
This virtual method was always set to the x86-specific pc_madt_cpu_entry(), even in piix4 which is also used in MIPS. The previous changes use pc_madt_cpu_entry() otherwise, so madt_cpu can be dropped.
Since pc_madt_cpu_entry() is now only used in x86-specific code, the stub in hw/acpi/acpi-x86-stub can be removed as well.
Message-Id: <[email protected]>
--- include/hw/acpi/acpi_dev_interface.h | 2 -- hw/acpi/acpi-x86-stub.c | 6 ------ hw/acpi/piix4.c | 2 -- hw/i386/generic_event_device_x86.c | 9 --------- hw/isa/lpc_ich9.c | 1 - 5 files changed, 20 deletions(-)
include/hw/acpi/acpi_dev_interface.h +0 -2
@@ -52,7 +52,5 @@ struct AcpiDeviceIfClass {/* <public> */ void (*ospm_status)(AcpiDeviceIf *adev,ACPIOSTInfoList ***list); void (*send_event)(AcpiDeviceIf *adev, AcpiEventStatusBits ev); -void (*madt_cpu)(int uid,const CPUArchIdList *apic_ids,GArray *entry, - bool force_enabled); };#endif
hw/acpi/acpi-x86-stub.c +0 -6
@@ -1,12 +1,6 @@#include "qemu/osdep.h" -#include "hw/i386/pc.h" #include "hw/i386/acpi-build.h" -void pc_madt_cpu_entry (int uid,const CPUArchIdList *apic_ids, -GArray *entry,bool force_enabled) -{ -} -Object *acpi_get_i386_pci_host (void ) {return NULL ;
hw/acpi/piix4.c +0 -2
@@ -20,7 +20,6 @@*/ #include "qemu/osdep.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "hw/isa/apm.h" #include "hw/i2c/pm_smbus.h"
@@ -654,7 +653,6 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) hc->is_hotpluggable_bus = piix4_is_hotpluggable_bus; adevc->ospm_status = piix4_ospm_status; adevc->send_event = piix4_send_gpe; - adevc->madt_cpu = pc_madt_cpu_entry; }static const TypeInfo piix4_pm_info = {
hw/i386/generic_event_device_x86.c +0 -9
@@ -8,19 +8,10 @@#include "qemu/osdep.h" #include "hw/acpi/generic_event_device.h" -#include "hw/i386/pc.h" - -static void acpi_ged_x86_class_init (ObjectClass *class,void *data) -{ -AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_CLASS (class); - - adevc->madt_cpu = pc_madt_cpu_entry; -}static const TypeInfo acpi_ged_x86_info = { .name =TYPE_ACPI_GED_X86 , .parent =TYPE_ACPI_GED , - .class_init = acpi_ged_x86_class_init, .interfaces = (InterfaceInfo []) { {TYPE_HOTPLUG_HANDLER }, {TYPE_ACPI_DEVICE_IF },
hw/isa/lpc_ich9.c +0 -1
@@ -891,7 +891,6 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) hc->is_hotpluggable_bus = ich9_pm_is_hotpluggable_bus; adevc->ospm_status = ich9_pm_ospm_status; adevc->send_event = ich9_send_gpe; - adevc->madt_cpu = pc_madt_cpu_entry; amldevc->build_dev_aml = build_ich9_isa_aml; }
Signature · 1 line
MST
[PULL 49/63] hw/pci-bridge/cxl-upstream: Add serial number extended capability support
In reply to Michael S. TsirkinFrom: Jonathan Cameron <[email protected]>
Will be needed so there is a defined serial number for information queries via the Switch CCI.
Message-Id: <[email protected]>
--- hw/pci-bridge/cxl_upstream.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
hw/pci-bridge/cxl_upstream.c +13 -2
@@ -14,14 +14,21 @@#include "hw/pci/msi.h" #include "hw/pci/pcie.h" #include "hw/pci/pcie_port.h" +/* +* Null value of all Fs suggested by IEEE RA guidelines for use of +* EU, OUI and CID +*/ +#define UI64_NULL (~0ULL)#define CXL_UPSTREAM_PORT_MSI_NR_VECTOR 2#define CXL_UPSTREAM_PORT_MSI_OFFSET 0x70#define CXL_UPSTREAM_PORT_PCIE_CAP_OFFSET 0x90#define CXL_UPSTREAM_PORT_AER_OFFSET 0x100 -#define CXL_UPSTREAM_PORT_DVSEC_OFFSET \ +#define CXL_UPSTREAM_PORT_SN_OFFSET \ (CXL_UPSTREAM_PORT_AER_OFFSET + PCI_ERR_SIZEOF) +#define CXL_UPSTREAM_PORT_DVSEC_OFFSET \ + (CXL_UPSTREAM_PORT_SN_OFFSET + PCI_EXT_CAP_DSN_SIZEOF) typedef struct CXLUpstreamPort { /*< private >*/
@@ -30,6 +37,7 @@ typedef struct CXLUpstreamPort {/*< public >*/ CXLComponentState cxl_cstate;DOECap doe_cdat; +uint64_t sn; } CXLUpstreamPort;CXLComponentState *cxl_usp_to_cstate (CXLUpstreamPort *usp)
@@ -326,7 +334,9 @@ static void cxl_usp_realize(PCIDevice *d, Error **errp)if (rc) { goto err_cap; } - +if (usp->sn !=UI64_NULL ) { +pcie_dev_ser_num_init (d,CXL_UPSTREAM_PORT_SN_OFFSET , usp->sn); + } cxl_cstate->dvsec_offset =CXL_UPSTREAM_PORT_DVSEC_OFFSET ; cxl_cstate->pdev = d;build_dvsecs (cxl_cstate);
@@ -366,6 +376,7 @@ static void cxl_usp_exitfn(PCIDevice *d) }static Property cxl_upstream_props[] = { +DEFINE_PROP_UINT64 ("sn" , CXLUpstreamPort, sn,UI64_NULL ),DEFINE_PROP_STRING ("cdat" , CXLUpstreamPort, cxl_cstate.cdat.filename),DEFINE_PROP_END_OF_LIST () };
Signature · 1 line
MST
[PULL 50/63] vdpa net: fix error message setting virtio status
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
It incorrectly prints "error setting features", probably because a copy paste miss.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/vhost-vdpa.c +1 -1
@@ -1368,7 +1368,7 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features, r =ioctl (device_fd,VHOST_VDPA_SET_STATUS , &status);if (unlikely (r)) { -error_setg_errno (errp, -r,"Cannot set device features" ); +error_setg_errno (errp, -r,"Cannot set status" ); goto out; }
Signature · 1 line
MST
Quoted 20 lines · Michael S. Tsirkin
----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Quoted 7 lines
Philippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]
Woohoo \o/ thanks for merging this!
[PULL 45/63] hw/cxl: Push cxl_decoder_count_enc() and cxl_decode_ig() into .c
In reply to Michael S. TsirkinFrom: Jonathan Cameron <[email protected]>
There is no strong justification for keeping these in the header so push them down into the associated cxl-component-utils.c file.
Message-Id: <[email protected]>
--- include/hw/cxl/cxl_component.h | 18 ++---------------- hw/cxl/cxl-component-utils.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 16 deletions(-)
include/hw/cxl/cxl_component.h +2 -16
@@ -225,26 +225,12 @@ void cxl_component_create_dvsec(CXLComponentState *cxl_cstate, enum reg_type cxl_dev_type, uint16_t length, uint16_t type, uint8_t rev, uint8_t *body); -static inline int cxl_decoder_count_enc (int count) -{ -switch (count) { -case 1 :return 0 ; -case 2 :return 1 ; -case 4 :return 2 ; -case 6 :return 3 ; -case 8 :return 4 ; -case 10 :return 5 ; - } -return 0 ; -} +int cxl_decoder_count_enc (int count);uint8_t cxl_interleave_ways_enc (int iw,Error **errp);uint8_t cxl_interleave_granularity_enc (uint64_t gran,Error **errp); -static inline hwaddr cxl_decode_ig (int ig) -{ -return 1ULL << (ig +8 ); -} +hwaddr cxl_decode_ig (int ig);CXLComponentState *cxl_get_hb_cstate (PCIHostState *hb);bool cxl_get_hb_passthrough (PCIHostState *hb);
hw/cxl/cxl-component-utils.c +18 -0
@@ -13,6 +13,24 @@#include "hw/pci/pci.h" #include "hw/cxl/cxl.h" +int cxl_decoder_count_enc (int count) +{ +switch (count) { +case 1 :return 0 ; +case 2 :return 1 ; +case 4 :return 2 ; +case 6 :return 3 ; +case 8 :return 4 ; +case 10 :return 5 ; + } +return 0 ; +} + +hwaddr cxl_decode_ig (int ig) +{ +return 1ULL << (ig +8 ); +} +static uint64_t cxl_cache_mem_read_reg (void *opaque,hwaddr offset,unsigned size) {
Signature · 1 line
MST
[PULL 56/63] libvhost-user.c: add assertion to vu_message_read_default
In reply to Michael S. TsirkinFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
Explain Coverity that we are not going to overflow vmsg->fds.
Message-Id: <[email protected]>
--- subprojects/libvhost-user/libvhost-user.c | 1 + 1 file changed, 1 insertion(+)
subprojects/libvhost-user/libvhost-user.c +1 -0
@@ -322,6 +322,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 );memcpy (vmsg->fds,CMSG_DATA (cmsg), fd_size);break ; }
Signature · 1 line
MST
[PULL 29/63] vhost-user: allow "vhost_set_vring" to wait for a reply
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
The "vhost_set_vring" function already centralizes the common parts of "vhost_user_set_vring_num", "vhost_user_set_vring_base" and "vhost_user_set_vring_enable". We'll want to allow some of those callers to wait for a reply.
Therefore, rebase "vhost_set_vring" from just "vhost_user_write" to "vhost_user_write_sync", exposing the "wait_for_reply" parameter.
This is purely refactoring -- there is no observable change. That's because:
- all three callers pass in "false" for "wait_for_reply", which disables all logic in "vhost_user_write_sync" except the call to "vhost_user_write";
- the fds=NULL and fd_num=0 arguments of the original "vhost_user_write" call inside "vhost_set_vring" are hard-coded within "vhost_user_write_sync".
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
hw/virtio/vhost-user.c +6 -5
@@ -1149,7 +1149,8 @@ static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg,static int vhost_set_vring (struct vhost_dev *dev,unsigned long int request, -struct vhost_vring_state *ring) +struct vhost_vring_state *ring, +bool wait_for_reply) {VhostUserMsg msg = { .hdr.request = request,
@@ -1158,13 +1159,13 @@ static int vhost_set_vring(struct vhost_dev *dev, .hdr.size = sizeof(msg.payload.state), }; -return vhost_user_write (dev, &msg,NULL ,0 ); +return vhost_user_write_sync (dev, &msg, wait_for_reply); }static int vhost_user_set_vring_num (struct vhost_dev *dev,struct vhost_vring_state *ring) { -return vhost_set_vring (dev,VHOST_USER_SET_VRING_NUM , ring); +return vhost_set_vring (dev,VHOST_USER_SET_VRING_NUM , ring, false); }static void vhost_user_host_notifier_free (VhostUserHostNotifier *n)
@@ -1195,7 +1196,7 @@ static void vhost_user_host_notifier_remove(VhostUserHostNotifier *n,static int vhost_user_set_vring_base (struct vhost_dev *dev,struct vhost_vring_state *ring) { -return vhost_set_vring (dev,VHOST_USER_SET_VRING_BASE , ring); +return vhost_set_vring (dev,VHOST_USER_SET_VRING_BASE , ring, false); }static int vhost_user_set_vring_enable (struct vhost_dev *dev,int enable)
@@ -1213,7 +1214,7 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state); + ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, false);if (ret <0 ) {/* * Restoring the previous state is likely infeasible, as well as
Signature · 1 line
MST
[PULL 55/63] pcie_sriov: unregister_vfs(): fix error path
In reply to Michael S. TsirkinFrom: Vladimir Sementsov-Ogievskiy <[email protected]>
local_err must be NULL before calling object_property_set_bool(), so we must clear it on each iteration. Let's also use more convenient error_reportf_err().
Message-Id: <[email protected]>
--- hw/pci/pcie_sriov.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
hw/pci/pcie_sriov.c +3 -6
@@ -196,19 +196,16 @@ static void register_vfs(PCIDevice *dev)static void unregister_vfs (PCIDevice *dev) { -Error *local_err =NULL ;uint16_t num_vfs = dev->exp.sriov_pf.num_vfs;uint16_t i;trace_sriov_unregister_vfs (dev->name,PCI_SLOT (dev->devfn),PCI_FUNC (dev->devfn), num_vfs);for (i =0 ; i < num_vfs; i++) { +Error *err =NULL ;PCIDevice *vf = dev->exp.sriov_pf.vf[i]; -object_property_set_bool (OBJECT (vf),"realized" , false, &local_err); -if (local_err) { -fprintf (stderr,"Failed to unplug: %s\n" , -error_get_pretty (local_err)); -error_free (local_err); +if (!object_property_set_bool (OBJECT (vf),"realized" , false, &err)) { +error_reportf_err (err,"Failed to unplug: " ); }object_unparent (OBJECT (vf));object_unref (OBJECT (vf));
Signature · 1 line
MST
[PULL 62/63] vhost-user: add shared_object msg
In reply to Michael S. TsirkinFrom: Albert Esteve <[email protected]>
Add three new vhost-user protocol VHOST_USER_BACKEND_SHARED_OBJECT_* messages. These new messages are sent from vhost-user back-ends to interact with the virtio-dmabuf table in order to add or remove themselves as virtio exporters, or lookup for virtio dma-buf shared objects.
The action taken in the front-end depends on the type stored in the virtio shared object hash table.
When the table holds a pointer to a vhost backend for a given UUID, the front-end sends a VHOST_USER_GET_SHARED_OBJECT to the backend holding the shared object.
The messages can only be sent after successfully negotiating a new VHOST_USER_PROTOCOL_F_SHARED_OBJECT vhost-user protocol feature bit.
Finally, refactor code to send response message so that all common parts both for the common REPLY_ACK case, and other data responses, can call it and avoid code repetition.
Message-Id: <[email protected]>
--- include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user.h | 1 + hw/virtio/vhost-user.c | 167 +++++++++++++++++++++++++++--- docs/interop/vhost-user.rst | 57 ++++++++++ 4 files changed, 216 insertions(+), 12 deletions(-)
include/hw/virtio/vhost-backend.h +3 -0
@@ -196,4 +196,7 @@ int vhost_backend_handle_iotlb_msg(struct vhost_dev *dev,int vhost_user_gpu_set_socket (struct vhost_dev *dev,int fd); +int vhost_user_get_shared_object (struct vhost_dev *dev,unsigned char *uuid, +int *dmabuf_fd); +#endif /* VHOST_BACKEND_H */
include/hw/virtio/vhost-user.h +1 -0
@@ -29,6 +29,7 @@ enum VhostUserProtocolFeature {VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =14 ,VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =15 ,VHOST_USER_PROTOCOL_F_STATUS =16 , +VHOST_USER_PROTOCOL_F_SHARED_OBJECT =17 , VHOST_USER_PROTOCOL_F_MAX };
hw/virtio/vhost-user.c +155 -12
224 lines not on this page · raw message
docs/interop/vhost-user.rst +57 -0
69 lines not on this page · raw message
Signature · 1 line
MST
Quoted 9 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:
603cf7156bc64236b4a5cccca9b42d5af5df5eea now - had to fix some commit logs.
Quoted 200 lines
libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++ MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytes tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
[PULL 54/63] hw/i386/pc: improve physical address space bound check for 32-bit x86 systems
In reply to Michael S. TsirkinFrom: Ani Sinha <[email protected]>
32-bit x86 systems do not have a reserved memory for hole64. On those 32-bit systems without PSE36 or PAE CPU features, hotplugging memory devices are not supported by QEMU as QEMU always places hotplugged memory above 4 GiB boundary which is beyond the physical address space of the processor. Linux guests also does not support memory hotplug on those systems. Please see Linux kernel commit b59d02ed08690 ("mm/memory_hotplug: disable the functionality for 32b") for more details.
Therefore, the maximum limit of the guest physical address in the absence of additional memory devices effectively coincides with the end of "above 4G memory space" region for 32-bit x86 without PAE/PSE36. When users configure additional memory devices, after properly accounting for the additional device memory region to find the maximum value of the guest physical address, the address will be outside the range of the processor's physical address space.
This change adds improvements to take above into consideration.
For example, previously this was allowed:
$ ./qemu-system-x86_64 -cpu pentium -m size=10G
With this change now it is no longer allowed:
$ ./qemu-system-x86_64 -cpu pentium -m size=10G qemu-system-x86_64: Address space limit 0xffffffff < 0x2bfffffff phys-bits too low (32)
However, the following are allowed since on both cases physical address space of the processor is 36 bits:
$ ./qemu-system-x86_64 -cpu pentium2 -m size=10G $ ./qemu-system-x86_64 -cpu pentium,pse36=on -m size=10G
For 32-bit, without PAE/PSE36, hotplugging additional memory is no longer allowed.
$ ./qemu-system-i386 -m size=1G,maxmem=3G,slots=2 qemu-system-i386: Address space limit 0xffffffff < 0x1ffffffff phys-bits too low (32) $ ./qemu-system-i386 -machine q35 -m size=1G,maxmem=3G,slots=2 qemu-system-i386: Address space limit 0xffffffff < 0x1ffffffff phys-bits too low (32)
A new compatibility flag is introduced to make sure pc_max_used_gpa() keeps returning the old value for machines 8.1 and older.
Therefore, the above is still allowed for older machine types in order to support compatibility. Hence, the following still works:
$ ./qemu-system-i386 -machine pc-i440fx-8.1 -m size=1G,maxmem=3G,slots=2 $ ./qemu-system-i386 -machine pc-q35-8.1 -m size=1G,maxmem=3G,slots=2
Further, following is also allowed as with PSE36, the processor has 36-bit address space:
$ ./qemu-system-i386 -cpu 486,pse36=on -m size=1G,maxmem=3G,slots=2
After calling CPUID with EAX=0x80000001, all AMD64 compliant processors have the longmode-capable-bit turned on in the extended feature flags (bit 29) in EDX. The absence of CPUID longmode can be used to differentiate between 32-bit and 64-bit processors and is the recommended approach. QEMU takes this approach elsewhere (for example, please see x86_cpu_realizefn()), With this change, pc_max_used_gpa() also uses the same method to detect 32-bit processors.
Unit tests are modified to not run 32-bit x86 tests that use memory hotplug.
Message-Id: <[email protected]>
--- include/hw/i386/pc.h | 6 ++++++ hw/i386/pc.c | 32 +++++++++++++++++++++++++++++--- hw/i386/pc_piix.c | 4 ++++ hw/i386/pc_q35.c | 2 ++ tests/qtest/bios-tables-test.c | 26 ++++++++++++++++++-------- tests/qtest/numa-test.c | 7 ++++++- 6 files changed, 65 insertions(+), 12 deletions(-)
include/hw/i386/pc.h +6 -0
@@ -129,6 +129,12 @@ struct PCMachineClass {/* resizable acpi blob compat */ bool resizable_acpi_blob; + +/* +* whether the machine type implements broken 32-bit address space bound +* check for memory. +*/ +bool broken_32bit_mem_addr_check; };#define TYPE_PC_MACHINE "generic-pc-machine"
hw/i386/pc.c +29 -3
@@ -907,13 +907,39 @@ static uint64_t pc_get_cxl_range_end(PCMachineState *pcms)static hwaddr pc_max_used_gpa (PCMachineState *pcms,uint64_t pci_hole64_size) {X86CPU *cpu =X86_CPU (first_cpu); +PCMachineClass *pcmc =PC_MACHINE_GET_CLASS (pcms); +MachineState *ms =MACHINE (pcms); -/* 32-bit systems don't have hole64 thus return max CPU address */ -if (cpu->phys_bits <=32 ) { +if (cpu->env.features[FEAT_8000_0001_EDX ] &CPUID_EXT2_LM ) { +/* 64-bit systems */ +return pc_pci_hole64_start () + pci_hole64_size -1 ; + } + +/* 32-bit systems */ +if (pcmc->broken_32bit_mem_addr_check) { +/* old value for compatibility reasons */ return ((hwaddr )1 << cpu->phys_bits) -1 ; } -return pc_pci_hole64_start () + pci_hole64_size -1 ; +/* +* 32-bit systems don't have hole64 but they might have a region for +* memory devices. Even if additional hotplugged memory devices might +* not be usable by most guest OSes, we need to still consider them for +* calculating the highest possible GPA so that we can properly report +* if someone configures them on a CPU that cannot possibly address them. +*/ +if (pcmc->has_reserved_memory && + (ms->ram_size < ms->maxram_size)) { +hwaddr devmem_start; +ram_addr_t devmem_size; + +pc_get_device_memory_range (pcms, &devmem_start, &devmem_size); + devmem_start += devmem_size; +return devmem_start -1 ; + } + +/* configuration without any memory hotplug */ +return pc_above_4g_end (pcms) -1 ; }/*
hw/i386/pc_piix.c +4 -0
@@ -517,9 +517,13 @@ DEFINE_I440FX_MACHINE(v8_2, "pc-i440fx-8.2", NULL,static void pc_i440fx_8_1_machine_options (MachineClass *m) { +PCMachineClass *pcmc =PC_MACHINE_CLASS (m); +pc_i440fx_8_2_machine_options (m); m->alias =NULL ; m->is_default = false; + pcmc->broken_32bit_mem_addr_check = true; +compat_props_add (m->compat_props, hw_compat_8_1, hw_compat_8_1_len);compat_props_add (m->compat_props, pc_compat_8_1, pc_compat_8_1_len); }
hw/i386/pc_q35.c +2 -0
@@ -394,8 +394,10 @@ DEFINE_Q35_MACHINE(v8_2, "pc-q35-8.2", NULL,static void pc_q35_8_1_machine_options (MachineClass *m) { +PCMachineClass *pcmc =PC_MACHINE_CLASS (m);pc_q35_8_2_machine_options (m); m->alias =NULL ; + pcmc->broken_32bit_mem_addr_check = true;compat_props_add (m->compat_props, hw_compat_8_1, hw_compat_8_1_len);compat_props_add (m->compat_props, pc_compat_8_1, pc_compat_8_1_len); }
tests/qtest/bios-tables-test.c +18 -8
@@ -2080,7 +2080,6 @@ int main(int argc, char *argv[]) test_acpi_piix4_no_acpi_pci_hotplug);qtest_add_func ("acpi/piix4/ipmi" , test_acpi_piix4_tcg_ipmi);qtest_add_func ("acpi/piix4/cpuhp" , test_acpi_piix4_tcg_cphp); -qtest_add_func ("acpi/piix4/memhp" , test_acpi_piix4_tcg_memhp);qtest_add_func ("acpi/piix4/numamem" , test_acpi_piix4_tcg_numamem);qtest_add_func ("acpi/piix4/nosmm" , test_acpi_piix4_tcg_nosmm); qtest_add_func("acpi/piix4/smm-compat",
@@ -2088,9 +2087,15 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/piix4/smm-compat-nosmm" , test_acpi_piix4_tcg_smm_compat_nosmm);qtest_add_func ("acpi/piix4/nohpet" , test_acpi_piix4_tcg_nohpet); -qtest_add_func ("acpi/piix4/dimmpxm" , test_acpi_piix4_tcg_dimm_pxm); -qtest_add_func ("acpi/piix4/acpihmat" , - test_acpi_piix4_tcg_acpi_hmat); + +/* i386 does not support memory hotplug */ +if (strcmp (arch,"i386" )) { +qtest_add_func ("acpi/piix4/memhp" , test_acpi_piix4_tcg_memhp); +qtest_add_func ("acpi/piix4/dimmpxm" , + test_acpi_piix4_tcg_dimm_pxm); +qtest_add_func ("acpi/piix4/acpihmat" , + test_acpi_piix4_tcg_acpi_hmat); + }#ifdef CONFIG_POSIX qtest_add_func ("acpi/piix4/acpierst" , test_acpi_piix4_acpi_erst);#endif
@@ -2108,11 +2113,9 @@ int main(int argc, char *argv[]) test_acpi_q35_tcg_no_acpi_hotplug);qtest_add_func ("acpi/q35/multif-bridge" , test_acpi_q35_multif_bridge); -qtest_add_func ("acpi/q35/mmio64" , test_acpi_q35_tcg_mmio64);qtest_add_func ("acpi/q35/ipmi" , test_acpi_q35_tcg_ipmi);qtest_add_func ("acpi/q35/smbus/ipmi" , test_acpi_q35_tcg_smbus_ipmi);qtest_add_func ("acpi/q35/cpuhp" , test_acpi_q35_tcg_cphp); -qtest_add_func ("acpi/q35/memhp" , test_acpi_q35_tcg_memhp);qtest_add_func ("acpi/q35/numamem" , test_acpi_q35_tcg_numamem);qtest_add_func ("acpi/q35/nosmm" , test_acpi_q35_tcg_nosmm); qtest_add_func("acpi/q35/smm-compat",
@@ -2120,10 +2123,17 @@ int main(int argc, char *argv[])qtest_add_func ("acpi/q35/smm-compat-nosmm" , test_acpi_q35_tcg_smm_compat_nosmm);qtest_add_func ("acpi/q35/nohpet" , test_acpi_q35_tcg_nohpet); -qtest_add_func ("acpi/q35/dimmpxm" , test_acpi_q35_tcg_dimm_pxm); -qtest_add_func ("acpi/q35/acpihmat" , test_acpi_q35_tcg_acpi_hmat);qtest_add_func ("acpi/q35/acpihmat-noinitiator" , test_acpi_q35_tcg_acpi_hmat_noinitiator); + +/* i386 does not support memory hotplug */ +if (strcmp (arch,"i386" )) { +qtest_add_func ("acpi/q35/memhp" , test_acpi_q35_tcg_memhp); +qtest_add_func ("acpi/q35/dimmpxm" , test_acpi_q35_tcg_dimm_pxm); +qtest_add_func ("acpi/q35/acpihmat" , + test_acpi_q35_tcg_acpi_hmat); +qtest_add_func ("acpi/q35/mmio64" , test_acpi_q35_tcg_mmio64); + }#ifdef CONFIG_POSIX qtest_add_func ("acpi/q35/acpierst" , test_acpi_q35_acpi_erst);#endif
tests/qtest/numa-test.c +6 -1
@@ -568,7 +568,7 @@ int main(int argc, char **argv)qtest_add_data_func ("/numa/mon/cpus/partial" , args, test_mon_partial);qtest_add_data_func ("/numa/qmp/cpus/query-cpus" , args, test_query_cpus); -if (!strcmp (arch,"i386" ) || !strcmp (arch,"x86_64" )) { +if (!strcmp (arch,"x86_64" )) {qtest_add_data_func ("/numa/pc/cpu/explicit" , args, pc_numa_cpu);qtest_add_data_func ("/numa/pc/dynamic/cpu" , args, pc_dynamic_cpu_cfg);qtest_add_data_func ("/numa/pc/hmat/build" , args, pc_hmat_build_cfg);
@@ -576,6 +576,11 @@ int main(int argc, char **argv)qtest_add_data_func ("/numa/pc/hmat/erange" , args, pc_hmat_erange_cfg); } +if (!strcmp (arch,"i386" )) { +qtest_add_data_func ("/numa/pc/cpu/explicit" , args, pc_numa_cpu); +qtest_add_data_func ("/numa/pc/dynamic/cpu" , args, pc_dynamic_cpu_cfg); + } +if (!strcmp (arch,"ppc64" )) {qtest_add_data_func ("/numa/spapr/cpu/explicit" , args, spapr_numa_cpu); }
Signature · 1 line
MST
[PULL 11/63] virtio-net: Expose MAX_VLAN
In reply to Michael S. TsirkinFrom: Hawkins Jiawei <[email protected]>
vhost-vdpa shadowed CVQ needs to know the maximum number of vlans supported by the virtio-net device, so QEMU can restore the VLAN state in a migration.
Message-Id: <ca03403319c6405ea7c400836a572255bbc9ceba.1690106284.git.yin31149@gmail.com>
--- include/hw/virtio/virtio-net.h | 6 ++++++ hw/net/virtio-net.c | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-)
include/hw/virtio/virtio-net.h +6 -0
@@ -38,6 +38,12 @@ OBJECT_DECLARE_SIMPLE_TYPE(VirtIONet, VIRTIO_NET)/* Maximum VIRTIO_NET_CTRL_MAC_TABLE_SET unicast + multicast entries. */ #define MAC_TABLE_ENTRIES 64 +/* +* The maximum number of VLANs in the VLAN filter table +* added by VIRTIO_NET_CTRL_VLAN_ADD +*/ +#define MAX_VLAN (1 << 12)/* Per 802.1Q definition */ + typedef struct virtio_net_conf { uint32_t txtimer;
hw/net/virtio-net.c +0 -2
@@ -49,8 +49,6 @@#define VIRTIO_NET_VM_VERSION 11 -#define MAX_VLAN (1 << 12)/* Per 802.1Q definition */ -/* previously fixed value */ #define VIRTIO_NET_RX_QUEUE_DEFAULT_SIZE 256#define VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE 256
Signature · 1 line
MST
[PULL 27/63] vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
At this point, only "vhost_user_write_sync" calls "enforce_reply"; embed the latter into the former.
This is purely refactoring -- no observable change.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-)
hw/virtio/vhost-user.c +13 -19
@@ -1281,24 +1281,6 @@ static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features)return 0 ; } -static int enforce_reply (struct vhost_dev *dev, -const VhostUserMsg *msg) -{ -uint64_t dummy; - -if (msg->hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { -return process_message_reply (dev, msg); - } - -/* -* We need to wait for a reply but the backend does not -* support replies for the command we just sent. -* Send VHOST_USER_GET_FEATURES which makes all backends -* send a reply. -*/ -return vhost_user_get_features (dev, &dummy); -} -/* Note: "msg->hdr.flags" may be modified. */ static int vhost_user_write_sync (struct vhost_dev *dev,VhostUserMsg *msg,bool wait_for_reply)
@@ -1319,7 +1301,19 @@ static int vhost_user_write_sync(struct vhost_dev *dev, VhostUserMsg *msg, }if (wait_for_reply) { -return enforce_reply (dev, msg); +uint64_t dummy; + +if (msg->hdr.flags &VHOST_USER_NEED_REPLY_MASK ) { +return process_message_reply (dev, msg); + } + +/* +* We need to wait for a reply but the backend does not +* support replies for the command we just sent. +* Send VHOST_USER_GET_FEATURES which makes all backends +* send a reply. +*/ +return vhost_user_get_features (dev, &dummy); }return 0 ;
Signature · 1 line
MST
[PULL 30/63] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
(1) The virtio-1.2 specification
Quoted 11 lines · <http://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html> writes:
3 General Initialization And Device Operation
3.1 Device Initialization
3.1.1 Driver Requirements: Device Initialization[...]
7. Perform device-specific setup, including discovery of virtqueues for the device, optional per-bus setup, reading and possibly writing the device’s virtio configuration space, and population of virtqueues.
8. Set the
DRIVER_OKstatus bit. At this point the device is “live”.
and
Quoted 4 lines
4 Virtio Transport Options 4.1 Virtio Over PCI Bus 4.1.4 Virtio Structure PCI Capabilities 4.1.4.3 Common configuration structure layout
Quoted 8 lines
4.1.4.3.2 Driver Requirements: Common configuration structure layout
[...]
The driver MUST configure the other virtqueue fields before enabling the virtqueue with
queue_enable.[...]
(The same statements are present in virtio-1.0 identically, at
<http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.html>.)
These together mean that the following sub-sequence of steps is valid for a virtio-1.0 guest driver:
(1.1) set "queue_enable" for the needed queues as the final part of device initialization step (7),
(1.2) set DRIVER_OK in step (8),
(1.3) immediately start sending virtio requests to the device.
(2) When vhost-user is enabled, and the VHOST_USER_F_PROTOCOL_FEATURES special virtio feature is negotiated, then virtio rings start in disabled state, according to
<https://qemu-project.gitlab.io/qemu/interop/vhost-user.html#ring-states>.
In this case, explicit VHOST_USER_SET_VRING_ENABLE messages are needed for enabling vrings.
Therefore setting "queue_enable" from the guest (1.1) is a *control plane* operation, which travels from the guest through QEMU to the vhost-user backend, using a unix domain socket.
Whereas sending a virtio request (1.3) is a *data plane* operation, which evades QEMU -- it travels from guest to the vhost-user backend via eventfd.
This means that steps (1.1) and (1.3) travel through different channels, and their relative order can be reversed, as perceived by the vhost-user backend.
That's exactly what happens when OVMF's virtiofs driver (VirtioFsDxe) runs against the Rust-language virtiofsd version 1.7.2. (Which uses version 0.10.1 of the vhost-user-backend crate, and version 0.8.1 of the vhost crate.)
Namely, when VirtioFsDxe binds a virtiofs device, it goes through the device initialization steps (i.e., control plane operations), and immediately sends a FUSE_INIT request too (i.e., performs a data plane operation). In the Rust-language virtiofsd, this creates a race between two components that run *concurrently*, i.e., in different threads or processes:
- Control plane, handling vhost-user protocol messages:
The "VhostUserSlaveReqHandlerMut::set_vring_enable" method [crates/vhost-user-backend/src/handler.rs] handles VHOST_USER_SET_VRING_ENABLE messages, and updates each vring's "enabled" flag according to the message processed.
- Data plane, handling virtio / FUSE requests:
The "VringEpollHandler::handle_event" method [crates/vhost-user-backend/src/event_loop.rs] handles the incoming virtio / FUSE request, consuming the virtio kick at the same time. If the vring's "enabled" flag is set, the virtio / FUSE request is processed genuinely. If the vring's "enabled" flag is clear, then the virtio / FUSE request is discarded.
Note that OVMF enables the queue *first*, and sends FUSE_INIT *second*. However, if the data plane processor in virtiofsd wins the race, then it sees the FUSE_INIT *before* the control plane processor took notice of VHOST_USER_SET_VRING_ENABLE and green-lit the queue for the data plane processor. Therefore the latter drops FUSE_INIT on the floor, and goes back to waiting for further virtio / FUSE requests with epoll_wait. Meanwhile OVMF is stuck waiting for the FUSET_INIT response -- a deadlock.
The deadlock is not deterministic. OVMF hangs infrequently during first boot. However, OVMF hangs almost certainly during reboots from the UEFI shell.
The race can be "reliably masked" by inserting a very small delay -- a single debug message -- at the top of "VringEpollHandler::handle_event", i.e., just before the data plane processor checks the "enabled" field of the vring. That delay suffices for the control plane processor to act upon VHOST_USER_SET_VRING_ENABLE.
We can deterministically prevent the race in QEMU, by blocking OVMF inside step (1.1) -- i.e., in the write to the "queue_enable" register -- until VHOST_USER_SET_VRING_ENABLE actually *completes*. That way OVMF's VCPU cannot advance to the FUSE_INIT submission before virtiofsd's control plane processor takes notice of the queue being enabled.
Wait for VHOST_USER_SET_VRING_ENABLE completion by:
- setting the NEED_REPLY flag on VHOST_USER_SET_VRING_ENABLE, and waiting for the reply, if the VHOST_USER_PROTOCOL_F_REPLY_ACK vhost-user feature has been negotiated, or
- performing a separate VHOST_USER_GET_FEATURES *exchange*, which requires a backend response regardless of VHOST_USER_PROTOCOL_F_REPLY_ACK.
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
hw/virtio/vhost-user.c +15 -1
@@ -1214,7 +1214,21 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, false); +/* +* SET_VRING_ENABLE travels from guest to QEMU to vhost-user backend / +* control plane thread via unix domain socket. Virtio requests travel +* from guest to vhost-user backend / data plane thread via eventfd. +* Even if the guest enables the ring first, and pushes its first virtio +* request second (conforming to the virtio spec), the data plane thread +* in the backend may see the virtio request before the control plane +* thread sees the queue enablement. This causes (in fact, requires) the +* data plane thread to discard the virtio request (it arrived on a +* seemingly disabled queue). To prevent this out-of-order delivery, +* don't let the guest proceed to pushing the virtio request until the +* backend control plane acknowledges enabling the queue -- IOW, pass +* wait_for_reply=true below. +*/ + ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, true);if (ret <0 ) {/* * Restoring the previous state is likely infeasible, as well as
Signature · 1 line
MST
[PULL 43/63] vdpa: fix gcc cvq_isolated uninitialized variable warning
In reply to Michael S. TsirkinFrom: Stefan Hajnoczi <[email protected]>
gcc 13.2.1 emits the following warning:
net/vhost-vdpa.c: In function ‘net_vhost_vdpa_init.constprop’:
net/vhost-vdpa.c:1394:25: error: ‘cvq_isolated’ may be used uninitialized [-Werror=maybe-uninitialized]
1394 | s->cvq_isolated = cvq_isolated;
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
net/vhost-vdpa.c:1355:9: note: ‘cvq_isolated’ was declared here
1355 | int cvq_isolated;
| ^~~~~~~~~~~~cc1: all warnings being treated as errors
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/vhost-vdpa.c +1 -1
@@ -1425,7 +1425,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,VhostVDPAState *s;int ret =0 ;assert (name); -int cvq_isolated; +int cvq_isolated =0 ;if (is_datapath) { nc = qemu_new_net_client(&net_vhost_vdpa_info, peer, device,
Signature · 1 line
MST
[PULL 63/63] libvhost-user: handle shared_object msg
In reply to Michael S. TsirkinFrom: Albert Esteve <[email protected]>
In the libvhost-user library we need to handle VHOST_USER_GET_SHARED_OBJECT requests, and add helper functions to allow sending messages to interact with the virtio shared objects hash table.
Message-Id: <[email protected]>
--- subprojects/libvhost-user/libvhost-user.h | 55 +++++++++- subprojects/libvhost-user/libvhost-user.c | 120 ++++++++++++++++++++++ 2 files changed, 174 insertions(+), 1 deletion(-)
subprojects/libvhost-user/libvhost-user.h +54 -1
@@ -64,7 +64,8 @@ enum VhostUserProtocolFeature {VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD =12 ,VHOST_USER_PROTOCOL_F_INBAND_NOTIFICATIONS =14 ,VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS =15 , - +/* Feature 16 is reserved for VHOST_USER_PROTOCOL_F_STATUS. */ +VHOST_USER_PROTOCOL_F_SHARED_OBJECT =17 , VHOST_USER_PROTOCOL_F_MAX };
@@ -109,6 +110,7 @@ typedef enum VhostUserRequest {VHOST_USER_GET_MAX_MEM_SLOTS =36 ,VHOST_USER_ADD_MEM_REG =37 ,VHOST_USER_REM_MEM_REG =38 , +VHOST_USER_GET_SHARED_OBJECT =41 , VHOST_USER_MAX } VhostUserRequest;
@@ -119,6 +121,9 @@ typedef enum VhostUserBackendRequest {VHOST_USER_BACKEND_VRING_HOST_NOTIFIER_MSG =3 ,VHOST_USER_BACKEND_VRING_CALL =4 ,VHOST_USER_BACKEND_VRING_ERR =5 , +VHOST_USER_BACKEND_SHARED_OBJECT_ADD =6 , +VHOST_USER_BACKEND_SHARED_OBJECT_REMOVE =7 , +VHOST_USER_BACKEND_SHARED_OBJECT_LOOKUP =8 , VHOST_USER_BACKEND_MAX } VhostUserBackendRequest;
@@ -172,6 +177,12 @@ typedef struct VhostUserInflight {uint16_t queue_size; } VhostUserInflight; +#define UUID_LEN 16 + +typedef struct VhostUserShared { +unsigned char uuid[UUID_LEN ]; +}VhostUserShared ; +#if defined(_WIN32) && (defined(__x86_64__) || defined(__i386__))# define VU_PACKED __attribute__((gcc_struct, packed))#else
@@ -199,6 +210,7 @@ typedef struct VhostUserMsg {VhostUserConfig config;VhostUserVringArea area;VhostUserInflight inflight; +VhostUserShared object; } payload;int fds[VHOST_MEMORY_BASELINE_NREGIONS ];
@@ -232,6 +244,7 @@ typedef int (*vu_get_config_cb) (VuDev *dev, uint8_t *config, uint32_t len);typedef int (*vu_set_config_cb ) (VuDev *dev,const uint8_t *data,uint32_t offset,uint32_t size,uint32_t flags); +typedef int (*vu_get_shared_object_cb ) (VuDev *dev,const unsigned char *uuid); typedef struct VuDevIface { /* called by VHOST_USER_GET_FEATURES to get the features bitmask */
@@ -258,6 +271,8 @@ typedef struct VuDevIface {vu_get_config_cb get_config;/* set the config space of the device */ vu_set_config_cb set_config; +/* get virtio shared object from the underlying vhost implementation. */ +vu_get_shared_object_cb get_shared_object; } VuDevIface;typedef void (*vu_queue_handler_cb ) (VuDev *dev,int qidx);
@@ -541,6 +556,44 @@ void vu_set_queue_handler(VuDev *dev, VuVirtq *vq,bool vu_set_queue_host_notifier (VuDev *dev,VuVirtq *vq,int fd,int size,int offset); +/** +* vu_lookup_shared_object: +* @dev: a VuDev context +* @uuid: UUID of the shared object +* @dmabuf_fd: output dma-buf file descriptor +* +* Lookup for a virtio shared object (i.e., dma-buf fd) associated with the +* received UUID. Result, if found, is stored in the dmabuf_fd argument. +* +* Returns: whether the virtio object was found. +*/ +bool vu_lookup_shared_object (VuDev *dev,unsigned char uuid[UUID_LEN ], +int *dmabuf_fd); + +/** +* vu_add_shared_object: +* @dev: a VuDev context +* @uuid: UUID of the shared object +* +* Registers this back-end as the exporter for the object associated with +* the received UUID. +* +* Returns: TRUE on success, FALSE on failure. +*/ +bool vu_add_shared_object (VuDev *dev,unsigned char uuid[UUID_LEN ]); + +/** +* vu_rm_shared_object: +* @dev: a VuDev context +* @uuid: UUID of the shared object +* +* Removes a shared object entry (i.e., back-end entry) associated with the +* received UUID key from the hash table. +* +* Returns: TRUE on success, FALSE on failure. +*/ +bool vu_rm_shared_object (VuDev *dev,unsigned char uuid[UUID_LEN ]); +/** * vu_queue_set_notification: * @dev: a VuDev context
subprojects/libvhost-user/libvhost-user.c +120 -0
144 lines not on this page · raw message
Signature · 1 line
MST
[PULL 24/63] vhost-user: strip superfluous whitespace
In reply to Michael S. TsirkinFrom: Laszlo Ersek <[email protected]>
Message-Id: <[email protected]>
--- hw/virtio/vhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
@@ -377,7 +377,7 @@ static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg,* operations such as configuring device memory mappings or issuing device * resets, which affect the whole device instead of individual VQs, * vhost-user messages should only be sent once. -* +* * Devices with multiple vhost_devs are given an associated dev->vq_index * so per_device requests are only sent if vq_index is 0. */
Signature · 1 line
MST
[PULL 35/63] hw/i386/acpi-build: Use pc_madt_cpu_entry() directly
In reply to Michael S. TsirkinFrom: Bernhard Beschow <[email protected]>
This is x86-specific code, so there is no advantage in using pc_madt_cpu_entry() behind an architecture-agnostic interface.
Message-Id: <[email protected]>
--- hw/i386/acpi-common.h | 3 +-- hw/i386/acpi-build.c | 3 +-- hw/i386/acpi-common.c | 5 ++--- hw/i386/acpi-microvm.c | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-)
hw/i386/acpi-common.h +1 -2
@@ -1,7 +1,6 @@#ifndef HW_I386_ACPI_COMMON_H #define HW_I386_ACPI_COMMON_H -#include "hw/acpi/acpi_dev_interface.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/i386/x86.h"
@@ -9,7 +8,7 @@#define ACPI_BUILD_IOAPIC_ID 0x0void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev, +X86MachineState *x86ms,const char *oem_id,const char *oem_table_id);#endif
hw/i386/acpi-build.c +1 -2
@@ -2548,8 +2548,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker, x86ms, -ACPI_DEVICE_IF (x86ms->acpi_dev), x86ms->oem_id, - x86ms->oem_table_id); + x86ms->oem_id, x86ms->oem_table_id);#ifdef CONFIG_ACPI_ERST {
hw/i386/acpi-common.c +2 -3
@@ -94,14 +94,13 @@ build_xrupt_override(GArray *entry, uint8_t src, uint32_t gsi, uint16_t flags)* 5.2.8 Multiple APIC Description Table */ void acpi_build_madt (GArray *table_data,BIOSLinker *linker, -X86MachineState *x86ms,AcpiDeviceIf *adev, +X86MachineState *x86ms,const char *oem_id,const char *oem_table_id) {int i;bool x2apic_mode = false;MachineClass *mc =MACHINE_GET_CLASS (x86ms);const CPUArchIdList *apic_ids = mc->possible_cpu_arch_ids (MACHINE (x86ms)); -AcpiDeviceIfClass *adevc =ACPI_DEVICE_IF_GET_CLASS (adev);AcpiTable table = { .sig ="APIC" , .rev =3 , .oem_id = oem_id, .oem_table_id = oem_table_id };
@@ -111,7 +110,7 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker,build_append_int_noprefix (table_data,1 /* PCAT_COMPAT */ ,4 );/* Flags */ for (i =0 ; i < apic_ids->len; i++) { - adevc->madt_cpu (i, apic_ids, table_data, false); +pc_madt_cpu_entry (i, apic_ids, table_data, false);if (apic_ids->cpus[i].arch_id >254 ) { x2apic_mode = true; }
hw/i386/acpi-microvm.c +1 -2
@@ -214,8 +214,7 @@ static void acpi_build_microvm(AcpiBuildTables *tables,acpi_add_table (table_offsets, tables_blob);acpi_build_madt (tables_blob, tables->linker,X86_MACHINE (machine), -ACPI_DEVICE_IF (x86ms->acpi_dev), x86ms->oem_id, - x86ms->oem_table_id); + x86ms->oem_id, x86ms->oem_table_id);#ifdef CONFIG_ACPI_ERST {
Signature · 1 line
MST
[PULL 59/63] virtio: remove unused next argument from virtqueue_split_read_next_desc()
In reply to Michael S. TsirkinFrom: Ilya Maximets <[email protected]>
The 'next' was converted from a local variable to an output parameter in commit:
412e0e81b174 ("virtio: handle virtqueue_read_next_desc() errors")
But all the actual uses of the 'i/next' as an output were removed a few months prior in commit:
aa570d6fb6bd ("virtio: combine the read of a descriptor")
Remove the unused argument to simplify the code.
Also, adding a comment to the function to describe what it is actually doing, as it is not obvious that the 'desc' is both an input and an output argument.
Message-Id: <[email protected]>
--- hw/virtio/virtio.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
hw/virtio/virtio.c +8 -10
@@ -1049,9 +1049,10 @@ enum { VIRTQUEUE_READ_DESC_MORE = 1, /* more buffers in chain */ }; +/* Reads the 'desc->next' descriptor into '*desc'. */ static int virtqueue_split_read_next_desc (VirtIODevice *vdev,VRingDesc *desc,MemoryRegionCache *desc_cache, -unsigned int max,unsigned int *next) +unsigned int max) {/* If this descriptor says it doesn't chain, we're done. */ if (!(desc->flags &VRING_DESC_F_NEXT )) {
@@ -1059,14 +1060,12 @@ static int virtqueue_split_read_next_desc(VirtIODevice *vdev, VRingDesc *desc, }/* Check they're not leading us off end of descriptors. */ - *next = desc->next; - -if (*next >= max) { -virtio_error (vdev,"Desc next is %u" , *next); +if (desc->next >= max) { +virtio_error (vdev,"Desc next is %u" , desc->next);return VIRTQUEUE_READ_DESC_ERROR ; } -vring_split_desc_read (vdev, desc, desc_cache, *next); +vring_split_desc_read (vdev, desc, desc_cache, desc->next);return VIRTQUEUE_READ_DESC_MORE ; }
@@ -1146,7 +1145,7 @@ static void virtqueue_split_get_avail_bytes(VirtQueue *vq, goto done; } - rc =virtqueue_split_read_next_desc (vdev, &desc, desc_cache, max, &i); + rc =virtqueue_split_read_next_desc (vdev, &desc, desc_cache, max); }while (rc ==VIRTQUEUE_READ_DESC_MORE );if (rc ==VIRTQUEUE_READ_DESC_ERROR ) {
@@ -1601,7 +1600,7 @@ static void *virtqueue_split_pop(VirtQueue *vq, size_t sz) goto err_undo_map; } - rc =virtqueue_split_read_next_desc (vdev, &desc, desc_cache, max, &i); + rc =virtqueue_split_read_next_desc (vdev, &desc, desc_cache, max); }while (rc ==VIRTQUEUE_READ_DESC_MORE );if (rc ==VIRTQUEUE_READ_DESC_ERROR ) {
@@ -4055,8 +4054,7 @@ VirtioQueueElement *qmp_x_query_virtio_queue_element(const char *path, list = node; ndescs++; - rc =virtqueue_split_read_next_desc (vdev, &desc, desc_cache, - max, &i); + rc =virtqueue_split_read_next_desc (vdev, &desc, desc_cache, max); }while (rc ==VIRTQUEUE_READ_DESC_MORE ); element->descs = list; done:
Signature · 1 line
MST
[PULL 52/63] vdpa net: follow VirtIO initialization properly at cvq isolation probing
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
This patch solves a few issues. The most obvious is that the feature set was done previous to ACKNOWLEDGE | DRIVER status bit set. Current vdpa devices are permissive with this, but it is better to follow the standard.
Message-Id: <[email protected]>
--- net/vhost-vdpa.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
net/vhost-vdpa.c +11 -5
@@ -1345,8 +1345,7 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features,uint64_t backend_features;int64_t cvq_group;uint8_t status =VIRTIO_CONFIG_S_ACKNOWLEDGE | -VIRTIO_CONFIG_S_DRIVER | -VIRTIO_CONFIG_S_FEATURES_OK ; +VIRTIO_CONFIG_S_DRIVER ;int r;ERRP_GUARD ();
@@ -1361,15 +1360,22 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features,return 0 ; } - r =ioctl (device_fd,VHOST_SET_FEATURES , &features); + r =ioctl (device_fd,VHOST_VDPA_SET_STATUS , &status);if (unlikely (r)) { -error_setg_errno (errp, errno,"Cannot set features" ); +error_setg_errno (errp, -r,"Cannot set device status" ); goto out; } + r =ioctl (device_fd,VHOST_SET_FEATURES , &features); +if (unlikely (r)) { +error_setg_errno (errp, -r,"Cannot set features" ); + goto out; + } + + status |=VIRTIO_CONFIG_S_FEATURES_OK ; r =ioctl (device_fd,VHOST_VDPA_SET_STATUS , &status);if (unlikely (r)) { -error_setg_errno (errp, -r,"Cannot set status" ); +error_setg_errno (errp, -r,"Cannot set device status" ); goto out; }
Signature · 1 line
MST
[PULL 18/63] vdpa: move vhost_vdpa_set_vring_ready to the caller
In reply to Michael S. TsirkinFrom: Eugenio Pérez <[email protected]>
Doing that way allows CVQ to be enabled before the dataplane vqs, restoring the state as MQ or MAC addresses properly in the case of a migration.
The patch does it by defining a ->load NetClientInfo callback also for dataplane. Ideally, this should be done by an independent patch, but the function is already static so it would only add an empty vhost_vdpa_net_data_load stub.
Message-Id: <[email protected]>
--- hw/virtio/vdpa-dev.c | 3 ++ hw/virtio/vhost-vdpa.c | 3 -- net/vhost-vdpa.c | 65 ++++++++++++++++++++++++++++-------------- 3 files changed, 46 insertions(+), 25 deletions(-)
hw/virtio/vdpa-dev.c +3 -0
@@ -255,6 +255,9 @@ static int vhost_vdpa_device_start(VirtIODevice *vdev, Error **errp)error_setg_errno (errp, -ret,"Error starting vhost" ); goto err_guest_notifiers; } +for (i =0 ; i < s->dev.nvqs; ++i) { +vhost_vdpa_set_vring_ready (&s->vdpa, i); + } s->started = true;/*
hw/virtio/vhost-vdpa.c +0 -3
@@ -1303,9 +1303,6 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started)if (unlikely (!ok)) {return -1 ; } -for (int i =0 ; i < dev->nvqs; ++i) { -vhost_vdpa_set_vring_ready (v, dev->vq_index + i); - } }else {vhost_vdpa_suspend (dev);vhost_vdpa_svqs_stop (dev);
net/vhost-vdpa.c +43 -22
85 lines not on this page · raw message
Signature · 1 line
MST
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Michael S. Tsirkin
----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Quoted 7 lines
Philippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]
Quoted 1 line
Woohoo \o/ thanks for merging this!
😳
Re: [PULL 30/63] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously
In reply to Michael S. TsirkinQuoted 158 lines · Michael S. Tsirkin
From: Laszlo Ersek <[email protected]>
(1) The virtio-1.2 specification
Quoted 11 lines · <http://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html> writes:
3 General Initialization And Device Operation
3.1 Device Initialization
3.1.1 Driver Requirements: Device Initialization[...]
7. Perform device-specific setup, including discovery of virtqueues for the device, optional per-bus setup, reading and possibly writing the device’s virtio configuration space, and population of virtqueues.
8. Set the
DRIVER_OKstatus bit. At this point the device is “live”.and
Quoted 4 lines
4 Virtio Transport Options 4.1 Virtio Over PCI Bus 4.1.4 Virtio Structure PCI Capabilities 4.1.4.3 Common configuration structure layoutQuoted 8 lines
4.1.4.3.2 Driver Requirements: Common configuration structure layout
[...]
The driver MUST configure the other virtqueue fields before enabling the virtqueue with
queue_enable.[...]
(The same statements are present in virtio-1.0 identically, at
<http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.html>.)These together mean that the following sub-sequence of steps is valid for a virtio-1.0 guest driver:
(1.1) set "
queue_enable" for the needed queues as the final part of device initialization step (7),(1.2) set
DRIVER_OKin step (8),(1.3) immediately start sending virtio requests to the device.
(2) When vhost-user is enabled, and the
VHOST_USER_F_PROTOCOL_FEATURESspecial virtio feature is negotiated, then virtio rings start in disabled state, according to
<https://qemu-project.gitlab.io/qemu/interop/vhost-user.html#ring-states>.
In this case, explicitVHOST_USER_SET_VRING_ENABLEmessages are needed for enabling vrings.Therefore setting "
queue_enable" from the guest (1.1) is a *control plane* operation, which travels from the guest through QEMU to the vhost-user backend, using a unix domain socket.Whereas sending a virtio request (1.3) is a *data plane* operation, which evades QEMU -- it travels from guest to the vhost-user backend via eventfd.
This means that steps (1.1) and (1.3) travel through different channels, and their relative order can be reversed, as perceived by the vhost-user backend.
That's exactly what happens when OVMF's virtiofs driver (VirtioFsDxe) runs against the Rust-language virtiofsd version 1.7.2. (Which uses version 0.10.1 of the vhost-user-backend crate, and version 0.8.1 of the vhost crate.)
Namely, when VirtioFsDxe binds a virtiofs device, it goes through the device initialization steps (i.e., control plane operations), and immediately sends a
FUSE_INITrequest too (i.e., performs a data plane operation). In the Rust-language virtiofsd, this creates a race between two components that run *concurrently*, i.e., in different threads or processes:- Control plane, handling vhost-user protocol messages:
The "
VhostUserSlaveReqHandlerMut::set_vring_enable" method [crates/vhost-user-backend/src/handler.rs] handlesVHOST_USER_SET_VRING_ENABLEmessages, and updates each vring's "enabled" flag according to the message processed.- Data plane, handling virtio / FUSE requests:
The "
VringEpollHandler::handle_event" method [crates/vhost-user-backend/src/event_loop.rs] handles the incoming virtio / FUSE request, consuming the virtio kick at the same time. If the vring's "enabled" flag is set, the virtio / FUSE request is processed genuinely. If the vring's "enabled" flag is clear, then the virtio / FUSE request is discarded.Note that OVMF enables the queue *first*, and sends
FUSE_INIT*second*. However, if the data plane processor in virtiofsd wins the race, then it sees theFUSE_INIT*before* the control plane processor took notice ofVHOST_USER_SET_VRING_ENABLEand green-lit the queue for the data plane processor. Therefore the latter dropsFUSE_INITon the floor, and goes back to waiting for further virtio / FUSE requests withepoll_wait. Meanwhile OVMF is stuck waiting for theFUSET_INITresponse -- a deadlock.The deadlock is not deterministic. OVMF hangs infrequently during first boot. However, OVMF hangs almost certainly during reboots from the UEFI shell.
The race can be "reliably masked" by inserting a very small delay -- a single debug message -- at the top of "
VringEpollHandler::handle_event", i.e., just before the data plane processor checks the "enabled" field of the vring. That delay suffices for the control plane processor to act uponVHOST_USER_SET_VRING_ENABLE.We can deterministically prevent the race in QEMU, by blocking OVMF inside step (1.1) -- i.e., in the write to the "
queue_enable" register -- untilVHOST_USER_SET_VRING_ENABLEactually *completes*. That way OVMF's VCPU cannot advance to theFUSE_INITsubmission before virtiofsd's control plane processor takes notice of the queue being enabled.Wait for
VHOST_USER_SET_VRING_ENABLEcompletion by:- setting the
NEED_REPLYflag onVHOST_USER_SET_VRING_ENABLE, and waiting for the reply, if theVHOST_USER_PROTOCOL_F_REPLY_ACKvhost-user feature has been negotiated, or- performing a separate
VHOST_USER_GET_FEATURES*exchange*, which requires a backend response regardless ofVHOST_USER_PROTOCOL_F_REPLY_ACK.Cc "Michael S. Tsirkin" <[email protected]> (supporter:vhost)Cc Eugenio Perez Martin <[email protected]>Cc German Maglione <[email protected]>Cc Liu Jiang <[email protected]>Cc Sergio Lopez Pascual <[email protected]>Cc Stefano Garzarella <[email protected]>Signed-off-by Laszlo Ersek <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Message-Id: <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Reviewed-by Eugenio Pérez <[email protected]>--- hw/virtio/vhost-user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +8
-1@@ -1214,7 +1214,21 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, false); +/* +* SET_VRING_ENABLE travels from guest to QEMU to vhost-user backend / +* control plane thread via unix domain socket. Virtio requests travel +* from guest to vhost-user backend / data plane thread via eventfd. +* Even if the guest enables the ring first, and pushes its first virtio +* request second (conforming to the virtio spec), the data plane thread +* in the backend may see the virtio request before the control plane +* thread sees the queue enablement. This causes (in fact, requires) the
hw/virtio/vhost-user.c static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) · line 1234
Quoted 10 lines
hw/virtio/vhost-user.c +7
-0+* data plane thread to discard the virtio request (it arrived on a +* seemingly disabled queue). To prevent this out-of-order delivery, +* don't let the guest proceed to pushing the virtio request until the +* backend control plane acknowledges enabling the queue -- IOW, pass +* wait_for_reply=true below. +*/ + ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, true);if (ret <0 ) {/* * Restoring the previous state is likely infeasible, as well as
This is not the latest version (v3) of this set -- please see
<https://patchwork.ozlabs.org/project/qemu-devel/cover/[email protected]/>.
Thanks,
Laszlo
Re: [PULL 30/63] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously
Quoted 173 lines · Laszlo Ersek
Quoted 158 lines · Michael S. Tsirkin
From: Laszlo Ersek <[email protected]>
(1) The virtio-1.2 specification
Quoted 11 lines · <http://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html> writes:
3 General Initialization And Device Operation
3.1 Device Initialization
3.1.1 Driver Requirements: Device Initialization[...]
7. Perform device-specific setup, including discovery of virtqueues for the device, optional per-bus setup, reading and possibly writing the device’s virtio configuration space, and population of virtqueues.
8. Set the
DRIVER_OKstatus bit. At this point the device is “live”.and
Quoted 4 lines
4 Virtio Transport Options 4.1 Virtio Over PCI Bus 4.1.4 Virtio Structure PCI Capabilities 4.1.4.3 Common configuration structure layoutQuoted 8 lines
4.1.4.3.2 Driver Requirements: Common configuration structure layout
[...]
The driver MUST configure the other virtqueue fields before enabling the virtqueue with
queue_enable.[...]
(The same statements are present in virtio-1.0 identically, at
<http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.html>.)These together mean that the following sub-sequence of steps is valid for a virtio-1.0 guest driver:
(1.1) set "
queue_enable" for the needed queues as the final part of device initialization step (7),(1.2) set
DRIVER_OKin step (8),(1.3) immediately start sending virtio requests to the device.
(2) When vhost-user is enabled, and the
VHOST_USER_F_PROTOCOL_FEATURESspecial virtio feature is negotiated, then virtio rings start in disabled state, according to
<https://qemu-project.gitlab.io/qemu/interop/vhost-user.html#ring-states>.
In this case, explicitVHOST_USER_SET_VRING_ENABLEmessages are needed for enabling vrings.Therefore setting "
queue_enable" from the guest (1.1) is a *control plane* operation, which travels from the guest through QEMU to the vhost-user backend, using a unix domain socket.Whereas sending a virtio request (1.3) is a *data plane* operation, which evades QEMU -- it travels from guest to the vhost-user backend via eventfd.
This means that steps (1.1) and (1.3) travel through different channels, and their relative order can be reversed, as perceived by the vhost-user backend.
That's exactly what happens when OVMF's virtiofs driver (VirtioFsDxe) runs against the Rust-language virtiofsd version 1.7.2. (Which uses version 0.10.1 of the vhost-user-backend crate, and version 0.8.1 of the vhost crate.)
Namely, when VirtioFsDxe binds a virtiofs device, it goes through the device initialization steps (i.e., control plane operations), and immediately sends a
FUSE_INITrequest too (i.e., performs a data plane operation). In the Rust-language virtiofsd, this creates a race between two components that run *concurrently*, i.e., in different threads or processes:- Control plane, handling vhost-user protocol messages:
The "
VhostUserSlaveReqHandlerMut::set_vring_enable" method [crates/vhost-user-backend/src/handler.rs] handlesVHOST_USER_SET_VRING_ENABLEmessages, and updates each vring's "enabled" flag according to the message processed.- Data plane, handling virtio / FUSE requests:
The "
VringEpollHandler::handle_event" method [crates/vhost-user-backend/src/event_loop.rs] handles the incoming virtio / FUSE request, consuming the virtio kick at the same time. If the vring's "enabled" flag is set, the virtio / FUSE request is processed genuinely. If the vring's "enabled" flag is clear, then the virtio / FUSE request is discarded.Note that OVMF enables the queue *first*, and sends
FUSE_INIT*second*. However, if the data plane processor in virtiofsd wins the race, then it sees theFUSE_INIT*before* the control plane processor took notice ofVHOST_USER_SET_VRING_ENABLEand green-lit the queue for the data plane processor. Therefore the latter dropsFUSE_INITon the floor, and goes back to waiting for further virtio / FUSE requests withepoll_wait. Meanwhile OVMF is stuck waiting for theFUSET_INITresponse -- a deadlock.The deadlock is not deterministic. OVMF hangs infrequently during first boot. However, OVMF hangs almost certainly during reboots from the UEFI shell.
The race can be "reliably masked" by inserting a very small delay -- a single debug message -- at the top of "
VringEpollHandler::handle_event", i.e., just before the data plane processor checks the "enabled" field of the vring. That delay suffices for the control plane processor to act uponVHOST_USER_SET_VRING_ENABLE.We can deterministically prevent the race in QEMU, by blocking OVMF inside step (1.1) -- i.e., in the write to the "
queue_enable" register -- untilVHOST_USER_SET_VRING_ENABLEactually *completes*. That way OVMF's VCPU cannot advance to theFUSE_INITsubmission before virtiofsd's control plane processor takes notice of the queue being enabled.Wait for
VHOST_USER_SET_VRING_ENABLEcompletion by:- setting the
NEED_REPLYflag onVHOST_USER_SET_VRING_ENABLE, and waiting for the reply, if theVHOST_USER_PROTOCOL_F_REPLY_ACKvhost-user feature has been negotiated, or- performing a separate
VHOST_USER_GET_FEATURES*exchange*, which requires a backend response regardless ofVHOST_USER_PROTOCOL_F_REPLY_ACK.Cc "Michael S. Tsirkin" <[email protected]> (supporter:vhost)Cc Eugenio Perez Martin <[email protected]>Cc German Maglione <[email protected]>Cc Liu Jiang <[email protected]>Cc Sergio Lopez Pascual <[email protected]>Cc Stefano Garzarella <[email protected]>Signed-off-by Laszlo Ersek <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Message-Id: <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Reviewed-by Eugenio Pérez <[email protected]>--- hw/virtio/vhost-user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +8
-1@@ -1214,7 +1214,21 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, false); +/* +* SET_VRING_ENABLE travels from guest to QEMU to vhost-user backend / +* control plane thread via unix domain socket. Virtio requests travel +* from guest to vhost-user backend / data plane thread via eventfd. +* Even if the guest enables the ring first, and pushes its first virtio +* request second (conforming to the virtio spec), the data plane thread +* in the backend may see the virtio request before the control plane +* thread sees the queue enablement. This causes (in fact, requires) the hw/virtio/vhost-user.c static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) · line 1234
Quoted 10 lines
hw/virtio/vhost-user.c +7
-0+* data plane thread to discard the virtio request (it arrived on a +* seemingly disabled queue). To prevent this out-of-order delivery, +* don't let the guest proceed to pushing the virtio request until the +* backend control plane acknowledges enabling the queue -- IOW, pass +* wait_for_reply=true below. +*/ + ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, true);if (ret <0 ) {/* * Restoring the previous state is likely infeasible, as well as This is not the latest version (v3) of this set -- please see
<https://patchwork.ozlabs.org/project/qemu-devel/cover/[email protected]/>.
Quoted 2 lines
Thanks,
Laszlo
Ouch. OK I will drop. Feel free to send v4 tweaking commit message - I think you wanted to do it anyway right?
Re: [PULL 30/63] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously
Quoted 174 lines · Michael S. Tsirkin
Quoted 173 lines · Laszlo Ersek
Quoted 158 lines · Michael S. Tsirkin
From: Laszlo Ersek <[email protected]>
(1) The virtio-1.2 specification
Quoted 11 lines · <http://docs.oasis-open.org/virtio/virtio/v1.2/virtio-v1.2.html> writes:
3 General Initialization And Device Operation
3.1 Device Initialization
3.1.1 Driver Requirements: Device Initialization[...]
7. Perform device-specific setup, including discovery of virtqueues for the device, optional per-bus setup, reading and possibly writing the device’s virtio configuration space, and population of virtqueues.
8. Set the
DRIVER_OKstatus bit. At this point the device is “live”.and
Quoted 4 lines
4 Virtio Transport Options 4.1 Virtio Over PCI Bus 4.1.4 Virtio Structure PCI Capabilities 4.1.4.3 Common configuration structure layoutQuoted 8 lines
4.1.4.3.2 Driver Requirements: Common configuration structure layout
[...]
The driver MUST configure the other virtqueue fields before enabling the virtqueue with
queue_enable.[...]
(The same statements are present in virtio-1.0 identically, at
<http://docs.oasis-open.org/virtio/virtio/v1.0/virtio-v1.0.html>.)These together mean that the following sub-sequence of steps is valid for a virtio-1.0 guest driver:
(1.1) set "
queue_enable" for the needed queues as the final part of device initialization step (7),(1.2) set
DRIVER_OKin step (8),(1.3) immediately start sending virtio requests to the device.
(2) When vhost-user is enabled, and the
VHOST_USER_F_PROTOCOL_FEATURESspecial virtio feature is negotiated, then virtio rings start in disabled state, according to
<https://qemu-project.gitlab.io/qemu/interop/vhost-user.html#ring-states>.
In this case, explicitVHOST_USER_SET_VRING_ENABLEmessages are needed for enabling vrings.Therefore setting "
queue_enable" from the guest (1.1) is a *control plane* operation, which travels from the guest through QEMU to the vhost-user backend, using a unix domain socket.Whereas sending a virtio request (1.3) is a *data plane* operation, which evades QEMU -- it travels from guest to the vhost-user backend via eventfd.
This means that steps (1.1) and (1.3) travel through different channels, and their relative order can be reversed, as perceived by the vhost-user backend.
That's exactly what happens when OVMF's virtiofs driver (VirtioFsDxe) runs against the Rust-language virtiofsd version 1.7.2. (Which uses version 0.10.1 of the vhost-user-backend crate, and version 0.8.1 of the vhost crate.)
Namely, when VirtioFsDxe binds a virtiofs device, it goes through the device initialization steps (i.e., control plane operations), and immediately sends a
FUSE_INITrequest too (i.e., performs a data plane operation). In the Rust-language virtiofsd, this creates a race between two components that run *concurrently*, i.e., in different threads or processes:- Control plane, handling vhost-user protocol messages:
The "
VhostUserSlaveReqHandlerMut::set_vring_enable" method [crates/vhost-user-backend/src/handler.rs] handlesVHOST_USER_SET_VRING_ENABLEmessages, and updates each vring's "enabled" flag according to the message processed.- Data plane, handling virtio / FUSE requests:
The "
VringEpollHandler::handle_event" method [crates/vhost-user-backend/src/event_loop.rs] handles the incoming virtio / FUSE request, consuming the virtio kick at the same time. If the vring's "enabled" flag is set, the virtio / FUSE request is processed genuinely. If the vring's "enabled" flag is clear, then the virtio / FUSE request is discarded.Note that OVMF enables the queue *first*, and sends
FUSE_INIT*second*. However, if the data plane processor in virtiofsd wins the race, then it sees theFUSE_INIT*before* the control plane processor took notice ofVHOST_USER_SET_VRING_ENABLEand green-lit the queue for the data plane processor. Therefore the latter dropsFUSE_INITon the floor, and goes back to waiting for further virtio / FUSE requests withepoll_wait. Meanwhile OVMF is stuck waiting for theFUSET_INITresponse -- a deadlock.The deadlock is not deterministic. OVMF hangs infrequently during first boot. However, OVMF hangs almost certainly during reboots from the UEFI shell.
The race can be "reliably masked" by inserting a very small delay -- a single debug message -- at the top of "
VringEpollHandler::handle_event", i.e., just before the data plane processor checks the "enabled" field of the vring. That delay suffices for the control plane processor to act uponVHOST_USER_SET_VRING_ENABLE.We can deterministically prevent the race in QEMU, by blocking OVMF inside step (1.1) -- i.e., in the write to the "
queue_enable" register -- untilVHOST_USER_SET_VRING_ENABLEactually *completes*. That way OVMF's VCPU cannot advance to theFUSE_INITsubmission before virtiofsd's control plane processor takes notice of the queue being enabled.Wait for
VHOST_USER_SET_VRING_ENABLEcompletion by:- setting the
NEED_REPLYflag onVHOST_USER_SET_VRING_ENABLE, and waiting for the reply, if theVHOST_USER_PROTOCOL_F_REPLY_ACKvhost-user feature has been negotiated, or- performing a separate
VHOST_USER_GET_FEATURES*exchange*, which requires a backend response regardless ofVHOST_USER_PROTOCOL_F_REPLY_ACK.Cc "Michael S. Tsirkin" <[email protected]> (supporter:vhost)Cc Eugenio Perez Martin <[email protected]>Cc German Maglione <[email protected]>Cc Liu Jiang <[email protected]>Cc Sergio Lopez Pascual <[email protected]>Cc Stefano Garzarella <[email protected]>Signed-off-by Laszlo Ersek <[email protected]>Reviewed-by Stefano Garzarella <[email protected]>Message-Id: <[email protected]>
Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Reviewed-by Eugenio Pérez <[email protected]>--- hw/virtio/vhost-user.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)hw/virtio/vhost-user.c +8
-1@@ -1214,7 +1214,21 @@ static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) .num = enable, }; - ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, false); +/* +* SET_VRING_ENABLE travels from guest to QEMU to vhost-user backend / +* control plane thread via unix domain socket. Virtio requests travel +* from guest to vhost-user backend / data plane thread via eventfd. +* Even if the guest enables the ring first, and pushes its first virtio +* request second (conforming to the virtio spec), the data plane thread +* in the backend may see the virtio request before the control plane +* thread sees the queue enablement. This causes (in fact, requires) the hw/virtio/vhost-user.c static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable) · line 1234
Quoted 10 lines
hw/virtio/vhost-user.c +7
-0+* data plane thread to discard the virtio request (it arrived on a +* seemingly disabled queue). To prevent this out-of-order delivery, +* don't let the guest proceed to pushing the virtio request until the +* backend control plane acknowledges enabling the queue -- IOW, pass +* wait_for_reply=true below. +*/ + ret =vhost_set_vring (dev,VHOST_USER_SET_VRING_ENABLE , &state, true);if (ret <0 ) {/* * Restoring the previous state is likely infeasible, as well as This is not the latest version (v3) of this set -- please see
<https://patchwork.ozlabs.org/project/qemu-devel/cover/[email protected]/>.
Quoted 4 lines
Quoted 2 lines
Thanks,
LaszloOuch. OK I will drop.
Thanks!
Quoted 2 lines
Feel free to send v4 tweaking commit message - I
think you wanted to do it anyway right?
The v3 series (already on list) is the latest / most recent version, and that one already includes the intended commit message tweaks. So there's no need for me to post another version (i.e., no need for a v4); just please replace my patches in this PR with the v3 series.
Thanks!
Laszlo
Quoted 9 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:
8c4f1adf6b2dec02f0c04de470c78a4aa2da97dc now - Laszlo found an issue with version of his patchset that I applied, dropped for now and will be in the next pull.
Quoted 200 lines
libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++ MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytes tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++
Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytes
Hi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:
QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh /home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test --tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source file tests/qtest/bios-tables-test.c for instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)
Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360
Stefan
Quoted 11 lines
tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
Quoted 225 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)
Quoted 4 lines
Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360Stefan
OK but .. CI seemed to pass for me. Interesting.
Could you send the link to the pipeline please?
Quoted 11 lines
Quoted 11 lines
tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
Quoted 225 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)
Quoted 16 lines
Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360Stefan
Quoted 11 lines
tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
Hmm something related to that (ubuntu on s390) environment and triggered by fortify source somehow? Weird. My guess would be an uninitialized variable somwhere, which if true would be serious enough. Unfortunately IIRC IASL is not available on that platform. Is there a way to get the binaries from that build to compare against expected files?
Signature · 1 line
MST
Quoted 226 lines · Michael S. Tsirkin
Quoted 225 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle shared_object msg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)
Quoted 7 lines
Quoted 4 lines
Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360Stefan
OK but .. CI seemed to pass for me. Interesting.
Could you send the link to the pipeline please?
It's on a big endian s390x host ... so it's likely an endianness issue?
Thomas
Re: [PULL 33/63] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Michael S. TsirkinQuoted 108 lines · Michael S. Tsirkin
From: Dave Jiang <[email protected]>
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.Following edited for readbility only
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- include/hw/acpi/cxl.h | 1 + hw/acpi/cxl.c | 57 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + 3 files changed, 59 insertions(+)include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif hw/acpi/cxl.c +38
-0@@ -30,6 +30,63 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 *, QTG ID _DSM */ + ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ + +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} inciate that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. +*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list[1 ] = {0x01 }; +uint16_t word_list2[1 ] = {0 }; +uint8_t *byte_list = (uint8_t *)word_list; +uint8_t *byte_list2 = (uint8_t *)word_list2; +Aml *pak, *pak1; +
hw/acpi/cxl.c line 80
Quoted 10 lines
hw/acpi/cxl.c +10
-0+/* +* The return package is a package of a WORD and another package. +* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. +*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), byte_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), byte_list)); +aml_append (pak, pak1);
This looks fishy ... first declaring a uint16_t array in host endian order, then casting it to an uint8_t* byte array for code that likely expects little endian byte order in the guest ... I assume that this won't work and needs some more love for big endian hosts?
Thomas
Quoted 7 lines
hw/acpi/cxl.c +7
-0+aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +}
The link to the job is https://gitlab.com/qemu-project/qemu/-/jobs/5222693360.
The link to the pipeline is
https://gitlab.com/qemu-project/qemu/-/pipelines/1025613961.
Quoted 248 lines · Michael S. Tsirkin
Quoted 225 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)Quoted 4 lines
Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360Stefan
OK but .. CI seemed to pass for me. Interesting.
Could you send the link to the pipeline please?Quoted 11 lines
Quoted 11 lines
tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
Quoted 245 lines · Michael S. Tsirkin
Quoted 225 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)Quoted 16 lines
Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360Stefan
Quoted 11 lines
tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.c
Quoted 5 lines
Hmm something related to that (ubuntu on s390) environment and triggered by fortify source somehow? Weird. My guess would be an uninitialized variable somwhere, which if true would be serious enough. Unfortunately IIRC IASL is not available on that platform. Is there a way to get the binaries from that build to compare against expected files?
The job artifacts only include the meson logs, not the binaries:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360/artifacts/browse
Two options for reproducing this:
- Access an s390 system via Red Hat and reproduce it.
- Point me to a branch that has debugging modifications (e.g. GitLab CI YAML that saves files you need as artifacts) and I'll run the job on the qemu-project GitLab account for you.
Stefan
Quoted 4 lines
--
MST
Re: [PULL 33/63] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Thomas HuthQuoted 123 lines · Thomas Huth
Quoted 106 lines · Michael S. Tsirkin
From: Dave Jiang <[email protected]>
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.Following edited for readbility only
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- include/hw/acpi/cxl.h | 1 + hw/acpi/cxl.c | 57 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + 3 files changed, 59 insertions(+)include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif hw/acpi/cxl.c +38
-0@@ -30,6 +30,63 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 *, QTG ID _DSM */ + ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ + +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} inciate that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. +*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list[1 ] = {0x01 }; +uint16_t word_list2[1 ] = {0 }; +uint8_t *byte_list = (uint8_t *)word_list; +uint8_t *byte_list2 = (uint8_t *)word_list2; +Aml *pak, *pak1; +hw/acpi/cxl.c line 79
Quoted 10 lines
hw/acpi/cxl.c +10
-0+/* +* The return package is a package of a WORD and another package. +* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. +*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), byte_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), byte_list)); +aml_append (pak, pak1);This looks fishy ... first declaring a
uint16_tarray in host endian order, then casting it to an uint8_t* byte array for code that likely expects little endian byte order in the guest ... I assume that this won't work and needs some more love for big endian hosts?
Quoted 2 lines
Thomas
Oh, good catch!
So that would be "Add dummy ACPI QTG DSM".
I actually also don't like sizeof(uint16_t) here, it should be sizeof array. Maybe it actually can use build_append_int_noprefix in some way?
And inciate is a typo.
Quoted 8 lines
Quoted 7 lines
hw/acpi/cxl.c +7
-0+aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +}
Quoted 255 lines · Stefan Hajnoczi
Quoted 245 lines · Michael S. Tsirkin
Quoted 225 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)
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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle
shared_objectmsg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)Quoted 16 lines
Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360Stefan
Quoted 11 lines
tests/unit/meson.build | 1 + 74 files changed, 2192 insertions(+), 558 deletions(-) create mode 100644 include/hw/virtio/vhost-user-device.h create mode 100644 include/hw/virtio/virtio-dmabuf.h create mode 100644 hw/display/virtio-dmabuf.c delete mode 100644 hw/i386/generic_event_device_x86.c create mode 100644 hw/virtio/vhost-user-device-pci.c create mode 100644 hw/virtio/vhost-user-device.c create mode 100644 tests/unit/test-virtio-dmabuf.cQuoted 5 lines
Hmm something related to that (ubuntu on s390) environment and triggered by fortify source somehow? Weird. My guess would be an uninitialized variable somwhere, which if true would be serious enough. Unfortunately IIRC IASL is not available on that platform. Is there a way to get the binaries from that build to compare against expected files?
The job artifacts only include the meson logs, not the binaries:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360/artifacts/browse
Quoted 7 lines
Two options for reproducing this:
- Access an s390 system via Red Hat and reproduce it.
- Point me to a branch that has debugging modifications (e.g. GitLab CI YAML that saves files you need as artifacts) and I'll run the job on the qemu-project GitLab account for you.Stefan
OK I think Thomas found the issue. The tag is now at ce0f3b032a960726c0dddfb4f81f223215179f26 and it should be fine - I dropped the DSDT.cxl changes.
Quoted 4 lines
Quoted 4 lines
--
MST
Quoted 230 lines · Thomas Huth
Quoted 229 lines · Michael S. Tsirkin
Quoted 228 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle shared_object msg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Stefan
OK but .. CI seemed to pass for me. Interesting.
Could you send the link to the pipeline please?It's on a big endian s390x host ... so it's likely an endianness issue?
Thomas
yes but weird thing is, it passed ci for me.
Signature · 1 line
MST
PATCH v3 1/1 hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Michael S. TsirkinAdd a simple _DSM call support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for _DSM plumbing testing from the OS.
Following edited for readbility only
Device (CXLM)
{
Name (_HID, "ACPI0017") // _HID: Hardware ID
...
Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
{
If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52")))
{
If ((Arg2 == Zero))
{
Return (Buffer (One) { 0x01 })
}
If ((Arg2 == One))
{
Return (Package (0x02)
{
Buffer (0x02)
{ 0x01, 0x00 },
Package (0x01)
{
Buffer (0x02)
{ 0x00, 0x00 }
}
})
}
}
}--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.
v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>
--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)
hw/acpi/cxl.c +55 -0
@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 *, QTG ID _DSM */ + ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ + +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. +*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package. +* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. +*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list)); +aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);
hw/i386/acpi-build.c +1 -0
@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);
include/hw/acpi/cxl.h +1 -0
@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
Quoted 3 lines · Dave Jiang
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.
the enabling -> this
Quoted 2 lines
Following edited for readbility only
readbility only -> readability
Quoted 61 lines
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)hw/acpi/cxl.c +1
-0@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev)
hw/acpi/cxl.c line 43
Quoted 10 lines
hw/acpi/cxl.c +10
-0+{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 *
drop this * please
Quoted 1 line
, QTG ID
_DSM
this is not the name of this paragraph. pls make it match exactly so people can search
hw/acpi/cxl.c line 50
Quoted 8 lines
*/
hw/acpi/cxl.c +7
-0+ ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */
function 1?
hw/acpi/cxl.c line 61
Quoted 11 lines
hw/acpi/cxl.c +11
-0+ +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation.
again pls quote spec directly do not paraphrase
hw/acpi/cxl.c line 72
Quoted 12 lines
hw/acpi/cxl.c +9
-0+*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package.
hw/acpi/cxl.c +2
-0+* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs.
pls quote the spec directly
what does "a WORD" mean is unclear - do you match what hardware does when you use aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.
hw/acpi/cxl.c line 77
Quoted 5 lines
hw/acpi/cxl.c +5
-0+*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list));
It does not look like this patch compiles.
So how did you test it?
Please do not post untested patches.
If you do at least minimal testing
you would also see failures in bios table test
and would follow the procedure described there to
post it.
When you post next version please also document how the patch was tested: which guests, what tests, what were the results.
thanks!
Quoted 37 lines
hw/acpi/cxl.c +10
-0+aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);hw/i386/acpi-build.c +1
-0@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
Quoted 233 lines · Michael S. Tsirkin
Quoted 232 lines · Thomas Huth
Quoted 231 lines · Michael S. Tsirkin
Quoted 229 lines · Stefan Hajnoczi
Quoted 193 lines · Michael S. Tsirkin
The following changes since commit
494a6a2cf7f775d2c20fd6df9601e30606cc2014:Merge tag 'pull-request-2023-09-25' of https://gitlab.com/thuth/qemu into staging (2023-09-25 10:10:30 -0400)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
dc1499091ca09db0ac7a5615a592e55f27d4965d:libvhost-user: handle shared_object msg (2023-10-04 04:28:35 -0400)----------------------------------------------------------------
virtio,pci: features, cleanupsvdpa:
shadow vq vlan support
net migration with cvq
cxl:
dummy ACPI QTG DSM
support emulating 4 HDM decoders
serial number extended capability
virtio:
hared dma-bufFixes, cleanups all over the place.
Signed-off-by Michael S. Tsirkin <[email protected]>----------------------------------------------------------------
Akihiko Odaki (1):
amd_iommu: Fix APIC address checkAlbert Esteve (4):
util/uuid: add a hash function
hw/display: introduce virtio-dmabuf
vhost-user: addshared_objectmsg
libvhost-user: handleshared_objectmsgAlex Bennée (2):
virtio: add vhost-user-base and a generic vhost-user-device hw/virtio: add config support to vhost-user-deviceAni Sinha (1):
hw/i386/pc: improve physical address space bound check for 32-bit x86 systemsBernhard Beschow (8):
hw/i386/acpi-build: Usepc_madt_cpu_entry()directly hw/acpi/cpu: Havebuild_cpus_aml()take abuild_madt_cpu_fncallback hw/acpi/acpi_dev_interface: Remove now unusedmadt_cpuvirtual method hw/acpi/acpi_dev_interface: Remove now unused #include "hw/boards.h" hw/i386: Remove now redundantTYPE_ACPI_GED_X86hw/i386/acpi-build: Determine SMI command port just once hw/acpi: Trace GPE access in all device models, not just PIIX4 hw/acpi/core: Trace enable and status registers of GPE separatelyDave Jiang (1):
hw/cxl: Add QTG_DSMsupport for ACPI0017 deviceDavid Woodhouse (1):
hw/isa/ich9: Add comment on imperfect emulation of PIC vs. I/O APIC routingEugenio Pérez (9):
vdpa: use first queue SVQ state for CVQ default
vdpa: exportvhost_vdpa_set_vring_ready
vdpa: renamevhost_vdpa_net_loadtovhost_vdpa_net_cvq_load
vdpa: movevhost_vdpa_set_vring_readyto the caller
vdpa: remove net cvq migration blocker
vdpa net: zerovhost_vdpaiova_treepointer at cleanup
vdpa net: fix error message setting virtio status
vdpa net: stop probing if cannot set features
vdpa net: follow VirtIO initialization properly at cvq isolation probingHawkins Jiawei (5):
virtio-net: do not reset vlan filtering atset_features
virtio-net: ExposeMAX_VLAN
vdpa: Restore vlan filtering state
vdpa: AllowVIRTIO_NET_F_CTRL_VLANin SVQ
vhost: Add count argument tovhost_svq_poll()Ilya Maximets (4):
virtio: don't zero out memory region cache for indirect descriptors
virtio: useshadow_avail_idxwhile checking number of heads
virtio: remove unnecessary thread fence while reading next descriptor
virtio: remove unused next argument fromvirtqueue_split_read_next_desc()Jonah Palmer (3):
qmp: removevirtio_list, search QOM tree instead
qmp: update virtio feature maps, vhost-user-gpio introspection
vhost-user: move VhostUserProtocolFeature definition to header fileJonathan Cameron (7):
tests/acpi: Allow update of DSDT.cxl
tests/acpi: Update DSDT.cxl with QTG DSM
hw/cxl: Pushcxl_decoder_count_enc()andcxl_decode_ig()into .c hw/cxl: Add utility functions decoder interleave ways and target count. hw/cxl: Fix and use same calculation for HDM decoder block size everywhere hw/cxl: Support 4 HDM decoders at all levels of topology hw/pci-bridge/cxl-upstream: Add serial number extended capability supportLaszlo Ersek (7):
vhost-user: strip superfluous whitespace
vhost-user: tighten "reply_supported" scope in "set_vring_addr"
vhost-user: factor out "vhost_user_write_sync"
vhost-user: flatten "enforce_reply" into "vhost_user_write_sync"
vhost-user: hoist "write_sync", "get_features", "get_u64"
vhost-user: allow "vhost_set_vring" to wait for a reply
vhost-user: callVHOST_USER_SET_VRING_ENABLEsynchronouslyMichael S. Tsirkin (1):
pci: SLT must be ROPhilippe Mathieu-Daudé (6):
hw/virtio: Propagatepage_masktovhost_vdpa_listener_skipped_section()hw/virtio: Propagatepage_masktovhost_vdpa_section_end()hw/virtio/vhost-vdpa: InlineTARGET_PAGE_ALIGN()macro hw/virtio/vhost-vdpa: Use target-agnosticqemu_target_page_mask()hw/virtio: Build vhost-vdpa.o once
hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]Stefan Hajnoczi (1):
vdpa: fix gcccvq_isolateduninitialized variable warningVladimir Sementsov-Ogievskiy (2):
pcie_sriov:unregister_vfs(): fix error pathlibvhost-user.c: add assertion tovu_message_read_defaulthw/acpi/hmat.h | 3 +- hw/i386/acpi-common.h | 3 +- hw/i386/amd_iommu.h | 2 - hw/virtio/vhost-shadow-virtqueue.h | 2 +- hw/virtio/virtio-qmp.h | 7 - include/exec/memory.h | 16 +- include/hw/acpi/acpi_dev_interface.h | 3 - include/hw/acpi/cpu.h | 6 +- include/hw/acpi/cxl.h | 1 + include/hw/acpi/generic_event_device.h | 2 - include/hw/cxl/cxl_component.h | 30 ++- include/hw/i386/pc.h | 6 + include/hw/pci/pci_bridge.h | 3 + include/hw/virtio/vhost-backend.h | 3 + include/hw/virtio/vhost-user-device.h | 46 ++++ include/hw/virtio/vhost-user.h | 22 ++ include/hw/virtio/vhost-vdpa.h | 1 + include/hw/virtio/virtio-dmabuf.h | 100 ++++++++ include/hw/virtio/virtio-net.h | 6 + include/qemu/uuid.h | 2 + subprojects/libvhost-user/libvhost-user.h | 55 +++- hw/acpi/acpi-x86-stub.c | 6 - hw/acpi/core.c | 9 + hw/acpi/cpu.c | 9 +- hw/acpi/cxl.c | 57 +++++ hw/acpi/hmat.c | 1 + hw/acpi/memory_hotplug.c | 1 + hw/acpi/piix4.c | 5 - hw/core/machine.c | 5 +- hw/cxl/cxl-component-utils.c | 92 ++++++- hw/cxl/cxl-host.c | 67 +++-- hw/display/virtio-dmabuf.c | 138 ++++++++++ hw/i386/acpi-build.c | 14 +- hw/i386/acpi-common.c | 5 +- hw/i386/acpi-microvm.c | 3 +- hw/i386/amd_iommu.c | 9 +- hw/i386/generic_event_device_x86.c | 36 --- hw/i386/microvm.c | 2 +- hw/i386/pc.c | 32 ++- hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 2 + hw/isa/lpc_ich9.c | 16 +- hw/mem/cxl_type3.c | 106 +++++--- hw/net/virtio-net.c | 6 +- hw/pci-bridge/cxl_upstream.c | 15 +- hw/pci/pci.c | 2 +- hw/pci/pci_bridge.c | 14 ++ hw/pci/pcie_sriov.c | 9 +- hw/scsi/vhost-user-scsi.c | 4 - hw/virtio/vdpa-dev.c | 3 + hw/virtio/vhost-shadow-virtqueue.c | 36 +-- hw/virtio/vhost-user-device-pci.c | 71 ++++++ hw/virtio/vhost-user-device.c | 380 ++++++++++++++++++++++++++++ hw/virtio/vhost-user-gpio.c | 7 + hw/virtio/vhost-user.c | 404 +++++++++++++++++++----------- hw/virtio/vhost-vdpa.c | 66 ++--- hw/virtio/virtio-qmp.c | 139 +++++----- hw/virtio/virtio.c | 64 +++-- net/vhost-vdpa.c | 153 +++++++---- subprojects/libvhost-user/libvhost-user.c | 121 +++++++++ tests/qtest/bios-tables-test.c | 26 +- tests/qtest/numa-test.c | 7 +- tests/unit/test-uuid.c | 27 ++ tests/unit/test-virtio-dmabuf.c | 137 ++++++++++ util/uuid.c | 14 ++Quoted 8 lines
MAINTAINERS | 7 + docs/interop/vhost-user.rst | 57 +++++ hw/acpi/trace-events | 10 +- hw/display/meson.build | 1 + hw/i386/meson.build | 1 - hw/virtio/meson.build | 28 ++- hw/virtio/trace-events | 2 +- tests/data/acpi/q35/DSDT.cxl | Bin 9655 -> 9723 bytesHi Michael,
There is a CI failure, probably related to the DSDT.cxl change in this pull request:QTEST_QEMU_BINARY=./qemu-system-x86_64 QTEST_QEMU_IMG=./qemu-img QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon MALLOC_PERTURB_=165 G_TEST_DBUS_DAEMON=/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
/home/gitlab-runner/builds/FLaZkdt1/0/qemu-project/qemu/build/tests/qtest/bios-tables-test--tap -k
――――――――――――――――――――――――――――――――――――― ✀ ―――――――――――――――――――――――――――――――――――――
stderr:
acpi-test: Warning! DSDT binary file mismatch. Actual
[aml:/tmp/aml-O8CAC2], Expected [aml:tests/data/acpi/q35/DSDT.cxl].
See source filetests/qtest/bios-tables-test.cfor instructions on how
to update expected files.
to see ASL diff between mismatched files install IASL, rebuild QEMU
from scratch and re-run tests with V=1 environment variable set** ERROR:../tests/qtest/bios-tables-test.c:535:test_acpi_asl: assertion
failed: (all_tables_match)
(test program exited with status code -6)Please take a look:
https://gitlab.com/qemu-project/qemu/-/jobs/5222693360Stefan
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
OK but .. CI seemed to pass for me. Interesting.
Could you send the link to the pipeline please?It's on a big endian s390x host ... so it's likely an endianness issue?
Thomas
yes but weird thing is, it passed ci for me.
If you run the CI in your forked repo, you only get the x86 runners by default. The s390x host is a special runner that runs on a dedicated s390x machine and thus only works when the CI runs in the upstream qemu-project.
Thomas
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Michael S. TsirkinQuoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Dave Jiang
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.the enabling -> this
will update
Quoted 5 lines
Quoted 3 lines
Following edited for readbility only
readbility only -> readability
will update
Quoted 62 lines
Quoted 62 lines
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)hw/acpi/cxl.c +0
-0@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h"
Quoted 16 lines
hw/acpi/cxl.c
Quoted 11 lines
hw/acpi/cxl.c +11
-0+void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 * drop this * please
Quoted 1 line
, QTG ID
_DSM
Ooops. git format-patch mangled this and I didn't catch. Will fix
Quoted 14 lines
this is not the name of this paragraph. pls make it match exactly so people can search
hw/acpi/cxl.c line 50
Quoted 8 lines
*/
hw/acpi/cxl.c +7
-0+ ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */
Quoted 1 line
function 1?
Yes, will fix
Quoted 14 lines
hw/acpi/cxl.c line 61
Quoted 12 lines
hw/acpi/cxl.c +11
-0+ +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. again pls quote spec directly do not paraphrase
Here it's not paraphrasing from the spec. I'm just describing the dummy value that will be provided.
Quoted 16 lines
hw/acpi/cxl.c line 72
Quoted 13 lines
hw/acpi/cxl.c +9
-0+*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package.
hw/acpi/cxl.c +2
-0+* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs.
Quoted 1 line
pls quote the spec directly
Will do.
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.
The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
Quoted 11 lines
hw/acpi/cxl.c line 77
Quoted 7 lines
hw/acpi/cxl.c +5
-0+*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list));It does not look like this patch compiles.
Quoted 8 lines
So how did you test it?
Please do not post untested patches.
If you do at least minimal testing
you would also see failures in bios table test
and would follow the procedure described there to
post it.
Sorry about that. I compiled successfully but did not test. The following chunk is tested. However, is it the correct way to do this? The comment is direct spec verbiage. I'm not familiar with constructing ACPI tables in QEMU and tried my best by looking at other ACPI code in QEMU.
+ ifctx2 = aml_if(aml_equal(function, aml_int(1)));
+ {
+ uint16_t max_id = cpu_to_le16(1);
+ uint16_t qtg_id = 0;
+ Aml *pak, *pak1;
+
+ /*
+ * Return: A package containing two elements - a WORD that returns
+ * the maximum throttling group that the platform supports, and a
+ * package containing the QTG ID(s) that the platform recommends.
+ * Package {
+ * Max Supported QTG ID
+ * Package {QTG Recommendations}
+ * }
+ */
+ pak1 = aml_package(1);
+ aml_append(pak1, aml_buffer(sizeof(uint16_t), (uint8_t *)&qtg_id));
+ pak = aml_package(2);
+ aml_append(pak, aml_buffer(sizeof(uint16_t), (uint8_t *)&max_id));
+ aml_append(pak, pak1);+
+ aml_append(ifctx2, aml_return(pak));
+ }
Quoted 45 lines
When you post next version please also document how the patch was tested: which guests, what tests, what were the results.
thanks!
Quoted 37 lines
hw/acpi/cxl.c +10
-0+aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);hw/i386/acpi-build.c +1
-0@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
Quoted 154 lines · Dave Jiang
Quoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Dave Jiang
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.the enabling -> this
will update
Quoted 5 lines
Quoted 3 lines
Following edited for readbility only
readbility only -> readability
will update
Quoted 62 lines
Quoted 62 lines
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)hw/acpi/cxl.c +0
-0@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h" Quoted 16 lines
hw/acpi/cxl.c
Quoted 11 lines
hw/acpi/cxl.c +11
-0+void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 * drop this * please
Quoted 1 line
, QTG ID
_DSMOoops. git format-patch mangled this and I didn't catch. Will fix
Quoted 14 lines
this is not the name of this paragraph. pls make it match exactly so people can search
hw/acpi/cxl.c line 50
Quoted 8 lines
*/
hw/acpi/cxl.c +7
-0+ ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ Quoted 1 line
function 1?
Yes, will fix
Quoted 14 lines
hw/acpi/cxl.c line 61
Quoted 12 lines
hw/acpi/cxl.c +11
-0+ +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. again pls quote spec directly do not paraphrase
Here it's not paraphrasing from the spec. I'm just describing the dummy value that will be provided.
Quoted 16 lines
hw/acpi/cxl.c line 72
Quoted 13 lines
hw/acpi/cxl.c +9
-0+*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package.
hw/acpi/cxl.c +2
-0+* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. Quoted 1 line
pls quote the spec directly
Quoted 7 lines
Will do.
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
It's not clear buffer is actually word though.
Jonathan do you have hardware access?
Also, possible to get clarification from the spec committee?
Quoted 14 lines
Quoted 14 lines
hw/acpi/cxl.c line 77
Quoted 8 lines
hw/acpi/cxl.c +5
-0+*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list));It does not look like this patch compiles.
So how did you test it?
Quoted 8 lines
Quoted 6 lines
Please do not post untested patches.
If you do at least minimal testing
you would also see failures in bios table test
and would follow the procedure described there to
post it.Sorry about that. I compiled successfully but did not test.
I don't see how it can compile either. In fact I just applied and build fails.
Quoted 1 line
The following chunk is tested. However, is it the correct way to do this? The comment is direct spec verbiage. I'm not familiar with constructing ACPI tables in QEMU and tried my best by looking at other ACPI code in QEMU.
To do what? create a buffer with a two byte word?
For example:
word = aml_buffer(0, NULL); build_append_int_noprefix(word->buf, 2, 0x1);
but again it is not clear at all what does spec mean. an integer up to 0xfffff? a buffer as you did? just two bytes?
could be any of these.
Quoted 71 lines
hw/acpi/cxl.c +23
-0+ ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t max_id =cpu_to_le16 (1 ); +uint16_t qtg_id =0 ; +Aml *pak, *pak1; + +/* +* Return: A package containing two elements - a WORD that returns +* the maximum throttling group that the platform supports, and a +* package containing the QTG ID(s) that the platform recommends. +* Package { +* Max Supported QTG ID +* Package {QTG Recommendations} +* } +*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), (uint8_t *)&qtg_id)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), (uint8_t *)&max_id)); +aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + }Quoted 47 lines
When you post next version please also document how the patch was tested: which guests, what tests, what were the results.
thanks!
Quoted 37 lines
hw/acpi/cxl.c +10
-0+aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);hw/i386/acpi-build.c +1
-0@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Dave JiangQuoted 97 lines · Dave Jiang
Quoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Dave Jiang
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.the enabling -> this
will update
Quoted 5 lines
Quoted 3 lines
Following edited for readbility only
readbility only -> readability
will update
Quoted 77 lines
Quoted 63 lines
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)hw/acpi/cxl.c +1
-0@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev)hw/acpi/cxl.c line 43
Quoted 10 lines
hw/acpi/cxl.c +10
-0+{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 * drop this * please
Quoted 3 lines
Quoted 1 line
Quoted 1 line
, QTG ID
_DSMOoops. git format-patch mangled this and I didn't catch.
Really? That would be a first in a long while for me. Maybe report to git mailing list.
Quoted 1 line
Will fix
My point is that name should match spec, not be a shortened version of it.
Quoted 33 lines
Quoted 14 lines
this is not the name of this paragraph. pls make it match exactly so people can search
hw/acpi/cxl.c line 50
Quoted 8 lines
*/
hw/acpi/cxl.c +7
-0+ ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ Quoted 1 line
function 1?
Yes, will fix
Quoted 14 lines
hw/acpi/cxl.c line 61
Quoted 12 lines
hw/acpi/cxl.c +11
-0+ +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. again pls quote spec directly do not paraphrase
Quoted 1 line
Here it's not paraphrasing from the spec. I'm just describing the dummy value that will be provided.
ok then
Function 1 return value {1, {0}} indicates ..
and
QTG ID of 1 -> QTG is 1.
these are faked in what sense? why not both 0?
I will let Jonathan decide whether it is wise to come up with random stuff and expose it to userspace by default. how will userspace know if we ever start exposing real values?
Quoted 118 lines
Quoted 16 lines
hw/acpi/cxl.c line 72
Quoted 13 lines
hw/acpi/cxl.c +9
-0+*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package.
hw/acpi/cxl.c +2
-0+* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. Quoted 1 line
pls quote the spec directly
Will do.
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
Quoted 11 lines
hw/acpi/cxl.c line 77
Quoted 7 lines
hw/acpi/cxl.c +5
-0+*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list));It does not look like this patch compiles.
Quoted 8 lines
So how did you test it?
Please do not post untested patches.
If you do at least minimal testing
you would also see failures in bios table test
and would follow the procedure described there to
post it.Sorry about that. I compiled successfully but did not test. The following chunk is tested. However, is it the correct way to do this? The comment is direct spec verbiage. I'm not familiar with constructing ACPI tables in QEMU and tried my best by looking at other ACPI code in QEMU.
hw/acpi/cxl.c +23
-0+ ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t max_id =cpu_to_le16 (1 ); +uint16_t qtg_id =0 ; +Aml *pak, *pak1; + +/* +* Return: A package containing two elements - a WORD that returns +* the maximum throttling group that the platform supports, and a +* package containing the QTG ID(s) that the platform recommends. +* Package { +* Max Supported QTG ID +* Package {QTG Recommendations} +* } +*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), (uint8_t *)&qtg_id)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), (uint8_t *)&max_id)); +aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + }Quoted 47 lines
When you post next version please also document how the patch was tested: which guests, what tests, what were the results.
thanks!
Quoted 37 lines
hw/acpi/cxl.c +10
-0+aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);hw/i386/acpi-build.c +1
-0@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Michael S. TsirkinQuoted 155 lines · On Thu, 5 Oct 2023 12:32:11 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 154 lines · Dave Jiang
Quoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Dave Jiang
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.the enabling -> this
will update
Quoted 5 lines
Quoted 3 lines
Following edited for readbility only
readbility only -> readability
will update
Quoted 62 lines
Quoted 62 lines
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)hw/acpi/cxl.c +0
-0@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h" Quoted 16 lines
hw/acpi/cxl.c
Quoted 11 lines
hw/acpi/cxl.c +11
-0+void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 * drop this * please
Quoted 1 line
, QTG ID
_DSMOoops. git format-patch mangled this and I didn't catch. Will fix
Quoted 14 lines
this is not the name of this paragraph. pls make it match exactly so people can search
hw/acpi/cxl.c line 50
Quoted 8 lines
*/
hw/acpi/cxl.c +7
-0+ ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ Quoted 1 line
function 1?
Yes, will fix
Quoted 14 lines
hw/acpi/cxl.c line 61
Quoted 12 lines
hw/acpi/cxl.c +11
-0+ +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. again pls quote spec directly do not paraphrase
Here it's not paraphrasing from the spec. I'm just describing the dummy value that will be provided.
Quoted 17 lines
hw/acpi/cxl.c line 72
Quoted 13 lines
hw/acpi/cxl.c +9
-0+*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package.
hw/acpi/cxl.c +2
-0+* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. pls quote the spec directly
Quoted 8 lines
Quoted 7 lines
Will do.
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
WORD does seem to be clearly defined in the ACPI spec as uint16 and as this is describing a DSDT blob I think we can safe that it means that. Also lines up with the fixed sizes in CEDT.
Quoted 3 lines
It's not clear buffer is actually word though.
Jonathan do you have hardware access?
No. +CC linux-cxl to see if anyone else has hardware + BIOS with QTG implemented... There will be lots of implementations soon so I'd make not guarantee they will all interpret this the same.
Aim here is Linux kernel enablement support, and unfortunately that almost always means we are ahead of easy availability of hardware. If it exists its probably prototypes in a lab, in which case no guarantees on the BIOS tables presented...
Quoted 2 lines
Also, possible to get clarification from the spec committee?
I'm unclear what we are clarifying. As I read it current implementation is indeed wrong and I failed to notice this earlier :(
Ultimately data encoding (ACPI 6.5 section 20.2..3 Data Objects Encoding) should I think be
0x0B 0x00 0x00
WordPrefix then data : note if you try a 0x0001 and feed
it to iasl it will squash it into a byte instead and indeed if you force the binary to the above it will decode it as 0x0000 but recompile that and you will be back to just0x00 (as bytes don't need a prefix..)
Currently it would be.0x11 0x05 0x0a 0x02 0x00 0x01
BufferOp
Btw I built a minimal DSDT file to test this and iasl isn't happy with the fact the _DSM doesn't return anything at all if ARG2 isn't 1 or 2. Whilst that's imdef territory as not covered by the CXL spec, we should return 'something' ;)
Anyhow, to do this as per the CXL spec we need an aml_word() that just implements the word case from aml_int()
Chance are that it never matters if we get an ecoding that is only single byte (because the value is small) but who knows what other AML parsers might do.
Something simple like (copy typed from test machine..)
Aml *aml_word(const uint16_t val)
{
Aml *var = aml_alloc();
build_append_byte(var->buf, 0x0B);
build_append_int_noprefix(var->buf, val, 2);
return var;
}and one blob in acpi/cxl.c becomes
ifctx2 = aml_if(aml_equal(function, aml_int(1)));
{
Aml *pak, *pac1;
pak1 = aml_package(1)
aml_append(pak1, aml_word(0));
pak = aml_package(2);
aml_append(pack, aml_word(0x1));
aml_append(pak, pak1);
aml_append(ifctx2, aml_return(pak));
}
aml_append(ifctx, ifctx2);...
}
Give something like
If ((Arg2 == One))
{
Return (Package (0x02)
{
0x0001,
Package (0x01)
{
0x0000
}
})
}Binary encoding then clearly uses packages of words.
12 0b 02 0b 01 00 12 05 01 0b 00 00 PkgOp len elements word 0x0001 pkgOp len elements word 0x0000
(note I cheated an added a marker in one of the values and didn't decode the whole thing by hand ;)
Quoted 36 lines
Quoted 15 lines
Quoted 15 lines
hw/acpi/cxl.c line 77
Quoted 9 lines
hw/acpi/cxl.c +5
-0+*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list));It does not look like this patch compiles.
So how did you test it?
Quoted 8 lines
Quoted 6 lines
Please do not post untested patches.
If you do at least minimal testing
you would also see failures in bios table test
and would follow the procedure described there to
post it.Sorry about that. I compiled successfully but did not test.
I don't see how it can compile either. In fact I just applied and build fails.
Quoted 1 line
The following chunk is tested. However, is it the correct way to do this? The comment is direct spec verbiage. I'm not familiar with constructing ACPI tables in QEMU and tried my best by looking at other ACPI code in QEMU.
To do what? create a buffer with a two byte word?
For example:word = aml_buffer(0, NULL); build_append_int_noprefix(word->buf, 2, 0x1);
Quoted 4 lines
but again it is not clear at all what does spec mean. an integer up to
0xfffff? a buffer as you did? just two bytes?could be any of these.
The best we have in the way of description is the multiple QTG example where it'sPackage() {2, 1} combined with it being made up of WORDs
whereas in general that will get squashed to a pair of bytes... So I'm thinking WORDs is max size rather than only size but given ambiguity we should encode them as words anyway.
Note this breaks Dave's current kernel proposal which is assuming a buffer...
https://lore.kernel.org/all/168695172301.3031571.9812118774299137032.stgit@djiang5-mobl3/
Hohum. Dave, can you sanity check with the appropriate SSWG person (MN IIRC) I can do it you'd prefer - just let me know.
Jonathan
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
Jonathan Cameron wrote:
[..]
Quoted 10 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
WORD does seem to be clearly defined in the ACPI spec as uint16 and as this is describing a DSDT blob I think we can safe that it means that. Also lines up with the fixed sizes in CEDT.
I am not sure it means that, the ACPI specification indicates that packages can hold "integers" and integers can be any size up to 64-bits.
Quoted 4 lines
Quoted 3 lines
It's not clear buffer is actually word though.
Jonathan do you have hardware access?
Quoted 8 lines
No. +CC linux-cxl to see if anyone else has hardware + BIOS with QTG implemented... There will be lots of implementations soon so I'd make not guarantee they will all interpret this the same.
Aim here is Linux kernel enablement support, and unfortunately that almost always means we are ahead of easy availability of hardware. If it exists its probably prototypes in a lab, in which case no guarantees on the BIOS tables presented...
From a pre-production system the ASL is putting the result of SizeOf directly into the first element in the return package:
Local1 = SizeOf (CXQI) Local0 [0x00] = Local1
...where CXQI appears to be a fixed table of QTG ids for the platform, and SizeOf() returns an integer type with no restriction that it be a 16-bit value.
So I think the specification is misleading by specifying WORD when ACPI "Package" objects convey "Integers" where the size of the integer can be a u8 to a u64.
Quoted 19 lines
Quoted 1 line
Also, possible to get clarification from the spec committee?
I'm unclear what we are clarifying. As I read it current implementation is indeed wrong and I failed to notice this earlier :(
Ultimately data encoding (ACPI 6.5 section 20.2..3 Data Objects Encoding) should I think be
0x0B0x000x00
WordPrefix then data : note if you try a0x0001and feed
it to iasl it will squash it into a byte instead and indeed if you force the binary to the above it will decode it as0x0000but recompile that and you will be back to just0x00(as bytes don't need a prefix..)Currently it would be.
0x110x050x0a0x020x000x01
BufferOp
Quoted 7 lines
Btw I built a minimal DSDT file to test this and iasl isn't happy with the fact the
_DSMdoesn't return anything at all if ARG2 isn't 1 or 2. Whilst that's imdef territory as not covered by the CXL spec, we should return 'something' ;)Anyhow, to do this as per the CXL spec we need an
aml_word()that just implements the word case fromaml_int()
If I understand correctly, aml_int() is sufficient since this is not a Field() where access size matters.
Quoted 3 lines
Chance are that it never matters if we get an ecoding that is only single byte (because the value is small) but who knows what other AML parsers might do.
I expect the reason WORD is used in the specification is because of the size of the QTG ID field in the CFMWS. ACPI could support returning more than USHRT_MAX in an Integer field in a Package, but those IDs above USHRT_MAX could not be represented in CFMWS.
[..]
Quoted 5 lines
Quoted 4 lines
but again it is not clear at all what does spec mean. an integer up to
0xfffff? a buffer as you did? just two bytes?could be any of these.
Quoted 7 lines
The best we have in the way of description is the multiple QTG example where it's
Package(){2, 1} combined with it being made up of WORDswhereas in general that will get squashed to a pair of bytes... So I'm thinking WORDs is max size rather than only size but given ambiguity we should encode them as words anyway.
My assertion is that for the Package format the size of the integer does not matter because the Package.Integer type can convey up to 64-bit values. For being compatible with the *usage* of that max id, values that do not fit into 16-bits are out of spec, but nothing prevents the Package from using any size integer, afaics.
PATCH v4 1/1 hw/cxl: Add QTG _DSM support for ACPI0017 device
Add a simple _DSM call support for the ACPI0017 device to return fake QTG ID values of 0 and 1 in all cases. This for _DSM plumbing testing from the OS.
Following edited for readability
Device (CXLM)
{
Name (_HID, "ACPI0017") // _HID: Hardware ID
...
Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method
{
If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52")))
{
If ((Arg2 == Zero))
{
Return (Buffer (One) { 0x01 })
}
If ((Arg2 == One))
{
Return (Package (0x02)
{
One,
Package (0x02)
{
Zero,
One
}
})
}
}
}--
v4: Change to package of ints rather than buffers. Also moved to 2 QTG IDs to improve kernel side testing. Tested on x86 qemu guest against kernel QTG ID _DSM parsing code to be upstreamed.
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.
v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>
--- hw/acpi/cxl.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 71 insertions(+)
hw/acpi/cxl.c +69 -0
@@ -30,6 +30,75 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 _DSM Function for Retrieving QTG ID */ + ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* function 1 only */ + +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* Creating a package with static values. The max supported QTG ID will +* be 1 and recommended QTG IDs are 0 and then 1. +* The values here are statically created to simplify emulation. Values +* from a real BIOS would be determined by the performance of all the +* present CXL memory and then assigned. +*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +Aml *pak, *pak1; + +/* +* Return: A package containing two elements - a WORD that returns +* the maximum throttling group that the platform supports, and a +* package containing the QTG ID(s) that the platform recommends. +* Package { +* Max Supported QTG ID +* Package {QTG Recommendations} +* } +* +* While the SPEC specified WORD that hints at the value being +* 16bit, the ACPI dump of BIOS DSDT table showed that the values +* are integers with no specific size specification. aml_int() will +* be used for the values. +*/ + pak1 =aml_package (2 ); +/* Set QTG ID of 0 */ +aml_append (pak1,aml_int (0 )); +/* Set QTG ID of 1 */ +aml_append (pak1,aml_int (1 )); + + pak =aml_package (2 ); +/* Set Max QTG 1 */ +aml_append (pak,aml_int (1 )); +aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);
hw/i386/acpi-build.c +1 -0
@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);
include/hw/acpi/cxl.h +1 -0
@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Jonathan CameronQuoted 164 lines · Jonathan Cameron
Quoted 161 lines · On Thu, 5 Oct 2023 12:32:11 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 160 lines · Dave Jiang
Quoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Dave Jiang
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.the enabling -> this
will update
Quoted 5 lines
Quoted 3 lines
Following edited for readbility only
readbility only -> readability
will update
Quoted 62 lines
Quoted 62 lines
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)hw/acpi/cxl.c +0
-0@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h" Quoted 16 lines
hw/acpi/cxl.c
Quoted 11 lines
hw/acpi/cxl.c +11
-0+void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 * drop this * please
Quoted 1 line
, QTG ID
_DSMOoops. git format-patch mangled this and I didn't catch. Will fix
Quoted 14 lines
this is not the name of this paragraph. pls make it match exactly so people can search
hw/acpi/cxl.c line 50
Quoted 8 lines
*/
hw/acpi/cxl.c +7
-0+ ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ Quoted 1 line
function 1?
Yes, will fix
Quoted 14 lines
hw/acpi/cxl.c line 61
Quoted 12 lines
hw/acpi/cxl.c +11
-0+ +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. again pls quote spec directly do not paraphrase
Here it's not paraphrasing from the spec. I'm just describing the dummy value that will be provided.
Quoted 16 lines
hw/acpi/cxl.c line 72
Quoted 13 lines
hw/acpi/cxl.c +9
-0+*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package.
hw/acpi/cxl.c +2
-0+* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. Quoted 1 line
pls quote the spec directly
Will do.
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
WORD does seem to be clearly defined in the ACPI spec as uint16 and as this is describing a DSDT blob I think we can safe that it means that. Also lines up with the fixed sizes in CEDT.
Binary blobs are not really legal as return values of AML though. What this patch was doing was a buffer. An alternative interpretation would be an integer. Or something else yet ...
Quoted 14 lines
Quoted 3 lines
It's not clear buffer is actually word though.
Jonathan do you have hardware access?
No. +CC linux-cxl to see if anyone else has hardware + BIOS with QTG implemented... There will be lots of implementations soon so I'd make not guarantee they will all interpret this the same.
Aim here is Linux kernel enablement support, and unfortunately that almost always means we are ahead of easy availability of hardware. If it exists its probably prototypes in a lab, in which case no guarantees on the BIOS tables presented...
Quoted 1 line
Quoted 3 lines
Quoted 1 line
Also, possible to get clarification from the spec committee?
I'm unclear what we are clarifying.
Let me clarify, below.
Quoted 6 lines
As I read it current implementation
is indeed wrong and I failed to notice this earlier :(Ultimately data encoding (ACPI 6.5 section 20.2..3 Data Objects Encoding) should I think be
Quoted 6 lines
0x0B0x000x00
WordPrefix then data : note if you try a0x0001and feed
it to iasl it will squash it into a byte instead and indeed if you force the binary to the above it will decode it as0x0000but recompile that and you will be back to just0x00(as bytes don't need a prefix..)
Exactly. So this is the clarification we seek. ACPI spec does mention WordPrefix however only as one of the
ways to encode an integer, as part of ComputationalData, never directly. If CXL requires it to be WordPrefix then qemu can do it but tools such as IASL will need to be taught a way to force using WordPrefix.
Quoted 60 lines
Currently it would be.
0x110x050x0a0x020x000x01
BufferOpBtw I built a minimal DSDT file to test this and iasl isn't happy with the fact the
_DSMdoesn't return anything at all if ARG2 isn't 1 or 2. Whilst that's imdef territory as not covered by the CXL spec, we should return 'something' ;)Anyhow, to do this as per the CXL spec we need an
aml_word()that just implements the word case fromaml_int()Chance are that it never matters if we get an ecoding that is only single byte (because the value is small) but who knows what other AML parsers might do.
Something simple like (copy typed from test machine..)
Aml *aml_word(const
uint16_tval){ Aml *var = aml_alloc(); build_append_byte(var->buf, 0x0B); build_append_int_noprefix(var->buf, val, 2); return var; }and one blob in
acpi/cxl.cbecomesifctx2 = aml_if(aml_equal(function, aml_int(1))); { Aml *pak, *pac1; pak1 = aml_package(1) aml_append(pak1, aml_word(0)); pak = aml_package(2); aml_append(pack, aml_word(0x1)); aml_append(pak, pak1); aml_append(ifctx2, aml_return(pak)); } aml_append(ifctx, ifctx2);...
}Give something like
If ((Arg2 == One)){ Return (Package (0x02) { 0x0001, Package (0x01) { 0x0000 } }) }
Quoted 7 lines
Binary encoding then clearly uses packages of words.
12 0b 02 0b 01 00 12 05 01 0b 00 00 PkgOp len elements word 0x0001 pkgOp len elements word 0x0000(note I cheated an added a marker in one of the values and didn't decode the whole thing by hand ;)
We could. But I suspect it's a spec bug and they really just meant "an integer in the range 0x0 to 0xffff, encoded in any legal way".
Quoted 41 lines
Quoted 36 lines
Quoted 15 lines
Quoted 15 lines
hw/acpi/cxl.c line 77
Quoted 9 lines
hw/acpi/cxl.c +5
-0+*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list));It does not look like this patch compiles.
So how did you test it?
Quoted 8 lines
Quoted 6 lines
Please do not post untested patches.
If you do at least minimal testing
you would also see failures in bios table test
and would follow the procedure described there to
post it.Sorry about that. I compiled successfully but did not test.
I don't see how it can compile either. In fact I just applied and build fails.
Quoted 1 line
The following chunk is tested. However, is it the correct way to do this? The comment is direct spec verbiage. I'm not familiar with constructing ACPI tables in QEMU and tried my best by looking at other ACPI code in QEMU.
To do what? create a buffer with a two byte word?
For example:word = aml_buffer(0, NULL); build_append_int_noprefix(word->buf, 2, 0x1);Quoted 4 lines
but again it is not clear at all what does spec mean. an integer up to
0xfffff? a buffer as you did? just two bytes?could be any of these.
Quoted 7 lines
The best we have in the way of description is the multiple QTG example where it's
Package(){2, 1} combined with it being made up of WORDswhereas in general that will get squashed to a pair of bytes... So I'm thinking WORDs is max size rather than only size but given ambiguity we should encode them as words anyway.
But why, is it suddenly important to be compatible with lots of drivers? These are just dummy values after all.
If the point is for driver development then I would say just use aml_int, this will test support for One and Zero opcodes :)
Quoted 9 lines
Note this breaks Dave's current kernel proposal which is assuming a buffer...
https://lore.kernel.org/all/168695172301.3031571.9812118774299137032.stgit@djiang5-mobl3/Hohum. Dave, can you sanity check with the appropriate SSWG person (MN IIRC) I can do it you'd prefer - just let me know.
Jonathan
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
Quoted 168 lines · On Sat, 7 Oct 2023 17:17:44 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 167 lines · Jonathan Cameron
Quoted 163 lines · On Thu, 5 Oct 2023 12:32:11 -0400 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 161 lines · Dave Jiang
Quoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Dave Jiang
Add a simple
_DSMcall support for the ACPI0017 device to return a fake QTG ID value of 0 in all cases. The enabling is for_DSMplumbing testing from the OS.the enabling -> this
will update
Quoted 5 lines
Quoted 3 lines
Following edited for readbility only
readbility only -> readability
will update
Quoted 62 lines
Quoted 62 lines
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { Buffer (0x02) { 0x01, 0x00 }, Package (0x01) { Buffer (0x02) { 0x00, 0x00 } } }) } } }Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/acpi/cxl.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 57 insertions(+)hw/acpi/cxl.c +0
-0@@ -30,6 +30,61 @@#include "qapi/error.h" #include "qemu/uuid.h" Quoted 16 lines
hw/acpi/cxl.c
Quoted 11 lines
hw/acpi/cxl.c +11
-0+void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 * drop this * please
Quoted 1 line
, QTG ID
_DSMOoops. git format-patch mangled this and I didn't catch. Will fix
Quoted 14 lines
this is not the name of this paragraph. pls make it match exactly so people can search
hw/acpi/cxl.c line 50
Quoted 8 lines
*/
hw/acpi/cxl.c +7
-0+ ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* functions 1 only */ Quoted 1 line
function 1?
Yes, will fix
Quoted 14 lines
hw/acpi/cxl.c line 61
Quoted 12 lines
hw/acpi/cxl.c +11
-0+ +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* A return value of {1, {0}} indicates that +* max supported QTG ID of 1 and recommended QTG is 0. +* The values here are faked to simplify emulation. again pls quote spec directly do not paraphrase
Here it's not paraphrasing from the spec. I'm just describing the dummy value that will be provided.
Quoted 16 lines
hw/acpi/cxl.c line 72
Quoted 13 lines
hw/acpi/cxl.c +9
-0+*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +uint16_t word_list =cpu_to_le16 (1 ); +uint16_t word_list2 =0 ; +Aml *pak, *pak1; + +/* +* The return package is a package of a WORD and another package.
hw/acpi/cxl.c +2
-0+* The embedded package contains 0 or more WORDs for the +* recommended QTG IDs. Quoted 1 line
pls quote the spec directly
Will do.
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
Quoted 7 lines
Quoted 3 lines
WORD does seem to be clearly defined in the ACPI spec as uint16 and as this is describing a DSDT blob I think we can safe that it means that. Also lines up with the fixed sizes in CEDT.
Binary blobs are not really legal as return values of AML though. What this patch was doing was a buffer. An alternative interpretation would be an integer. Or something else yet ...
Yes. On taking another look, what was here definitely seems wrong.
Quoted 35 lines
Quoted 16 lines
Quoted 5 lines
It's not clear buffer is actually word though.
Jonathan do you have hardware access?
No. +CC linux-cxl to see if anyone else has hardware + BIOS with QTG implemented... There will be lots of implementations soon so I'd make not guarantee they will all interpret this the same.
Aim here is Linux kernel enablement support, and unfortunately that almost always means we are ahead of easy availability of hardware. If it exists its probably prototypes in a lab, in which case no guarantees on the BIOS tables presented...
Quoted 1 line
Quoted 3 lines
Quoted 1 line
Also, possible to get clarification from the spec committee?
I'm unclear what we are clarifying.
Let me clarify, below.
Quoted 6 lines
As I read it current implementation
is indeed wrong and I failed to notice this earlier :(Ultimately data encoding (ACPI 6.5 section 20.2..3 Data Objects Encoding) should I think be
Quoted 6 lines
0x0B0x000x00
WordPrefix then data : note if you try a0x0001and feed
it to iasl it will squash it into a byte instead and indeed if you force the binary to the above it will decode it as0x0000but recompile that and you will be back to just0x00(as bytes don't need a prefix..)
Quoted 6 lines
Exactly. So this is the clarification we seek. ACPI spec does mention WordPrefix however only as one of the
ways to encode an integer, as part of ComputationalData, never directly. If CXL requires it to be WordPrefix then qemu can do it but tools such as IASL will need to be taught a way to force using WordPrefix.
Agreed.
Quoted 64 lines
Quoted 64 lines
Currently it would be.
0x110x050x0a0x020x000x01
BufferOpBtw I built a minimal DSDT file to test this and iasl isn't happy with the fact the
_DSMdoesn't return anything at all if ARG2 isn't 1 or 2. Whilst that's imdef territory as not covered by the CXL spec, we should return 'something' ;)Anyhow, to do this as per the CXL spec we need an
aml_word()that just implements the word case fromaml_int()Chance are that it never matters if we get an ecoding that is only single byte (because the value is small) but who knows what other AML parsers might do.
Something simple like (copy typed from test machine..)
Aml *aml_word(const
uint16_tval){ Aml *var = aml_alloc(); build_append_byte(var->buf, 0x0B); build_append_int_noprefix(var->buf, val, 2); return var; }and one blob in
acpi/cxl.cbecomesifctx2 = aml_if(aml_equal(function, aml_int(1))); { Aml *pak, *pac1; pak1 = aml_package(1) aml_append(pak1, aml_word(0)); pak = aml_package(2); aml_append(pack, aml_word(0x1)); aml_append(pak, pak1); aml_append(ifctx2, aml_return(pak)); } aml_append(ifctx, ifctx2);...
}Give something like
If ((Arg2 == One)){ Return (Package (0x02) { 0x0001, Package (0x01) { 0x0000 } }) }Binary encoding then clearly uses packages of words.
Quoted 8 lines
Quoted 5 lines
12 0b 02 0b 01 00 12 05 01 0b 00 00 PkgOp len elements word 0x0001 pkgOp len elements word 0x0000(note I cheated an added a marker in one of the values and didn't decode the whole thing by hand ;)
We could. But I suspect it's a spec bug and they really just meant "an integer in the range
0x0to0xffff, encoded in any legal way".
I suspect you are correct. We all love filing errata docs.. *sigh* Hopefully Dave will do it ;)
Quoted 47 lines
Quoted 47 lines
Quoted 38 lines
Quoted 17 lines
Quoted 17 lines
hw/acpi/cxl.c line 77
Quoted 11 lines
hw/acpi/cxl.c +5
-0+*/ + pak1 =aml_package (1 ); +aml_append (pak1,aml_buffer (sizeof (uint16_t ), word_list2)); + pak =aml_package (2 ); +aml_append (pak,aml_buffer (sizeof (uint16_t ), word_list));It does not look like this patch compiles.
So how did you test it?
Quoted 8 lines
Quoted 6 lines
Please do not post untested patches.
If you do at least minimal testing
you would also see failures in bios table test
and would follow the procedure described there to
post it.Sorry about that. I compiled successfully but did not test.
I don't see how it can compile either. In fact I just applied and build fails.
Quoted 1 line
The following chunk is tested. However, is it the correct way to do this? The comment is direct spec verbiage. I'm not familiar with constructing ACPI tables in QEMU and tried my best by looking at other ACPI code in QEMU.
To do what? create a buffer with a two byte word?
For example:word = aml_buffer(0, NULL); build_append_int_noprefix(word->buf, 2, 0x1);Quoted 4 lines
but again it is not clear at all what does spec mean. an integer up to
0xfffff? a buffer as you did? just two bytes?could be any of these.
The best we have in the way of description is the multiple QTG example where it's
Package(){2, 1} combined with it being made up of WORDs
Quoted 8 lines
Quoted 3 lines
whereas in general that will get squashed to a pair of bytes... So I'm thinking WORDs is max size rather than only size but given ambiguity we should encode them as words anyway.
But why, is it suddenly important to be compatible with lots of drivers? These are just dummy values after all.
If the point is for driver development then I would say just useaml_int, this will test support for One and Zero opcodes :)
Works for me ;)
Quoted 12 lines
Quoted 10 lines
Note this breaks Dave's current kernel proposal which is assuming a buffer...
https://lore.kernel.org/all/168695172301.3031571.9812118774299137032.stgit@djiang5-mobl3/Hohum. Dave, can you sanity check with the appropriate SSWG person (MN IIRC) I can do it you'd prefer - just let me know.
Jonathan
Re: [PATCH v3] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Dan WilliamsQuoted 9 lines · On Fri, 6 Oct 2023 10:50:28 -0700 Dan Williams <[email protected]> wrote:
Jonathan Cameron wrote:
[..]Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
what does "a WORD" mean is unclear - do you match what hardware does when you use
aml_buffer? pls mention this in commit log, and show actual hardware dump for comparison.The CXL spec says WORD without much qualification. It's a 16bit value AFAICT. I'll add additional comment. Currently I do not have access to actual hardware unfortunately. I'm constructing this purely based on spec description.
Quoted 6 lines
Quoted 3 lines
WORD does seem to be clearly defined in the ACPI spec as uint16 and as this is describing a DSDT blob I think we can safe that it means that. Also lines up with the fixed sizes in CEDT.
I am not sure it means that, the ACPI specification indicates that packages can hold "integers" and integers can be any size up to 64-bits.
I agree that intent might be more general than an AML WORD but was being paranoid on the basis using one was definitely never wrong ;)
Quoted 20 lines
Quoted 5 lines
Quoted 4 lines
It's not clear buffer is actually word though.
Jonathan do you have hardware access?
Quoted 8 lines
No. +CC linux-cxl to see if anyone else has hardware + BIOS with QTG implemented... There will be lots of implementations soon so I'd make not guarantee they will all interpret this the same.
Aim here is Linux kernel enablement support, and unfortunately that almost always means we are ahead of easy availability of hardware. If it exists its probably prototypes in a lab, in which case no guarantees on the BIOS tables presented...
From a pre-production system the ASL is putting the result of SizeOf directly into the first element in the return package:
Local1 = SizeOf (CXQI) Local0 [0x00] = Local1
Quoted 7 lines
...where CXQI appears to be a fixed table of QTG ids for the platform, and
SizeOf()returns an integer type with no restriction that it be a 16-bit value.So I think the specification is misleading by specifying WORD when ACPI "Package" objects convey "Integers" where the size of the integer can be a u8 to a u64.
Good, that's simpler.
Quoted 31 lines
Quoted 20 lines
Quoted 2 lines
Also, possible to get clarification from the spec committee?
I'm unclear what we are clarifying. As I read it current implementation is indeed wrong and I failed to notice this earlier :(
Ultimately data encoding (ACPI 6.5 section 20.2..3 Data Objects Encoding) should I think be
0x0B0x000x00
WordPrefix then data : note if you try a0x0001and feed
it to iasl it will squash it into a byte instead and indeed if you force the binary to the above it will decode it as0x0000but recompile that and you will be back to just0x00(as bytes don't need a prefix..)Currently it would be.
0x110x050x0a0x020x000x01
BufferOpQuoted 7 lines
Btw I built a minimal DSDT file to test this and iasl isn't happy with the fact the
_DSMdoesn't return anything at all if ARG2 isn't 1 or 2. Whilst that's imdef territory as not covered by the CXL spec, we should return 'something' ;)Anyhow, to do this as per the CXL spec we need an
aml_word()that just implements the word case fromaml_int()If I understand correctly,
aml_int()is sufficient since this is not aField()where access size matters.
Quoted 8 lines
Quoted 3 lines
Chance are that it never matters if we get an ecoding that is only single byte (because the value is small) but who knows what other AML parsers might do.
I expect the reason WORD is used in the specification is because of the size of the QTG ID field in the CFMWS. ACPI could support returning more than
USHRT_MAXin an Integer field in a Package, but those IDs aboveUSHRT_MAXcould not be represented in CFMWS.
Agreed that's probably the cause and if anyone does use an AML WORD by forcing the prefix, it does no harm for software stacks that assume INTEGER.
Quoted 15 lines
[..]
Quoted 5 lines
Quoted 4 lines
but again it is not clear at all what does spec mean. an integer up to
0xfffff? a buffer as you did? just two bytes?could be any of these.
Quoted 7 lines
The best we have in the way of description is the multiple QTG example where it's
Package(){2, 1} combined with it being made up of WORDswhereas in general that will get squashed to a pair of bytes... So I'm thinking WORDs is max size rather than only size but given ambiguity we should encode them as words anyway.
Quoted 6 lines
My assertion is that for the Package format the size of the integer does not matter because the Package.Integer type can convey up to 64-bit values. For being compatible with the *usage* of that max id, values that do not fit into 16-bits are out of spec, but nothing prevents the Package from using any size integer, afaics.
Works for me, though we should do the leg work to get the spec tweaked to clarify this..
Jonathan
Re: [PATCH v4] hw/cxl: Add QTG _DSM support for ACPI0017 device
In reply to Dave JiangQuoted 33 lines · On Fri, 06 Oct 2023 15:15:56 -0700 Dave Jiang <[email protected]> wrote:
Add a simple
_DSMcall support for the ACPI0017 device to return fake QTG ID values of 0 and 1 in all cases. This for_DSMplumbing testing from the OS.Following edited for readability
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { One, Package (0x02) { Zero, One } }) } } }
Quoted 4 lines
Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
You've picked up my bad habit / typo. Needs to be --- to stop git picking up this text...
Quoted 11 lines
v4: Change to package of ints rather than buffers. Also moved to 2 QTG IDs to improve kernel side testing. Tested on x86 qemu guest against kernel QTG ID
_DSMparsing code to be upstreamed.v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.
Quoted 4 lines
v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
Given it's changed in significant way should drop these.
Anyhow, the tests also need updating. I can do that and push out a v5 with tests as well once I've tested.
I'm assuming need tweaked kernel code to test?
Quoted 111 lines
--- hw/acpi/cxl.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 71 insertions(+)hw/acpi/cxl.c +69
-0@@ -30,6 +30,75 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 _DSM Function for Retrieving QTG ID */ + ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* function 1 only */ + +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* Creating a package with static values. The max supported QTG ID will +* be 1 and recommended QTG IDs are 0 and then 1. +* The values here are statically created to simplify emulation. Values +* from a real BIOS would be determined by the performance of all the +* present CXL memory and then assigned. +*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +Aml *pak, *pak1; + +/* +* Return: A package containing two elements - a WORD that returns +* the maximum throttling group that the platform supports, and a +* package containing the QTG ID(s) that the platform recommends. +* Package { +* Max Supported QTG ID +* Package {QTG Recommendations} +* } +* +* While the SPEC specified WORD that hints at the value being +* 16bit, the ACPI dump of BIOS DSDT table showed that the values +* are integers with no specific size specification. aml_int() will +* be used for the values. +*/ + pak1 =aml_package (2 ); +/* Set QTG ID of 0 */ +aml_append (pak1,aml_int (0 )); +/* Set QTG ID of 1 */ +aml_append (pak1,aml_int (1 )); + + pak =aml_package (2 ); +/* Set Max QTG 1 */ +aml_append (pak,aml_int (1 )); +aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);hw/i386/acpi-build.c +1
-0@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif
Re: [PATCH v4] hw/cxl: Add QTG _DSM support for ACPI0017 device
Quoted 36 lines · Jonathan Cameron
Quoted 33 lines · On Fri, 06 Oct 2023 15:15:56 -0700 Dave Jiang <[email protected]> wrote:
Add a simple
_DSMcall support for the ACPI0017 device to return fake QTG ID values of 0 and 1 in all cases. This for_DSMplumbing testing from the OS.Following edited for readability
Device (CXLM)
{ Name (_HID, "ACPI0017") // _HID: Hardware ID ... Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { If ((Arg0 == ToUUID ("f365f9a6-a7de-4071-a66a-b40c0b4f8e52"))) { If ((Arg2 == Zero)) { Return (Buffer (One) { 0x01 }) } If ((Arg2 == One)) { Return (Package (0x02) { One, Package (0x02) { Zero, One } }) } } }
Quoted 7 lines
Quoted 4 lines
Signed-off-by Dave Jiang <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>--
You've picked up my bad habit / typo. Needs to be --- to stop git picking up this text...
I preserved what was in the original post. I wasn't sure if Michael had it like that on purpose or if it was a typo.
Quoted 12 lines
Quoted 12 lines
v4: Change to package of ints rather than buffers. Also moved to 2 QTG IDs to improve kernel side testing. Tested on x86 qemu guest against kernel QTG ID
_DSMparsing code to be upstreamed.v3: Fix output assignment to be BE host friendly. Fix typo in comment. According to the CXL spec, the DSM output should be 1 WORD to indicate the max suppoted QTG ID and a package of 0 or more WORDs for the QTG IDs. In this dummy impementation, we have first WORD with a 1 to indcate max supprted QTG ID of 1. And second WORD in a package to indicate the QTG ID of 0.
Quoted 5 lines
Quoted 4 lines
v2: Minor edit to drop reference to switches in patch description.
Message-Id: <[email protected]>Reviewed-by Michael S. Tsirkin <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>Given it's changed in significant way should drop these.
Sure. I just whole sale preserved what was there as revision history.
Quoted 5 lines
Anyhow, the tests also need updating. I can do that and push out a v5 with tests as well once I've tested.
I'm assuming need tweaked kernel code to test?
There may be some additional changes Dan wanted function input parameter wise. So there will be a v10. But here are the changes to use ints and fixing the input as well. Tested against the changes in qemu and looks to be working as expected. The inputs actually looks like below now:
+ [0].integer = { ACPI_TYPE_INTEGER, input->rd_lat },
+ [1].integer = { ACPI_TYPE_INTEGER, input->wr_lat },
+ [2].integer = { ACPI_TYPE_INTEGER, input->rd_bw },
+ [3].integer = { ACPI_TYPE_INTEGER, input->wr_bw },Quoted 113 lines
Quoted 112 lines
--- hw/acpi/cxl.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/acpi-build.c | 1 + include/hw/acpi/cxl.h | 1 + 3 files changed, 71 insertions(+)hw/acpi/cxl.c +69
-0@@ -30,6 +30,75 @@#include "qapi/error.h" #include "qemu/uuid.h" +void build_cxl_dsm_method (Aml *dev) +{ +Aml *method, *ifctx, *ifctx2; + + method =aml_method ("_DSM" ,4 ,AML_SERIALIZED ); + { +Aml *function, *uuid; + + uuid =aml_arg (0 ); + function =aml_arg (2 ); +/* CXL spec v3.0 9.17.3.1 _DSM Function for Retrieving QTG ID */ + ifctx =aml_if (aml_equal ( + uuid,aml_touuid ("F365F9A6-A7DE-4071-A66A-B40C0B4F8E52" ))); + +/* Function 0, standard DSM query function */ + ifctx2 =aml_if (aml_equal (function,aml_int (0 ))); + { +uint8_t byte_list[1 ] = {0x01 };/* function 1 only */ + +aml_append (ifctx2, +aml_return (aml_buffer (sizeof (byte_list), byte_list))); + } +aml_append (ifctx, ifctx2); + +/* +* Function 1 +* Creating a package with static values. The max supported QTG ID will +* be 1 and recommended QTG IDs are 0 and then 1. +* The values here are statically created to simplify emulation. Values +* from a real BIOS would be determined by the performance of all the +* present CXL memory and then assigned. +*/ + ifctx2 =aml_if (aml_equal (function,aml_int (1 ))); + { +Aml *pak, *pak1; + +/* +* Return: A package containing two elements - a WORD that returns +* the maximum throttling group that the platform supports, and a +* package containing the QTG ID(s) that the platform recommends. +* Package { +* Max Supported QTG ID +* Package {QTG Recommendations} +* } +* +* While the SPEC specified WORD that hints at the value being +* 16bit, the ACPI dump of BIOS DSDT table showed that the values +* are integers with no specific size specification. aml_int() will +* be used for the values. +*/ + pak1 =aml_package (2 ); +/* Set QTG ID of 0 */ +aml_append (pak1,aml_int (0 )); +/* Set QTG ID of 1 */ +aml_append (pak1,aml_int (1 )); + + pak =aml_package (2 ); +/* Set Max QTG 1 */ +aml_append (pak,aml_int (1 )); +aml_append (pak, pak1); + +aml_append (ifctx2,aml_return (pak)); + } +aml_append (ifctx, ifctx2); + } +aml_append (method, ifctx); +aml_append (dev, method); +} +static void cedt_build_chbs (GArray *table_data,PXBCXLDev *cxl) {PXBDev *pxb =PXB_DEV (cxl);hw/i386/acpi-build.c +1
-0@@ -1422,6 +1422,7 @@ static void build_acpi0017(Aml *table) method =aml_method ("_STA" ,0 ,AML_NOTSERIALIZED );aml_append (method,aml_return (aml_int (0x01 )));aml_append (dev, method); +build_cxl_dsm_method (dev);aml_append (scope, dev);aml_append (table, scope);include/hw/acpi/cxl.h +1
-0@@ -25,5 +25,6 @@ void cxl_build_cedt(GArray *table_offsets, GArray *table_data, BIOSLinker *linker, const char *oem_id, const char *oem_table_id, CXLState *cxl_state);void build_cxl_osc_method (Aml *dev); +void build_cxl_dsm_method (Aml *dev);#endif