Re: [PATCH 26/33] linux-user: Deprecate and disable -p pagesize

2023-08-20 Thread Philippe Mathieu-Daudé
On 18/8/23 19:12, Richard Henderson wrote: This option controls the host page size. From the mis-usage in our own testsuite, this is easily confused with guest page size. The only thing that occurs when changing the host page size is that stuff breaks, because one cannot actually change the hos

Re: [PATCH 25/33] tests/tcg: Extend file in linux-madvise.c

2023-08-20 Thread Philippe Mathieu-Daudé
On 18/8/23 19:12, Richard Henderson wrote: When guest page size > host page size, this test can fail due to the SIGBUS protection hack. Avoid this by making sure that the file size is at least one guest page. Visible with alpha guest on x86_64 host. Signed-off-by: Richard Henderson --- test

Re: [PATCH 19/33] linux-user: Split out mmap_end

2023-08-20 Thread Philippe Mathieu-Daudé
On 18/8/23 19:12, Richard Henderson wrote: Use a subroutine instead of a goto within target_mmap__locked. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 69 +++ 1 file changed, 40 insertions(+), 29 deletions(-) Reviewed-by: Philippe Mat

Re: [PATCH 17/33] linux-user: Move some mmap checks outside the lock

2023-08-20 Thread Philippe Mathieu-Daudé
On 18/8/23 19:12, Richard Henderson wrote: Basic validation of operands does not require the lock. Hoist them from target_mmap__locked back into target_mmap. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 107 +++--- 1 file changed, 53 insert

Re: [PATCH 16/33] linux-user: Split out target_mmap__locked

2023-08-20 Thread Philippe Mathieu-Daudé
On 18/8/23 19:12, Richard Henderson wrote: All "goto fail" may be transformed to "return -1". Signed-off-by: Richard Henderson --- linux-user/mmap.c | 62 ++- 1 file changed, 35 insertions(+), 27 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH 1/4] linux-user: Move shmat and shmdt implementations to mmap.c

2023-08-20 Thread Philippe Mathieu-Daudé
On 20/8/23 22:44, Richard Henderson wrote: Rename from do_* to target_*. Fix some minor checkpatch errors. Signed-off-by: Richard Henderson --- linux-user/user-mmap.h | 4 ++ linux-user/mmap.c | 138 +++ linux-user/syscall.c | 143 ++

Re: [PATCH] target/arm: Fix 64-bit SSRA

2023-08-20 Thread Philippe Mathieu-Daudé
On 21/8/23 04:20, Richard Henderson wrote: Typo applied byte-wise shift instead of double-word shift. Cc: qemu-sta...@nongnu.org Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779 Signed-off-by: Richard Henderson --- target/

Re: [PATCH] softfloat: Handle m68k extended precision denormals properly

2023-08-20 Thread Philippe Mathieu-Daudé
On 21/8/23 02:32, Richard Henderson wrote: Motorola treats denormals with explicit integer bit set as having unbiased exponent 0, unlike Intel which treats it as having unbiased exponent 1 (like all other IEEE formats). Add a flag on FloatFmt to differentiate the behaviour. Reported-by: Keith P

Re: [PATCH v6 00/12] Add VIRTIO sound card

2023-08-20 Thread Manos Pitsidianakis
Hello Volker, On Sun, 20 Aug 2023 14:46, Volker Rümelin wrote: I tested the virtio-sound-pci device. It seems the device works unreliably. Audio playback has a lot of dropouts. I can actually hear my mouse moving around. Audio recording with audacity doesn't work. Either recording stops with

Re: [PATCH v10 00/10] migration: Modify 'migrate' and 'migrate-incoming' QAPI commands for migration

2023-08-20 Thread Het Gala
Hi qemu-devel community, A gentle reminder and request for all migration maintainers - Peter, Juan, Dr. Gilbert and others too for review of the patchset series. Received reviewed-by from Daniel on migration implementation patches but need final approval from migration maintainers before getti

Re: [PATCH v6 01/12] Add virtio-sound device stub

