[PATCH v6 14/23] bsd-user: Implement msync(2)

2023-09-25 Thread Karim Taha
From: Stacey Son Co-authored-by: Kyle Evans Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed-off-by: Karim Taha Reviewed-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-mem.h| 11 +++ bsd-user/freebsd/os-syscall.c | 4 2 files changed,

[PATCH v6 09/23] bsd-user: Implement ipc_perm conversion between host and target.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson --- bsd-user/bsd-mem.c | 25 + 1 file changed, 25 insertions(+) diff --git a/bsd-user/bsd-mem.c b/bsd-user/bsd-mem.c index 8834ab2e58..46cda8eb5c 100644 ---

[PATCH v5 15/28] bsd-user: Implement several get/set system calls:

2023-09-25 Thread Karim Taha
From: Stacey Son getpid(2), getppid(2), getpgrp(2) setreuid(2), setregid(2) getuid(2), geteuid(2), getgid(2), getegid(2), getpgid(2) setuid(2), seteuid(2), setgid(2), setegid(2), setpgid(2) Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner

[PATCH v6 05/23] bsd-user: Implement shm_open2(2) system call

2023-09-25 Thread Karim Taha
Signed-off-by: Kyle Evans Signed-off-by: Karim Taha Reviewed-by: Richard Henderson --- bsd-user/freebsd/os-misc.h| 42 +++ bsd-user/freebsd/os-syscall.c | 10 + 2 files changed, 52 insertions(+) diff --git a/bsd-user/freebsd/os-misc.h

[PATCH v6 17/23] bsd-user: Implement mincore(2)

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson --- bsd-user/bsd-mem.h| 23 +++ bsd-user/freebsd/os-syscall.c | 4 2 files changed, 27 insertions(+) diff --git a/bsd-user/bsd-mem.h b/bsd-user/bsd-mem.h

[PATCH v5 00/28] bsd-user: Implement freebsd process related system calls.

2023-09-25 Thread Karim Taha
Karim Taha (3): bsd-user: define TARGET_RFSPAWN for rfork to use vfork(2) semantics, and fix RLIM_INFINITY bsd-user: Implement get_filename_from_fd. bsd-user: Implement execve(2) and fexecve(2) system calls. Kyle Evans (1): bsd-user: Get number of cpus. Stacey Son (24):

[PATCH v6 13/23] bsd-user: Implement mprotect(2)

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/bsd-mem.h| 7 +++ bsd-user/freebsd/os-syscall.c | 4 2 files changed, 11 insertions(+) diff --git a/bsd-user/bsd-mem.h

[PATCH v5 02/28] bsd-user: Define procctl(2) related structs

2023-09-25 Thread Karim Taha
From: Stacey Son Implement procctl flags and related structs: struct target_procctl_reaper_status struct target_procctl_reaper_pidinfo struct target_procctl_reaper_pids struct target_procctl_reaper_kill Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson

[PATCH v6 07/23] bsd-user: Add bsd-mem.c to meson.build

2023-09-25 Thread Karim Taha
Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- 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

[PATCH v6 10/23] bsd-user: Implement shmid_ds conversion between host and target.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson --- bsd-user/bsd-mem.c | 47 ++ 1 file changed, 47 insertions(+) diff --git a/bsd-user/bsd-mem.c b/bsd-user/bsd-mem.c index 46cda8eb5c..2ab1334b70

[PATCH v6 15/23] bsd-user: Implement mlock(2), munlock(2), mlockall(2), munlockall(2), minherit(2)

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson --- bsd-user/bsd-mem.h| 37 +++ bsd-user/freebsd/os-syscall.c | 20 +++ 2 files changed, 57 insertions(+) diff --git

[PATCH v6 08/23] bsd-user: Implement target_set_brk function in bsd-mem.c instead of os-syscall.c

2023-09-25 Thread Karim Taha
From: Stacey Son The definitions and variables names matches the corresponding ones in linux-user/syscall.c, for making later implementation of do_obreak easier Co-authored-by: Mikaël Urankar Signed-off-by: Mikaël Urankar Signed-off-by: Karim Taha Reviewed-by: Warner Losh Reviewed-by:

[PATCH v6 12/23] bsd-user: Implement mmap(2) and munmap(2)

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsd-mem.h| 20 bsd-user/freebsd/os-syscall.c | 9 + 2 files changed, 29 insertions(+) diff --git

[PATCH v6 16/23] bsd-user: Implment madvise(2) to match the linux-user implementation.

2023-09-25 Thread Karim Taha
Signed-off-by: Karim Taha Reviewed-by: Richard Henderson --- bsd-user/bsd-mem.h| 53 +++ bsd-user/freebsd/os-syscall.c | 4 +++ bsd-user/syscall_defs.h | 2 ++ 3 files changed, 59 insertions(+) diff --git a/bsd-user/bsd-mem.h

