Re: [RFC PATCH v3 1/5] build-sys: Add rust feature option

2024-07-02 Thread Paolo Bonzini
On Tue, Jul 2, 2024 at 4:44 PM Manos Pitsidianakis wrote: > >Normally you'd see either --enable-XXX or --with-XXX and their > >corresponding --disable-XXX or --without-XXX. > > True. As the commit message says, `rust` is a reserved meson feature > name, so the auto-generated

Re: [PATCH 0/5] target/i386: CCOp cleanups

2024-07-01 Thread Paolo Bonzini
On Mon, Jul 1, 2024 at 9:05 PM Richard Henderson wrote: > > no objections at all to introducing more asserts. I think keeping the > > array is a better underlying implementation for cc_op_live() however. > > Hmm. I had an implementation that would detect missing entries at runtime, > but this

Re: [PATCH 0/5] target/i386: CCOp cleanups

2024-07-01 Thread Paolo Bonzini
On Mon, Jul 1, 2024 at 4:51 AM Richard Henderson wrote: > While debugging #2413, I spent quite a bit of time trying to work > out if the CCOp value was incorrect. I think the following is a > worthwhile cleanup, isolating potential problems to asserts. Hi Richard, no objections at all to

Re: [PATCH 2/2] system/vl.c: parse all -accel options

2024-07-01 Thread Paolo Bonzini
On Mon, Jul 1, 2024 at 4:34 PM Philippe Mathieu-Daudé wrote: > Reviewed-by: Philippe Mathieu-Daudé In principle, a Reviewed-by tag is just stating that you don't know of any issues that would prevent the patch being included. However, as a frequent participant to the project, your Reviewed-by

Re: [PATCH 0/2] system/vl.c: parse all '-accel' opts

2024-07-01 Thread Paolo Bonzini
On Mon, Jul 1, 2024 at 3:30 PM Daniel Henrique Barboza wrote: > My initial intention was to fix a problem we're having with libvirt and > RISC-V where we can't set 'riscv-aia' by appending '-accel kvm,riscv-aia=val' > via in the domain XML. libvirt will add a leading > '-accel kvm' in the

Re: [PATCH 1/2] system/vl.c: do not allow mixed -accel opts

2024-07-01 Thread Paolo Bonzini
On Mon, Jul 1, 2024 at 5:53 PM Daniel Henrique Barboza wrote: > > We use '-accel kvm -accel tcg' to allow kvm to fail (e.g. no /dev/kvm > > permission) and proceed with tcg. > > > > This patch will cause testsuite failures. > > For the issue I want to fix patch 2 alone is enough. I'll re-send.

Re: [PATCH 0/2] change some odd-looking atomic uses

2024-07-01 Thread Paolo Bonzini
On Mon, Jul 1, 2024 at 1:52 PM Wolfgang Bumiller wrote: > > I spotted the weird-looking pattern of: > atomic_set(atomic_load() N) > in a few palces and one variable in the graph-lock code which was used with > atomics except for a single case, which also seemed suspicious. > > I'm not sure

[PATCH 05/14] rust: define wrappers for Error

2024-07-01 Thread Paolo Bonzini
for Rust wrappers of C functions Signed-off-by: Paolo Bonzini --- qemu/src/lib.rs| 2 + qemu/src/util/error.rs | 241 + qemu/src/util/mod.rs | 1 + 3 files changed, 244 insertions(+) create mode 100644 qemu/src/util/error.rs diff --git a/qemu

[PATCH 14/14] rust: use version of toml_edit that does not require new Rust

2024-07-01 Thread Paolo Bonzini
toml_edit is quite aggressive in bumping the minimum required version of Rust. Force usage of an old version that runs with 1.63.0. Signed-off-by: Paolo Bonzini --- qemu/Cargo.toml | 3 +++ 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/qemu/Cargo.toml b/qemu/Cargo.toml index

[PATCH 12/14] rust: replace c"" literals with cstr crate

2024-07-01 Thread Paolo Bonzini
Part of what's needed to work with Rust versions prior to 1.77. Signed-off-by: Paolo Bonzini --- qemu/Cargo.toml| 3 +++ qemu/qom-rust.txt | 2 +- qemu/src/hw/core/device.rs | 4 +++- qemu/src/qom/object.rs | 4 +++- qemu/src/util/error.rs | 4 +++- qemu/src

[PATCH 00/14] rust: example of bindings code for Rust in QEMU

2024-07-01 Thread Paolo Bonzini
ber function, into an extern "C" function. Anyhow: I think we can do it, otherwise I would not have written 2000 lines of code (some of it two or three times). But if people are now scared and think we shouldn't, well, that's also a success of its own kind. Paolo Paolo Bonzini (14): add

