[PATCH v3 2/2] target/riscv: Optimize ambiguous local variable in pmp_hart_has_privs

2023-07-07 Thread Ruibo Lu
These two values represents whether start/end address is in pmp_range. However, the type and name of them is ambiguous. This commit change the name and type of them to improve code readability and accuracy. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1735 Reviewed-by: Philippe

[PATCH v3 1/2] target/riscv: Remove redundant check in pmp_is_locked

2023-07-07 Thread Ruibo Lu
the check of top PMP is redundant and will not influence the return value, so consider remove it Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1733 Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Ruibo Lu ---

[PATCH v2 1/3] linux-user: Fix fcntl() and fcntl64() to return O_LARGEFILE for 32-bit targets

2023-07-07 Thread Helge Deller
When running a 32-bit guest on a 64-bit host, fcntl[64](F_GETFL) should return with the TARGET_O_LARGEFILE flag set, because all 64-bit hosts support large files unconditionally. But on 64-bit hosts, O_LARGEFILE has the value 0, so the flag translation can't be done with the fcntl_flags_tbl[].

[PATCH v2 2/3] linux-user: Fix accept4(SOCK_NONBLOCK) syscall

2023-07-07 Thread 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 values. Beside the

[PATCH v2 3/3] linux-user: Improve strace output of pread64() and pwrite64()

2023-07-07 Thread Helge Deller
Make the strace look nicer for those two syscalls. Signed-off-by: Helge Deller Reviewed-by: Richard Henderson --- linux-user/strace.c| 19 +++ linux-user/strace.list | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/linux-user/strace.c

[PATCH v2 0/3] linux-user: Fix fcntl64() and accept4() for 32-bit targets

2023-07-07 Thread Helge Deller
A set of 3 patches: The first two patches fix fcntl64() and accept4(). the 3rd patch enhances the strace output for pread64/pwrite64(). I dropped my mmap2 patch in favour of Richard's proposal:

[PULL 10/10] hw/arm/virt-acpi-build.c: Add missing header

2023-07-07 Thread Michael Tokarev
From: Peng Liang virt-acpi-build.c uses warn_report. However, it doesn't include qemu/error-report.h directly, it include qemu/error-report.h via trace.h if we enable log trace backend. But if we disable the log trace backend (e.g., --enable-trace-backends=nop), then virt-acpi-build.c will not

[PULL 08/10] migration: factor out "resume_requested" in qmp_migrate()

2023-07-07 Thread Michael Tokarev
From: Laszlo Ersek It cuts back on those awkward, duplicated !(has_resume && resume) expressions. Cc: Juan Quintela (maintainer:Migration) Cc: Leonardo Bras (reviewer:Migration) Cc: Peter Xu (reviewer:Migration) Cc: qemu-triv...@nongnu.org Bugzilla:

[PULL 04/10] hw: Simplify calls to pci_nic_init_nofail()

2023-07-07 Thread Michael Tokarev
From: Thomas Huth pci_nic_init_nofail() calls qemu_find_nic_model(), and this function sets nd->model = g_strdup(default_model) if it has not been initialized yet. So we don't have to set nd->model to the default_nic in the calling sites. Signed-off-by: Thomas Huth Reviewed-by: Philippe

[PULL 07/10] qemu-options.hx: Fix indentation of some option descriptions

2023-07-07 Thread Michael Tokarev
From: Thomas Huth The description of the options starts at column 16, so fix this in some runaway lines for a more uniform output. While we're at it, replace the capital "NOTE" with "Note" since this seems to be the more common capitalization in qemu-options.hx. Signed-off-by: Thomas Huth

[PULL 03/10] trivial: man page: document display::gtk::zoom-to-fit

2023-07-07 Thread Michael Tokarev
From: Jan Kratochvil Document display::gtk::zoom-to-fit. info from: https://superuser.com/questions/1752209/qemu-zoom-to-fit-shortcut-or-cli-switch Signed-off-by: Jan Kratochvil Signed-off-by: Michael Tokarev --- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+) diff --git

[PULL 02/10] target/avr: Fix handling of interrupts above 33.

2023-07-07 Thread Michael Tokarev
From: Lucas Dietrich This commit addresses a bug in the AVR interrupt handling code. The modification involves replacing the usage of the ctz32 function with ctz64 to ensure proper handling of interrupts above 33 in the AVR target. Previously, timers 3, 4, and 5 interrupts were not functioning

[PULL 09/10] migration: unexport migrate_fd_error()

2023-07-07 Thread Michael Tokarev
From: Laszlo Ersek The only migrate_fd_error() call sites are in "migration/migration.c", which is also where we define migrate_fd_error(). Make the function static, and remove its declaration from "migration/migration.h". Cc: Juan Quintela (maintainer:Migration) Cc: Leonardo Bras

