Re: [PATCH v8 16/17] linux-user: Do not adjust zero_bss for host page size

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Rely on target_mmap to handle guest vs host page size mismatch. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

[PATCH 0/2] Fix vhost reconnect issues

2023-08-03 Thread Li Feng
The patchset fixes the regression issue of vhost reconnect. It's a serious bug that the vhost-user will lose the reconnect forever. The 2nd patch enhances the error handle of vhost-user-scsi. This patchset's parent commit is:

[PATCH 2/2] vhost: Add Error parameter to vhost_scsi_common_start()

2023-08-03 Thread Li Feng
Add a Error parameter to report the real error, like vhost-user-blk. Signed-off-by: Li Feng --- hw/scsi/vhost-scsi-common.c | 17 ++--- hw/scsi/vhost-scsi.c | 5 +++-- hw/scsi/vhost-user-scsi.c | 14 --

[PATCH 1/2] vhost-user: fix lost reconnect

2023-08-03 Thread Li Feng
When the vhost-user is reconnecting to the backend, and if the vhost-user fails at the get_features in vhost_dev_init(), then the reconnect will fail and it will not be retriggered forever. The reason is: When the vhost-user fail at get_features, the vhost_dev_cleanup will be called immediately.

Re: [PATCH v8 15/17] linux-user: Do not adjust image mapping for host page size

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Remove TARGET_ELF_EXEC_PAGESIZE, and 3 other TARGET_ELF_PAGE* macros based off of that. Rely on target_mmap to handle guest vs host page size mismatch. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 14/17] linux-user: Properly set image_info.brk in flatload

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: The heap starts at "brk" not "start_brk". With this fixed, image_info.start_brk is unused and may be removed. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 13/17] linux-user: Adjust initial brk when interpreter is close to executable

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: From: Helge Deller While we attempt to load a ET_DYN executable far away from TASK_UNMAPPED_BASE, we are not completely in control of the address space layout. If the interpreter lands close to the executable, leaving insufficient heap space, move

Re: [PATCH v8 12/17] linux-user: Use elf_et_dyn_base for ET_DYN with interpreter

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Follow the lead of the linux kernel in fs/binfmt_elf.c, in which an ET_DYN executable which uses an interpreter (usually a PIE executable) is loaded away from where the interpreter itself will be loaded. Signed-off-by: Richard Henderson

Re: [PATCH v8 11/17] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Use this as extra protection for the guest mapping over any qemu host mappings. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 10/17] linux-user: Define ELF_ET_DYN_BASE in $guest/target_mman.h

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Copy each guest kernel's default value, then bound it against reserved_va or the host address space. Signed-off-by: Richard Henderson --- linux-user/aarch64/target_mman.h | 3 +++ linux-user/alpha/target_mman.h | 3 +++

Re: [PATCH v8 09/17] linux-user: Define TASK_UNMAPPED_BASE in $guest/target_mman.h

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Provide default values that are as close as possible to the values used by the guest's kernel. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 08/17] linux-user: Adjust task_unmapped_base for reserved_va

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Ensure that the chosen values for mmap_next_start and task_unmapped_base are within the guest address space. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 07/17] linux-user: Remove last_brk

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: This variable is unused. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PULL 14/22] vhost: fix the fd leak

2023-08-03 Thread Michael Tokarev
04.08.2023 07:36, Michael Tokarev wrote: This smells like a stable-8.0 material. Please let me know if it is not. Ah, it is, Cc'd -stable already. N/m, picked this one up. /mjt

Re: [PULL 13/22] pci: do not respond config requests after PCI device eject

2023-08-03 Thread Michael Tokarev
04.08.2023 01:21, Michael S. Tsirkin wrote: From: Yuri Benditovich Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2224964 In migration with VF failover, Windows guest and ACPI hot unplug we do not need to satisfy config requests, otherwise the guest immediately detects the device and

Re: [PULL 14/22] vhost: fix the fd leak

2023-08-03 Thread Michael Tokarev
04.08.2023 01:21, Michael S. Tsirkin wrote: From: Li Feng When the vhost-user reconnect to the backend, the notifer should be cleanup. Otherwise, the fd resource will be exhausted. Fixes: f9a09ca3ea ("vhost: add support for configure interrupt") Signed-off-by: Li Feng Reviewed-by: Raphael

Re: [PULL 22/22] cryptodev: Handle unexpected request to avoid crash

2023-08-03 Thread Michael Tokarev
04.08.2023 01:21, Michael S. Tsirkin wrote: From: zhenwei pi Generally guest side should discover which services the device is able to offer, then do requests on device. However it's also possible to break this rule in a guest. Handle unexpected request here to avoid NULL pointer dereference.

Re: [PULL 0/1] Hppa linux user speedup patches

2023-08-03 Thread Richard Henderson
On 8/3/23 15:35, Helge Deller wrote: The following changes since commit 9ba37026fcf6b7f3f096c0cca3e1e7307802486b: Update version for v8.1.0-rc2 release (2023-08-02 08:22:45 -0700) are available in the Git repository at: https://github.com/hdeller/qemu-hppa.git