[PATCH 06/14] rust: define wrappers for basic QOM concepts

2024-07-01 Thread Paolo Bonzini
This provides type-safe object casts, and automatic reference counting. Signed-off-by: Paolo Bonzini --- qemu/qom-rust.txt | 82 qemu/src/lib.rs| 6 + qemu/src/qom/mod.rs| 2 + qemu/src/qom/object.rs | 34 + qemu/src/qom/refs.rs | 274

[PATCH 08/14] rust: define wrappers for methods of the QOM Device class

2024-07-01 Thread Paolo Bonzini
Provide a trait that can be used to invoke methods of the QOM Device class. The trait extends Deref and has a blanket implementation for any type that dereferences to IsA. This way, it can be used on any struct that dereferences to Object or a subclass. Signed-off-by: Paolo Bonzini --- qemu

[PATCH 13/14] rust: introduce alternative to offset_of!

2024-07-01 Thread Paolo Bonzini
Allow working with Rust versions prior to 1.77. The code was taken from Rust's Discourse platform and is used with permission of the author. Signed-off-by: Paolo Bonzini --- qemu/Cargo.toml | 3 + qemu/build.rs | 5 ++ qemu/src/hw/core/device_impl.rs | 4

[PATCH 03/14] rust: define traits and pointer wrappers to convert from/to C representations

2024-07-01 Thread Paolo Bonzini
can build an OwnedPointer and it will free the contents automatically unless you retrieve it with owned_ptr.into_inner() Signed-off-by: Paolo Bonzini --- qemu/src/lib.rs | 6 + qemu/src/util/foreign.rs | 247 +++ qemu/src/util/mod.rs | 1 + 3 fil

[PATCH 11/14] rust: replace std::ffi::c_char with libc::c_char

2024-07-01 Thread Paolo Bonzini
Allow working with Rust versions prior to 1.64. Signed-off-by: Paolo Bonzini --- qemu/src/bindings/mod.rs | 3 ++- qemu/src/util/foreign.rs | 7 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/qemu/src/bindings/mod.rs b/qemu/src/bindings/mod.rs index a49447b..0ad3828

[PATCH 04/14] rust: add tests for util::foreign

2024-07-01 Thread Paolo Bonzini
Provide sample implementations in util::foreign for strings and elementary integer types, and use them to test the code. Signed-off-by: Paolo Bonzini --- qemu/Cargo.toml | 4 + qemu/src/util/foreign.rs | 456 +++ 3 files changed, 474 insertions

[PATCH 09/14] rust: add idiomatic bindings to define Object subclasses

2024-07-01 Thread Paolo Bonzini
-by: Paolo Bonzini --- qemu/src/lib.rs | 4 + qemu/src/qom/mod.rs | 1 + qemu/src/qom/object_impl.rs | 146 qemu/src/util/mod.rs| 1 + qemu/src/util/zeroed.rs | 21 ++ qemu/tests/main.rs | 32 6 files

[PATCH 01/14] add skeleton

2024-07-01 Thread Paolo Bonzini
qemu/ is where target-independent code goes. This code should not use constructors and will be brought in as needed. qemu-hw/ is where the target-dependent code goes, which is going to be built depending on Kconfig symbols. Signed-off-by: Paolo Bonzini --- .gitignore | 2

[PATCH 10/14] rust: add idiomatic bindings to define Device subclasses

2024-07-01 Thread Paolo Bonzini
Provide a macro to register a type and automatically define qdev properties. Subclasses of DeviceState must define a trait DeviceImpl, to point the type definition machinery to the implementation of virtual functions in DeviceState. Signed-off-by: Paolo Bonzini --- qemu/src/hw/core

[PATCH 02/14] set expectations

2024-07-01 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000..5ef6f0d --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +This is very experimental and barely compiles -- 2.45.2

[PATCH 07/14] rust: define wrappers for methods of the QOM Object class

2024-07-01 Thread Paolo Bonzini
Provide a trait that can be used to invoke methods of the QOM object class. The trait extends Deref and has a blanket implementation for any type that dereferences to IsA. This way, it can be used on any struct that dereferences to Object or a subclass. Signed-off-by: Paolo Bonzini --- qemu

Re: [PATCH 2/2] target/i386: drop AMD machine check bits from Intel CPUID

2024-07-01 Thread Paolo Bonzini
On Mon, Jul 1, 2024 at 6:08 AM Zhao Liu wrote: > > > It seems to adjust it based on vendor in kvm_arch_get_supported_cpuid() > > > is better than in x86_cpu_get_supported_feature_word(). Otherwise > > > kvm_arch_get_supported_cpuid() still returns "risky" value for Intel VMs. > > > > But the