[PULL 06/10] vdpa: Sort vdpa_feature_bits array alphabetically

2023-07-07 Thread Michael Tokarev
From: Hawkins Jiawei This patch sorts the vdpa_feature_bits array alphabetically in ascending order to avoid future duplicates. Signed-off-by: Hawkins Jiawei Signed-off-by: Michael Tokarev --- net/vhost-vdpa.c | 39 +++ 1 file changed, 23 insertions(+), 16

[PULL 05/10] vdpa: Delete duplicated VIRTIO_NET_F_RSS in vdpa_feature_bits

2023-07-07 Thread Michael Tokarev
From: Hawkins Jiawei This entry was duplicated on referenced commit. Removing it. Fixes: 402378407dbd ("vhost-vdpa: multiqueue support") Signed-off-by: Hawkins Jiawei Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Michael Tokarev --- net/vhost-vdpa.c | 1 - 1 file changed, 1 deletion(-)

[PULL 01/10] hw/riscv/virt.c: fix typo in 'aia' description

2023-07-07 Thread Michael Tokarev
From: Daniel Henrique Barboza Cc: qemu-triv...@nongnu.org Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Weiwei Li Signed-off-by: Michael Tokarev --- hw/riscv/virt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/virt.c

[PULL trival-patches 00/10] trivial-patches for 2023-07-08

2023-07-07 Thread Michael Tokarev
The following changes since commit 3b08e40b7abfe8be6020c4c27c93ad85590b9213: Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-07-07 20:23:01 +0100) are available in the Git repository at: https://gitlab.com/mjt0k/qemu.git tags/trivial-patches-20230708 for you

Re: [PATCH v6] ppc: Enable 2nd DAWR support on p10

2023-07-07 Thread Nicholas Piggin
On Sat Jul 8, 2023 at 2:10 AM AEST, Shivaprasad G Bhat wrote: > > On 7/7/23 19:54, Cédric Le Goater wrote: > > On 7/7/23 13:59, Greg Kurz wrote: > >> Hi Daniel and Shiva ! > >> > >> On Fri, 7 Jul 2023 08:09:47 -0300 > >> Daniel Henrique Barboza wrote: > >> > >>> This one was a buzzer shot. > >>>

Re: [PATCH v2] ppc/pnv: Add QME region for P10

2023-07-07 Thread Nicholas Piggin
On Fri Jul 7, 2023 at 5:12 PM AEST, Joel Stanley wrote: > The Quad Management Engine (QME) manages power related settings for its > quad. The xscom region is separate from the quad xscoms, therefore a new > region is added. The xscoms in a QME select a given core by selecting > the forth nibble. >

Re: [QEMU][PATCH v2 2/2] xen_arm: Initialize RAM and add hi/low memory regions

2023-07-07 Thread Stefano Stabellini
On Fri, 7 Jul 2023, Vikram Garhwal wrote: > From: Oleksandr Tyshchenko > > In order to use virtio backends we need to initialize RAM for the > xen-mapcache (which is responsible for mapping guest memory using foreign > mapping) to work. Calculate and add hi/low memory regions based on >

Re: [QEMU][PATCH v2 1/2] xen_arm: Create virtio-mmio devices during initialization

2023-07-07 Thread Stefano Stabellini
On Fri, 7 Jul 2023, Vikram Garhwal wrote: > From: Oleksandr Tyshchenko > > In order to use virtio backends we need to allocate virtio-mmio > parameters (irq and base) and register corresponding buses. > > Use the constants defined in public header arch-arm.h to be > aligned with the toolstack.

Re: [PATCH v2 15/24] bsd-user: Use page_find_range_empty for mmap_find_vma_reserved

2023-07-07 Thread Warner Losh
On Fri, Jul 7, 2023 at 2:41 PM Richard Henderson < richard.hender...@linaro.org> wrote: > Use the interval tree to find empty space, rather than > probing each page in turn. > > Cc: Warner Losh > Cc: Kyle Evans > Signed-off-by: Richard Henderson > Reviewed-bt: Warner Losh I tested the prior

[QEMU][PATCH v2 0/2] Add Virtio support to Xenpvh machine for arm

2023-07-07 Thread Vikram Garhwal
Hi, We added virtio-mmio support in xenpvh machine. Now, it can support upto 10 virtio mmio. Changelog: v1->v2: Add reference for VIRTIO_MMIO_DEV_SIZE. Update ram_size=0 print statement. Oleksandr Tyshchenko (2): xen_arm: Create virtio-mmio devices during initialization

Re: [PATCH v2 08/24] bsd-user: Use page_check_range_empty for MAP_EXCL