[PATCH v5 25/28] bsd-user: Implement pdgetpid(2) and the undocumented setugid.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.h| 23 +++ bsd-user/freebsd/os-syscall.c | 8 2 files changed, 31 insertions(+) diff --git

[PATCH v5 01/28] bsd-user: define TARGET_RFSPAWN for rfork to use vfork(2) semantics, and fix RLIM_INFINITY

2023-09-25 Thread Karim Taha
RLIM_INFINITY on FreeBSD, OpenBSD and NetBSD has value of ~(1<<63), caculated one way or another. Signed-off-by: Kyle Evans Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/syscall_defs.h | 8 1 file changed, 4 insertions(+), 4

[PATCH v5 14/28] bsd-user: Implement getrlimit(2) and setrlimit(2)

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/bsd-proc.h | 59 +++ bsd-user/freebsd/os-syscall.c | 8 + 2 files changed, 67 insertions(+) diff --git

[PATCH v5 24/28] bsd-user: Implement setloginclass(2) and getloginclass(2) system calls.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.h| 32 bsd-user/freebsd/os-syscall.c | 8 2 files changed, 40 insertions(+) diff --git a/bsd-user/freebsd/os-proc.h

[PATCH v5 03/28] bsd-user: Implement host_to_target_siginfo.

2023-09-25 Thread Karim Taha
From: Stacey Son Used in wait6 system call Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/signal-common.h | 1 + bsd-user/signal.c| 6 ++ 2 files changed, 7 insertions(+) diff --git

[PATCH v5 08/28] bsd-user: Implement host_to_target_rusage and host_to_target_wrusage.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/bsd-proc.c | 54 + 1 file changed, 54 insertions(+) diff --git a/bsd-user/bsd-proc.c b/bsd-user/bsd-proc.c

[PATCH v5 20/28] bsd-user: Implement freebsd_exec_common, used in implementing execve/fexecve.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.c | 177 + bsd-user/main.c| 2 +- bsd-user/qemu.h| 1 + 3 files changed, 179 insertions(+), 1 deletion(-)

[PATCH v5 12/28] bsd-user: Implement umask(2), setlogin(2) and getlogin(2)

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Warner Losh --- bsd-user/bsd-proc.h | 39 +++ bsd-user/freebsd/os-syscall.c | 12 +++ 2 files changed, 51 insertions(+) diff --git a/bsd-user/bsd-proc.h

[PATCH v5 27/28] bsd-user: Implement rfork(2) system call.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.h| 39 +++ bsd-user/freebsd/os-syscall.c | 4 2 files changed, 43 insertions(+) diff --git

[PATCH v5 28/28] bsd-user: Implement pdfork(2) system call.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Acked-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.h| 32 bsd-user/freebsd/os-syscall.c | 4 2 files changed, 36 insertions(+) diff --git

[PATCH v5 22/28] bsd-user: Implement execve(2) and fexecve(2) system calls.

2023-09-25 Thread Karim Taha
Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.h| 49 +++ bsd-user/freebsd/os-syscall.c | 11 +++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode

[PATCH v5 26/28] bsd-user: Implement fork(2) and vfork(2) system calls.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.h| 34 ++ bsd-user/freebsd/os-syscall.c | 8 2 files changed, 42 insertions(+) diff --git

[PATCH v5 09/28] bsd-user: Implement host_to_target_waitstatus conversion.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/bsd-proc.c | 17 + 1 file changed, 17 insertions(+) diff --git a/bsd-user/bsd-proc.c b/bsd-user/bsd-proc.c index aa386ff482..19f6efe1f7

[PATCH v5 21/28] bsd-user: Implement procctl(2) along with necessary conversion functions.

2023-09-25 Thread Karim Taha
From: Stacey Son Implement t2h_procctl_cmd, h2t_reaper_status, h2t_reaper_pidinfo and h2t/t2h reaper_kill conversion functions. Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.c| 222 ++

[PATCH v5 17/28] bsd-user: Add stubs for profil(2), ktrace(2), utrace(2) and ptrace(2).

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/bsd-proc.h | 28 bsd-user/freebsd/os-syscall.c | 16 2 files changed, 44 insertions(+) diff

[PATCH v5 06/28] bsd-user: Implement target_to_host_resource conversion function

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Warner Losh --- bsd-user/bsd-proc.c | 40 bsd-user/bsd-proc.h | 4 bsd-user/meson.build | 6 ++ 3 files changed, 50 insertions(+) create mode 100644