Re: [RFC PATCH v3 2/5] rust: add bindgen step as a meson dependency

2024-06-28 Thread Paolo Bonzini
On Fri, Jun 28, 2024 at 9:12 PM Pierrick Bouvier wrote: > However, even tough I can build the executable, I get this error: > $ ./build/qemu-system-aarch64 -M virt > C:\w\qemu\build\qemu-system-aarch64.exe: unknown type 'x-pl011-rust' > > Any idea of what could be missing here? Maybe the

[PULL 06/23] meson: remove dead optimization option

2024-06-28 Thread Paolo Bonzini
Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- meson.build | 13 - meson_options.txt | 2 -- scripts/meson-buildoptions.sh | 3 --- 3 files changed, 18 deletions(-) diff --git a/meson.build b/meson.build index 6e694ecd9fe

[PULL 03/23] Revert "host/i386: assume presence of SSSE3"

2024-06-28 Thread Paolo Bonzini
This reverts commit 433cd6d94a8256af70a5200f236dc8047c3c1468. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- util/cpuinfo-i386.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/cpuinfo-i386.c b

[PULL 07/23] block: make assertion more generic

2024-06-28 Thread Paolo Bonzini
.bdrv_needs_filename is only set for drivers that also set bdrv_file_open, i.e. protocol drivers. So we can make the assertion always, it will always pass for those drivers that use bdrv_open. Signed-off-by: Paolo Bonzini --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PULL 15/23] target/i386: use cpu_cc_dst for CC_OP_POPCNT

2024-06-28 Thread Paolo Bonzini
It is the only CCOp, among those that compute ZF from one of the cc_op_* registers, that uses cpu_cc_src. Do not make it the odd one off, instead use cpu_cc_dst like the others. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 2 +- target/i386/tcg

[PULL 19/23] target/i386: SEV: store pointer to decoded id_block in SevSnpGuest

2024-06-28 Thread Paolo Bonzini
Do not rely on finish->id_block_uaddr, so that there are no casts from pointer to uint64_t. They break on 32-bit hosts. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/i

[PULL 18/23] target/i386: SEV: rename sev_snp_guest->id_block

2024-06-28 Thread Paolo Bonzini
Free the "id_block" name for the binary version of the data. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 30b83f1d77d..6

[PULL 20/23] target/i386: SEV: rename sev_snp_guest->id_auth

2024-06-28 Thread Paolo Bonzini
Free the "id_auth" name for the binary version of the data. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 2d4cfd41e83..a

[PULL 17/23] target/i386: remove unused enum

2024-06-28 Thread Paolo Bonzini
Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 16 1 file changed, 16 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 934c514e64f..95bad55bf46 100644 --- a/target/i386/tcg/translate.c

[PULL 05/23] meson: allow configuring the x86-64 baseline

2024-06-28 Thread Paolo Bonzini
. Acked-by: Richard Henderson Signed-off-by: Paolo Bonzini --- meson.build | 41 --- meson_options.txt | 3 +++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/meson.build b

[PULL 14/23] target/i386: fix CC_OP dump

2024-06-28 Thread Paolo Bonzini
X", 2024-06-11) Signed-off-by: Paolo Bonzini --- target/i386/cpu-dump.c | 101 + 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/target/i386/cpu-dump.c b/target/i386/cpu-dump.c index 40697064d92..3bb8e440916 100644 --- a/target/i386/cpu

[PULL 11/23] exec: avoid using C++ keywords in function parameters

2024-06-28 Thread Paolo Bonzini
From: Roman Kiryanov to use the QEMU headers with a C++ compiler. Signed-off-by: Roman Kiryanov Link: https://lore.kernel.org/r/20240618224553.878869-1-r...@google.com Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PULL 04/23] Revert "host/i386: assume presence of SSE2"

2024-06-28 Thread Paolo Bonzini
This reverts commit b18236897ca15c3db1506d8edb9a191dfe51429c. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- host/include/i386/host/cpuinfo.h | 1 + util/cpuinfo-i386.c | 1 + host/include/i386

[PULL 16/23] target/i386: give CC_OP_POPCNT low bits corresponding to MO_TL

2024-06-28 Thread Paolo Bonzini
Handle it like the other arithmetic cc_ops. This simplifies a bit the implementation of bit test instructions. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 13 +++-- target/i386/tcg/translate.c | 3 +-- 2 files changed, 12 insertions

[PULL 02/23] Revert "host/i386: assume presence of POPCNT"