2023-07-07 Thread Warner Losh
On Fri, Jul 7, 2023 at 2:41 PM Richard Henderson < richard.hender...@linaro.org> wrote: > The previous check returned -1 when any page within > [start, start+len) is unmapped, not when all are unmapped. > > Cc: Warner Losh > Cc: Kyle Evans > Signed-off-by: Richard Henderson > Reviewed-by:

[QEMU][PATCH v2 2/2] xen_arm: Initialize RAM and add hi/low memory regions

2023-07-07 Thread Vikram Garhwal
From: Oleksandr Tyshchenko In order to use virtio backends we need to initialize RAM for the xen-mapcache (which is responsible for mapping guest memory using foreign mapping) to work. Calculate and add hi/low memory regions based on machine->ram_size. Use the constants defined in public header

[QEMU][PATCH v2 1/2] xen_arm: Create virtio-mmio devices during initialization

2023-07-07 Thread Vikram Garhwal
From: Oleksandr Tyshchenko In order to use virtio backends we need to allocate virtio-mmio parameters (irq and base) and register corresponding buses. Use the constants defined in public header arch-arm.h to be aligned with the toolstack. So the number of current supported virtio-mmio devices

Re: [PATCH v2 2/2] accel/tcg: Always lock pages before translation

2023-07-07 Thread Richard W.M. Jones
I'm not sure if you meant v3 there, or if this is v2 rebased on top of the main branch, but I tested it again and it passed 5,000 boots. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog:

Re: [PULL 0/9] Final batch of patches for QEMU 8.1 soft freeze

2023-07-07 Thread Richard Henderson
On 7/7/23 15:04, Paolo Bonzini wrote: The following changes since commit 97c81ef4b8e203d9620fd46e7eb77004563e3675: Merge tag 'pull-9p-20230706' ofhttps://github.com/cschoenebeck/qemu into staging (2023-07-06 18:19:42 +0100) are available in the Git repository at:

Re: [PATCH v2 20/46] target/loongarch: Implement vext2xv

2023-07-07 Thread Richard Henderson
On 6/30/23 08:58, Song Gao wrote: +#define VEXT2XV(NAME, BIT, E1, E2)\ +void HELPER(NAME)(CPULoongArchState *env, uint32_t oprsz, \ + uint32_t vd, uint32_t vj) \ +{ \ +int i;

Re: [PATCH V4] migration: simplify blockers

2023-07-07 Thread Steven Sistare
On 7/7/2023 5:02 PM, Peter Xu wrote: > On Fri, Jul 07, 2023 at 01:20:48PM -0700, Steve Sistare wrote: >> Modify migrate_add_blocker and migrate_del_blocker to take an Error ** >> reason. This allows migration to own the Error object, so that if >> an error occurs, migration code can free the

Re: [PATCH v2 19/46] target/loongarch: Implement xvexth

2023-07-07 Thread Richard Henderson
On 6/30/23 08:58, Song Gao wrote: +#define VEXTH(NAME, BIT, E1, E2)\ +void HELPER(NAME)(CPULoongArchState *env, \ + uint32_t oprsz, uint32_t vd, uint32_t vj) \ +{ \ +int

Re: [PATCH V4] migration: simplify blockers

2023-07-07 Thread Peter Xu
On Fri, Jul 07, 2023 at 01:20:48PM -0700, Steve Sistare wrote: > Modify migrate_add_blocker and migrate_del_blocker to take an Error ** > reason. This allows migration to own the Error object, so that if > an error occurs, migration code can free the Error and clear the client > handle,

Re: [PATCH v2 6/6] hw/virtio/meson: Rename softmmu_virtio_ss[] -> system_virtio_ss[]

2023-07-07 Thread Richard Henderson
On 7/7/23 16:17, Philippe Mathieu-Daudé wrote: 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. Signed-off-by: Philippe

Re: [PATCH v2 5/6] hw/virtio: Build vhost-vdpa.o once

2023-07-07 Thread Richard Henderson
On 7/7/23 16:17, Philippe Mathieu-Daudé wrote: 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. Signed-off-by: Philippe Mathieu-Daudé ---

Re: [PATCH v2 4/6] hw/virtio/vhost-vdpa: Use target-agnostic qemu_target_page_mask()

2023-07-07 Thread Richard Henderson
On 7/7/23 16:17, Philippe Mathieu-Daudé wrote: +int page_size = qemu_target_page_size(); +int page_mask = page_size - 1; TARGET_PAGE_MASK is -TARGET_PAGE_SIZE. r~

Re: [PATCH v2 3/6] hw/virtio/vhost-vdpa: Inline TARGET_PAGE_ALIGN() macro

2023-07-07 Thread Richard Henderson
On 7/7/23 16:17, Philippe Mathieu-Daudé wrote: Use TARGET_PAGE_SIZE to calculate TARGET_PAGE_ALIGN (see the rationale in previous commits). Signed-off-by: Philippe Mathieu-Daudé --- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Richard