[PATCH v5 16/28] bsd-user: Implement get/set[resuid/resgid/sid] and issetugid.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/bsd-proc.h | 76 +++ bsd-user/freebsd/os-syscall.c | 28 + 2 files changed, 104 insertions(+) diff

[PATCH v5 23/28] bsd-user: Implement wait4(2) and wait6(2) system calls.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Warner Losh --- bsd-user/freebsd/os-proc.h| 84 +++ bsd-user/freebsd/os-syscall.c | 15 +++ 2 files changed, 99 insertions(+) diff --git a/bsd-user/freebsd/os-proc.h

[PATCH v5 04/28] bsd-user: Add freebsd_exec_common and do_freebsd_procctl to qemu.h.

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/qemu.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index d9507137cc..41c7bd31d3 100644 ---

[PATCH v5 19/28] bsd-user: Implement get_filename_from_fd.

2023-09-25 Thread Karim Taha
Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/freebsd/meson.build | 1 + bsd-user/freebsd/os-proc.c | 80 2 files changed, 81 insertions(+) create mode 100644

[PATCH v5 05/28] bsd-user: add extern declarations for bsd-proc.c conversion functions

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/qemu-bsd.h | 38 ++ 1 file changed, 38 insertions(+) create mode 100644 bsd-user/qemu-bsd.h diff --git

[PATCH v5 13/28] bsd-user: Implement getrusage(2).

2023-09-25 Thread Karim Taha
From: Stacey Son Signed-off-by: Stacey Son Signed-off-by: Karim Taha Reviewed-by: Richard Henderson Reviewed-by: Warner Losh --- bsd-user/bsd-proc.h | 13 + bsd-user/freebsd/os-syscall.c | 4 2 files changed, 17 insertions(+) diff --git a/bsd-user/bsd-proc.h

[PATCH v5 10/28] bsd-user: Get number of cpus.

2023-09-25 Thread Karim Taha
From: Kyle Evans Signed-off-by: Kyle Evans Signed-off-by: Karim Taha Reviewed-by: Warner Losh --- bsd-user/bsd-proc.c | 24 bsd-user/bsd-proc.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/bsd-user/bsd-proc.c b/bsd-user/bsd-proc.c index

Re: [PATCH] virtio: remove unnecessary thread fence while reading next descriptor

2023-09-25 Thread Ilya Maximets
On 9/25/23 16:32, Stefan Hajnoczi wrote: > On Fri, 25 Aug 2023 at 13:02, Ilya Maximets wrote: >> >> It was supposed to be a compiler barrier and it was a compiler barrier >> initially called 'wmb' (??) when virtio core support was introduced. >> Later all the instances of 'wmb' were switched to

[PATCH v4 03/19] target/riscv: move riscv_cpu_validate_set_extensions() to tcg-cpu.c

2023-09-25 Thread Daniel Henrique Barboza
This function is the core of the RISC-V validations for TCG CPUs, and it has a lot going on. Functions in cpu.c were made public to allow them to be used by the KVM accelerator class later on. 'cpu_cfg_ext_get_min_version()' is notably hard to move it to another file due to its dependency with

[PATCH v4 18/19] target/riscv/cpu.c: export isa_edata_arr[]

2023-09-25 Thread Daniel Henrique Barboza
This array will be read by the TCG accel class, allowing it to handle priv spec verifications on its own. The array will remain here in cpu.c because it's also used by the riscv,isa string function. To export it we'll finish it with an empty element since ARRAY_SIZE() won't work outside of cpu.c.

[PATCH v4 11/19] target/riscv: introduce KVM AccelCPUClass

2023-09-25 Thread Daniel Henrique Barboza
Add a KVM accelerator class like we did with TCG. The difference is that, at least for now, we won't be using a realize() implementation for this accelerator. We'll start by assiging kvm_riscv_cpu_add_kvm_properties(), renamed to kvm_cpu_instance_init(), as a 'cpu_instance_init' implementation.

[PATCH v4 04/19] target/riscv: move riscv_tcg_ops to tcg-cpu.c

2023-09-25 Thread Daniel Henrique Barboza
Move the remaining of riscv_tcg_ops now that we have a working realize() implementation. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 58

[PATCH v4 12/19] target/riscv: move KVM only files to kvm subdir

2023-09-25 Thread Daniel Henrique Barboza
Move the files to a 'kvm' dir to promote more code separation between accelerators and making our lives easier supporting build options such as --disable-tcg. Rename kvm.c to kvm-cpu.c to keep it in line with its TCG counterpart. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones

[PATCH v4 06/19] target/riscv: move 'host' CPU declaration to kvm.c