2024-06-28 Thread Paolo Bonzini
This reverts commit 45ccdbcb24baf99667997fac5cf60318e5e7db51. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- host/include/i386/host/cpuinfo.h | 1 + tcg/i386/tcg-target.h| 5 +++-- util/cpuinfo-i386.c

[PULL 23/23] target/i386/sev: Fix printf formats

2024-06-28 Thread Paolo Bonzini
From: Richard Henderson hwaddr uses HWADDR_PRIx, sizeof yields size_t so uses %zu, and gsize uses G_GSIZE_FORMAT. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Link: https://lore.kernel.org/r/20240626194950.1725800-4-richard.hender...@linaro.org Signed-off-by: Paolo

[PULL 22/23] target/i386/sev: Use size_t for object sizes

2024-06-28 Thread Paolo Bonzini
From: Richard Henderson This code was using both uint32_t and uint64_t for len. Consistently use size_t instead. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Link: https://lore.kernel.org/r/20240626194950.1725800-3-richard.hender...@linaro.org Signed-off-by: Paolo

[PULL 21/23] target/i386: SEV: store pointer to decoded id_auth in SevSnpGuest

2024-06-28 Thread Paolo Bonzini
Do not rely on finish->id_auth_uaddr, so that there are no casts from pointer to uint64_t. They break on 32-bit hosts. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tar

[PULL 13/23] include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH()

2024-06-28 Thread Paolo Bonzini
Pitsidianakis Tested-by: Manos Pitsidianakis Signed-off-by: Paolo Bonzini --- include/qapi/util.h | 2 +- include/qemu/atomic.h | 42 - include/qemu/compiler.h | 46 + 3 files changed, 47 insertions(+), 43 deletions

[PULL 08/23] block: do not check bdrv_file_open

2024-06-28 Thread Paolo Bonzini
The set of BlockDrivers that have .bdrv_file_open coincides with those that have .protocol_name and guess what---checking drv->bdrv_file_open is done to see if the driver is a protocol. So check drv->protocol_name instead. Signed-off-by: Paolo Bonzini --- block.c | 11 +--

[PULL 09/23] block: remove separate bdrv_file_open callback

2024-06-28 Thread Paolo Bonzini
bdrv_file_open and bdrv_open are completely equivalent, they are never checked except to see which one to invoke. So merge them into a single one. Signed-off-by: Paolo Bonzini --- include/block/block_int-common.h | 3 --- block.c | 4 +--- block/blkdebug.c

[PULL 10/23] block: rename former bdrv_file_open callbacks

2024-06-28 Thread Paolo Bonzini
Since there is no bdrv_file_open callback anymore, rename the implementations so that they end with "_open" instead of "_file_open". NFS is the exception because all the functions are named nfs_file_*. Suggested-by: Kevin Wolf Signed-off-by: Paolo Bonzini --- block/blkio.c

[PULL 12/23] exec: don't use void* in pointer arithmetic in headers

2024-06-28 Thread Paolo Bonzini
From: Roman Kiryanov void* pointer arithmetic is a GCC extentension which could not be available in other build tools (e.g. C++). This changes removes this assumption. Signed-off-by: Roman Kiryanov Suggested-by: Paolo Bonzini Link: https://lore.kernel.org/r/20240620201654.598024-1-r

[PULL v3 00/23] Misc changes for 2024-06-28

2024-06-28 Thread Paolo Bonzini
e dead optimization option * exec: small changes to allow compilation with C++ in Android emulator * fix SEV compilation on 32-bit systems ---- Paolo Bonzini (19): configure: detect --cpu=mipsisa64r6 Revert "host/i386: assu

[PULL 01/23] configure: detect --cpu=mipsisa64r6

2024-06-28 Thread Paolo Bonzini
Treat it as a MIPS64 machine. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5ad1674ca5f..8b6a2f16ceb 100755 --- a/configure +++ b/configure

Re: [PATCH 2/2] target/i386: drop AMD machine check bits from Intel CPUID

2024-06-28 Thread Paolo Bonzini
Il ven 28 giu 2024, 10:32 Xiaoyao Li ha scritto: > On 6/27/2024 10:06 PM, Paolo Bonzini wrote: > > The recent addition of the SUCCOR bit to kvm_arch_get_supported_cpuid() > > causes the bit to be visible when "-cpu host" VMs are started on Intel > > proces

Re: [PATCH v3] timer: Fix a race condition between timer's callback and destroying code