Re: [PATCH 2/4] linux-user: Fix accept4(SOCK_NONBLOCK) syscall

2023-07-07 Thread Helge Deller
On 7/7/23 22:15, Richard Henderson wrote: On 7/7/23 14:19, Helge Deller wrote: The accept4() syscall takes two flags only: SOCK_NONBLOCK and SOCK_CLOEXEC. Even the real Linux kernel returns -EINVAL if any other bits have been set. Change the implementation of accept4() to recognize those two

[PATCH v2 16/24] linux-user: Use page_find_range_empty for mmap_find_vma_reserved

2023-07-07 Thread Richard Henderson
Use the interval tree to find empty space, rather than probing each page in turn. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 52 ++- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c

[PATCH v2 13/24] linux-user: Rewrite mmap_frag

2023-07-07 Thread Richard Henderson
Use 'last' variables instead of 'end' variables. Always zero MAP_ANONYMOUS fragments, which we previously failed to do if they were not writable; early exit in case we allocate a new page from the kernel, known zeros. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 123

[PATCH v2 15/24] bsd-user: Use page_find_range_empty for mmap_find_vma_reserved

2023-07-07 Thread Richard Henderson
Use the interval tree to find empty space, rather than probing each page in turn. Cc: Warner Losh Cc: Kyle Evans Signed-off-by: Richard Henderson --- bsd-user/mmap.c | 48 +++- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git

Re: [PATCH v2 2/6] hw/virtio: Propagate page_mask to vhost_vdpa_section_end()

2023-07-07 Thread Richard Henderson
On 7/7/23 16:17, Philippe Mathieu-Daudé wrote: Propagate TARGET_PAGE_MASK (see the previous commit for rationale). Signed-off-by: Philippe Mathieu-Daudé --- hw/virtio/vhost-vdpa.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) Reviewed-by: Richard Henderson r~

[PATCH v2 03/24] linux-user/strace: Expand struct flags to hold a mask

2023-07-07 Thread Richard Henderson
A zero bit value does not make sense -- it must relate to some field in some way. Define FLAG_BASIC with a build-time sanity check. Adjust FLAG_GENERIC and FLAG_TARGET to use it. Add FLAG_GENERIC_MASK and FLAG_TARGET_MASK. Fix up the existing flag definitions for build errors. Reviewed-by: Alex

[PATCH v2 22/24] accel/tcg: Return bool from page_check_range

2023-07-07 Thread Richard Henderson
Replace the 0/-1 result with true/false. Invert the sense of the test of all callers. Document the function. Signed-off-by: Richard Henderson --- bsd-user/qemu.h| 2 +- include/exec/cpu-all.h | 13 - linux-user/qemu.h | 2 +-

[PATCH v2 09/24] linux-user: Implement MAP_FIXED_NOREPLACE

2023-07-07 Thread Richard Henderson
Signed-off-by: Richard Henderson --- linux-user/mmap.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 12275593a1..b2e130e700 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -508,7 +508,7 @@ abi_long

Re: [PATCH v2 1/6] hw/virtio: Propagate page_mask to vhost_vdpa_listener_skipped_section()

2023-07-07 Thread Richard Henderson
On 7/7/23 16:17, Philippe Mathieu-Daudé wrote: 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

[PATCH v2 18/24] linux-user: Rewrite mmap_reserve

2023-07-07 Thread Richard Henderson
Use 'last' variables instead of 'end' variables; be careful about avoiding overflow. Assert that the mmap succeeded. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 68 +-- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git

[PATCH v2 21/24] accel/tcg: Accept more page flags in page_check_range

2023-07-07 Thread Richard Henderson
Only PAGE_WRITE needs special attention, all others can be handled as we do for PAGE_READ. Adjust the mask. Signed-off-by: Richard Henderson --- accel/tcg/user-exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index

[PATCH v2 23/24] linux-user: Remove can_passthrough_madvise

2023-07-07 Thread Richard Henderson
Use page_check_range instead, which uses the interval tree instead of checking each page individually. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 24 +++- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index

[PATCH v2 2/2] accel/tcg: Always lock pages before translation

2023-07-07 Thread Richard Henderson
We had done this for user-mode by invoking page_protect within the translator loop. Extend this to handle system mode as well. Move page locking out of tb_link_page. Reported-by: Liren Wei Reported-by: Richard W.M. Jones Signed-off-by: Richard Henderson Tested-by: Richard W.M. Jones ---

[PATCH v2 14/24] accel/tcg: Introduce page_find_range_empty

2023-07-07 Thread Richard Henderson
Use the interval tree to locate an unused range in the VM. Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 15 +++ accel/tcg/user-exec.c | 41 + 2 files changed, 56 insertions(+) diff --git a/include/exec/cpu-all.h