2023-09-25 Thread Daniel Henrique Barboza
This CPU only exists if we're compiling with KVM so move it to the kvm specific file. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Andrew Jones Reviewed-by: LIU Zhiwei Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 15 ---

[PATCH v4 09/19] target/riscv: make riscv_add_satp_mode_properties() public

2023-09-25 Thread Daniel Henrique Barboza
This function is used for both accelerators. Make it public, and call it from kvm_riscv_cpu_add_kvm_properties(). This will make it easier to split KVM specific code for the KVM accelerator class in the next patch. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Reviewed-by:

[PATCH v4 08/19] target/riscv: move riscv_cpu_add_kvm_properties() to kvm.c

2023-09-25 Thread Daniel Henrique Barboza
We'll introduce the KVM accelerator class with a 'cpu_instance_init' implementation that is going to be invoked during the common riscv_cpu_post_init() (via accel_cpu_instance_init()). This instance_init will execute KVM exclusive code that TCG doesn't care about, such as adding KVM specific

[PATCH v4 16/19] target/riscv/cpu.c: make misa_ext_cfgs[] 'const'

2023-09-25 Thread Daniel Henrique Barboza
The array isn't marked as 'const' because we're initializing their elements in riscv_cpu_add_misa_properties(), 'name' and 'description' fields. In a closer look we can see that we're not using these 2 fields after creating the MISA properties. And we can create the properties by using

[PATCH v4 19/19] target/riscv/cpu: move priv spec functions to tcg-cpu.c

2023-09-25 Thread Daniel Henrique Barboza
Priv spec validation is TCG specific. Move it to the TCG accel class. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé --- target/riscv/cpu.c | 38 --

[PATCH v4 05/19] target/riscv/cpu.c: add .instance_post_init()

2023-09-25 Thread Daniel Henrique Barboza
All generic CPUs call riscv_cpu_add_user_properties(). The 'max' CPU calls riscv_init_max_cpu_extensions(). Both can be moved to a common instance_post_init() callback, implemented in riscv_cpu_post_init(), called by all CPUs. The call order then becomes: riscv_cpu_init() -> cpu_init() of each

[PATCH v4 10/19] target/riscv: remove kvm-stub.c

2023-09-25 Thread Daniel Henrique Barboza
This file is not needed for some time now. Both kvm_riscv_reset_vcpu() and kvm_riscv_set_irq() have public declarations in kvm_riscv.h and are wrapped in 'if kvm_enabled()' blocks that the compiler will rip it out in non-KVM builds. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Alistair

[PATCH v4 14/19] target/riscv/cpu.c: export set_misa()

2023-09-25 Thread Daniel Henrique Barboza
We'll move riscv_init_max_cpu_extensions() to tcg-cpu.c in the next patch and set_misa() needs to be usable from there. Rename it to riscv_cpu_set_misa() and make it public. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Andrew Jones Reviewed-by:

[PATCH v4 17/19] target/riscv/tcg: move riscv_cpu_add_misa_properties() to tcg-cpu.c

2023-09-25 Thread Daniel Henrique Barboza
All code related to MISA TCG properties is also moved. At this point, all TCG properties handling is done in tcg-cpu.c, all KVM properties handling is done in kvm-cpu.c. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis --- target/riscv/cpu.c

[PATCH v4 15/19] target/riscv/tcg: introduce tcg_cpu_instance_init()

2023-09-25 Thread Daniel Henrique Barboza
tcg_cpu_instance_init() will be the 'cpu_instance_init' impl for the TCG accelerator. It'll be called from within riscv_cpu_post_init(), via accel_cpu_instance_init(), similar to what happens with KVM. In fact, to preserve behavior, the implementation will be similar to what riscv_cpu_post_init()

[PATCH v4 01/19] target/riscv: introduce TCG AccelCPUClass

2023-09-25 Thread Daniel Henrique Barboza
target/riscv/cpu.c needs to handle all possible accelerators (TCG and KVM at this moment) during both init() and realize() time. This forces us to resort to a lot of "if tcg" and "if kvm" throughout the code, which isn't wrong, but can get cluttered over time. Splitting acceleration specific code

[PATCH v4 00/19] riscv: split TCG/KVM accelerators from cpu.c

2023-09-25 Thread Daniel Henrique Barboza
Hi, This new version has a simple copyright change in the tcg-cpu.c file, patch 01, suggested by Alistair in v3. No other changes made. All patches acked/reviewed. Changes from v3: - patch 1: - use cpu.c copyright notice in tcg-cpu.c - v3 link:

[PATCH v4 02/19] target/riscv: move riscv_cpu_realize_tcg() to TCG::cpu_realizefn()

