Re: [RFC PATCH 04/12] vhost_net: Use ops->vhost_reset_queue in vhost_net_virtqueue_reset

2023-07-25 Thread Jason Wang
在 2023/7/21 02:14, Eugenio Pérez 写道: Actually use vhost_reset_queue operation at queue reset. Signed-off-by: Eugenio Pérez --- hw/net/vhost_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 416b7d8132..5516b7a5aa 1006

Re: [RFC PATCH 03/12] vhost_net: Use ops->vhost_restart_queue in vhost_net_virtqueue_restart

2023-07-25 Thread Jason Wang
在 2023/7/21 02:14, Eugenio Pérez 写道: Actually use vhost_restart_queue operation at restart. Signed-off-by: Eugenio Pérez --- hw/net/vhost_net.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 6b958d6363..416b7d8

Re: [RFC PATCH 00/12] Prefer to use SVQ to stall dataplane at NIC state restore through CVQ

2023-07-25 Thread Jason Wang
在 2023/7/21 14:48, Eugenio Perez Martin 写道: On Thu, Jul 20, 2023 at 8:15 PM Eugenio Pérez wrote: At this moment the migration of net features that depends on CVQ is not possible, as there is no reliable way to restore the device state like mac address, number of enabled queues, etc to the des

Re: [PATCH v2 3/4] vdpa: Restore vlan filtering state

2023-07-25 Thread Hawkins Jiawei
On 2023/7/25 14:47, Jason Wang wrote: > On Sun, Jul 23, 2023 at 5:28 PM Hawkins Jiawei wrote: >> >> 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. >> >> Co-developed-by: Eugenio Pérez >> Signed-

Re: [PATCH 3/6] vhost: Do not reset suspended devices on stop

2023-07-25 Thread Hanna Czenczek
On 24.07.23 17:48, Eugenio Perez Martin wrote: On Fri, Jul 21, 2023 at 6:07 PM Hanna Czenczek wrote: On 21.07.23 17:25, Eugenio Perez Martin wrote: On Tue, Jul 11, 2023 at 5:52 PM Hanna Czenczek wrote: Move the `suspended` field from vhost_vdpa into the global vhost_dev struct, so vhost_dev_

Re: [PATCH v6 5/6] qapi: Add HV_BALLOON_STATUS_REPORT event