[PATCH v2 19/24] linux-user: Rename mmap_reserve to mmap_reserve_or_unmap

2023-07-07 Thread Richard Henderson
If !reserved_va, munmap instead and assert success. Update all callers. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 29 - 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 6b030dac42..8c90a690dd

[PATCH v2 10/24] linux-user: Split out target_to_host_prot

2023-07-07 Thread Richard Henderson
Split out from validate_prot_to_pageflags, as there is not one single host_prot for the entire range. We need to adjust prot for every host page that overlaps multiple guest pages. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- linux-user/mmap.c | 77

[PATCH v2 17/24] linux-user: Use 'last' instead of 'end' in target_mmap

2023-07-07 Thread Richard Henderson
Complete the transition within the mmap functions to a formulation that does not overflow at the end of the address space. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 45 +++-- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git

[PATCH v2 1/2] accel/tcg: Split out cpu_exec_longjmp_cleanup

2023-07-07 Thread Richard Henderson
Share the setjmp cleanup between cpu_exec_step_atomic and cpu_exec_setjmp. Reviewed-by: Richard W.M. Jones Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 43 +++ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git

[PATCH v2 24/24] linux-user: Simplify target_madvise

2023-07-07 Thread Richard Henderson
The trivial length 0 check can be moved up, simplifying some of the other cases. The end < start test is handled by guest_range_valid_untagged. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git

[PATCH v2 12/24] linux-user: Rewrite target_mprotect

2023-07-07 Thread Richard Henderson
Use 'last' variables instead of 'end' variables. When host page size > guest page size, detect when adjacent host pages have the same protection and merge that expanded host range into fewer syscalls. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 106

[PATCH v2 02/24] linux-user: Fix formatting of mmap.c

2023-07-07 Thread Richard Henderson
Fix all checkpatch.pl errors within mmap.c. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mmap.c | 199 -- 1 file changed, 122 insertions(+), 77 deletions(-) diff --git

[PATCH v2 08/24] bsd-user: Use page_check_range_empty for MAP_EXCL

2023-07-07 Thread Richard Henderson
The previous check returned -1 when any page within [start, start+len) is unmapped, not when all are unmapped. Cc: Warner Losh Cc: Kyle Evans Signed-off-by: Richard Henderson --- bsd-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd-user/mmap.c

[PATCH v2 05/24] linux-user: Split TARGET_PROT_* out of syscall_defs.h

2023-07-07 Thread Richard Henderson
Move the values into the per-target target_mman.h headers Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/aarch64/target_mman.h | 3 +++ linux-user/generic/target_mman.h | 4 linux-user/mips/target_mman.h| 2 ++

[PATCH v2 07/24] accel/tcg: Introduce page_check_range_empty

2023-07-07 Thread Richard Henderson
Examine the interval tree to validate that a region has no existing mappings. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/exec/cpu-all.h | 12 accel/tcg/user-exec.c | 7 +++ 2 files changed, 19 insertions(+) diff --git a/include/exec/cpu-all.h

[PATCH v2 11/24] linux-user: Widen target_mmap offset argument to off_t

2023-07-07 Thread Richard Henderson
We build with _FILE_OFFSET_BITS=64, so off_t = off64_t = uint64_t. With an extra cast, this fixes emulation of mmap2, which could overflow the computation of the full value of offset. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- linux-user/user-mmap.h | 2 +-

[PATCH v2 20/24] linux-user: Simplify target_munmap

2023-07-07 Thread Richard Henderson
All of the guest to host page adjustment is handled by mmap_reserve_or_unmap; there is no need to duplicate that. There are no failure modes for munmap after alignment and guest address range have been validated. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 47

[PATCH v2 00/24] linux-user: mmap range fixes

2023-07-07 Thread Richard Henderson
Changes for v2: * Apply r-b, * Fix bsd-user typo. r~ Richard Henderson (24): linux-user: Use assert in mmap_fork_start linux-user: Fix formatting of mmap.c linux-user/strace: Expand struct flags to hold a mask linux-user: Split TARGET_MAP_* out of syscall_defs.h linux-user: Split

[PATCH v2 01/24] linux-user: Use assert in mmap_fork_start

2023-07-07 Thread Richard Henderson
Assert is preferred over if+abort for the error message. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index

[PATCH v2 06/24] linux-user: Populate more bits in mmap_flags_tbl

2023-07-07 Thread Richard Henderson
Fix translation of TARGET_MAP_SHARED and TARGET_MAP_PRIVATE, which are types not single bits. Add TARGET_MAP_SHARED_VALIDATE, TARGET_MAP_SYNC, TARGET_MAP_NONBLOCK, TARGET_MAP_POPULATE, TARGET_MAP_FIXED_NOREPLACE, and TARGET_MAP_UNINITIALIZED. Update strace to match. Reviewed-by: Alex Bennée