2024-06-27 Thread Paolo Bonzini
On Thu, Jun 27, 2024 at 6:12 PM Roman Kiryanov wrote: > > On Thu, Jun 27, 2024 at 6:27 AM Paolo Bonzini wrote: > > > > On Thu, Jun 27, 2024 at 2:32 AM Roman Kiryanov wrote: > > > +if (qatomic_read(>cb_running)) { > > > +

Re: [PATCH 0/3] target/i386/sev: Fix 32-bit host build issues

2024-06-27 Thread Paolo Bonzini
On Wed, Jun 26, 2024 at 9:49 PM Richard Henderson wrote: > I separated the fixes into 3 smaller patches > that may be easier to review. Oops, I missed this. I queued patches 2-3, while for the first one I prefer the version I sent at

[PATCH 3/5] target/i386: SEV: rename sev_snp_guest->id_auth

2024-06-27 Thread Paolo Bonzini
Free the "id_auth" name for the binary version of the data. Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 2d4cfd41e83..a6b063b762c 100644 --- a/target/

[PATCH 1/5] target/i386: SEV: rename sev_snp_guest->id_block

2024-06-27 Thread Paolo Bonzini
Free the "id_block" name for the binary version of the data. Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 30b83f1d77d..6daa8c264cd 100644 --- a/target/

[PATCH 4/5] target/i386: SEV: store pointer to decoded id_auth in SevSnpGuest

2024-06-27 Thread Paolo Bonzini
Do not rely on finish->id_auth_uaddr, so that there are no casts from pointer to uint64_t. They break on 32-bit hosts. Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/target/i386/sev.c b/target/i386/se

[PATCH 5/5] target/i386: SEV: fix format strings for 32-bit hosts

2024-06-27 Thread Paolo Bonzini
Use PRIx64 for uint64_t and %zu for size_t/gsize. Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 28d6bd3adfa..77ff908ab17 100644 --- a/target/i386/sev.c +++ b

[PATCH 2/5] target/i386: SEV: store pointer to decoded id_block in SevSnpGuest

2024-06-27 Thread Paolo Bonzini
Do not rely on finish->id_block_uaddr, so that there are no casts from pointer to uint64_t. They break on 32-bit hosts. Signed-off-by: Paolo Bonzini --- target/i386/sev.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c in

[PATCH 0/5] target/i386: SEV: fix compiler warnings on 32-bit hosts

2024-06-27 Thread Paolo Bonzini
While SEV in practice is unlikely to be used when compiling for 32-bit environments (it is not even supported by 32-bit kernels), it is easier and/or nicer to clean up the warts that block compilation, than to add conditionals in the build system to limit it to 64-bit hosts. Paolo Paolo Bonzini

[PATCH 0/2] target/i386: drop AMD machine check bits from Intel CPUID

2024-06-27 Thread Paolo Bonzini
OS to take unexpected paths. So plumb in a mechanism for x86_cpu_get_supported_feature_word() to return different values depending on the *guest* CPU vendor (which, for KVM, is by default the same as the host vendor); and then use it to hide the SUCCOR bit if the guest has non-AMD vendor. Paolo Bonzini (2)

[PATCH 1/2] target/i386: pass X86CPU to x86_cpu_get_supported_feature_word

2024-06-27 Thread Paolo Bonzini
onfiguring the guest for an Intel model. Cc: Xiaoyao Li Cc: John Allen Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 3 +-- target/i386/cpu.c | 13 ++--- target/i386/kvm/kvm-cpu.c | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/target/i386

[PATCH 2/2] target/i386: drop AMD machine check bits from Intel CPUID

2024-06-27 Thread Paolo Bonzini
OS to take unexpected paths. Since x86_cpu_get_supported_feature_word() can return different different values depending on the guest, adjust it to hide the SUCCOR bit if the guest has non-AMD vendor. Suggested-by: Xiaoyao Li Cc: John Allen Signed-off-by: Paolo Bonzini --- target/i386/

Re: [PULL 39/42] i386: Add support for SUCCOR feature

2024-06-27 Thread Paolo Bonzini
On 6/13/24 11:50, Xiaoyao Li wrote: On 6/8/2024 4:34 PM, Paolo Bonzini wrote: From: John Allen Add cpuid bit definition for the SUCCOR feature. This cpuid bit is required to be exposed to guests to allow them to handle machine check exceptions on AMD hosts. v2:    - Add "s

Re: [PATCH v3] timer: Fix a race condition between timer's callback and destroying code

2024-06-27 Thread Paolo Bonzini
On Thu, Jun 27, 2024 at 2:32 AM Roman Kiryanov wrote: > +if (qatomic_read(>cb_running)) { > +qemu_event_wait(_list->timers_done_ev); > +} qemu_event_wait() already has the right atomic magic, and ts->cb_running is both redundant (in general), and I think racy (as

[PATCH] target/i386/tcg: remove unused enum

2024-06-27 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 16 1 file changed, 16 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 257110ac703..aeb7bc4d51b 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c

Re: [PATCH] include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH()

2024-06-27 Thread Paolo Bonzini
On Thu, Jun 27, 2024 at 10:38 AM Manos Pitsidianakis wrote: > > On Thu, 27 Jun 2024 00:32, Paolo Bonzini wrote: > >On Tue, Jun 25, 2024 at 9:17 PM Manos Pitsidianakis > > wrote: > >> >Move the macro to compiler.h and, while at it, move it under #ifndef > >>

Re: [RFC PATCH] target/i386: restrict SEV to 64 bit host builds

2024-06-26 Thread Paolo Bonzini
On 6/26/24 16:03, Alex Bennée wrote: Re-enabling the 32 bit host build on i686 showed the recently merged SEV code doesn't take enough care over its types. While the format strings could use more portable types there isn't much we can do about casting uint64_t into a pointer. The easiest

Re: [PATCH v2] timer: Fix a race condition between timer's callback and destroying code

2024-06-26 Thread Paolo Bonzini
On 6/26/24 23:52, Roman Kiryanov wrote: `timerlist_run_timers` provides no mechanism to make sure the data pointed by `opaque` is valid when calling timer's callback: there could be another thread running which is destroying timer's opaque data. With this change `timer_del` becomes blocking if

Re: [PATCH] include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH()

2024-06-26 Thread Paolo Bonzini
On Tue, Jun 25, 2024 at 9:17 PM Manos Pitsidianakis wrote: > >Move the macro to compiler.h and, while at it, move it under #ifndef > >__cplusplus to emphasize that it uses C-only constructs. A C++ version > >of typeof_strip_qual() using type traits is possible[1], but beyond the > >scope of this

Re: [RFC PATCH v3 1/5] build-sys: Add rust feature option

2024-06-26 Thread Paolo Bonzini
On 6/25/24 23:47, Manos Pitsidianakis wrote: On Mon, 24 Jun 2024 20:14, Paolo Bonzini wrote: Yes, I agree. However, considering we haven't even checked the situation with what language features are required by any idiomatic bindings vs the 1.63 version that we need to support for Debian, I

[PATCH] include: move typeof_strip_qual to compiler.h, use it in QAPI_LIST_LENGTH()

2024-06-25 Thread Paolo Bonzini
of strv_from_str_list() in qapi/qapi-type-helpers.c to: char **strv_from_str_list(const strList *const list) This is valid C code, and it fails to compile without this change. [1] https://lore.kernel.org/qemu-devel/20240624205647.112034-1-f...@google.com/ Signed-off-by: Paolo Bonzini --- include/qapi

Re: [PATCH 1/1] include/qemu: Provide a C++ compatible version of typeof_strip_qual

2024-06-25 Thread Paolo Bonzini
Il mar 25 giu 2024, 04:32 Roman Kiryanov ha scritto: > Hi Philippe, thank you for looking. > > On Mon, Jun 24, 2024 at 7:27 PM Philippe Mathieu-Daudé > wrote: > > In particular this patch seems contained well enough > > to be carried in forks were C++ _is_ used. > > Will you agree to take

Re: [RFC PATCH v3 1/5] build-sys: Add rust feature option

2024-06-24 Thread Paolo Bonzini
Il lun 24 giu 2024, 18:52 Daniel P. Berrangé ha scritto: > On Wed, Jun 19, 2024 at 11:13:58PM +0300, Manos Pitsidianakis wrote: > > Add options for Rust in meson_options.txt, meson.build, configure to > > prepare for adding Rust code in the followup commits. > > > > `rust` is a reserved meson

Re: [RFC PATCH v3 1/5] build-sys: Add rust feature option

2024-06-24 Thread Paolo Bonzini
Il lun 24 giu 2024, 10:36 Zhao Liu ha scritto: > [snip] > > > diff --git a/meson.build b/meson.build > > index c5360fbd299..ad7dbc0d641 100644 > > --- a/meson.build > > +++ b/meson.build > > @@ -290,6 +290,11 @@ foreach lang : all_languages > >endif > > endforeach > > +cargo = not_found > >

[PULL v2 15/23] Revert "host/i386: assume presence of SSE2"

2024-06-24 Thread Paolo Bonzini
This reverts commit b18236897ca15c3db1506d8edb9a191dfe51429c. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- host/include/i386/host/cpuinfo.h | 1 + util/cpuinfo-i386.c | 1 + host/include/i386

[PULL v2 00/23] Misc changes for 2024-06-22

2024-06-24 Thread Paolo Bonzini
address before going back to translate.c * meson: allow configuring the x86-64 baseline * meson: remove dead optimization option * exec: small changes to allow compilation with C++ in Android emulator Paolo Bonzini (21): configure

[PULL 21/23] block: rename former bdrv_file_open callbacks

2024-06-22 Thread Paolo Bonzini
Since there is no bdrv_file_open callback anymore, rename the implementations so that they end with "_open" instead of "_file_open". NFS is the exception because all the functions are named nfs_file_*. Suggested-by: Kevin Wolf Signed-off-by: Paolo Bonzini --- block/blkio.c

[PULL 15/23] Revert "host/i386: assume presence of SSE2"

2024-06-22 Thread Paolo Bonzini
This reverts commit b18236897ca15c3db1506d8edb9a191dfe51429c. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- host/include/i386/host/cpuinfo.h | 1 + util/bufferiszero.c | 4 ++-- util/cpuinfo-i386.c

[PULL 17/23] meson: remove dead optimization option

2024-06-22 Thread Paolo Bonzini
Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- meson.build | 13 - meson_options.txt | 2 -- scripts/meson-buildoptions.sh | 3 --- 3 files changed, 18 deletions(-) diff --git a/meson.build b/meson.build index 6e694ecd9fe

[PULL 02/23] target/i386: fix CC_OP dump

2024-06-22 Thread Paolo Bonzini
X", 2024-06-11) Signed-off-by: Paolo Bonzini --- target/i386/cpu-dump.c | 101 + 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/target/i386/cpu-dump.c b/target/i386/cpu-dump.c index 40697064d92..3bb8e440916 100644 --- a/target/i386/cpu

[PULL 07/23] target/i386: decode address before going back to translate.c

2024-06-22 Thread Paolo Bonzini
of the unification, the gen_lea_modrm() name is now free, so rename gen_load_ea() to gen_lea_modrm(). This is as good a name and it makes the changes to translate.c easier to review. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.h | 14 ++- target/i386/tcg

[PULL 01/23] configure: detect --cpu=mipsisa64r6

2024-06-22 Thread Paolo Bonzini
Treat it as a MIPS64 machine. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 5ad1674ca5f..8b6a2f16ceb 100755 --- a/configure +++ b/configure

[PULL 14/23] Revert "host/i386: assume presence of SSSE3"

2024-06-22 Thread Paolo Bonzini
This reverts commit 433cd6d94a8256af70a5200f236dc8047c3c1468. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- util/cpuinfo-i386.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/cpuinfo-i386.c b

[PULL 22/23] exec: avoid using C++ keywords in function parameters

2024-06-22 Thread Paolo Bonzini
From: Roman Kiryanov to use the QEMU headers with a C++ compiler. Signed-off-by: Roman Kiryanov Link: https://lore.kernel.org/r/20240618224553.878869-1-r...@google.com Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PULL 10/23] target/i386: list instructions still in translate.c

2024-06-22 Thread Paolo Bonzini
Group them so that it is easier to figure out which two-byte opcodes to tackle together. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 31 +++ 1 file changed, 31 insertions(+) diff --git a/target/i386/tcg/decode

[PULL 04/23] target/i386: give CC_OP_POPCNT low bits corresponding to MO_TL

2024-06-22 Thread Paolo Bonzini
Handle it like the other arithmetic cc_ops. This simplifies a bit the implementation of bit test instructions. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 13 +++-- target/i386/tcg/translate.c | 3 +-- 2 files changed, 12 insertions

[PULL 00/23] Misc changes for 2024-06-22

2024-06-22 Thread Paolo Bonzini
: decode address before going back to translate.c * meson: allow configuring the x86-64 baseline * meson: remove dead optimization option * exec: small changes to allow compilation with C++ in Android emulator Paolo Bonzini (21

[PULL 05/23] target/i386: convert bit test instructions to new decoder

2024-06-22 Thread Paolo Bonzini
Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.h | 3 + target/i386/tcg/translate.c | 147 +- target/i386/tcg/decode-new.c.inc | 40 ++--- target/i386/tcg/emit.c.inc | 149

[PULL 08/23] target/i386: convert CMPXCHG8B/CMPXCHG16B to new decoder

2024-06-22 Thread Paolo Bonzini
to be done is removing the gen_lea_modrm() call. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.h | 2 + target/i386/tcg/translate.c | 121 +-- target/i386/tcg/decode-new.c.inc | 34 ++--- target/i386/tcg

[PULL 23/23] exec: don't use void* in pointer arithmetic in headers

2024-06-22 Thread Paolo Bonzini
From: Roman Kiryanov void* pointer arithmetic is a GCC extentension which could not be available in other build tools (e.g. C++). This changes removes this assumption. Signed-off-by: Roman Kiryanov Suggested-by: Paolo Bonzini Link: https://lore.kernel.org/r/20240620201654.598024-1-r

[PULL 20/23] block: remove separate bdrv_file_open callback

2024-06-22 Thread Paolo Bonzini
bdrv_file_open and bdrv_open are completely equivalent, they are never checked except to see which one to invoke. So merge them into a single one. Signed-off-by: Paolo Bonzini --- include/block/block_int-common.h | 3 --- block.c | 4 +--- block/blkdebug.c

[PULL 19/23] block: do not check bdrv_file_open

2024-06-22 Thread Paolo Bonzini
The set of BlockDrivers that have .bdrv_file_open coincides with those that have .protocol_name and guess what---checking drv->bdrv_file_open is done to see if the driver is a protocol. So check drv->protocol_name instead. Signed-off-by: Paolo Bonzini --- block.c | 11 +--

[PULL 18/23] block: make assertion more generic

2024-06-22 Thread Paolo Bonzini
.bdrv_needs_filename is only set for drivers that also set bdrv_file_open, i.e. protocol drivers. So we can make the assertion always, it will always pass for those drivers that use bdrv_open. Signed-off-by: Paolo Bonzini --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PULL 12/23] target/i386: remove gen_ext_tl

2024-06-22 Thread Paolo Bonzini
e creation of a useless temporary. This can be done in the only place where it matters, which is gen_op_j_ecx. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 41 +++-- 1 file changed, 17 insertions(+), 24 deletions(-)

[PULL 16/23] meson: allow configuring the x86-64 baseline

2024-06-22 Thread Paolo Bonzini
. Acked-by: Richard Henderson Signed-off-by: Paolo Bonzini --- meson.build | 41 --- meson_options.txt | 3 +++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/meson.build b

[PULL 13/23] Revert "host/i386: assume presence of POPCNT"

2024-06-22 Thread Paolo Bonzini
This reverts commit 45ccdbcb24baf99667997fac5cf60318e5e7db51. The x86-64 instruction set can now be tuned down to x86-64 v1 or i386 Pentium Pro. Signed-off-by: Paolo Bonzini --- host/include/i386/host/cpuinfo.h | 1 + tcg/i386/tcg-target.h| 5 +++-- util/cpuinfo-i386.c

[PULL 09/23] target/i386: do not check PREFIX_LOCK in old-style decoder

2024-06-22 Thread Paolo Bonzini
It is already checked before getting there. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 26 -- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c

[PULL 03/23] target/i386: use cpu_cc_dst for CC_OP_POPCNT

2024-06-22 Thread Paolo Bonzini
It is the only CCOp, among those that compute ZF from one of the cc_op_* registers, that uses cpu_cc_src. Do not make it the odd one off, instead use cpu_cc_dst like the others. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 2 +- target/i386/tcg

[PULL 11/23] target/i386: assert that cc_op* and pc_save are preserved

2024-06-22 Thread Paolo Bonzini
Now all decoding has been done before any code generation. There is no need anymore to save and restore cc_op* and pc_save but, for the time being, assert that this is indeed the case. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- target/i386/tcg/translate.c | 12

[PULL 06/23] target/i386: try not to force EFLAGS computation for CC_OP_ADOX/ADCX

2024-06-22 Thread Paolo Bonzini
When computing the "other" flag (CF for CC_OP_ADOX, OF for CC_OP_ADCX), take into account that it is already in the right position of cpu_cc_src, just like for CC_OP_EFLAGS. There is no need to call gen_compute_eflags(). Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini -

Re: [PATCH v2] exec: don't use void* in pointer arithmetic in headers

2024-06-21 Thread Paolo Bonzini
Suggested-by: Paolo Bonzini --- v2: renamed from "use char* for pointer arithmetic" and removed all explicit extra cast with one typedef in memory.h. include/exec/memory.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/exec/memory.h b/in

Re: [RFC PATCH v3 1/5] build-sys: Add rust feature option

2024-06-20 Thread Paolo Bonzini
Il gio 20 giu 2024, 20:13 Manos Pitsidianakis < manos.pitsidiana...@linaro.org> ha scritto: > On Thu, 20 Jun 2024 16:21, Paolo Bonzini wrote: > >On 6/19/24 22:13, Manos Pitsidianakis wrote: > >> Add options for Rust in meson_options.txt, meson.build, configure to >

  1   2   3   4   5   6   7   8   9   10   >