2023-07-25 Thread Markus Armbruster
"Maciej S. Szmigiero" writes: > From: "Maciej S. Szmigiero" > > Used by the hv-balloon driver for (optional) guest memory status reports. Inhowfar optional? What enables / triggers it? Use case for the event? Could a status event make sense for other balloon drivers as well? > Signed-off-by

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin --- semihosting/uaccess.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c index 8018828069..8f2e6f63ee 1006

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread Michael Tokarev
25.07.2023 11:06, dinglimin wrote: Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). ... void *softmmu_lock_user(CPUArchState *env, target_ulong addr, target_ulong len, bool copy) { -void *p = malloc(len); +void *p

Re: [PATCH v6 4/6] qapi: Add HvBalloonDeviceInfo sub-type to MemoryDeviceInfo

2023-07-25 Thread Markus Armbruster
"Maciej S. Szmigiero" writes: > From: "Maciej S. Szmigiero" > > Used by the hv-balloon driver to report its provided memory state > information. > > Co-developed-by: David Hildenbrand > Signed-off-by: Maciej S. Szmigiero > --- > hw/core/machine-hmp-cmds.c | 15 +++ > qapi/machine.

Re: [PATCH v6 0/6] Hyper-V Dynamic Memory Protocol driver (hv-balloon 🎈️)

2023-07-25 Thread Markus Armbruster
David Hildenbrand writes: > On 20.07.23 12:12, Maciej S. Szmigiero wrote: >> From: "Maciej S. Szmigiero" >> This is a continuation of the v5 of the patch series located here: >> https://lore.kernel.org/qemu-devel/cover.1686577753.git.maciej.szmigi...@oracle.com/ >> > > We're now in QEMU soft-fr

Re: [PATCH v6 4/6] qapi: Add HvBalloonDeviceInfo sub-type to MemoryDeviceInfo

2023-07-25 Thread Markus Armbruster
"Maciej S. Szmigiero" writes: > On 24.07.2023 13:37, Markus Armbruster wrote: >> "Maciej S. Szmigiero" writes: >> >>> From: "Maciej S. Szmigiero" >>> >>> Used by the hv-balloon driver to report its provided memory state >>> information. >>> >>> Co-developed-by: David Hildenbrand >>> Signed-of

Re: [PATCH 1/6] vhost-user.rst: Add suspend/resume

2023-07-25 Thread Hanna Czenczek
On 24.07.23 19:55, Stefan Hajnoczi wrote: On Wed, Jul 19, 2023 at 03:59:32PM +0200, Hanna Czenczek wrote: On 18.07.23 16:25, Stefan Hajnoczi wrote: On Tue, Jul 11, 2023 at 05:52:23PM +0200, Hanna Czenczek wrote: When stopping the VM, qemu wants all devices to fully cease any operation, too. C

[Bug 1787] Qemu asan test make vm crash when using qxl and spice

2023-07-25 Thread zhangjianguo (A)
Bug links: https://gitlab.com/qemu-project/qemu/-/issues/1787 When we tested QEMU with asan, the vm crash. How to reproduce the bug: 1、 Start the vm with qxl and spice. 2、 Attach the vm with vnc and spice. 3、 Placed for more than three days. 4、 Operation on spice client and possible reproduce

Re: [PATCH 6/6] vhost-user: Have reset_status fall back to reset

2023-07-25 Thread Hanna Czenczek
On 24.07.23 20:04, Stefan Hajnoczi wrote: On Fri, Jul 21, 2023 at 04:16:07PM +0200, Hanna Czenczek wrote: On 20.07.23 18:03, Stefan Hajnoczi wrote: On Wed, Jul 19, 2023 at 04:27:58PM +0200, Hanna Czenczek wrote: On 19.07.23 16:11, Hanna Czenczek wrote: On 18.07.23 17:10, Stefan Hajnoczi wrote

Re: [PATCH] migrate/multifd: fix coredump when the multifd thread cleanup

2023-07-25 Thread chenyuhui (A)
@Peter Xu @Fabiano Rosas Kindly ping on this. On 2023/6/27 9:11, chenyuhui (A) wrote: > > On 2023/6/26 21:16, chenyuhui (A) wrote: >> >> On 2023/6/21 22:22, Fabiano Rosas wrote: >>> Jianguo Zhang via writes: >>> From: Yuhui Chen There is a coredump while trying to destroy mutex w

Re: [PATCH v21 01/20] s390x/cpu topology: add s390 specifics to CPU topology

2023-07-25 Thread Pierre Morel
On 7/24/23 12:15, Nina Schoetterl-Glausch wrote: On Fri, 2023-07-21 at 13:24 +0200, Pierre Morel wrote: On 7/18/23 18:31, Nina Schoetterl-Glausch wrote: Reviewed-by: Nina Schoetterl-Glausch Some notes below. The s390x/ prefix in the title might suggest that this patch is s390 specific, but

Re: [PATCH v21 02/20] s390x/cpu topology: add topology entries on CPU hotplug

2023-07-25 Thread Pierre Morel
On 7/24/23 22:19, Nina Schoetterl-Glausch wrote: On Fri, 2023-06-30 at 11:17 +0200, Pierre Morel wrote: The topology information are attributes of the CPU and are specified during the CPU device creation. On hot plug we: - calculate the default values for the topology for drawers,   books an

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin V1 -> V2:if cpu_memory_rw_debug failed, still need to set p=NULL --- semihosting/uaccess.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/semihosting/ua

Re: [PATCH QEMU v10 3/9] qapi/migration: Introduce vcpu-dirty-limit parameters

2023-07-25 Thread Markus Armbruster
~hyman writes: > From: Hyman Huang(黄勇) > > Introduce "vcpu-dirty-limit" migration parameter used > to limit dirty page rate during live migration. > > "vcpu-dirty-limit" and "x-vcpu-dirty-limit-period" are > two dirty-limit-related migration parameters, which can > be set before and during live

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread Michael Tokarev
25.07.2023 12:00, dinglimin wrote: Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin V1 -> V2:if cpu_memory_rw_debug failed, still need to set p=NULL --- semihosting/uaccess.c | 4 ++-- 1 file changed, 2 insertions(+), 2 de

Re: [PATCH] migration: Allow user to specify migration available bandwidth

2023-07-25 Thread Daniel P . Berrangé
On Mon, Jul 24, 2023 at 03:47:50PM -0400, Peter Xu wrote: > On Mon, Jul 24, 2023 at 07:04:29PM +0100, Daniel P. Berrangé wrote: > > On Mon, Jul 24, 2023 at 01:07:55PM -0400, Peter Xu wrote: > > > Migration bandwidth is a very important value to live migration. It's > > > because it's one of the ma

Re: [PATCH 0/6] Add nRF51 DETECT signal with test

2023-07-25 Thread Peter Maydell
On Tue, 25 Jul 2023 at 04:25, Chris Laplante wrote: > > Hi Peter, > > > Thanks for this patchset and especially for the work > > improving the qtest infrastructure. I've given my > > comments on the different patches, and in some cases > > reviewed-by tags. (Where I've given one of those, you shou

Re: [PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread Peter Maydell
On Tue, 25 Jul 2023 at 10:13, Michael Tokarev wrote: > > 25.07.2023 12:00, dinglimin wrote: > > Replaced a call to malloc() and its respective call to free() with > > g_malloc() and g_free(). > > > > Signed-off-by: dinglimin > > > > V1 -> V2:if cpu_memory_rw_debug failed, still need to set p=NUL

intel-iommu: Report interrupt remapping faults, fix return value

2023-07-25 Thread David Woodhouse
From: David Woodhouse A generic X86IOMMUClass->int_remap function should not return VT-d specific values; fix it to return 0 if the interrupt was successfully translated or -EINVAL if not. The VTD_FR_IR_xxx values are supposed to be used to actually raise faults through the fault reporting mecha

Re: [PATCH 3/6] vhost: Do not reset suspended devices on stop

2023-07-25 Thread Eugenio Perez Martin
On Tue, Jul 25, 2023 at 9:53 AM Hanna Czenczek wrote: > > On 24.07.23 17:48, Eugenio Perez Martin wrote: > > On Fri, Jul 21, 2023 at 6:07 PM Hanna Czenczek wrote: > >> On 21.07.23 17:25, Eugenio Perez Martin wrote: > >>> On Tue, Jul 11, 2023 at 5:52 PM Hanna Czenczek wrote: > Move the `susp

i386/xen: prevent guest from binding loopback event channel to itself

2023-07-25 Thread David Woodhouse
From: David Woodhouse Fuzzing showed that a guest could bind an interdomain port to itself, by guessing the next port to be allocated and putting that as the 'remote' port number. By chance, that works because the newly-allocated port has type EVTCHNSTAT_unbound. It shouldn't. Signed-off-by: Dav

Re: [PATCH] vhost-user-scsi: support reconnect to backend

2023-07-25 Thread Li Feng
Thanks for your comments. > 2023年7月25日 上午1:21,Raphael Norwitz 写道: > > Very excited to see this. High level looks good modulo a few small things. > > My major concern is around existing vhost-user-scsi backends which don’t > support VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD. IMO we should hide the

Re: [PATCH] kvm: Remove KVM_CREATE_IRQCHIP support assumption

2023-07-25 Thread Andrew Jones
On Mon, Jul 24, 2023 at 11:53:39AM +0200, Thomas Huth wrote: > On 22/07/2023 08.21, Andrew Jones wrote: > > Since Linux commit 00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA > > irqchip support") checking KVM_CAP_IRQCHIP returns non-zero when the > > RISC-V platform has AIA. The cap indicates K

[PULL 2/5] scripts/git-submodule.sh: Don't rely on non-POSIX 'read' behaviour

2023-07-25 Thread Peter Maydell
The POSIX definition of the 'read' utility requires that you specify the variable name to set; omitting the name and having it default to 'REPLY' is a bashism. If your system sh is dash, then it will print an error message during build: qemu/pc-bios/s390-ccw/../../scripts/git-submodule.sh: 106: re

[PULL 1/5] hw/arm/smmu: Handle big-endian hosts correctly

2023-07-25 Thread Peter Maydell
The implementation of the SMMUv3 has multiple places where it reads a data structure from the guest and directly operates on it without doing a guest-to-host endianness conversion. Since all SMMU data structures are little-endian, this means that the SMMU doesn't work on a big-endian host. In par

[PULL 3/5] target/arm: Special case M-profile in debug_helper.c code

2023-07-25 Thread Peter Maydell
A lot of the code called from helper_exception_bkpt_insn() is written assuming A-profile, but we will also call this helper on M-profile CPUs when they execute a BKPT insn. This used to work by accident, but recent changes mean that we will hit an assert when some of this code calls down into lowe

[PULL 0/5] target-arm queue

2023-07-25 Thread Peter Maydell
in the Git repository at: https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230725 for you to fetch changes up to 78cc90346ec680a7f1bb9f138bf7c9654cf526d5: tests/decode: Suppress "error: " string for expected-failure tests (2023-

[PULL 4/5] For curses display, recognize a few more control keys

2023-07-25 Thread Peter Maydell
From: Sean Estabrooks The curses display handles most control-X keys, and translates them into their corresponding keycode. Here we recognize a few that are missing, Ctrl-@ (null), Ctrl-\ (backslash), Ctrl-] (right bracket), Ctrl-^ (caret), Ctrl-_ (underscore). Signed-off-by: Sean Estabrooks M

[PULL 5/5] tests/decode: Suppress "error: " string for expected-failure tests

2023-07-25 Thread Peter Maydell
The "expected failure" tests for decodetree result in the error messages from decodetree ending up in logs and in V=1 output: >>> MALLOC_PERTURB_=226 >>> /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/x86/pyvenv/bin/python3 >>> /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/scripts/decodetree.py

[PATCH] block/blkio: enable the completion eventfd

2023-07-25 Thread Stefano Garzarella
Until libblkio 1.3.0, virtio-blk drivers had completion eventfd notifications enabled from the start, but from the next releases this is no longer the case, so we have to explicitly enable them. In fact, the libblkio documentation says they could be disabled, so we should always enable them at the

[PATCH v2 3/4] vhost: move and rename the conn retry times

2023-07-25 Thread Li Feng
Multile devices need this macro, move it to a common header. Signed-off-by: Li Feng --- hw/block/vhost-user-blk.c | 4 +--- hw/virtio/vhost-user-gpio.c | 3 +-- include/hw/virtio/vhost.h | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/block/vhost-user-blk.c b/hw/blo

[PATCH v2 2/4] vhost-user-common: send get_inflight_fd once

2023-07-25 Thread Li Feng
Get_inflight_fd is sent only once. When reconnecting to the backend, qemu sent set_inflight_fd to the backend. Signed-off-by: Li Feng --- hw/scsi/vhost-scsi-common.c | 37 ++--- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/hw/scsi/vhost-scsi-com

[PATCH v2 1/4] vhost: fix the fd leak

2023-07-25 Thread 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 --- hw/virtio/vhost.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/virti

[PATCH v2 4/4] vhost-user-scsi: support reconnect to backend

2023-07-25 Thread Li Feng
If the backend crashes and restarts, the device is broken. This patch adds reconnect for vhost-user-scsi. Tested with spdk backend. Signed-off-by: Li Feng --- hw/scsi/vhost-scsi-common.c | 6 + hw/scsi/vhost-user-scsi.c | 220 +++--- include/hw/virtio

[PATCH v2 0/4] Implement reconnect for vhost-user-scsi

2023-07-25 Thread Li Feng
Hi, This patchset adds reconnect support for vhost-user-scsi. At the same times, fix vhost fd leak and refactor some code. Changes for v2: - Split the v1 patch to small separate patchset; - New patch for fixing fd leak, which has sent to reviewers in another mail; - Implement the `vhost_user_sc

[PATCH] semihosting/uaccess.c: Replaced a malloc call with g_malloc.

2023-07-25 Thread dinglimin
Replaced a call to malloc() and its respective call to free() with g_malloc() and g_free(). Signed-off-by: dinglimin V2 -> V3:softmmu_unlock_user changes free to g free. V1 -> V2:if cpu_memory_rw_debug failed, still need to set p=NULL --- semihosting/uaccess.c | 6 +++--- 1 file changed, 3 ins

Re: [PATCH v2 4/4] vhost-user-scsi: support reconnect to backend

2023-07-25 Thread Li Feng
> 2023年7月25日 下午6:42,Li Feng 写道: > > If the backend crashes and restarts, the device is broken. > This patch adds reconnect for vhost-user-scsi. > > Tested with spdk backend. > > Signed-off-by: Li Feng > --- > hw/scsi/vhost-scsi-common.c | 6 + > hw/scsi/vhost-user-scsi.c

Re: [PATCH] migration: Allow user to specify migration available bandwidth

2023-07-25 Thread Markus Armbruster
Peter Xu writes: > Migration bandwidth is a very important value to live migration. It's > because it's one of the major factors that we'll make decision on when to > switchover to destination in a precopy process. > > This value is currently estimated by QEMU during the whole live migration > p

[PATCH] block/blkio: do not use open flags in qemu_open()

2023-07-25 Thread Stefano Garzarella
qemu_open() in blkio_virtio_blk_common_open() is used to open the character device (e.g. /dev/vhost-vdpa-0 or /dev/vfio/vfio) or in the future eventually the unix socket. In all these cases we cannot open the path in read-only mode, when the `read-only` option of blockdev is on, because the exchan

Re: [PATCH] block/blkio: do not use open flags in qemu_open()

2023-07-25 Thread Daniel P . Berrangé
On Tue, Jul 25, 2023 at 01:11:55PM +0200, Stefano Garzarella wrote: > qemu_open() in blkio_virtio_blk_common_open() is used to open the > character device (e.g. /dev/vhost-vdpa-0 or /dev/vfio/vfio) or in > the future eventually the unix socket. > > In all these cases we cannot open the path in rea

Re: [PATCH] block/blkio: do not use open flags in qemu_open()

2023-07-25 Thread Stefano Garzarella
On Tue, Jul 25, 2023 at 12:15:40PM +0100, Daniel P. Berrangé wrote: On Tue, Jul 25, 2023 at 01:11:55PM +0200, Stefano Garzarella wrote: qemu_open() in blkio_virtio_blk_common_open() is used to open the character device (e.g. /dev/vhost-vdpa-0 or /dev/vfio/vfio) or in the future eventually the un

Format type of qemu NVMe virtual drive reverted back to its default (512 bytes block size) after performing hot plugout/plugin operation on that drive.

2023-07-25 Thread Ashutosh Sharma
Hi, I have a virtual system created using qemu 7.2. In that system, I attached/hot plugged a virtual NVMe drive. This drive had a default block size of 512 bytes. admin@node-3:~$ sudo nvme list Node SN Model Namespace Usage Form

[PATCH] ui/dbus: fix win32 compilation when !opengl

2023-07-25 Thread marcandre . lureau
From: Marc-Andre Lureau Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1782 Signed-off-by: Marc-André Lureau --- ui/dbus-listener.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 68ff343799..02fc6ae239 100644 --- a/ui/

[PATCH for-8.1] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port()

2023-07-25 Thread Peter Maydell
In query_port() we pass the address of a local pvrdma_port_attr struct to the rdma_query_backend_port() function. Unfortunately, rdma_backend_query_port() wants a pointer to a struct ibv_port_attr, and the two are not the same length. Coverity spotted this (CID 1507146): pvrdma_port_attr is 48 by

Re: [PATCH] Open file as read only on private mapping in qemu_ram_alloc_from_file

2023-07-25 Thread David Hildenbrand
Hi, patch subject should start with "softmmu/physmem: Open ..." On 25.07.23 12:52, Thiner Logoer wrote: An read only file can be mapped with read write as long as the mapping is private, which is very common case. Make At least in the environments I know, using private file mappings is a corn

Re: [PULL 0/2] QAPI patches patches for 2023-07-10

2023-07-25 Thread Peter Maydell
On Mon, 10 Jul 2023 at 12:21, Markus Armbruster wrote: > > > The following changes since commit 2ff49e96accc8fd9a38e9abd16f0cfa0adab1605: > > Merge tag 'pull-tcg-20230709' of https://gitlab.com/rth7680/qemu into > staging (2023-07-09 15:01:43 +0100) > > are available in the Git repository at: >

Re: [PULL 00/16] s390x fixes

2023-07-25 Thread Peter Maydell
On Mon, 24 Jul 2023 at 17:53, Thomas Huth wrote: > > The following changes since commit 885fc169f09f5915ce037263d20a59eb226d473d: > > Merge tag 'pull-riscv-to-apply-20230723-3' of https://github.com/alistair23/qemu into staging (2023-07-24 11:34:35 +0100) > > are available in the Git repository

[PATCH v3 1/3] linux-user: Show heap address in /proc/pid/maps

2023-07-25 Thread Helge Deller
Show the memory location of the heap in the /proc/pid/maps file inside the guest. The heap address will be stored in ts->heap_base, so make that variable visible for all guest architectures, not just architectures for semihosted binaries (arm, m68k, riscv). Show 32- and 64-bit pointers with 8 digi

[PATCH v3 3/3] linux-user: Load pie executables at upper memory

2023-07-25 Thread Helge Deller
Adjust the loader to load dynamic pie executables at around: ~ 0x55 for 64-bit guest binaries on 64-bit host, - 0x4000for 32-bit guest binaries on 64-bit host, and - 0xfor 32-bit guest binaries on 32-bit host. Reason for this change is to unbreak the Thread Sanitizer (

[PATCH v3 0/3] linux-user: Fix static armhf binaries and optmize memory layout

2023-07-25 Thread Helge Deller
This patch series: - fixes qemu-arm to run static armhf binaries - shows address of heap in /proc/pid/maps output for all architectures - optimizes address layout of loaded executable It can be pulled from here: https://github.com/hdeller/qemu-hppa/tree/brk-fixes-2 Helge Deller (3): linux-user:

[PATCH v3 2/3] linux-user: Optimize memory layout for static and dynamic executables

2023-07-25 Thread Helge Deller
Organize the emulated memory layout in a way which leaves as much memory as possible for heap for the application. This patch tries to optize the memory layout by loading pie executables into lower memory and shared libs into higher memory (at TASK_UNMAPPED_BASE). This leaves a bigger memory area

Re: intel-iommu: Report interrupt remapping faults, fix return value

2023-07-25 Thread Michael S. Tsirkin
On Tue, Jul 25, 2023 at 11:01:16AM +0100, David Woodhouse wrote: > From: David Woodhouse > > A generic X86IOMMUClass->int_remap function should not return VT-d > specific values; fix it to return 0 if the interrupt was successfully > translated or -EINVAL if not. > > The VTD_FR_IR_xxx values are

Re: [PATCH] kvm: Remove KVM_CREATE_IRQCHIP support assumption

2023-07-25 Thread Andrew Jones
On Mon, Jul 24, 2023 at 11:53:39AM +0200, Thomas Huth wrote: > On 22/07/2023 08.21, Andrew Jones wrote: > > Since Linux commit 00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA > > irqchip support") checking KVM_CAP_IRQCHIP returns non-zero when the > > RISC-V platform has AIA. The cap indicates K

[PATCH v2] kvm: Remove KVM_CREATE_IRQCHIP support assumption

2023-07-25 Thread Andrew Jones
Since Linux commit 00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA irqchip support") checking KVM_CAP_IRQCHIP returns non-zero when the RISC-V platform has AIA. The cap indicates KVM supports at least one of the following ioctls: KVM_CREATE_IRQCHIP KVM_IRQ_LINE KVM_GET_IRQCHIP KVM_SET_I

Re: [PATCH v2] kvm: Remove KVM_CREATE_IRQCHIP support assumption

2023-07-25 Thread Thomas Huth
On 25/07/2023 14.26, Andrew Jones wrote: Since Linux commit 00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA irqchip support") checking KVM_CAP_IRQCHIP returns non-zero when the RISC-V platform has AIA. The cap indicates KVM supports at least one of the following ioctls: KVM_CREATE_IRQCHIP

Re: [PATCH v2] kvm: Remove KVM_CREATE_IRQCHIP support assumption

2023-07-25 Thread Philippe Mathieu-Daudé
On 25/7/23 14:26, Andrew Jones wrote: Since Linux commit 00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA irqchip support") checking KVM_CAP_IRQCHIP returns non-zero when the RISC-V platform has AIA. The cap indicates KVM supports at least one of the following ioctls: KVM_CREATE_IRQCHIP

Re: [PATCH] ui/dbus: fix win32 compilation when !opengl

2023-07-25 Thread Philippe Mathieu-Daudé
On 25/7/23 13:25, marcandre.lur...@redhat.com wrote: From: Marc-Andre Lureau Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1782 Signed-off-by: Marc-André Lureau --- ui/dbus-listener.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v3 0/8] misc AHCI cleanups

2023-07-25 Thread Philippe Mathieu-Daudé
Hi Niklas, John, Paolo, Kevin, On 19/7/23 12:47, Niklas Cassel wrote: Niklas Cassel (8): hw/ide/ahci: remove stray backslash hw/ide/core: set ERR_STAT in unsupported command completion hw/ide/ahci: write D2H FIS when processing NCQ command hw/ide/ahci: simplify and document PxCI han

Re: [PATCH for-8.1] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port()

2023-07-25 Thread Philippe Mathieu-Daudé
On 25/7/23 13:36, Peter Maydell wrote: In query_port() we pass the address of a local pvrdma_port_attr struct to the rdma_query_backend_port() function. Unfortunately, rdma_backend_query_port() wants a pointer to a struct ibv_port_attr, and the two are not the same length. Coverity spotted this

Re: [PATCH 3/6] vhost: Do not reset suspended devices on stop

2023-07-25 Thread Hanna Czenczek
On 25.07.23 12:03, Eugenio Perez Martin wrote: On Tue, Jul 25, 2023 at 9:53 AM Hanna Czenczek wrote: On 24.07.23 17:48, Eugenio Perez Martin wrote: On Fri, Jul 21, 2023 at 6:07 PM Hanna Czenczek wrote: On 21.07.23 17:25, Eugenio Perez Martin wrote: On Tue, Jul 11, 2023 at 5:52 PM Hanna Czen

Re: intel-iommu: Report interrupt remapping faults, fix return value

2023-07-25 Thread David Woodhouse
On Tue, 2023-07-25 at 08:03 -0400, Michael S. Tsirkin wrote: > On Tue, Jul 25, 2023 at 11:01:16AM +0100, David Woodhouse wrote: > > From: David Woodhouse > > > > A generic X86IOMMUClass->int_remap function should not return VT-d > > specific values; fix it to return 0 if the interrupt was success

[PATCH] memory: avoid updating ioeventfds for some address_space

2023-07-25 Thread hongmianquan
When updating ioeventfds, we need to iterate all address spaces, but some address spaces do not register eventfd_add|del call when memory_listener_register() and they do nothing when updating ioeventfds. So we can skip these AS in address_space_update_ioeventfds(). The overhead of memory_region_tr

[PATCH] memory: avoid updating ioeventfds for some address_space

2023-07-25 Thread hongmianquan
When updating ioeventfds, we need to iterate all address spaces, but some address spaces do not register eventfd_add|del call when memory_listener_register() and they do nothing when updating ioeventfds. So we can skip these AS in address_space_update_ioeventfds(). The overhead of memory_region_tr

Re: [PATCH] ppc: spapr: Fix device tree entries in absence of XIVE native mode

2023-07-25 Thread Gautam Menghani
Ok noted, thanks for the feedback Greg and Cedric. Thanks, Gautam

[PATCH] Open file as read only on private mapping in qemu_ram_alloc_from_file

2023-07-25 Thread Thiner Logoer
An read only file can be mapped with read write as long as the mapping is private, which is very common case. Make qemu_ram_alloc_from_file open file as read only when the mapping is private, otherwise open will fail when file does not allow write. If this file does not exist or is a directory, th

[PATCH] migration/ram: Refactor precopy ram loading code

2023-07-25 Thread Fabiano Rosas
From: Nikolay Borisov Extract the ramblock parsing code into a routine that operates on the sequence of headers from the stream and another the parses the individual ramblock. This makes ram_load_precopy() easier to comprehend. Signed-off-by: Nikolay Borisov Signed-off-by: Fabiano Rosas --- I'

Re: [PATCH] migration/ram: Refactor precopy ram loading code

2023-07-25 Thread Philippe Mathieu-Daudé
On 25/7/23 15:26, Fabiano Rosas wrote: From: Nikolay Borisov Extract the ramblock parsing code into a routine that operates on the sequence of headers from the stream and another the parses the individual ramblock. This makes ram_load_precopy() easier to comprehend. Signed-off-by: Nikolay Bori

Re: [PATCH v4 05/12] virtio-sound: prepare PCM streams

2023-07-25 Thread Marc-André Lureau
Hi On Thu, Jul 20, 2023 at 4:59 PM Emmanouil Pitsidianakis < manos.pitsidiana...@linaro.org> wrote: > After setting PCM parameters, instantiate ("prepare") each stream in > virtio_snd_pcm_prepare_impl(). > > Signed-off-by: Emmanouil Pitsidianakis > --- > hw/virtio/virtio-snd.c | 133 +++

Re: [PATCH v21 05/20] s390x/cpu topology: resetting the Topology-Change-Report

2023-07-25 Thread Nina Schoetterl-Glausch
On Fri, 2023-06-30 at 11:17 +0200, Pierre Morel wrote: > During a subsystem reset the Topology-Change-Report is cleared > by the machine. > Let's ask KVM to clear the Modified Topology Change Report (MTCR) > bit of the SCA in the case of a subsystem reset. > > Signed-off-by: Pierre Morel > Review

[Stable-8.0.4 04/31] linux-user: Fix accept4(SOCK_NONBLOCK) syscall

2023-07-25 Thread Michael Tokarev
From: Helge Deller The Linux accept4() syscall allows two flags only: SOCK_NONBLOCK and SOCK_CLOEXEC, and returns -EINVAL if any other bits have been set. Change the qemu implementation accordingly, which means we can not use the fcntl_flags_tbl[] translation table which allows too many other va

[Stable-8.0.4 01/31] virtio-net: correctly report maximum tx_queue_size value

2023-07-25 Thread Michael Tokarev
From: Laurent Vivier Maximum value for tx_queue_size depends on the backend type. 1024 for vDPA/vhost-user, 256 for all the others. The value is returned by virtio_net_max_tx_queue_size() to set the parameter: n->net_conf.tx_queue_size = MIN(virtio_net_max_tx_queue_size(n),

[Stable-8.0.4 02/31] qemu_cleanup: begin drained section after vm_shutdown()

2023-07-25 Thread Michael Tokarev
From: Fiona Ebner in order to avoid requests being stuck in a BlockBackend's request queue during cleanup. Having such requests can lead to a deadlock [0] with a virtio-scsi-pci device using iothread that's busy with IO when initiating a shutdown with QMP 'quit'. There is a race where such a que

[Stable-8.0.4 10/31] target/s390x: Fix LRA when DAT is off

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich LRA should perform DAT regardless of whether it's on or off. Disable DAT check for MMU_S390_LRA. Fixes: defb0e3157af ("s390x: Implement opcode helpers") Signed-off-by: Ilya Leoshkevich Reviewed-by: David Hildenbrand Cc: qemu-sta...@nongnu.org Message-Id: <20230704081506.

[Stable-8.0.4 06/31] target/s390x: Fix EPSW CC reporting

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich EPSW should explicitly calculate and insert CC, like IPM does. Fixes: e30a9d3fea58 ("target-s390: Implement EPSW") Signed-off-by: Ilya Leoshkevich Reviewed-by: David Hildenbrand Cc: qemu-sta...@nongnu.org Message-Id: <20230704081506.276055-3-...@linux.ibm.com> Signed-off

[Stable-8.0.4 17/31] linux-user: Make sure initial brk(0) is page-aligned

2023-07-25 Thread Michael Tokarev
From: Andreas Schwab Fixes: 86f04735ac ("linux-user: Fix brk() to release pages") Signed-off-by: Andreas Schwab Message-Id: Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson (cherry picked from commit d28b3c90cfad1a7e211ae2bce36ecb9071086129) Signed-off-by: Michael Tokarev dif

[Stable-8.0.4 22/31] qemu-nbd: pass structure into nbd_client_thread instead of plain char*

2023-07-25 Thread Michael Tokarev
From: "Denis V. Lunev" We are going to pass additional flag inside next patch. Signed-off-by: Denis V. Lunev CC: Eric Blake CC: Vladimir Sementsov-Ogievskiy CC: Message-ID: <20230717145544.194786-2-...@openvz.org> Reviewed-by: Eric Blake Signed-off-by: Eric Blake (cherry picked from commit

[Stable-8.0.4 15/31] linux-user/arm: Do not allocate a commpage at all for M-profile CPUs

2023-07-25 Thread Michael Tokarev
From: Philippe Mathieu-Daudé Since commit fbd3c4cff6 ("linux-user/arm: Mark the commpage executable") executing bare-metal (linked with rdimon.specs) cortex-M code fails as: $ qemu-arm -cpu cortex-m3 ~/hello.exe.m3 qemu-arm: ../../accel/tcg/user-exec.c:492: page_set_flags: Assertion `last <=

[Stable-8.0.4 08/31] target/s390x: Fix MVCRL with a large value in R0

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich Using a large R0 causes an assertion error: qemu-s390x: target/s390x/tcg/mem_helper.c:183: access_prepare_nf: Assertion `size > 0 && size <= 4096' failed. Even though PoP explicitly advises against using more than 8 bits for the size, an emulator crash is never a goo

[Stable-8.0.4 23/31] qemu-nbd: fix regression with qemu-nbd --fork run over ssh

2023-07-25 Thread Michael Tokarev
From: "Denis V. Lunev" Commit e6df58a5578fee7a50bbf36f4a50a2781cff855d Author: Hanna Reitz Date: Wed May 8 23:18:18 2019 +0200 qemu-nbd: Do not close stderr has introduced an interesting regression. Original behavior of ssh somehost qemu-nbd /home/den/tmp/file -f raw --fork wa

[Stable-8.0.4 07/31] target/s390x: Fix MDEB and MDEBR

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich These instructions multiply 32 bits by 32 bits, not 32 bits by 64 bits. Fixes: 83b00736f3d8 ("target-s390: Convert FP MULTIPLY") Signed-off-by: Ilya Leoshkevich Reviewed-by: David Hildenbrand Cc: qemu-sta...@nongnu.org Message-Id: <20230704081506.276055-4-...@linux.ibm.c

[Stable-8.0.4 29/31] target/s390x: Fix ICM with M3=0

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Cc: qemu-sta...@nongnu.org Fixes: e023e832d0ac ("s390x: translate engine for s390x CPU") Reviewed-by: David Hildenbrand Reviewed-by: Richar

[Stable-8.0.4 00/31] Patch Round-up for stable 8.0.4, freeze on 2023-08-05

2023-07-25 Thread Michael Tokarev
The following patches are queued for QEMU stable v8.0.4: https://gitlab.com/qemu-project/qemu/-/commits/staging-8.0 Patch freeze is 2023-08-05, and the release is planned for 2023-08-07: https://wiki.qemu.org/Planning/8.0 Please respond here or CC qemu-sta...@nongnu.org on any additional pa

[Stable-8.0.4 24/31] tcg/ppc: Fix race in goto_tb implementation

2023-07-25 Thread Michael Tokarev
From: Jordan Niethe Commit 20b6643324 ("tcg/ppc: Reorg goto_tb implementation") modified goto_tb to ensure only a single instruction was patched to prevent incorrect behavior if a thread was in the middle of multiple instructions when they were replaced. However this introduced a race between loa

[Stable-8.0.4 05/31] vfio: Fix null pointer dereference bug in vfio_bars_finalize()

2023-07-25 Thread Michael Tokarev
From: Avihai Horon vfio_realize() has the following flow: 1. vfio_bars_prepare() -- sets VFIOBAR->size. 2. msix_early_setup(). 3. vfio_bars_register() -- allocates VFIOBAR->mr. After vfio_bars_prepare() is called msix_early_setup() can fail. If it does fail, vfio_bars_register() is never called

[Stable-8.0.4 20/31] linux-user: Prohibit brk() to to shrink below initial heap address

2023-07-25 Thread Michael Tokarev
From: Helge Deller Since commit 86f04735ac ("linux-user: Fix brk() to release pages") it's possible for userspace applications to reduce their memory footprint by calling brk() with a lower address and free up memory. Before that commit guest heap memory was never unmapped. But the Linux kernel

[Stable-8.0.4 28/31] target/s390x: Fix CONVERT TO LOGICAL/FIXED with out-of-range inputs

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich CONVERT TO LOGICAL/FIXED deviate from IEEE 754 in that they raise an inexact exception on out-of-range inputs. float_flag_invalid_cvti aligns nicely with that behavior, so convert it to S390_IEEE_MASK_INEXACT. Cc: qemu-sta...@nongnu.org Fixes: defb0e3157af ("s390x: Impleme

[Stable-8.0.4 18/31] hw/nvme: fix endianness issue for shadow doorbells

2023-07-25 Thread Michael Tokarev
From: Klaus Jensen In commit 2fda0726e514 ("hw/nvme: fix missing endian conversions for doorbell buffers"), we fixed shadow doorbells for big-endian guests running on little endian hosts. But I did not fix little-endian guests on big-endian hosts. Fix this. Resolves: https://gitlab.com/qemu-proj

[Stable-8.0.4 16/31] ui/vnc-clipboard: fix infinite loop in inflate_buffer (CVE-2023-3255)

2023-07-25 Thread Michael Tokarev
From: Mauro Matteo Cascella A wrong exit condition may lead to an infinite loop when inflating a valid zlib buffer containing some extra bytes in the `inflate_buffer` function. The bug only occurs post-authentication. Return the buffer immediately if the end of the compressed data has been reache

[Stable-8.0.4 03/31] hw/ppc: Fix clock update drift

2023-07-25 Thread Michael Tokarev
From: Nicholas Piggin The clock update logic reads the clock twice to compute the new clock value, with a value derived from the later time subtracted from a value derived from the earlier time. The delta causes time to be lost. This can ultimately result in time becoming unsynchronized between

[Stable-8.0.4 30/31] target/s390x: Make MC raise specification exception when class >= 16

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich MC requires bit positions 8-11 (upper 4 bits of class) to be zeros, otherwise it must raise a specification exception. Cc: qemu-sta...@nongnu.org Fixes: 20d143e2cab8 ("s390x/tcg: Implement MONITOR CALL") Reviewed-by: David Hildenbrand Reviewed-by: Richard Henderson Signe

[Stable-8.0.4 27/31] target/s390x: Fix CLM with M3=0

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Cc: qemu-sta...@nongnu.org Fixes: defb0e3157af ("s390x: Implement opcode helpers") Reviewed-by: David Hildenbrand Reviewed-by: Richard Hend

[Stable-8.0.4 12/31] hw/ide/piix: properly initialize the BMIBA register

2023-07-25 Thread Michael Tokarev
From: Olaf Hering According to the 82371FB documentation (82371FB.pdf, 2.3.9. BMIBA-BUS MASTER INTERFACE BASE ADDRESS REGISTER, April 1997), the register is 32bit wide. To properly reset it to default values, all 32bit need to be cleared. Bit #0 "Resource Type Indicator (RTE)" needs to be enabled

[Stable-8.0.4 21/31] linux-user: Fix signed math overflow in brk() syscall

2023-07-25 Thread Michael Tokarev
From: Helge Deller Fix the math overflow when calculating the new_malloc_size. new_host_brk_page and brk_page are unsigned integers. If userspace reduces the heap, new_host_brk_page is lower than brk_page which results in a huge positive number (but should actually be negative). Fix it by addin

[Stable-8.0.4 31/31] target/s390x: Fix assertion failure in VFMIN/VFMAX with type 13

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich Type 13 is reserved, so using it should result in specification exception. Due to an off-by-1 error the code triggers an assertion at a later point in time instead. Cc: qemu-sta...@nongnu.org Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)") Reviewed

[Stable-8.0.4 25/31] tcg/{i386, s390x}: Add earlyclobber to the op_add2's first output

2023-07-25 Thread Michael Tokarev
From: Ilya Leoshkevich i386 and s390x implementations of op_add2 require an earlyclobber, which is currently missing. This breaks VCKSM in s390x guests. E.g., on x86_64 the following op: add2_i32 tmp2,tmp3,tmp2,tmp3,tmp3,tmp2 dead: 0 2 3 4 5 pref=none,0x is translated to: addl

  1   2   3   >