Re: [PULL 00/22] pc,pci,virtio,crypto: bugfixes

2023-08-03 Thread Richard Henderson
On 8/3/23 15:20, Michael S. Tsirkin wrote: The following changes since commit c167c80b463768e04a22fbe37ba6c53a4a08e41e: Merge tag 'pull-request-2023-08-03' ofhttps://gitlab.com/thuth/qemu into staging (2023-08-03 07:37:17 -0700) are available in the Git repository at:

[PATCH v8 14/17] linux-user: Properly set image_info.brk in flatload

2023-08-03 Thread Richard Henderson
The heap starts at "brk" not "start_brk". With this fixed, image_info.start_brk is unused and may be removed. Signed-off-by: Richard Henderson --- linux-user/qemu.h | 1 - linux-user/flatload.c | 2 +- linux-user/main.c | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff

[PATCH v8 12/17] linux-user: Use elf_et_dyn_base for ET_DYN with interpreter

2023-08-03 Thread Richard Henderson
Follow the lead of the linux kernel in fs/binfmt_elf.c, in which an ET_DYN executable which uses an interpreter (usually a PIE executable) is loaded away from where the interpreter itself will be loaded. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 27 +--

[PATCH v8 11/17] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-03 Thread Richard Henderson
Use this as extra protection for the guest mapping over any qemu host mappings. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 2aee2298ec..0c64aad8a5 100644

Re: [PULL for-8.1 0/2] Block patches

2023-08-03 Thread Richard Henderson
On 8/3/23 08:55, Stefan Hajnoczi wrote: The following changes since commit 9ba37026fcf6b7f3f096c0cca3e1e7307802486b: Update version for v8.1.0-rc2 release (2023-08-02 08:22:45 -0700) are available in the Git repository at: https://gitlab.com/stefanha/qemu.git tags/block-pull-request

[PATCH v8 07/17] linux-user: Remove last_brk

2023-08-03 Thread Richard Henderson
This variable is unused. Signed-off-by: Richard Henderson --- linux-user/user-mmap.h | 1 - linux-user/mmap.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/linux-user/user-mmap.h b/linux-user/user-mmap.h index 3fc986f92f..7265c2c116 100644 --- a/linux-user/user-mmap.h +++

[PATCH v8 05/17] linux-user: Do nothing if too small brk is specified

2023-08-03 Thread Richard Henderson
From: Akihiko Odaki Linux 6.4.7 does nothing when a value smaller than the initial brk is specified. Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Reviewed-by: Helge Deller Signed-off-by: Akihiko Odaki Message-Id: <20230802071754.14876-6-akihiko.od...@daynix.com> Signed-off-by:

[PATCH v8 09/17] linux-user: Define TASK_UNMAPPED_BASE in $guest/target_mman.h

2023-08-03 Thread Richard Henderson
Provide default values that are as close as possible to the values used by the guest's kernel. Signed-off-by: Richard Henderson --- linux-user/aarch64/target_mman.h | 10 ++ linux-user/alpha/target_mman.h | 8 linux-user/arm/target_mman.h | 8

[PATCH v8 08/17] linux-user: Adjust task_unmapped_base for reserved_va

2023-08-03 Thread Richard Henderson
Ensure that the chosen values for mmap_next_start and task_unmapped_base are within the guest address space. Signed-off-by: Richard Henderson --- linux-user/user-mmap.h | 18 +- linux-user/main.c | 18 ++ linux-user/mmap.c | 18 +++--- 3

[PATCH v8 15/17] linux-user: Do not adjust image mapping for host page size

2023-08-03 Thread Richard Henderson
Remove TARGET_ELF_EXEC_PAGESIZE, and 3 other TARGET_ELF_PAGE* macros based off of that. Rely on target_mmap to handle guest vs host page size mismatch. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git

[PATCH v8 03/17] linux-user: Do not call get_errno() in do_brk()

2023-08-03 Thread Richard Henderson
From: Akihiko Odaki Later the returned value is compared with -1, and negated errno is not expected. Fixes: 00faf08c95 ("linux-user: Don't use MAP_FIXED in do_brk()") Reviewed-by: Helge Deller Signed-off-by: Akihiko Odaki Message-Id: <20230802071754.14876-4-akihiko.od...@daynix.com>

[PATCH v8 01/17] linux-user: Unset MAP_FIXED_NOREPLACE for host