2023-08-20 Thread Manos Pitsidianakis
Hello Volker! On Sun, 20 Aug 2023 12:33, Volker Rümelin wrote: I think the virtio-snd.c code, the trace events and the Kconfig VIRTIO_SND should be moved to hw/audio. The code for nearly all audio devices is in this directory. This would be similar to other virtio devices. E.g. the virtio-scs

Re: [PATCH v5 1/5] ebpf: Added eBPF map update through mmap.

2023-08-20 Thread Jason Wang
On Fri, Aug 18, 2023 at 10:08 AM Andrew Melnichenko wrote: > > Hi all, > > On Wed, Aug 16, 2023 at 4:16 AM Jason Wang wrote: > > > > On Mon, Aug 14, 2023 at 4:36 PM Andrew Melnichenko > > wrote: > > > > > > Hi, all. > > > > > > I've researched an issue a bit. And what can we do? > > > In the ca

Re: [PATCH] softfloat: Handle m68k extended precision denormals properly

2023-08-20 Thread Keith Packard via
> That does look like a correct change. I'll fold it in. > Please let us know if you encounter anything else. Thanks so much. With these fixes, all of my long double math library tests in picolibc are passing now (once I fixed a bunch of additional m68k-denorm related math library bugs). That in

[PATCH v4 2/2] migration: Update error description outside migration.c

2023-08-20 Thread Tejus GK
A few code paths exist in the source code,where a migration is marked as failed via MIGRATION_STATUS_FAILED, but the failure happens outside of migration.c In such cases, an error_report() call is made, however the current MigrationState is never updated with the error description, and hence clien

[PATCH v4 1/2] migration/vmstate: Introduce vmstate_save_state_with_err

2023-08-20 Thread Tejus GK
Currently, a few code paths exist in the function vmstate_save_state_v, which ultimately leads to a migration failure. However, an update in the current MigrationState for the error description is never done. vmstate.c somehow doesn't seem to allow the use of migrate_set_error due to some dependen

[PATCH v4 0/2] Update error description outside migration.c

2023-08-20 Thread Tejus GK
Hi everyone, This is the rebased version of the v3 patchset, please review, thanks. Regards Tejus Changelog: v4: - Rebase on master v3: - Rebase on master v2: - Rebase on master Tejus GK (2): migration/vmstate: Introduce vmstate_save_state_with_err migration: Update error description ou

Re: [PATCH] softfloat: Handle m68k extended precision denormals properly

2023-08-20 Thread Richard Henderson
On 8/20/23 18:24, Keith Packard wrote: Motorola treats denormals with explicit integer bit set as having unbiased exponent 0, unlike Intel which treats it as having unbiased exponent 1 (like all other IEEE formats). Thanks for having a look at this. Your patch fixes a couple of cases, but the

Re: [PATCH] target/arm: Fix 64-bit SSRA

2023-08-20 Thread Richard Henderson
On 8/20/23 19:20, Richard Henderson wrote: Typo applied byte-wise shift instead of double-word shift. Cc: qemu-sta...@nongnu.org Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779 Bah. #1737 Signed-off-by: Richard Henderso

[PATCH] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr

2023-08-20 Thread Richard Henderson
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779 Signed-off-by: Richard Henderson --- target/ppc/cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c index 424f2e1741..48257f7225 100644 --- a/target/ppc/cpu.c +++ b/target/ppc/cpu.c @@ -59,6 +59

[PATCH] target/arm: Fix 64-bit SSRA

2023-08-20 Thread Richard Henderson
Typo applied byte-wise shift instead of double-word shift. Cc: qemu-sta...@nongnu.org Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779 Signed-off-by: Richard Henderson --- target/arm/tcg/translate.c | 2 +- 1 file changed, 1