2023-09-25 Thread Daniel Henrique Barboza
riscv_cpu_realize_tcg() was added to allow TCG cpus to have a different realize() path during the common riscv_cpu_realize(), making it a good choice to start moving TCG exclusive code to tcg-cpu.c. Rename it to tcg_cpu_realizefn() and assign it as a implementation of accel::cpu_realizefn().

[PATCH v4 13/19] target/riscv/kvm: do not use riscv_cpu_add_misa_properties()

2023-09-25 Thread Daniel Henrique Barboza
riscv_cpu_add_misa_properties() is being used to fill the missing KVM MISA properties but it is a TCG helper that was adapted to do so. We'll move it to tcg-cpu.c in the next patches, meaning that KVM needs to fill the remaining MISA properties on its own. Do not use

[PATCH v4 07/19] target/riscv/cpu.c: mark extensions arrays as 'const'

2023-09-25 Thread Daniel Henrique Barboza
We'll need to export these arrays to the accelerator classes in the next patches. Mark them as 'const' now because they should not be modified at runtime. Note that 'riscv_cpu_options' will also be exported, but can't be marked as 'const', because the properties are changed via

[PATCH v3 2/4] target/ppc: Add recording of taken branches to BHRB

2023-09-25 Thread Glenn Miles
This commit continues adding support for the Branch History Rolling Buffer (BHRB) as is provided starting with the P8 processor and continuing with its successors. This commit is limited to the recording and filtering of taken branches. The following changes were made: - Enabled functionality

[PATCH v3 4/4] target/ppc: Add migration support for BHRB

2023-09-25 Thread Glenn Miles
Adds migration support for Branch History Rolling Buffer (BHRB) internal state. Signed-off-by: Glenn Miles --- target/ppc/machine.c | 21 + 1 file changed, 21 insertions(+) diff --git a/target/ppc/machine.c b/target/ppc/machine.c index d42e475bfb..ba328ad5e2 100644 ---

[PATCH v3 3/4] target/ppc: Add clrbhrb and mfbhrbe instructions