2023-08-03 Thread Richard Henderson
From: Akihiko Odaki Passing MAP_FIXED_NOREPLACE to host will fail for reserved_va because the address space is reserved with mmap. Replace it with MAP_FIXED in that case. Signed-off-by: Akihiko Odaki Message-Id: <20230802071754.14876-2-akihiko.od...@daynix.com> [rth: Expand inline

[PATCH v8 06/17] linux-user: Do not align brk with host page size

2023-08-03 Thread Richard Henderson
From: Akihiko Odaki do_brk() minimizes calls into target_mmap() by aligning the address with host page size, which is potentially larger than the target page size. However, the current implementation of this optimization has two bugs: - The start of brk is rounded up with the host page size

[PATCH v8 04/17] linux-user: Use MAP_FIXED_NOREPLACE for do_brk()

2023-08-03 Thread Richard Henderson
From: Akihiko Odaki MAP_FIXED_NOREPLACE can ensure the mapped address is fixed without concerning that the new mapping overwrites something else. Signed-off-by: Akihiko Odaki Message-Id: <20230802071754.14876-5-akihiko.od...@daynix.com> [rth: Pass -1 as fd for MAP_ANON] Signed-off-by: Richard

[PATCH v8 17/17] linux-user: Use zero_bss for PT_LOAD with no file contents too

2023-08-03 Thread Richard Henderson
If p_filesz == 0, then vaddr_ef == vaddr. We can reuse the code in zero_bss rather than incompletely duplicating it in load_elf_image. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 27 +++ 1 file changed, 7 insertions(+), 20 deletions(-) diff --git

[PATCH v8 16/17] linux-user: Do not adjust zero_bss for host page size

2023-08-03 Thread Richard Henderson
Rely on target_mmap to handle guest vs host page size mismatch. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 54 +++- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index

[PATCH for-8.1 v8 00/17] linux-user: brk fixes

2023-08-03 Thread Richard Henderson
Changes for v8: * Remove adjustments to the image mapping for host page size. Instead, rely on target_mmap to do its job in that respect. This was the root cause of the 64k host page size issues. Please review. r~ Akihiko Odaki (6): linux-user: Unset MAP_FIXED_NOREPLACE for host

[PATCH v8 02/17] linux-user: Fix MAP_FIXED_NOREPLACE on old kernels

2023-08-03 Thread Richard Henderson
From: Akihiko Odaki The man page states: > Note that older kernels which do not recognize the MAP_FIXED_NOREPLACE > flag will typically (upon detecting a collision with a preexisting > mapping) fall back to a “non-MAP_FIXED” type of behavior: they will > return an address that is different from

[PATCH v8 13/17] linux-user: Adjust initial brk when interpreter is close to executable

2023-08-03 Thread Richard Henderson
From: Helge Deller While we attempt to load a ET_DYN executable far away from TASK_UNMAPPED_BASE, we are not completely in control of the address space layout. If the interpreter lands close to the executable, leaving insufficient heap space, move brk. Signed-off-by: Helge Deller [rth:

[PATCH v8 10/17] linux-user: Define ELF_ET_DYN_BASE in $guest/target_mman.h

2023-08-03 Thread Richard Henderson
Copy each guest kernel's default value, then bound it against reserved_va or the host address space. Signed-off-by: Richard Henderson --- linux-user/aarch64/target_mman.h | 3 +++ linux-user/alpha/target_mman.h | 3 +++ linux-user/arm/target_mman.h | 3 +++

[PATCH v3 1/9] virtio: Add shared memory capability

2023-08-03 Thread Gurchetan Singh
From: "Dr. David Alan Gilbert" Define a new capability type 'VIRTIO_PCI_CAP_SHARED_MEMORY_CFG' to allow defining shared memory regions with sizes and offsets of 2^32 and more. Multiple instances of the capability are allowed and distinguished by a device-specific 'id'. Signed-off-by: Dr. David

[PATCH v3 7/9] gfxstream + rutabaga: meson support

2023-08-03 Thread Gurchetan Singh
From: Gurchetan Singh - Add meson detection of rutabaga_gfx - Build virtio-gpu-rutabaga.c + associated vga/pci files when present Signed-off-by: Gurchetan Singh --- v3: Fix alignment issues (Akihiko) hw/display/meson.build| 22 ++ meson.build |

[PATCH v3 8/9] gfxstream + rutabaga: enable rutabaga

2023-08-03 Thread Gurchetan Singh
From: Gurchetan Singh This change enables rutabaga to receive virtio-gpu-3d hypercalls when it is active. Signed-off-by: Gurchetan Singh --- v3: Whitespace fix (Akihiko) hw/display/virtio-gpu-base.c | 3 ++- hw/display/virtio-gpu.c | 5 +++-- softmmu/qdev-monitor.c | 3 +++

[PATCH v3 5/9] gfxstream + rutabaga prep: added need defintions, fields, and options

2023-08-03 Thread Gurchetan Singh
From: Gurchetan Singh This modifies the common virtio-gpu.h file have the fields and defintions needed by gfxstream/rutabaga, by VirtioGpuRutabaga. The command to run these would be: -device virtio-vga-rutabaga,capset_names=gfxstream-vulkan:cross-domain, \

[PATCH v3 6/9] gfxstream + rutabaga: add initial support for gfxstream

2023-08-03 Thread Gurchetan Singh
From: Gurchetan Singh This adds initial support for gfxstream and cross-domain. Both features rely on virtio-gpu blob resources and context types, which are also implemented in this patch. gfxstream has a long and illustrious history in Android graphics paravirtualization. It has been

[PATCH v3 9/9] docs/system: add basic virtio-gpu documentation

2023-08-03 Thread Gurchetan Singh
From: Gurchetan Singh This adds basic documentation for virtio-gpu. Suggested-by: Akihiko Odaki Signed-off-by: Gurchetan Singh --- v2: - Incorporated suggestions by Akihiko Odaki - Listed the currently supported capset_names (Bernard) v3: - Incorporated suggestions by Akihiko Odaki and

[PATCH v3 4/9] virtio-gpu: blob prep

2023-08-03 Thread Gurchetan Singh
From: Antonio Caggiano This adds preparatory functions needed to: - decode blob cmds - tracking iovecs Signed-off-by: Antonio Caggiano Signed-off-by: Dmitry Osipenko Signed-off-by: Gurchetan Singh --- hw/display/virtio-gpu.c | 11 +++

[PATCH v3 0/9] gfxstream + rutabaga_gfx

2023-08-03 Thread Gurchetan Singh
Prior versions: https://lists.gnu.org/archive/html/qemu-devel/2023-07/msg05801.html https://lists.gnu.org/archive/html/qemu-devel/2023-07/msg02341.html https://patchew.org/QEMU/20230421011223.718-1-gurchetansi...@chromium.org/ Changes since v2: - Incorporated review feedback How to build both

[PATCH v3 2/9] virtio-gpu: CONTEXT_INIT feature

2023-08-03 Thread Gurchetan Singh
From: Antonio Caggiano The feature can be enabled when a backend wants it. Signed-off-by: Antonio Caggiano Reviewed-by: Marc-André Lureau Signed-off-by: Gurchetan Singh Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Akihiko Odaki --- hw/display/virtio-gpu-base.c | 3 +++

[PATCH v3 3/9] virtio-gpu: hostmem

2023-08-03 Thread Gurchetan Singh
From: Gerd Hoffmann Use VIRTIO_GPU_SHM_ID_HOST_VISIBLE as id for virtio-gpu. Signed-off-by: Antonio Caggiano Acked-by: Michael S. Tsirkin --- hw/display/virtio-gpu-pci.c| 14 ++ hw/display/virtio-gpu.c| 1 + hw/display/virtio-vga.c| 33

Re: [PATCH v4 3/3] linux-user: Emulate /proc/cpuinfo for Alpha

2023-08-03 Thread Richard Henderson
On 8/3/23 14:44, Helge Deller wrote: Add emulation for /proc/cpuinfo for the alpha architecture. alpha output example: (alpha-chroot)root@p100:/# cat /proc/cpuinfo cpu : Alpha cpu model : ev67 cpu variation : 7 cpu revision: 0 cpu serial

Re: [PATCH v4 2/3] linux-user: Emulate /proc/cpuinfo on aarch64 and arm

2023-08-03 Thread Richard Henderson
On 8/3/23 14:44, Helge Deller wrote: Add emulation for /proc/cpuinfo for arm architecture. The output below mimics output as seen on debian porterboxes. aarch64 output example: processor : 0 model name : ARMv8 Processor rev 0 (v8l) BogoMIPS: 100.00 Features: swp half

[PULL 1/1] target/hppa: Move iaoq registers and thus reduce generated code size

2023-08-03 Thread Helge Deller
On hppa the Instruction Address Offset Queue (IAOQ) registers specifies the next to-be-executed instructions addresses. Each generated TB writes those registers at least once, so those registers are used heavily in generated code. Looking at the generated assembly, for a x86-64 host this code to

[PULL 0/1] Hppa linux user speedup patches

2023-08-03 Thread Helge Deller
The following changes since commit 9ba37026fcf6b7f3f096c0cca3e1e7307802486b: Update version for v8.1.0-rc2 release (2023-08-02 08:22:45 -0700) are available in the Git repository at: https://github.com/hdeller/qemu-hppa.git tags/hppa-linux-user-speedup-pull-request for you to fetch

[PULL 21/22] virtio-crypto: verify src buffer length for sym request

2023-08-03 Thread Michael S. Tsirkin
From: zhenwei pi For symmetric algorithms, the length of ciphertext must be as same as the plaintext. The missing verification of the src_len and the dst_len in virtio_crypto_sym_op_helper() may lead buffer overflow/divulged. This patch is originally written by Yiming Tao for QEMU-SECURITY,

[PULL 08/22] tests: acpi: whitelist expected blobs

2023-08-03 Thread Michael S. Tsirkin
From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230720133858.1974024-5-imamm...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 37 + 1 file changed, 37 insertions(+) diff

[PULL 04/22] hw/virtio: Add a protection against duplicate vu_scmi_stop calls

2023-08-03 Thread Michael S. Tsirkin
From: Milan Zamazal The QEMU CI fails in virtio-scmi test occasionally. As reported by Thomas Huth, this happens most likely when the system is loaded and it fails with the following error: qemu-system-aarch64: ../../devel/qemu/hw/pci/msix.c:659: msix_unset_vector_notifiers: Assertion

[PULL 10/22] tests: acpi: update expected blobs

2023-08-03 Thread Michael S. Tsirkin
From: Igor Mammedov Expected change is that _ADR object is removed from hostbridge descriptor in DSDT for PC and Q35 machines. Signed-off-by: Igor Mammedov Message-Id: <20230720133858.1974024-7-imamm...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin ---

[PULL 07/22] tests: acpi: x86: update expected blobs

2023-08-03 Thread Michael S. Tsirkin
From: Igor Mammedov Following change is expected on each PCI slot with enabled ACPI PCI hotplug -BSEL, -ASUN +Zero, +Zero } +Local0 [Zero]

[PULL 22/22] cryptodev: Handle unexpected request to avoid crash

2023-08-03 Thread Michael S. Tsirkin
From: zhenwei pi Generally guest side should discover which services the device is able to offer, then do requests on device. However it's also possible to break this rule in a guest. Handle unexpected request here to avoid NULL pointer dereference. Fixes: e7a775fd ('cryptodev: Account

[PULL 20/22] include/hw/i386/x86-iommu: Fix struct X86IOMMU_MSIMessage for big endian hosts

2023-08-03 Thread Michael S. Tsirkin
From: Thomas Huth The first bitfield here is supposed to be used as a 64-bit equivalent to the "uint64_t msi_addr" in the union. To make this work correctly on big endian hosts, too, the __addr_hi field has to be part of the bitfield, and the the bitfield members must be declared with "uint64_t"

[PULL 13/22] pci: do not respond config requests after PCI device eject

2023-08-03 Thread Michael S. Tsirkin
From: Yuri Benditovich Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2224964 In migration with VF failover, Windows guest and ACPI hot unplug we do not need to satisfy config requests, otherwise the guest immediately detects the device and brings up its driver. Many network VF's are stuck

[PULL 12/22] virtio: Fix packed virtqueue used_idx mask

2023-08-03 Thread Michael S. Tsirkin
From: Hanna Czenczek virtio_queue_packed_set_last_avail_idx() is used by vhost devices to set the internal queue indices to what has been reported by the vhost back-end through GET_VRING_BASE. For packed virtqueues, this 32-bit value is expected to contain both the device's internal avail and

[PULL 16/22] hw/i386/intel_iommu: Fix endianness problems related to VTD_IR_TableEntry

2023-08-03 Thread Michael S. Tsirkin
From: Thomas Huth The code already tries to do some endianness handling here, but currently fails badly: - While it already swaps the data when logging errors / tracing, it fails to byteswap the value before e.g. accessing entry->irte.present - entry->irte.source_id is swapped with

[PULL 06/22] x86: acpi: workaround Windows not handling name references in Package properly

2023-08-03 Thread Michael S. Tsirkin
From: Igor Mammedov it seems that Windows is unable to handle variable references making it choke up when accessing ASUN during _DSM call when device is hotplugged (it lists package elements as DataAlias but despite that later on it misbehaves) with following error shown up in AMLI debugger

[PULL 14/22] vhost: fix the fd leak

2023-08-03 Thread Michael S. Tsirkin
From: Li Feng When the vhost-user reconnect to the backend, the notifer should be cleanup. Otherwise, the fd resource will be exhausted. Fixes: f9a09ca3ea ("vhost: add support for configure interrupt") Signed-off-by: Li Feng Reviewed-by: Raphael Norwitz Message-Id:

[PULL 03/22] virtio-iommu: Standardize granule extraction and formatting

2023-08-03 Thread Michael S. Tsirkin
From: Eric Auger At several locations we compute the granule from the config page_size_mask using ctz() and then format it in traces using BIT(). As the page_size_mask is 64b we should use ctz64 and BIT_ULL() for formatting. We failed to be consistent. Note the page_size_mask is garanteed to be

[PULL 18/22] hw/i386/intel_iommu: Fix index calculation in vtd_interrupt_remap_msi()

2023-08-03 Thread Michael S. Tsirkin
From: Thomas Huth The values in "addr" are populated locally in this function in host endian byte order, so we must not swap the index_l field here. Signed-off-by: Thomas Huth Message-Id: <20230802135723.178083-5-th...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S.

[PULL 01/22] hw/virtio-iommu: Fix potential OOB access in virtio_iommu_handle_command()

2023-08-03 Thread Michael S. Tsirkin
From: Eric Auger In the virtio_iommu_handle_command() when a PROBE request is handled, output_size takes a value greater than the tail size and on a subsequent iteration we can get a stack out-of-band access. Initialize the output_size on each iteration. The issue was found with ASAN. Credits

[PULL 15/22] hw/i386/intel_iommu: Fix trivial endianness problems

2023-08-03 Thread Michael S. Tsirkin
From: Thomas Huth After reading the guest memory with dma_memory_read(), we have to make sure that we byteswap the little endian data to the host's byte order. Signed-off-by: Thomas Huth Message-Id: <20230802135723.178083-2-th...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by:

[PULL 11/22] hw/virtio: qmp: add RING_RESET to 'info virtio-status'

2023-08-03 Thread Michael S. Tsirkin
From: David Edmondson Signed-off-by: David Edmondson Message-Id: <20230721072820.75797-1-david.edmond...@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé --- hw/virtio/virtio-qmp.c | 2 ++ 1 file changed, 2 insertions(+) diff

[PULL 17/22] hw/i386/intel_iommu: Fix struct VTDInvDescIEC on big endian hosts

2023-08-03 Thread Michael S. Tsirkin
From: Thomas Huth On big endian hosts, we need to reverse the bitfield order in the struct VTDInvDescIEC, just like it is already done for the other bitfields in the various structs of the intel-iommu device. Signed-off-by: Thomas Huth Message-Id: <20230802135723.178083-4-th...@redhat.com>

[PULL 05/22] tests: acpi: x86: whitelist expected blobs

2023-08-03 Thread Michael S. Tsirkin
From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230720133858.1974024-2-imamm...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 14 ++ 1 file changed, 14 insertions(+) diff --git

[PULL 19/22] hw/i386/x86-iommu: Fix endianness issue in x86_iommu_irq_to_msi_message()

2023-08-03 Thread Michael S. Tsirkin
From: Thomas Huth The values in "msg" are assembled in host endian byte order (the other field are also not swapped), so we must not swap the __addr_head here. Signed-off-by: Thomas Huth Message-Id: <20230802135723.178083-6-th...@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by:

[PULL 02/22] hw/pci-bridge/cxl_upstream.c: Use g_new0() in build_cdat_table()

2023-08-03 Thread Michael S. Tsirkin
From: Peter Maydell In build_cdat_table() we do: *cdat_table = g_malloc0(sizeof(*cdat_table) * CXL_USP_CDAT_NUM_ENTRIES); This is wrong because: - cdat_table has type CDATSubHeader *** - so *cdat_table has type CDATSubHeader ** - so the array we're allocating here should be items of type

[PULL 09/22] acpi: x86: remove _ADR on host bridges

2023-08-03 Thread Michael S. Tsirkin
From: Igor Mammedov ACPI spec (since 2.0a) says " A device object must contain either an _HID object or an _ADR object, but can contain both. " _ADR is used when device is attached to an ennumerable bus, however hostbridge is not and uses dedicated _HID for discovery, drop _ADR field. It

[PULL 00/22] pc,pci,virtio,crypto: bugfixes

2023-08-03 Thread Michael S. Tsirkin
The following changes since commit c167c80b463768e04a22fbe37ba6c53a4a08e41e: Merge tag 'pull-request-2023-08-03' of https://gitlab.com/thuth/qemu into staging (2023-08-03 07:37:17 -0700) are available in the Git repository at: https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git

[PATCH v4 1/3] linux-user: Fix openat() emulation to correctly detect accesses to /proc

2023-08-03 Thread Helge Deller
In qemu we catch accesses to files like /proc/cpuinfo or /proc/net/route and return to the guest contents which would be visible on a real system (instead what the host would show). This patch fixes a bug, where for example the accesses cat /proccpuinfo or cd /proc && cat cpuinfo will

[PATCH v4 2/3] linux-user: Emulate /proc/cpuinfo on aarch64 and arm

2023-08-03 Thread Helge Deller
Add emulation for /proc/cpuinfo for arm architecture. The output below mimics output as seen on debian porterboxes. aarch64 output example: processor : 0 model name : ARMv8 Processor rev 0 (v8l) BogoMIPS: 100.00 Features: swp half thumb fast_mult vfp edsp neon vfpv3

[PATCH v4 3/3] linux-user: Emulate /proc/cpuinfo for Alpha

2023-08-03 Thread Helge Deller
Add emulation for /proc/cpuinfo for the alpha architecture. alpha output example: (alpha-chroot)root@p100:/# cat /proc/cpuinfo cpu : Alpha cpu model : ev67 cpu variation : 7 cpu revision: 0 cpu serial number : JA system type

[PATCH v4 0/3] linux-user: /proc/cpuinfo fix and content emulation for arm

2023-08-03 Thread Helge Deller
- One fix for correctly detecting /proc/cpuinfo access - A new /proc/cpuinfo output for arm/arm64. - A new /proc/cpuinfo output for Alpha Helge Deller (3): linux-user: Fix openat() emulation to correctly detect accesses to /proc linux-user: Emulate /proc/cpuinfo on aarch64 and arm

Re: [PATCH] Revert "virtio-scsi: Send "REPORTED LUNS CHANGED" sense data upon disk hotplug events"

2023-08-03 Thread Stefano Garzarella
Hi Michael, On Thu, Aug 3, 2023 at 10:02 PM Michael S. Tsirkin wrote: > > On Wed, Jul 05, 2023 at 09:15:23AM +0200, Stefano Garzarella wrote: > > This reverts commit 8cc5583abe6419e7faaebc9fbd109f34f4c850f2. > > > > That commit causes several problems in Linux as described in the BZ. > > In

Re: [PATCH v3 3/3] linux-user: Emulate /proc/cpuinfo for Alpha

2023-08-03 Thread Richard Henderson
On 8/3/23 13:48, Helge Deller wrote: +dprintf(fd, "cpu active mask\t\t: %016llx\n", (unsigned long long) cpu_mask); PRIx64 better than using long long. r~

Re: [PATCH v3 2/3] linux-user: Emulate /proc/cpuinfo on aarch64 and arm

2023-08-03 Thread Richard Henderson
On 8/3/23 13:48, Helge Deller wrote: Add emulation for /proc/cpuinfo for arm architecture. The output below mimics output as seen on debian porterboxes. aarch64 output example: processor : 0 model name : ARMv8 Processor rev 0 (v8l) BogoMIPS: 100.00 Features: swp half

[PATCH v3 0/3] linux-user: /proc/cpuinfo fix and content emulation for arm

2023-08-03 Thread Helge Deller
- One fix for correctly detecting /proc/cpuinfo access - A new /proc/cpuinfo output for arm/arm64. - A new /proc/cpuinfo output for Alpha Helge Deller (3): linux-user: Fix openat() emulation to correctly detect accesses to /proc linux-user: Emulate /proc/cpuinfo on aarch64 and arm

[PATCH v3 2/3] linux-user: Emulate /proc/cpuinfo on aarch64 and arm

2023-08-03 Thread Helge Deller
Add emulation for /proc/cpuinfo for arm architecture. The output below mimics output as seen on debian porterboxes. aarch64 output example: processor : 0 model name : ARMv8 Processor rev 0 (v8l) BogoMIPS: 100.00 Features: swp half thumb fast_mult vfp edsp neon vfpv3

[PATCH v3 1/3] linux-user: Fix openat() emulation to correctly detect accesses to /proc

2023-08-03 Thread Helge Deller
In qemu we catch accesses to files like /proc/cpuinfo or /proc/net/route and return to the guest contents which would be visible on a real system (instead what the host would show). This patch fixes a bug, where for example the accesses cat /proccpuinfo or cd /proc && cat cpuinfo will

[PATCH v3 3/3] linux-user: Emulate /proc/cpuinfo for Alpha

2023-08-03 Thread Helge Deller
Add emulation for /proc/cpuinfo for the alpha architecture. alpha output example: (alpha-chroot)root@p100:/# cat /proc/cpuinfo cpu : Alpha cpu model : ev67 cpu variation : 7 cpu revision: 0 cpu serial number : JA system type

Re: [PATCH v3 1/5] Refactor i.MX6UL processor code

2023-08-03 Thread Jean-Christophe DUBOIS
Le 02/08/2023 à 23:32, Philippe Mathieu-Daudé a écrit : Hi Jean-Christophe, On 2/8/23 23:08, Jean-Christophe Dubois wrote: * Add Addr and size definition for all i.MX6UL devices in i.MX6UL header file. I'm OK with your patch, but some addr/size are added, while other are changed. It is hard

Re: [PATCH v3 16/17] i386: Use CPUCacheInfo.share_level to encode CPUID[0x8000001D].EAX[bits 25:14]

2023-08-03 Thread Moger, Babu
Hi Zhao, Please copy the thread to k...@vger.kernel.org also. It makes it easier to browse. On 8/1/23 05:35, Zhao Liu wrote: > From: Zhao Liu > > CPUID[0x801D].EAX[bits 25:14] is used to represent the cache > topology for amd CPUs. Please change this to. CPUID[0x801D].EAX[bits

Re: [PATCH v3 15/17] i386: Fix NumSharingCache for CPUID[0x8000001D].EAX[bits 25:14]

2023-08-03 Thread Moger, Babu
Hi Zhao, On 8/1/23 05:35, Zhao Liu wrote: > From: Zhao Liu > > The commit 8f4202fb1080 ("i386: Populate AMD Processor Cache Information > for cpuid 0x801D") adds the cache topology for AMD CPU by encoding > the number of sharing threads directly. > > From AMD's APM, NumSharingCache

Re: [PATCH] Revert "virtio-scsi: Send "REPORTED LUNS CHANGED" sense data upon disk hotplug events"

2023-08-03 Thread Michael S. Tsirkin
On Wed, Jul 12, 2023 at 10:12:13AM +0200, Paolo Bonzini wrote: > On 7/10/23 21:40, Michael S. Tsirkin wrote: > > > > Acked-by: Michael S. Tsirkin > > > > Seems safest to revert, but I'll let storage guys decide whether to > > queue this. > > There are multiple possibilities: > > 1) it's a QEMU

Re: [PATCH] Revert "virtio-scsi: Send "REPORTED LUNS CHANGED" sense data upon disk hotplug events"

2023-08-03 Thread Michael S. Tsirkin
On Wed, Jul 05, 2023 at 09:15:23AM +0200, Stefano Garzarella wrote: > This reverts commit 8cc5583abe6419e7faaebc9fbd109f34f4c850f2. > > That commit causes several problems in Linux as described in the BZ. > In particular, after a while, other devices on the bus are no longer > usable even if

Re: [PATCH] Revert "virtio-scsi: Send "REPORTED LUNS CHANGED" sense data upon disk hotplug events"

2023-08-03 Thread Michael S. Tsirkin
On Thu, Aug 03, 2023 at 03:36:44PM -0400, Michael S. Tsirkin wrote: > On Wed, Jul 05, 2023 at 09:15:23AM +0200, Stefano Garzarella wrote: > > This reverts commit 8cc5583abe6419e7faaebc9fbd109f34f4c850f2. > > > > That commit causes several problems in Linux as described in the BZ. > > In

[PATCH] qdev-properties: alias all object class properties

2023-08-03 Thread Stefan Hajnoczi
qdev_alias_all_properties() aliases a DeviceState's qdev properties onto an Object. This is used for VirtioPCIProxy types so that --device virtio-blk-pci has properties of its embedded --device virtio-blk-device object. Currently this function is implemented using qdev properties. Change the

Re: [PATCH v3 0/3] qmp,vhost-user: Remove virtio_list & update virtio introspection

2023-08-03 Thread Michael S. Tsirkin
On Thu, Aug 03, 2023 at 10:54:57AM -0400, Jonah Palmer wrote: > These patches update a few things related to virtio introspection via. > QMP/HMP commands. > > 1. Remove 'virtio_list' and instead query the QOM composition tree to > find any active & realized virtio devices. > > The 'virtio_list'

Re: [PATCH] Revert "virtio-scsi: Send "REPORTED LUNS CHANGED" sense data upon disk hotplug events"

2023-08-03 Thread Michael S. Tsirkin
On Wed, Jul 05, 2023 at 09:15:23AM +0200, Stefano Garzarella wrote: > This reverts commit 8cc5583abe6419e7faaebc9fbd109f34f4c850f2. > > That commit causes several problems in Linux as described in the BZ. > In particular, after a while, other devices on the bus are no longer > usable even if

Re: [PATCH 2/2] virtio-gpu: reset gfx resources in main thread

2023-08-03 Thread Marc-André Lureau
Hi On Thu, Aug 3, 2023 at 10:23 PM Kim, Dongwon wrote: > > Looking good. By the way, what does 'BH' stand for? > BH: bottom-half, it's a kind of delayed callback. > Acked-by: Dongwon Kim thanks > > From: Marc-André Lureau > > Calling OpenGL from different threads can have bad consequences

[PATCH] hw/nvme: fix oob memory read in fdp events log

2023-08-03 Thread Klaus Jensen
From: Klaus Jensen As reported by Trend Micro's Zero Day Initiative, an oob memory read vulnerability exists in nvme_fdp_events(). The host-provided offset is not verified. Fix this. This is only exploitable when Flexible Data Placement mode (fdp=on) is enabled. Fixes: CVE-2023-4135 Fixes:

Re: [PATCH 2/2] virtio-gpu: reset gfx resources in main thread

2023-08-03 Thread Kim, Dongwon
Looking good. By the way, what does 'BH' stand for? Acked-by: Dongwon Kim From: Marc-André Lureau Calling OpenGL from different threads can have bad consequences if not carefully reviewed. It's not generally supported. In my case, I was debugging a crash in glDeleteTextures from

Re: [PATCH 1/2] virtio-gpu: free BHs, by implementing unrealize

2023-08-03 Thread Kim, Dongwon
Acked-by: Dongwon Kim From: Marc-André Lureau Signed-off-by: Marc-André Lureau ---  include/hw/virtio/virtio-gpu.h |  1 +  hw/display/virtio-gpu-base.c   |  2 +-  hw/display/virtio-gpu.c    | 10 ++  3 files changed, 12 insertions(+), 1 deletion(-) diff --git

Re: [PATCH v3 1/3] qmp: remove virtio_list, search QOM tree instead

2023-08-03 Thread Manos Pitsidianakis
On Thu, 03 Aug 2023 17:54, Jonah Palmer wrote: -VirtioInfoList *qmp_x_query_virtio(Error **errp) +static int query_dev_child(Object *child, void *opaque) { -VirtioInfoList *list = NULL; -VirtioInfo *node; -VirtIODevice *vdev; +VirtioInfoList **vdevs = opaque; +Object *dev =

  1   2   3   >