Re: [PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread bibo mao
在 2023/8/21 09:29, Jiajie Chen 写道: > > On 2023/8/21 09:24, bibo mao wrote: >> + Add xianglai >> >> Good catch. >> >> In theory, it is logical id, and it can be not equal to physical id. >> However it must be equal to _UID in cpu dsdt table which is missing >> now. > > Yes, the logical id can b

Re: [PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread Jiajie Chen
On 2023/8/21 09:24, bibo mao wrote: + Add xianglai Good catch. In theory, it is logical id, and it can be not equal to physical id. However it must be equal to _UID in cpu dsdt table which is missing now. Yes, the logical id can be different from index. The spec says: If the processor struc

Re: [PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread bibo mao
+ Add xianglai Good catch. In theory, it is logical id, and it can be not equal to physical id. However it must be equal to _UID in cpu dsdt table which is missing now. Can pptt table parse error be fixed if cpu dsdt table is added? Regards Bibo Mao 在 2023/8/20 18:56, Jiajie Chen 写道: > In hw/

Re: [PATCH] softfloat: Handle m68k extended precision denormals properly

2023-08-20 Thread Keith Packard via
> Motorola treats denormals with explicit integer bit set as > having unbiased exponent 0, unlike Intel which treats it as > having unbiased exponent 1 (like all other IEEE formats). Thanks for having a look at this. Your patch fixes a couple of cases, but there are further adventures that await

[PATCH] softfloat: Handle m68k extended precision denormals properly

2023-08-20 Thread Richard Henderson
Motorola treats denormals with explicit integer bit set as having unbiased exponent 0, unlike Intel which treats it as having unbiased exponent 1 (like all other IEEE formats). Add a flag on FloatFmt to differentiate the behaviour. Reported-by: Keith Packard Signed-off-by: Richard Henderson ---

Funny results with long double denorms on m68k

2023-08-20 Thread Keith Packard via
I'm doing some testing of an fmal implementation and discovered some "odd" results on m68k where the emulated 80-bit FPU is generating results that don't match how GCC computes things. Assuming gcc is correct, this means there are some subtle bugs in how qemu is handling denorms for this platform.

[PATCH 2/4] linux-user: Use WITH_MMAP_LOCK_GUARD in target_{shmat, shmdt}

2023-08-20 Thread Richard Henderson
Move the CF_PARALLEL setting outside of the mmap lock. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 98 ++- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 3aeacd1ecd..f45b2d307c 1

[PATCH 1/4] linux-user: Move shmat and shmdt implementations to mmap.c

2023-08-20 Thread Richard Henderson
Rename from do_* to target_*. Fix some minor checkpatch errors. Signed-off-by: Richard Henderson --- linux-user/user-mmap.h | 4 ++ linux-user/mmap.c | 138 +++ linux-user/syscall.c | 143 ++--- 3 files changed, 14

[PATCH 3/4] linux-user: Fix shmdt

2023-08-20 Thread Richard Henderson
If the shm region is not mapped at shmaddr, EINVAL. Do not unmap the region until the syscall succeeds. Use mmap_reserve_or_unmap to preserve reserved_va semantics. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) di

[PATCH 4/4] linux-user: Track shm regions with an interval tree

2023-08-20 Thread Richard Henderson
Remove the fixed size shm_regions[] array. Remove references when other mappings completely remove or replace a region. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 81 +++ 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/lin

[PATCH 0/4] linux-user: shmat/shmdt improvements

2023-08-20 Thread Richard Henderson
A couple of points I noticed with bsd-user copying linux-user: (1) Make sure to remap memory for reserved_va (2) Use something better than an array for tracking shmat. r~ Richard Henderson (4): linux-user: Move shmat and shmdt implementations to mmap.c linux-user: Use WITH_MMAP_LOCK_GUARD

Re: [PATCH 22/22] Add stubs for vadvise(), sbrk() and sstk()

2023-08-20 Thread Warner Losh
On Sun, Aug 20, 2023 at 9:35 AM Richard Henderson < richard.hender...@linaro.org> wrote: > On 8/19/23 02:48, Karim Taha wrote: > > From: Stacey Son > > > > The above system calls are not supported by qemu. > > > > Signed-off-by: Stacey Son > > Signed-off-by: Karim Taha > > --- > > bsd-user/bs

Re: [PATCH 22/22] Add stubs for vadvise(), sbrk() and sstk()

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: From: Stacey Son The above system calls are not supported by qemu. Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.h| 21 + bsd-user/freebsd/os-syscall.c | 12 2 files changed, 33 in

Re: [PATCH 21/22] Implement shmat(2) and shmdt(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.h| 72 +++ bsd-user/freebsd/os-syscall.c | 8 2 files changed, 80 insertions(+) diff --git a/bsd-user/bsd-mem.h

Re: [PATCH 20/22] Implement shmctl(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: +switch (cmd) { +case IPC_STAT: +case IPC_SET: +if (target_to_host_shmid_ds(&dsarg, buff)) { +return -TARGET_EFAULT; +} +ret = get_errno(shmctl(shmid, cmd, &dsarg)); +if (host_to_target_shmid_ds(buff, &dsa

Re: [PATCH 18/22] Implement shm_open(2)

2023-08-20 Thread Richard Henderson
On 8/20/23 08:04, Richard Henderson wrote: On 8/19/23 02:48, Karim Taha wrote: +#define SHM_PATH(p) ((p) == SHM_ANON ? (p) : path(p)) +    if (arg1 == (uintptr_t)SHM_ANON) { +    p = SHM_ANON; +    } else { +    p = lock_user_string(arg1); +    if (p == NULL) { +    return -T

Re: [PATCH 19/22] Implement shm_unlink(2) and shmget(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.h| 23 +++ bsd-user/freebsd/os-syscall.c | 8 2 files changed, 31 insertions(+) Reviewed-by: Richard Henderson r~

Re: [PATCH 19/22] Implement shm_unlink(2) and shmget(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.h| 23 +++ bsd-user/freebsd/os-syscall.c | 8 2 files changed, 31 insertions(+) Reviewed-by: Richard Henderson r~

Re: [PATCH 18/22] Implement shm_open(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: +#define SHM_PATH(p) ((p) == SHM_ANON ? (p) : path(p)) +if (arg1 == (uintptr_t)SHM_ANON) { +p = SHM_ANON; +} else { +p = lock_user_string(arg1); +if (p == NULL) { +return -TARGET_EFAULT; +} +} +ret = g

Re: [PATCH 17/22] Implement do_obreak function

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: From: Stacey Son Co-authored-by: Mikaël Urankar Signed-off-by: Mikaël Urankar Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.h| 85 +++ bsd-user/freebsd/os-syscall.c | 7 +++ 2 fi

Re: [PATCH 16/22] Implement mincore(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:48, Karim Taha wrote: +/* mincore(2) */ +static inline abi_long do_bsd_mincore(abi_ulong target_addr, abi_ulong len, +abi_ulong target_vec) +{ +abi_long ret; +void *p, *a; + +a = lock_user(VERIFY_WRITE, target_addr, len, 0); +if (a == NULL) { +return

Re: [PATCH 15/22] Implement mlock(2), munlock(2), mlockall(2), munlockall(2), madvise(2), minherit(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: +static inline abi_long do_bsd_mlock(abi_long arg1, abi_long arg2) +{ +return get_errno(mlock(g2h_untagged(arg1), arg2)); +} + +/* munlock(2) */ +static inline abi_long do_bsd_munlock(abi_long arg1, abi_long arg2) +{ +return get_errno(munlock(g2h_untagg

Re: [PATCH 15/22] Implement mlock(2), munlock(2), mlockall(2), munlockall(2), madvise(2), minherit(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 21:37, Warner Losh wrote: +/* madvise(2) */ +static inline abi_long do_bsd_madvise(abi_long arg1, abi_long arg2, +        abi_long arg3) +{ +    /* +     * A straight passthrough may not be safe because qemu sometimes +     * turns private file-backed mappin

Re: [PATCH 14/22] Implement msync(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: +static inline abi_long do_bsd_msync(abi_long addr, abi_long len, abi_long flags) +{ +if (!access_ok(VERIFY_WRITE, addr, len)) { I think this check is wrong. There's nothing in the kernel that requires writability, or even that the entire range be mapp

Re: [PATCH 12/22] Implement mmap(2) and munmap(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: +case TARGET_FREEBSD_NR_mmap: /* mmap(2) */ +ret = do_bsd_mmap(cpu_env, arg1, arg2, arg3, arg4, arg5, arg6, arg7, + arg8); Indentation. Align after (. Reviewed-by: Richard Henderson r~

Re: [PATCH 13/22] Implement mprotect(2)

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.h| 7 +++ bsd-user/freebsd/os-syscall.c | 4 2 files changed, 11 insertions(+) Reviewed-by: Richard Henderson r~

Re: [PATCH 11/22] Introduce bsd-mem.h to the source tree

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: From: Stacey Son To preserve the copyright notice and help with the 'Author' info for subsequent changes to the file. Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.h| 65 +++ bsd-user/f

Re: [PATCH 10/22] Implement shmid_ds conversion between host and target.

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: +if (!lock_user_struct(VERIFY_WRITE, target_sd, target_addr, 0)) { +return -TARGET_EFAULT; +} +if (host_to_target_ipc_perm(target_addr, &(host_sd->shm_perm))) { +return -TARGET_EFAULT; +} While it works, ideally you wouldn't do

Re: [PATCH 09/22] Implement ipc_perm conversion between host and target.

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha --- bsd-user/bsd-mem.c | 41 + 1 file changed, 41 insertions(+) Reviewed-by: Richard Henderson r~

Re: [PATCH 08/22] Implement target_set_brk function in bsd-mem.c instead of os-syscall.c

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: From: Stacey Son Co-authored-by: Mikaël Urankar Signed-off-by: Mikaël Urankar Signed-off-by: Karim Taha --- bsd-user/bsd-mem.c| 38 +++ bsd-user/freebsd/os-syscall.c | 4 2 files changed, 38 insertions(

Re: [PATCH 07/22] Add bsd-mem.c to meson.build

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: --- bsd-user/bsd-mem.c | 0 bsd-user/meson.build | 1 + 2 files changed, 1 insertion(+) create mode 100644 bsd-user/bsd-mem.c diff --git a/bsd-user/bsd-mem.c b/bsd-user/bsd-mem.c new file mode 100644 index 00..e69de29bb2 diff --git a/bsd-user/m

Re: [PATCH 06/22] Implement shm_rename(2) system call

2023-08-20 Thread Richard Henderson
On 8/19/23 02:47, Karim Taha wrote: From: Kyle Evans Signed-off-by: Kyle Evans Signed-off-by: Karim Taha --- bsd-user/freebsd/os-misc.h| 24 bsd-user/freebsd/os-syscall.c | 6 ++ 2 files changed, 30 insertions(+) Reviewed-by: Richard Henderson r~

Re: [PATCH] bsd-user: Add missing break after do_bsd_preadv

2023-08-20 Thread Richard Henderson
On 8/19/23 21:54, Warner Losh wrote: Without it, we'd call preadv, then write with weird parameters, which is clearly not ideal... Signed-off-by: Warner Losh --- bsd-user/freebsd/os-syscall.c | 1 + 1 file changed, 1 insertion(+) Reviewed-by: Richard Henderson r~

Re: [PATCH v6 00/12] Add VIRTIO sound card

2023-08-20 Thread Volker Rümelin
Hi Manos, I tested the virtio-sound-pci device. It seems the device works unreliably. Audio playback has a lot of dropouts. I can actually hear my mouse moving around. Audio recording with audacity doesn't work. Either recording stops with an error or the recorded stream is silent. I'll see

[PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread Jiajie Chen
In hw/acpi/aml-build.c:build_pptt() function, the code assumes that the ACPI processor id equals to the cpu index, for example if we have 8 cpus, then the ACPI processor id should be in range 0-7. However, in hw/loongarch/acpi-build.c:build_madt() function we broke the assumption. If we have 8 cpu

Re: [PATCH v6 01/12] Add virtio-sound device stub

2023-08-20 Thread Volker Rümelin
Hi Manos, Add a new VIRTIO device for the virtio sound device id. Functionality will be added in the following commits. I think the virtio-snd.c code, the trace events and the Kconfig VIRTIO_SND should be moved to hw/audio. The code for nearly all audio devices is in this directory. This wou

Re: [PATCH v6 02/12] Add virtio-sound-pci device

2023-08-20 Thread Volker Rümelin
Hi Manos, I see a core dump with this code on my host. I don't use the -audio command line argument and the audiodev_id variable is NULL. You can't use a global audiodev_id variable because each guest can have more than one virtio-sound-pci device and each virtio-sound-pci device may be conne