[PATCH v2 04/24] linux-user: Split TARGET_MAP_* out of syscall_defs.h

2023-07-07 Thread Richard Henderson
Move the values into the per-target target_mman.h headers Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- linux-user/alpha/target_mman.h | 13 + linux-user/generic/target_mman.h | 54 linux-user/hppa/target_mman.h| 10

Re: [PATCH v4 29/37] target/riscv: Use aesenc_SB_SR_AK

2023-07-07 Thread Philippe Mathieu-Daudé
On 3/7/23 12:05, Richard Henderson wrote: This implements the AES64ES instruction. Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v4 23/37] target/i386: Use aesdec_ISB_ISR_IMC_AK

2023-07-07 Thread Philippe Mathieu-Daudé
On 3/7/23 12:05, Richard Henderson wrote: This implements the AESDEC instruction. Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v4 30/37] target/riscv: Use aesdec_ISB_ISR_AK

2023-07-07 Thread Philippe Mathieu-Daudé
On 3/7/23 12:05, Richard Henderson wrote: This implements the AES64DS instruction. Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/target/riscv/crypto_helper.c b/target/riscv/crypto_helper.c index

Re: [PATCH v4 32/37] target/riscv: Use aesenc_SB_SR_MC_AK

2023-07-07 Thread Philippe Mathieu-Daudé
On 3/7/23 12:05, Richard Henderson wrote: This implements the AES64ESM instruction. Signed-off-by: Richard Henderson --- target/riscv/crypto_helper.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v3 1/4] QGA VSS: Add wrapper to send log to debugger and stderr

2023-07-07 Thread Konstantin Kostiuk
On Fri, Jul 7, 2023 at 6:36 PM Philippe Mathieu-Daudé wrote: > On 7/7/23 16:24, Konstantin Kostiuk wrote: > > > > > > On Fri, Jul 7, 2023 at 1:33 PM Philippe Mathieu-Daudé > > wrote: > > > > On 7/7/23 11:22, Konstantin Kostiuk wrote: > > > Signed-off-by:

[PATCH V4] migration: simplify blockers

2023-07-07 Thread Steve Sistare
Modify migrate_add_blocker and migrate_del_blocker to take an Error ** reason. This allows migration to own the Error object, so that if an error occurs, migration code can free the Error and clear the client handle, simplifying client code. This is also a pre-requisite for future patches that

Re: [PATCH 4/4] linux-user: Improve strace output of pread64() and pwrite64()

2023-07-07 Thread Richard Henderson
On 7/7/23 14:19, Helge Deller wrote: Make the strace look nicer for those two syscalls. Signed-off-by: Helge Deller --- linux-user/strace.c| 19 +++ linux-user/strace.list | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH 2/4] linux-user: Fix accept4(SOCK_NONBLOCK) syscall

2023-07-07 Thread Richard Henderson
On 7/7/23 14:19, Helge Deller wrote: The accept4() syscall takes two flags only: SOCK_NONBLOCK and SOCK_CLOEXEC. Even the real Linux kernel returns -EINVAL if any other bits have been set. Change the implementation of accept4() to recognize those two values only, instead of using the

Re: [PATCH 1/4] linux-user: Fix fcntl64() to return O_LARGEFILE for 32-bit targets

2023-07-07 Thread Richard Henderson
On 7/7/23 14:19, Helge Deller wrote: On a 64-bit host, O_LARGEFILE has the value 0. When running a 32-bit guest on a 64-bit host, fcntl64(F_GETFL) should return with the O_LARGEFILE flag set, because the 64-bit host supports large files unconditionally. The flag translation should have happened

Re: [PATCH 3/4] linux-user: Fix mmap2() syscall on 32-bit targets to allow file mapping beyond 4GB

2023-07-07 Thread Richard Henderson
On 7/7/23 21:04, Helge Deller wrote: On 7/7/23 21:47, Richard Henderson wrote: On 7/7/23 14:19, Helge Deller wrote: The mmap2() syscall allows 32-bit guests to specify the offset into a file in page units (instead of bytes, as done by mmap(2)). On physical machines this allows 32-bit

Re: [PATCH 3/4] linux-user: Fix mmap2() syscall on 32-bit targets to allow file mapping beyond 4GB

2023-07-07 Thread Helge Deller
On 7/7/23 21:47, Richard Henderson wrote: On 7/7/23 14:19, Helge Deller wrote: The mmap2() syscall allows 32-bit guests to specify the offset into a file in page units (instead of bytes, as done by mmap(2)). On physical machines this allows 32-bit applications to map such parts of large files

Re: [PATCH v4 22/37] target/i386: Use aesenc_SB_SR_MC_AK