2023-09-25 Thread Glenn Miles
Add support for the clrbhrb and mfbhrbe instructions. Since neither instruction is believed to be critical to performance, both instructions were implemented using helper functions. Access to both instructions is controlled by bits in the HFSCR (for privileged state) and MMCR0 (for problem

[PATCH v3 0/4] Add BHRB Facility Support

2023-09-25 Thread Glenn Miles
This is a series of patches for adding support for the Branch History Rolling Buffer (BHRB) facility. This was added to the Power ISA starting with version 2.07. Changes were subsequently made in version 3.1 to limit BHRB recording to instructions run in problem state only and to add a control

[PATCH v3 1/4] target/ppc: Add new hflags to support BHRB

2023-09-25 Thread Glenn Miles
This commit is preparatory to the addition of Branch History Rolling Buffer (BHRB) functionality, which is being provided today starting with the P8 processor. BHRB uses several SPR register fields to control whether or not a branch instruction's address (and sometimes target address) should be

Re: [PATCH v2 08/20] asc: generate silence if FIFO empty but engine still running

2023-09-25 Thread Laurent Vivier
Le 09/09/2023 à 11:48, Mark Cave-Ayland a écrit : MacOS (un)helpfully leaves the FIFO engine running even when all the samples have been written to the hardware, and expects the FIFO status flags and IRQ to be updated continuously. There is an additional problem in that not all audio backends

Re: [PATCH v23 01/20] CPU topology: extend with s390 specifics

2023-09-25 Thread Markus Armbruster
Nina Schoetterl-Glausch writes: > On Tue, 2023-09-19 at 14:47 +0200, Markus Armbruster wrote: >> Nina Schoetterl-Glausch writes: >> >> > From: Pierre Morel >> > >> > S390 adds two new SMP levels, drawers and books to the CPU >> > topology. >> > S390 CPUs have specific topology features like

Re: [PATCH 04/31] docs: mark CRIS support as deprecated

2023-09-25 Thread Edgar E. Iglesias
On Mon, Sep 25, 2023 at 7:00 PM Alex Bennée wrote: > > Daniel P. Berrangé writes: > > > On Mon, Sep 25, 2023 at 03:48:27PM +0100, Alex Bennée wrote: > >> This might be premature but while streamling the avocado tests I > >> realised the only tests we have are "check-tcg" ones. The aging > >>

RE: [PATCH RFC V2 00/37] Support of Virtual CPU Hotplug for ARMv8 Arch

2023-09-25 Thread Salil Mehta via
Hello, Please ignore this series. Forgot to add RFC V2 Tag in all of the patches. Will send again shortly. Sorry for inconvenience. Thanks Salil. > From: Salil Mehta > Sent: Monday, September 25, 2023 6:12 PM > To: qemu-devel@nongnu.org; qemu-...@nongnu.org > Cc: Salil Mehta ; m...@kernel.org;

[PATCH RFC V2 00/37] Support of Virtual CPU Hotplug for ARMv8 Arch

2023-09-25 Thread Salil Mehta via
PROLOGUE To assist in review and set the right expectations from this RFC, please first read below sections *APPENDED AT THE END* of this cover letter, 1. Important *DISCLAIMER* [Section (X)] 2. Work presented at KVMForum Conference (slides available) [Section (V)F] 3. Organization of

Re: [PATCH v7 6/7] qapi: Add HV_BALLOON_STATUS_REPORT event and its QMP query command

2023-09-25 Thread Maciej S. Szmigiero
On 25.09.2023 13:49, Markus Armbruster wrote: "Maciej S. Szmigiero" writes: From: "Maciej S. Szmigiero" Used by the hv-balloon driver for (optional) guest memory status reports. Signed-off-by: Maciej S. Szmigiero [...] static void hv_balloon_handle_unballoon_response(HvBalloon

Re: [PATCH 08/31] configure: ensure dependency for cross-compile setup

2023-09-25 Thread Peter Maydell
On Mon, 25 Sept 2023 at 17:45, Alex Bennée wrote: > > > Paolo Bonzini writes: > > > On 9/25/23 16:48, Alex Bennée wrote: > >> If we update configure we should make sure we regenerate all the > >> compiler details. We should also ensure those details are upto date > >> before building the TCG

Re: [PATCH 08/31] configure: ensure dependency for cross-compile setup

2023-09-25 Thread Paolo Bonzini
Il lun 25 set 2023, 18:45 Alex Bennée ha scritto: > Paolo Bonzini writes: > > On 9/25/23 16:48, Alex Bennée wrote: > >> echo "HOST_GDB_SUPPORTS_ARCH=y" >> "$config_target_mak" > >> fi > >> + echo "$config_target_mak: configure" >> Makefile.prereqs > > > > This in

Re: [PATCH v2 01/20] q800-glue.c: convert to Resettable interface

2023-09-25 Thread Laurent Vivier
Le 09/09/2023 à 11:48, Mark Cave-Ayland a écrit : Convert the GLUE device to 3-phase reset. The legacy method doesn't do anything that's invalid in the hold phase, so the conversion is simple and not a behaviour change. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé ---

Re: [PATCH 04/31] docs: mark CRIS support as deprecated

2023-09-25 Thread Alex Bennée
Alex Bennée writes: > This might be premature but while streamling the avocado tests I > realised the only tests we have are "check-tcg" ones. The aging > fedora-criss-cross image works well enough for developers but can't be > used in CI as we need supported build platforms to build QEMU. > >

Re: [PATCH 04/31] docs: mark CRIS support as deprecated

2023-09-25 Thread Alex Bennée
Daniel P. Berrangé writes: > On Mon, Sep 25, 2023 at 03:48:27PM +0100, Alex Bennée wrote: >> This might be premature but while streamling the avocado tests I >> realised the only tests we have are "check-tcg" ones. The aging >> fedora-criss-cross image works well enough for developers but

Re: [PATCH v1 3/4] hw/arm/virt-acpi-build: patch guest SRAT for NUMA nodes

2023-09-25 Thread Jonathan Cameron via
On Mon, 25 Sep 2023 13:00:43 -0300 Jason Gunthorpe wrote: > On Mon, Sep 25, 2023 at 03:53:51PM +0100, Jonathan Cameron wrote: > > On Mon, 25 Sep 2023 11:03:28 -0300 > > Jason Gunthorpe wrote: > > > > > On Mon, Sep 25, 2023 at 02:54:40PM +0100, Jonathan Cameron wrote: > > > > > > >

Re: [PATCH 00/19] QEMU: CXL mailbox rework and features

2023-09-25 Thread Jonathan Cameron via
On Mon, 25 Sep 2023 17:11:05 +0100 Jonathan Cameron wrote: > Based on: [PATCH] hw/cxl: Fix local variable shadowing of cap_hdrs > Based on: [PATCH v2 0/3] hw/cxl: Add dummy ACPI QTG DSM Missed one. Based on: [PATCH v4 0/4] hw/cxl: Support emulating 4 HDM decoders throughout topology > Based

Re: [PATCH 08/31] configure: ensure dependency for cross-compile setup

2023-09-25 Thread Alex Bennée
Paolo Bonzini writes: > On 9/25/23 16:48, Alex Bennée wrote: >> If we update configure we should make sure we regenerate all the >> compiler details. We should also ensure those details are upto date >> before building the TCG tests. >> Signed-off-by: Alex Bennée >> --- >> configure | 2 ++

Re: [PATCH v2 13/15] hw/qdev: Remove DEFINE_PROP_DMAADDR() and 'hw/qdev-dma.h'

2023-09-25 Thread Paolo Bonzini
On 9/25/23 13:03, Markus Armbruster wrote: +David Markus Armbruster writes: Philippe Mathieu-Daudé writes: DEFINE_PROP_DMAADDR() is only used once. Since it doesn't add much value, simply remove it, along with the header defining it. Signed-off-by: Philippe Mathieu-Daudé

Re: Help wanted for enabling -Wshadow=local

2023-09-25 Thread Warner Losh
On Sat, Sep 23, 2023 at 6:33 AM Peter Maydell wrote: > On Fri, 22 Sept 2023 at 19:59, Warner Losh wrote: > > The third one, though, makes me ask the question: When should we > > pass in cpu_env to functions and when should we use the global value? > > > > I have a lot of changes that look like:

Re: [PATCH 04/31] docs: mark CRIS support as deprecated

2023-09-25 Thread Daniel P . Berrangé
On Mon, Sep 25, 2023 at 03:48:27PM +0100, Alex Bennée wrote: > This might be premature but while streamling the avocado tests I > realised the only tests we have are "check-tcg" ones. The aging > fedora-criss-cross image works well enough for developers but can't be > used in CI as we need

Re: [PATCH 0/4] aspeed: Clean up local variable shadowing

2023-09-25 Thread Cédric Le Goater
On 9/23/23 09:13, Markus Armbruster wrote: Cédric Le Goater writes: On 9/22/23 20:20, Philippe Mathieu-Daudé wrote: On 22/9/23 17:59, Cédric Le Goater wrote: Hello, Here are cleanups for local variable shadowing warnings in aspeed models. Joel, Andrew, Could you please double check patch

Re: [PATCH 04/31] docs: mark CRIS support as deprecated

2023-09-25 Thread Daniel P . Berrangé
On Mon, Sep 25, 2023 at 03:48:27PM +0100, Alex Bennée wrote: > This might be premature but while streamling the avocado tests I > realised the only tests we have are "check-tcg" ones. The aging > fedora-criss-cross image works well enough for developers but can't be > used in CI as we need

Re: [PATCH v2] hw/sd/sdhci: Block Size Register bits [14:12] is lost

2023-09-25 Thread Philippe Mathieu-Daudé
On 22/9/23 04:03, Lu Gao wrote: Block Size Register bits [14:12] is SDMA Buffer Boundary, it is missed in register write, but it is needed in SDMA transfer. e.g. it will be used in sdhci_sdma_transfer_multi_blocks to calculate boundary_ variables. Missing this field will cause wrong operation

[PATCH 19/19] hw/cxl: Add tunneled command support to mailbox for switch cci/mctp.

2023-09-25 Thread Jonathan Cameron via
The implementation of tunneling makes the choice that our Type 3 device is a Logical Device (LD) of a Multi-Logical Device (MLD) that just happens to only have one LD for now. Tunneling is supported from a Switch Mailbox CCI or via MCTP over I2C connected to the switch mctp CCI via an outer level

[PATCH 18/19] hw/cxl: Add dummy security state get

2023-09-25 Thread Jonathan Cameron via
Needed to allow the santize comamnds to be tested with proposed Linux Kernel support. Default value + no control of the security state will work for now. Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 17 + 1 file changed, 17 insertions(+) diff --git

[PATCH 17/19] hw/cxl/type3: Cleanup multiple CXL_TYPE3() calls in read/write functions

2023-09-25 Thread Jonathan Cameron via
From: Gregory Price Call CXL_TYPE3 once at top of function to avoid multiple invocations. Signed-off-by: Gregory Price Signed-off-by: Jonathan Cameron --- hw/mem/cxl_type3.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c

[PATCH 16/19] hw/cxl: Add support for device sanitation

2023-09-25 Thread Jonathan Cameron via
From: Davidlohr Bueso Make use of the background operations through the sanitize command, per CXL 3.0 specs. Traditionally run times can be rather long, depending on the size of the media. Estimate times based on: https://pmem.io/documents/NVDIMM_DSM_Interface-V1.8.pdf Signed-off-by:

[PATCH 15/19] hw/cxl/mbox: Wire up interrupts for background completion

2023-09-25 Thread Jonathan Cameron via
From: Davidlohr Bueso Notify when the background operation is done. Note that for now background commands are only supported on the main Type 3 mailbox. Signed-off-by: Davidlohr Bueso Signed-off-by: Jonathan Cameron --- include/hw/cxl/cxl_device.h | 1 + hw/cxl/cxl-device-utils.c | 10

[PATCH 14/19] hw/cxl/mbox: Add support for background operations

2023-09-25 Thread Jonathan Cameron via
From: Davidlohr Bueso Support background commands in the mailbox, and update cmd_infostat_bg_op_sts() accordingly. This patch does not implement mbox interrupts upon completion, so the kernel driver must rely on polling to know when the operation is done. Signed-off-by: Davidlohr Bueso

[PATCH 12/19] hw/cxl: Implement Physical Ports status retrieval

2023-09-25 Thread Jonathan Cameron via
Add this command for both the Switch CCI and the MCTP CCI found in switch upstream ports. Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 121 + 1 file changed, 121 insertions(+) diff --git a/hw/cxl/cxl-mailbox-utils.c

[PATCH 13/19] hw/cxl/mbox: Add Get Background Operation Status Command

2023-09-25 Thread Jonathan Cameron via
For now, provide this command on type 3 main mailbox only. Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 33 + 1 file changed, 33 insertions(+) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 26fb0192a9..d9785f324a

[PATCH 11/19] hw/pci-bridge/cxl_downstream: Set default link width and link speed

2023-09-25 Thread Jonathan Cameron via
Without these being set the PCIE Link Capabilities register has invalid values in these two fields. Signed-off-by: Jonathan Cameron --- hw/pci-bridge/cxl_downstream.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/hw/pci-bridge/cxl_downstream.c

[PATCH 10/19] hw/cxl: Add a switch mailbox CCI function

2023-09-25 Thread Jonathan Cameron via
CXL switch CCIs were added in CXL r3.0. They are a PCI function, identified by class code that provides a CXL mailbox (identical to that previously defined for CXL type 3 memory devices) over which various FM-API commands may be used. Whilst the intent of this feature is enable switch control from

[PATCH 09/19] hw/cxl/mbox: Add Physical Switch Identify command.

2023-09-25 Thread Jonathan Cameron via
Enable it for MCTP CCI for the switch. Will shortly be enabled for switch CCI as well. Signed-off-by: Jonathan Cameron --- include/hw/cxl/cxl.h | 6 hw/cxl/cxl-mailbox-utils.c | 65 ++ hw/pci-bridge/cxl_downstream.c | 4 +-- 3 files changed,

[PATCH 08/19] docs: cxl: Add example commandline for MCTP CXL CCIs

2023-09-25 Thread Jonathan Cameron via
Add initial documentation for the MCTP over I2C management device. At current time this can only be used with the Aspeed I2C controller which is only available in aspeed SoCs, though can be added to other emulated boards. Signed-off-by: Jonathan Cameron --- docs/system/devices/cxl.rst | 27

[PATCH 07/19] hw/cxl/mbox: Add Information and Status / Identify command

2023-09-25 Thread Jonathan Cameron via
Add this command that is only available via out of band CCIs. It replicates information that can be discovered inband via PCI config space. Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 48 ++ 1 file changed, 48 insertions(+) diff --git

Re: [PATCH 08/31] configure: ensure dependency for cross-compile setup

2023-09-25 Thread Paolo Bonzini
On 9/25/23 16:48, Alex Bennée wrote: If we update configure we should make sure we regenerate all the compiler details. We should also ensure those details are upto date before building the TCG tests. Signed-off-by: Alex Bennée --- configure | 2 ++ 1 file changed, 2 insertions(+) diff

[PATCH 06/19] hw/cxl/i2c_mctp_cxl: Initial device emulation

2023-09-25 Thread Jonathan Cameron via
The CCI and Fabric Manager APIs are used to configure CXL switches and devices. DMTF has defined an MCTP binding specification to carry these messages. The end goal of this work is to hook this up to emulated CXL switches and devices to allow control of the configuration. Since this relies on

[PATCH 05/19] hw/pci-bridge/cxl_upstream: Move defintion of device to header.

2023-09-25 Thread Jonathan Cameron via
To avoid repetition of switch upstream port specific data in the CXLDeviceState structure it will be necessary to access the switch USP specific data from mailbox callbacks. Hence move it to cxl_device.h so it is no longer an opaque structure. Signed-off-by: Jonathan Cameron ---

[PATCH 03/19] hw/cxl/mbox: Pull the CCI definition out of the CXLDeviceState

2023-09-25 Thread Jonathan Cameron via
Enables having multiple CCIs per devices. Each CCI (mailbox) has it's own state and command list, so they can't share a single structure. Signed-off-by: Jonathan Cameron --- include/hw/cxl/cxl_device.h | 45 ++ hw/cxl/cxl-device-utils.c | 31 +---

<    1   2   3   4   >