2023-07-07 Thread Philippe Mathieu-Daudé
On 3/7/23 12:05, Richard Henderson wrote: This implements the AESENC instruction. Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v4 17/37] target/ppc: Use aesenc_SB_SR_MC_AK

2023-07-07 Thread Philippe Mathieu-Daudé
On 3/7/23 12:05, Richard Henderson wrote: This implements the VCIPHER instruction. Reviewed-by: Daniel Henrique Barboza Signed-off-by: Richard Henderson --- target/ppc/int_helper.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v4 21/37] target/i386: Use aesdec_IMC

2023-07-07 Thread Philippe Mathieu-Daudé
On 3/7/23 12:05, Richard Henderson wrote: This implements the AESIMC instruction. Signed-off-by: Richard Henderson --- target/i386/ops_sse.h | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH 3/4] linux-user: Fix mmap2() syscall on 32-bit targets to allow file mapping beyond 4GB

2023-07-07 Thread Richard Henderson
On 7/7/23 14:19, Helge Deller wrote: The mmap2() syscall allows 32-bit guests to specify the offset into a file in page units (instead of bytes, as done by mmap(2)). On physical machines this allows 32-bit applications to map such parts of large files which are stored beyond the 4GB limit.

Re: [PATCH v2 1/2] target/riscv: Remove redundant check in pmp_is_locked

2023-07-07 Thread Daniel Henrique Barboza
On 7/3/23 23:33, Ruibo Lu wrote: the check of top PMP is redundant and will not influence the return value, so consider remove it Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis Signed-off-by: Ruibo Lu --- I believe we might want to add: Resolves:

Re: [PULL 00/15] Net patches

2023-07-07 Thread Richard Henderson
On 7/7/23 10:06, Jason Wang wrote: The following changes since commit 97c81ef4b8e203d9620fd46e7eb77004563e3675: Merge tag 'pull-9p-20230706' ofhttps://github.com/cschoenebeck/qemu into staging (2023-07-06 18:19:42 +0100) are available in the git repository at:

Re: [Qemu-devel] [PATCH] acpi: Add emulated sleep button

2023-07-07 Thread Annie.li
Hi Igor, Revisiting this thread and have more questions, please clarify, thank you! On 9/20/2021 3:53 AM, Igor Mammedov wrote: On Fri, 6 Aug 2021 16:18:09 -0400 "Annie.li" wrote: Hello Igor, This is an old patch, but it does what we need. I am getting a little bit lost about not

Re: [PATCH v4 00/37] crypto: Provide aes-round.h and host accel

2023-07-07 Thread Daniel Henrique Barboza
Richard, On 7/3/23 07:04, Richard Henderson wrote: Inspired by Ard Biesheuvel's RFC patches for accelerating AES under emulation, provide a set of primitives that maps between the guest and host fragments. Changes for v4: * Fix typo in AESState (Max Chou) * Define AES_SH/ISH as macros

Re: [RFC PATCH 6/9] ui/gtk: Add a new parameter to assign connectors/monitors to GFX VCs

2023-07-07 Thread Kim, Dongwon
On 7/7/2023 7:07 AM, Markus Armbruster wrote: "Kim, Dongwon" writes: Hi Markus, So I've worked on the description of this param. Can you check if this new version looks ok? # @connectors:  List of physical monitor/connector names where the GTK #           windows containing the respective

[PATCH 0/1] vdpa: Fix possible use-after-free for VirtQueueElement

2023-07-07 Thread Hawkins Jiawei
This patch fixes the problem that vhost_vdpa_net_handle_ctrl_avail() mistakenly frees the `elem`, even if it fails to forward the CVQ command to vdpa device. This can result in a use-after-free TestStep 1. test the patch using vp-vdpa device - For L0 guest, boot QEMU with

[PATCH 1/1] vdpa: Fix possible use-after-free for VirtQueueElement

2023-07-07 Thread Hawkins Jiawei
QEMU uses vhost_handle_guest_kick() to forward guest's available buffers to the vdpa device in SVQ avail ring. In vhost_handle_guest_kick(), a `g_autofree` `elem` is used to iterate through the available VirtQueueElements. This `elem` is then passed to `svq->ops->avail_handler`, specifically to

Re: [PATCH v6] ppc: Enable 2nd DAWR support on p10

2023-07-07 Thread Shivaprasad G Bhat
On 7/7/23 19:54, Cédric Le Goater wrote: On 7/7/23 13:59, Greg Kurz wrote: Hi Daniel and Shiva ! On Fri, 7 Jul 2023 08:09:47 -0300 Daniel Henrique Barboza wrote: This one was a buzzer shot. Indeed ! :-) I would have appreciated some more time to re-assess my R-b tag on this 2 year old

Re: [PATCH v6] ppc: Enable 2nd DAWR support on p10

2023-07-07 Thread Shivaprasad G Bhat
On 7/7/23 17:52, Daniel Henrique Barboza wrote: On 7/7/23 08:59, Greg Kurz wrote: Hi Daniel and Shiva ! On Fri, 7 Jul 2023 08:09:47 -0300 Daniel Henrique Barboza wrote: This one was a buzzer shot. Indeed ! :-) I would have appreciated some more time to re-assess my R-b tag on this 2

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

2023-07-07 Thread Mark Kanda
Hi Stefano, On 7/5/2023 7:36 AM, Stefano Garzarella wrote: Hi Mark, On Wed, Jul 05, 2023 at 07:28:05AM -0500, Mark Kanda wrote: On 7/5/2023 2:15 AM, Stefano Garzarella wrote: This reverts commit 8cc5583abe6419e7faaebc9fbd109f34f4c850f2. That commit causes several problems in Linux as

[PATCH] tests/tcg/s390x: Fix test-svc with clang

2023-07-07 Thread Ilya Leoshkevich
clang does not support expressions involving symbols in instructions like lghi yet, so building hello-s390x-asm.S with it fails. Move the expression to the literal pool and load it from there. Reported-by: Thomas Huth Fixes: be4a4cb42961 ("tests/tcg/s390x: Test single-stepping SVC")

Re: [PATCH v3 1/4] QGA VSS: Add wrapper to send log to debugger and stderr

2023-07-07 Thread Philippe Mathieu-Daudé
On 7/7/23 16:24, Konstantin Kostiuk wrote: On Fri, Jul 7, 2023 at 1:33 PM Philippe Mathieu-Daudé > wrote: On 7/7/23 11:22, Konstantin Kostiuk wrote: > Signed-off-by: Konstantin Kostiuk mailto:kkost...@redhat.com>> > --- >   

[PATCH v3 0/7] Vhost-vdpa Shadow Virtqueue _F_CTRL_RX commands support

2023-07-07 Thread Hawkins Jiawei
This series enables shadowed CVQ to intercept rx commands related to VIRTIO_NET_F_CTRL_RX feature through shadowed CVQ, update the virtio NIC device model so qemu send it in a migration, and the restore of that rx state in the destination. Note that this patch should be based on [1] patch "vdpa:

[PATCH v3 1/7] vdpa: Use iovec for vhost_vdpa_net_load_cmd()

2023-07-07 Thread Hawkins Jiawei
According to VirtIO standard, "The driver MUST follow the VIRTIO_NET_CTRL_MAC_TABLE_SET command by a le32 number, followed by that number of non-multicast MAC addresses, followed by another le32 number, followed by that number of multicast addresses." Considering that these data is not stored in

[PATCH v3 7/7] vdpa: Allow VIRTIO_NET_F_CTRL_RX in SVQ

2023-07-07 Thread Hawkins Jiawei
Enable SVQ with VIRTIO_NET_F_CTRL_RX feature. Signed-off-by: Hawkins Jiawei Acked-by: Eugenio Pérez --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index a4ff6c52b7..0994836f8c 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@

[PATCH v3 4/7] vhost: Fix false positive out-of-bounds

2023-07-07 Thread Hawkins Jiawei
QEMU uses vhost_svq_translate_addr() to translate addresses between the QEMU's virtual address and the SVQ IOVA. In order to validate this translation, QEMU checks whether the translated range falls within the mapped range. Yet the problem is that, the value of `needle_last`, which is calculated

[PATCH v3 5/7] vdpa: Accessing CVQ header through its structure

2023-07-07 Thread Hawkins Jiawei
We can access the CVQ header through `struct virtio_net_ctrl_hdr`, instead of accessing it through a `uint8_t` pointer, which improves the code's readability and maintainability. Signed-off-by: Hawkins Jiawei --- net/vhost-vdpa.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff

[PATCH v3 3/7] vdpa: Restore packet receive filtering state relative with _F_CTRL_RX feature

2023-07-07 Thread Hawkins Jiawei
This patch introduces vhost_vdpa_net_load_rx_mode() and vhost_vdpa_net_load_rx() to restore the packet receive filtering state in relation to VIRTIO_NET_F_CTRL_RX feature at device's startup. Signed-off-by: Hawkins Jiawei --- v3: - return early if mismatch the condition suggested by Eugenio

[PATCH v3 2/7] vdpa: Restore MAC address filtering state

2023-07-07 Thread Hawkins Jiawei
This patch refactors vhost_vdpa_net_load_mac() to restore the MAC address filtering state at device's startup. Signed-off-by: Hawkins Jiawei --- v3: - return early if mismatch the condition suggested by Eugenio v2:

  1   2   3   >