Re: [PATCH v4 3/4] qapi: rename 'special_features' to 'features'

2025-02-07 Thread Markus Armbruster
Daniel P. Berrangé writes: > This updates the QAPI code generation to refer to 'features' instead > of 'special_features', in preparation for generalizing their exposure. > > Signed-off-by: Daniel P. Berrangé John pointed out that isort wants the appended fixup. Not thrilled about the addition

Re: [PATCH v4 4/4] qapi: expose all schema features to code

2025-02-07 Thread Markus Armbruster
Daniel P. Berrangé writes: > This replaces use of the constants from the QapiSpecialFeatures > enum, with constants from the auto-generate QapiFeatures enum > in qapi-features.h > > The 'deprecated' and 'unstable' features still have a little bit of > special handling, being force defined to be t

[PATCH 04/15] arm/cpu: Store aa64isar1/2 into the idregs array

2025-02-07 Thread Cornelia Huck
From: Eric Auger Signed-off-by: Eric Auger Signed-off-by: Cornelia Huck --- target/arm/cpu-features.h | 42 +++ target/arm/cpu.c | 8 +++- target/arm/cpu.h | 2 -- target/arm/cpu64.c| 9 + target/arm/helper.c |

[PATCH 00/15] arm: rework id register storage

2025-02-07 Thread Cornelia Huck
[Note: I've kept the cc list from the last round of cpu model patches; so if you're confused as to why you're cc:ed here, take it as a heads-up that a new cpu model series will come along soon] This patch series contains patches extracted from the larger cpu model series (RFC v2 last posted at htt

Re: [PULL 5/7] target/i386: Do not raise Invalid for 0 * Inf + QNaN

2025-02-07 Thread Michael Tokarev
07.02.2025 13:27, Paolo Bonzini wrote: From: Peter Maydell In commit 8adcff4ae7 ("fpu: handle raising Invalid for infzero in pick_nan_muladd") we changed the handling of 0 * Inf + QNaN to always raise the Invalid exception regardless of target architecture. (This was a change affecting hppa, i

Re: [PATCH v3 4/4] qapi: expose all schema features to code

2025-02-07 Thread Markus Armbruster
John Snow writes: > On Fri, Jan 31, 2025 at 8:18 AM Markus Armbruster wrote: > >> Cc: John Snow for Python typing expertise. >> >> Daniel P. Berrangé writes: >> >> > This replaces use of the constants from the QapiSpecialFeatures >> > enum, with constants from the auto-generate QapiFeatures enu

[Stable-9.1.3 v2 00/65] Patch Round-up for stable 9.1.3, freeze on 2025-02-06 (frozen)

2025-02-07 Thread Michael Tokarev
The following patches are queued for QEMU stable v9.1.3: https://gitlab.com/qemu-project/qemu/-/commits/staging-9.1 Patch freeze is 2025-02-06 (frozen), and the release is planned for 2025-02-08: https://wiki.qemu.org/Planning/9.1 Please respond here or CC qemu-sta...@nongnu.org on any patc

[Stable-9.1.3 65/65] gdbstub/user-target: fix gdbserver int format (%d -> %x)

2025-02-07 Thread Michael Tokarev
From: Dominik 'Disconnect3d' Czarnota This commit fixes an incorrect format string for formatting integers provided to GDB when debugging a target run in QEMU user mode. The correct format is hexadecimal for both success and errno values, some of which can be seen here [0]. [0] https://github.

[Stable-9.1.3 60/65] hw/usb/canokey: Fix buffer overflow for OUT packet

2025-02-07 Thread Michael Tokarev
From: Hongren Zheng When USBPacket in OUT direction has larger payload than the ep_out_buffer (of size 512), a buffer overflow would occur. It could be fixed by limiting the size of usb_packet_copy to be at most buffer size. Further optimization gets rid of the ep_out_buffer and directly uses ep

[Stable-9.1.3 59/65] target/arm: arm_reset_sve_state() should set FPSR, not FPCR

2025-02-07 Thread Michael Tokarev
From: Peter Maydell The pseudocode ResetSVEState() does: FPSR = ZeroExtend(0x089f<31:0>, 64); but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident. Before the advent of FEAT_AFP, this was only setting a collection of RES0 bits, which vfp_set_fpsr() would then ignore, so the

[Stable-9.1.3 61/65] physmem: fix qemu_ram_alloc_from_fd size calculation

2025-02-07 Thread Michael Tokarev
From: Steve Sistare qemu_ram_alloc_from_fd allocates space if file_size == 0. If non-zero, it uses the existing space and verifies it is large enough, but the verification was broken when the offset parameter was introduced. As a result, a file smaller than offset passes the verification and ca

[Stable-9.1.3 63/65] net: Fix announce_self

2025-02-07 Thread Michael Tokarev
From: Laurent Vivier b9ad513e1876 ("net: Remove receive_raw()") adds an iovec entry in qemu_deliver_packet_iov() to add the virtio-net header in the data when QEMU_NET_PACKET_FLAG_RAW is set but forgets to increase the number of iovec entries in the array, so receive_iov() will only send the firs

[Stable-9.1.3 64/65] net/dump: Correctly compute Ethernet packet offset

2025-02-07 Thread Michael Tokarev
From: Laurent Vivier When a packet is sent with QEMU_NET_PACKET_FLAG_RAW by QEMU it never includes virtio-net header even if qemu_get_vnet_hdr_len() is not 0, and filter-dump is not managing this case. The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self, we can show the problem using it a

[Stable-9.1.3 62/65] target/s390x: Fix MVC not always invalidating translation blocks

2025-02-07 Thread Michael Tokarev
From: Ilya Leoshkevich Node.js crashes in qemu-system-s390x with random SIGSEGVs / SIGILLs. The v8 JIT used by Node.js can garbage collect and overwrite unused code. Overwriting is performed by WritableJitAllocation::CopyCode(), which ultimately calls memcpy(). For certain sizes, memcpy() uses t

Re: [PATCH v4 4/4] qapi: expose all schema features to code

2025-02-07 Thread Markus Armbruster
Daniel P. Berrangé writes: > This replaces use of the constants from the QapiSpecialFeatures > enum, with constants from the auto-generate QapiFeatures enum > in qapi-features.h > > The 'deprecated' and 'unstable' features still have a little bit of > special handling, being force defined to be t

Re: [PATCH v4 2/4] qdev-properties: Accept bool for OnOffAuto

2025-02-07 Thread Markus Armbruster
BALATON Zoltan writes: > On Thu, 6 Feb 2025, Akihiko Odaki wrote: >> On 2025/02/06 18:48, Markus Armbruster wrote: This problem can be solved using an existing mechanism, OnOffAuto, which differentiates the "auto" state and explicit the

[PATCH 12/12] rust: pl011: convert pl011_create to safe Rust

2025-02-07 Thread Paolo Bonzini
Not a major change but, as a small but significant step in creating qdev bindings, show how pl011_create can be written without "unsafe" calls (apart from converting pointers to references). This also provides a starting point for creating Error** bindings. Signed-off-by: Paolo Bonzini --- rust

[PULL 7/7] tcg/optimize: optimize TSTNE using smask and zmask

2025-02-07 Thread Paolo Bonzini
Generalize the existing optimization of "TSTNE x,sign" and "TSTNE x,-1". This can be useful for example in the i386 frontend, which will generate tests of zero-extended registers against 0x. Ironically, on x86 hosts this is a very slight pessimization in the very case it's meant to optimiz

[PULL 1/7] rust: remove unnecessary Cargo.toml metadata

2025-02-07 Thread Paolo Bonzini
Some items of Cargo.toml (readme, homepage, repository) are only present because of clippy::cargo warnings being enabled in rust/hw/char/pl011/src/lib.rs. But these items are not particularly useful and would be all the same for all Cargo.toml files in the QEMU workspace. Clean them up. Signed-o

[PULL 2/7] rust: include rust_version in Cargo.toml

2025-02-07 Thread Paolo Bonzini
Tell clippy the minimum supported Rust version for QEMU. Signed-off-by: Paolo Bonzini --- rust/hw/char/pl011/Cargo.toml | 1 + rust/hw/char/pl011/src/device_class.rs | 1 - rust/qemu-api-macros/Cargo.toml| 1 + rust/qemu-api/Cargo.toml | 1 + 4 files changed, 3 ins

Re: [PATCH v5 3/5] migration: enable multifd and postcopy together

2025-02-07 Thread Prasad Pandit
Hi, On Fri, 7 Feb 2025 at 04:46, Peter Xu wrote: > > +/* Migration channel types */ > > +enum { CH_DEFAULT, CH_MULTIFD, CH_POSTCOPY }; > > Maybe s/DEFAULT/MAIN/? * Okay. > > -if (migrate_multifd() && !migrate_mapped_ram() && > > -!migrate_postcopy_ram() && > > -qio_channel_h

Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3

2025-02-07 Thread Daniel P . Berrangé
On Fri, Feb 07, 2025 at 10:21:17AM +, Shameerali Kolothum Thodi wrote: > > > > -Original Message- > > From: Nicolin Chen > > Sent: Thursday, February 6, 2025 8:33 PM > > To: Shameerali Kolothum Thodi > > ; Daniel P. Berrangé > > ; Jason Gunthorpe > > Cc: qemu-...@nongnu.org; qemu-de

[PATCH 02/12] rust: qom: add object creation functionality

2025-02-07 Thread Paolo Bonzini
The basic object lifecycle test can now be implemented using safe code! Signed-off-by: Paolo Bonzini --- rust/hw/char/pl011/src/device.rs | 23 +-- rust/qemu-api/src/prelude.rs | 1 + rust/qemu-api/src/qom.rs | 23 +-- rust/qemu-api/tests/test

[PULL 0/7] Rust, TCG, x86 patches for 2025-02-07

2025-02-07 Thread Paolo Bonzini
The following changes since commit 131c58469f6fb68c89b38fee6aba8bbb20c7f4bf: rust: add --rust-target option for bindgen (2025-02-06 13:51:46 -0500) are available in the Git repository at: https://gitlab.com/bonzini/qemu.git tags/for-upstream for you to fetch changes up to 07f858bd1bf7cafc20

[PULL v2 4/4] MAINTAINERS: Mark me as reviewer only for 9pfs

2025-02-07 Thread Christian Schoenebeck
From: Greg Kurz I still review 9pfs changes from time to time but I'm definitely not able to do actual maintainer work. Drop my tree on the way as I'll obviously not use it anymore, and it has been left untouched since May 2020. Signed-off-by: Greg Kurz Reviewed-by: Christian Schoenebeck Messa

[PULL v2 3/4] 9pfs: improve v9fs_open() tracing

2025-02-07 Thread Christian Schoenebeck
Improve tracing of 9p 'Topen' request type by showing open() flags as human-readable text. E.g. trace output: v9fs_open tag 0 id 12 fid 2 mode 100352 would become: v9fs_open tag=0 id=12 fid=2 mode=100352(RDONLY|NONBLOCK|DIRECTORY| TMPFILE|NDELAY) Therefor add a new utility function qemu_

[PULL v2 2/4] 9pfs: make multidevs=remap default

2025-02-07 Thread Christian Schoenebeck
1a6ed33cc5 introduced option multidevs=remap|forbid|warn and made "warn" the default option. As it turned out though, e.g. by several reports in conjunction with following 9p client issue: https://github.com/torvalds/linux/commit/850925a8133c73c4a2453c360b2c3beb3bab67c9 Many people are just igno

[PULL v2 0/4] 9p queue 2025-02-06

2025-02-07 Thread Christian Schoenebeck
gs/pull-9p-20250207 for you to fetch changes up to 52065d405ae96221f15b0fd9c099437c77178d4f: MAINTAINERS: Mark me as reviewer only for 9pfs (2025-02-07 10:28:27 +0100) 9pfs changes: * Greg Kurz steps back as maintainer of 9pfs. * Make

[Stable-9.2.1 45/49] physmem: fix qemu_ram_alloc_from_fd size calculation

2025-02-07 Thread Michael Tokarev
From: Steve Sistare qemu_ram_alloc_from_fd allocates space if file_size == 0. If non-zero, it uses the existing space and verifies it is large enough, but the verification was broken when the offset parameter was introduced. As a result, a file smaller than offset passes the verification and ca

[PATCH 06/12] rust: qdev: make ObjectImpl a supertrait of DeviceImpl

2025-02-07 Thread Paolo Bonzini
In practice it has to be implemented always in order to access an implementation of ClassInitImpl. Make the relationship explicit in the code. Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/qdev.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PULL v2 1/4] 9pfs: improve v9fs_walk() tracing

2025-02-07 Thread Christian Schoenebeck
'Twalk' is the most important request type in the 9p protocol to look out for when debugging 9p communication. That's because it is the only part of the 9p protocol which actually deals with human-readable path names, whereas all other 9p request types work on numeric file IDs (FIDs) only. Improve

[Stable-9.2.1 47/49] net: Fix announce_self

2025-02-07 Thread Michael Tokarev
From: Laurent Vivier b9ad513e1876 ("net: Remove receive_raw()") adds an iovec entry in qemu_deliver_packet_iov() to add the virtio-net header in the data when QEMU_NET_PACKET_FLAG_RAW is set but forgets to increase the number of iovec entries in the array, so receive_iov() will only send the firs

[PATCH 08/12] rust: bindings: add Send and Sync markers for types that have bindings

2025-02-07 Thread Paolo Bonzini
This is needed for the MemoryRegionOps to be declared as static; Rust requires static elements to be Sync. Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/bindings.rs | 46 +++ rust/qemu-api/src/irq.rs | 3 +++ 2 files changed, 49 i

[PATCH 15/15] arm/cpu: Add generated files

2025-02-07 Thread Cornelia Huck
And switch to using the generated definitions. Generated against Linux 6.14-rc1. Signed-off-by: Cornelia Huck --- target/arm/cpu-sysreg-properties.c | 716 - target/arm/cpu-sysregs.h | 116 + target/arm/cpu-sysregs.h.inc | 164 +++ 3 files cha

[PATCH 10/15] arm/cpu: Store id_mfr0/1 into the idregs array

2025-02-07 Thread Cornelia Huck
From: Eric Auger Signed-off-by: Eric Auger Signed-off-by: Cornelia Huck --- hw/intc/armv7m_nvic.c | 5 ++-- target/arm/cpu-features.h | 10 +++ target/arm/cpu.c | 8 ++--- target/arm/cpu.h | 3 -- target/arm/cpu64.c| 8 ++--- target/arm/helper.c | 8

[Stable-9.2.1 46/49] target/s390x: Fix MVC not always invalidating translation blocks

2025-02-07 Thread Michael Tokarev
From: Ilya Leoshkevich Node.js crashes in qemu-system-s390x with random SIGSEGVs / SIGILLs. The v8 JIT used by Node.js can garbage collect and overwrite unused code. Overwriting is performed by WritableJitAllocation::CopyCode(), which ultimately calls memcpy(). For certain sizes, memcpy() uses t

[Stable-9.2.1 48/49] net/dump: Correctly compute Ethernet packet offset

2025-02-07 Thread Michael Tokarev
From: Laurent Vivier When a packet is sent with QEMU_NET_PACKET_FLAG_RAW by QEMU it never includes virtio-net header even if qemu_get_vnet_hdr_len() is not 0, and filter-dump is not managing this case. The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self, we can show the problem using it a

[Stable-9.2.1 49/49] gdbstub/user-target: fix gdbserver int format (%d -> %x)

2025-02-07 Thread Michael Tokarev
From: Dominik 'Disconnect3d' Czarnota This commit fixes an incorrect format string for formatting integers provided to GDB when debugging a target run in QEMU user mode. The correct format is hexadecimal for both success and errno values, some of which can be seen here [0]. [0] https://github.

[Stable-9.2.1 43/49] target/arm: arm_reset_sve_state() should set FPSR, not FPCR

2025-02-07 Thread Michael Tokarev
From: Peter Maydell The pseudocode ResetSVEState() does: FPSR = ZeroExtend(0x089f<31:0>, 64); but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident. Before the advent of FEAT_AFP, this was only setting a collection of RES0 bits, which vfp_set_fpsr() would then ignore, so the

[PATCH 11/12] rust: chardev, qdev: add bindings to qdev_prop_set_chr

2025-02-07 Thread Paolo Bonzini
Because the argument to the function is an Owned, this also adds an ObjectType implementation to Chardev. Signed-off-by: Paolo Bonzini --- rust/hw/char/pl011/src/device.rs | 1 + rust/qemu-api/meson.build| 1 + rust/qemu-api/src/chardev.rs | 19 +++ rust/qemu-api/sr

[PATCH 04/12] rust: qdev: add clock creation

2025-02-07 Thread Paolo Bonzini
Add a Rust version of qdev_init_clock_in, which can be used in instance_init. There are a couple differences with the C version: - in Rust the object keeps its own reference to the clock (in addition to the one embedded in the NamedClockList), and the reference is dropped automatically by ins

[PATCH 09/12] rust: bindings for MemoryRegionOps

2025-02-07 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- rust/hw/char/pl011/src/device.rs | 51 +++ rust/hw/char/pl011/src/lib.rs| 1 - rust/hw/char/pl011/src/memory_ops.rs | 34 - rust/qemu-api/meson.build| 1 + rust/qemu-api/src/lib.rs | 1 + rust/qemu-api/src/memory

[PATCH 01/12] rust: qom: add reference counting functionality

2025-02-07 Thread Paolo Bonzini
Add a smart pointer that allows to add and remove references from QOM objects. It's important to note that while all QOM objects have a reference count, in practice not all of them have their lifetime guarded by it. Embedded objects, specifically, are confined to the lifetime of the owner. When

[PATCH 07/12] rust: qdev: switch from legacy reset to Resettable

2025-02-07 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- meson.build | 1 + rust/hw/char/pl011/src/device.rs | 10 ++- rust/qemu-api/src/qdev.rs| 111 --- rust/qemu-api/tests/tests.rs | 5 +- 4 files changed, 99 insertions(+), 28 deletions(-) diff --git

[PATCH 00/12] rust: remaining parts of qdev bindings

2025-02-07 Thread Paolo Bonzini
This concludes the part of the qdev bindings that is needed to convert pl011 to safe Rust, with the exception of chardev bindings and switching to the pinned_init crate. It includes reference counting, object creation, clocks, Resettable and MemoryRegionOps. Documentation is at least decent. The

[PATCH 10/12] rust: irq: define ObjectType for IRQState

2025-02-07 Thread Paolo Bonzini
This is a small preparation in order to use an Owned for the argument to sysbus_connect_irq. Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/irq.rs | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rust/qemu-api/src/irq.rs b/rust/qemu-api/src/irq.rs index 63

[PULL 3/7] rust: add docs

2025-02-07 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- docs/devel/index-process.rst | 1 + docs/devel/rust.rst | 425 +++ tests/lcitool/libvirt-ci | 2 +- 3 files changed, 427 insertions(+), 1 deletion(-) create mode 100644 docs/devel/rust.rst diff --git a/docs/devel/

[PULL 5/7] target/i386: Do not raise Invalid for 0 * Inf + QNaN

2025-02-07 Thread Paolo Bonzini
From: Peter Maydell In commit 8adcff4ae7 ("fpu: handle raising Invalid for infzero in pick_nan_muladd") we changed the handling of 0 * Inf + QNaN to always raise the Invalid exception regardless of target architecture. (This was a change affecting hppa, i386, sh4 and tricore.) However, this was

[PULL 6/7] tests/tcg/x86_64/fma: Test some x86 fused-multiply-add cases

2025-02-07 Thread Paolo Bonzini
From: Peter Maydell Add a test case which tests some corner case behaviour of fused-multiply-add on x86: * 0 * Inf + SNaN should raise Invalid * 0 * Inf + QNaN shouldh not raise Invalid * tininess should be detected after rounding There is also one currently-disabled test case: * flush-to-ze

[PULL 4/7] rust: add clippy configuration file

2025-02-07 Thread Paolo Bonzini
Configure the minimum supported Rust version (though strictly speaking that's redundant with Cargo.toml), and the list of CamelCase identifiers that are not Rust types. Signed-off-by: Paolo Bonzini --- rust/clippy.toml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 rust/clippy.toml

RE: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3

2025-02-07 Thread Shameerali Kolothum Thodi via
> -Original Message- > From: Nicolin Chen > Sent: Thursday, February 6, 2025 8:33 PM > To: Shameerali Kolothum Thodi > ; Daniel P. Berrangé > ; Jason Gunthorpe > Cc: qemu-...@nongnu.org; qemu-devel@nongnu.org; > eric.au...@redhat.com; peter.mayd...@linaro.org; ddut...@redhat.com; > Lin

[Stable-8.2.9 46/51] target/arm: arm_reset_sve_state() should set FPSR, not FPCR

2025-02-07 Thread Michael Tokarev
From: Peter Maydell The pseudocode ResetSVEState() does: FPSR = ZeroExtend(0x089f<31:0>, 64); but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident. Before the advent of FEAT_AFP, this was only setting a collection of RES0 bits, which vfp_set_fpsr() would then ignore, so the

Re: [PATCH 03/10] rust/irq: Add a helper to convert [InterruptSource] to [*mut IRQState]

2025-02-07 Thread Paolo Bonzini
Il ven 7 feb 2025, 08:25 Zhao Liu ha scritto: > Just to confirm, I check with `cargo +nightly clippy` but it doesn't > complain about this case. Should I switch to another version of clippy > when I do such check? (currently I'm using v0.1.63 clippy as well, to > match rustc.) > I don't remember

[Stable-9.2.1 44/49] hw/usb/canokey: Fix buffer overflow for OUT packet

2025-02-07 Thread Michael Tokarev
From: Hongren Zheng When USBPacket in OUT direction has larger payload than the ep_out_buffer (of size 512), a buffer overflow would occur. It could be fixed by limiting the size of usb_packet_copy to be at most buffer size. Further optimization gets rid of the ep_out_buffer and directly uses ep

[Stable-9.2.1 42/49] stub: Fix build failure with --enable-user --disable-system --enable-tools

2025-02-07 Thread Michael Tokarev
From: Zhao Liu Configuring "--enable-user --disable-system --enable-tools" causes the build failure with the following information: /usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function `device_finalize': /qemu/build/../hw/core/qdev.c:688: undefined reference to `qapi_event_send_device_delet

[Stable-9.2.1 v2 00/49] Patch Round-up for stable 9.2.1, freeze on 2025-02-06 (frozen)

2025-02-07 Thread Michael Tokarev
The following patches are queued for QEMU stable v9.2.1: https://gitlab.com/qemu-project/qemu/-/commits/staging-9.2 Patch freeze is 2025-02-06 (frozen), and the release is planned for 2025-02-08: https://wiki.qemu.org/Planning/9.2 Please respond here or CC qemu-sta...@nongnu.org on any patc

[PATCH 03/12] rust: callbacks: allow passing optional callbacks as ()

2025-02-07 Thread Paolo Bonzini
In some cases, callbacks are optional. Using "Some(function)" and "None" does not work well, because when someone writes "None" the compiler does not know what to use for "F" in "Option". Therefore, adopt () to mean a "null" callback. It is possible to enforce that a callback is valid by adding

[PATCH 05/12] rust: qom: allow initializing interface vtables

2025-02-07 Thread Paolo Bonzini
Unlike regular classes, interface vtables can only be obtained via object_class_dynamic_cast. Provide a wrapper that allows accessing the vtable and pass it to a ClassInitImpl implementation, for example ClassInitImpl. Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/pr

[Stable-8.2.9 48/51] physmem: fix qemu_ram_alloc_from_fd size calculation

2025-02-07 Thread Michael Tokarev
From: Steve Sistare qemu_ram_alloc_from_fd allocates space if file_size == 0. If non-zero, it uses the existing space and verifies it is large enough, but the verification was broken when the offset parameter was introduced. As a result, a file smaller than offset passes the verification and ca

[Stable-8.2.9 51/51] tap: Remove qemu_using_vnet_hdr()

2025-02-07 Thread Michael Tokarev
From: Akihiko Odaki Since qemu_set_vnet_hdr_len() is always called when qemu_using_vnet_hdr() is called, we can merge them and save some code. For consistency, express that the virtio-net header is not in use by returning 0 with qemu_get_vnet_hdr_len() instead of having a dedicated function, qem

[Stable-8.2.9 47/51] hw/usb/canokey: Fix buffer overflow for OUT packet

2025-02-07 Thread Michael Tokarev
From: Hongren Zheng When USBPacket in OUT direction has larger payload than the ep_out_buffer (of size 512), a buffer overflow would occur. It could be fixed by limiting the size of usb_packet_copy to be at most buffer size. Further optimization gets rid of the ep_out_buffer and directly uses ep

[Stable-8.2.9 v2 00/51] Patch Round-up for stable 8.2.9, freeze on 2025-02-06 (frozen)

2025-02-07 Thread Michael Tokarev
The following patches are queued for QEMU stable v8.2.9: https://gitlab.com/qemu-project/qemu/-/commits/staging-8.2 Patch freeze is 2025-02-06 (frozen), and the release is planned for 2025-02-08: https://wiki.qemu.org/Planning/8.2 Please respond here or CC qemu-sta...@nongnu.org on any patc

[Stable-8.2.9 50/51] gdbstub/user-target: fix gdbserver int format (%d -> %x)

2025-02-07 Thread Michael Tokarev
From: Dominik 'Disconnect3d' Czarnota This commit fixes an incorrect format string for formatting integers provided to GDB when debugging a target run in QEMU user mode. The correct format is hexadecimal for both success and errno values, some of which can be seen here [0]. [0] https://github.

[Stable-8.2.9 49/51] target/s390x: Fix MVC not always invalidating translation blocks

2025-02-07 Thread Michael Tokarev
From: Ilya Leoshkevich Node.js crashes in qemu-system-s390x with random SIGSEGVs / SIGILLs. The v8 JIT used by Node.js can garbage collect and overwrite unused code. Overwriting is performed by WritableJitAllocation::CopyCode(), which ultimately calls memcpy(). For certain sizes, memcpy() uses t

Re: [PATCH v5 2/5] migration: refactor ram_save_target_page functions

2025-02-07 Thread Fabiano Rosas
Peter Xu writes: > On Wed, Feb 05, 2025 at 05:57:09PM +0530, Prasad Pandit wrote: >> From: Prasad Pandit >> >> Refactor ram_save_target_page legacy and multifd >> functions into one. Other than simplifying it, >> it frees 'migration_ops' object from usage, so it >> is expunged. >> >> Reviewed-

RE: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3

2025-02-07 Thread Shameerali Kolothum Thodi via
> -Original Message- > From: Daniel P. Berrangé > Sent: Friday, February 7, 2025 10:32 AM > To: Shameerali Kolothum Thodi > Cc: Nicolin Chen ; Jason Gunthorpe > ; qemu-...@nongnu.org; qemu-devel@nongnu.org; > eric.au...@redhat.com; peter.mayd...@linaro.org; ddut...@redhat.com; > Linuxar

Re: [PATCH v4 2/4] qdev-properties: Accept bool for OnOffAuto

2025-02-07 Thread Daniel P . Berrangé
On Fri, Feb 07, 2025 at 01:31:47PM +0100, Markus Armbruster wrote: > Akihiko Odaki writes: > > [...] > > > Let me go back to the discussion of the bool/OnOffAuto problem below: > > > > The values the command line syntax accepts are on/yes/true/y and > > off/no/false/n. > > > > For the command l

Re: [RFC v2 1/5] qapi/qom: Introduce kvm-pmu-filter object

2025-02-07 Thread Markus Armbruster
Zhao Liu writes: >> Let's ignore how to place it for now, and focus on where we would *like* >> to place it. >> >> Is it related to anything other than ObjectType / ObjectOptions in the >> QMP reference manual? > > Yes! Now I'm confused :) It is related to ObjectType / ObjectType. Is it relat

Re: [RFC v2 3/5] i386/kvm: Support event with select & umask format in KVM PMU filter

2025-02-07 Thread Markus Armbruster
Zhao Liu writes: >> > Do users need to know how to compute the raw event value from @select >> > and @umask? >> >> Yes, because it's also a unified calculation. AMD and Intel have >> differences in bits for supported select field, but this calculation >> (which follows from the KVM code) makes b

Re: Call for GSoC internship project ideas

2025-02-07 Thread Hanna Czenczek
On 28.01.25 17:16, Stefan Hajnoczi wrote: Dear QEMU and KVM communities, QEMU will apply for the Google Summer of Code internship program again this year. Regular contributors can submit project ideas that they'd like to mentor by replying to this email by February 7th. About Google Summer of Co

[PATCH] hw/acpi: Remove legacy reset handling from vmclock

2025-02-07 Thread David Woodhouse
From: David Woodhouse The vmclock device only has a reset method in order to plug its memory region into the system memory. It was originally done this way in order to defer the memory_region_add_subregion_overlap() from vmclock_realize(), but that doesn't seem to be necessary (any longer?). Sti

Re: [RFC PATCH v2 1/8] crypto: Allow gracefully ending the TLS session

2025-02-07 Thread Daniel P . Berrangé
On Fri, Feb 07, 2025 at 11:27:51AM -0300, Fabiano Rosas wrote: > QEMU's TLS session code provides no way to call gnutls_bye() to > terminate a TLS session. Callers of qcrypto_tls_session_read() can > choose to ignore a GNUTLS_E_PREMATURE_TERMINATION error by setting the > gracefulTermination argume

Re: [PATCH v4 17/33] migration/multifd: Make MultiFDSendData a struct

2025-02-07 Thread Fabiano Rosas
"Maciej S. Szmigiero" writes: > From: Peter Xu > > The newly introduced device state buffer can be used for either storing > VFIO's read() raw data, but already also possible to store generic device > states. After noticing that device states may not easily provide a max > buffer size (also the

[PATCH 1/2] i386/xen: Move KVM_XEN_HVM_CONFIG ioctl to kvm_xen_init_vcpu()

2025-02-07 Thread David Woodhouse
From: David Woodhouse At the time kvm_xen_init() is called, hyperv_enabled() doesn't yet work, so the correct MSR index to use for the hypercall page isn't known. Rather than setting it to the default and then shifting it later for the Hyper-V case with a confusing second call to kvm_init_xen(),

[PATCH 2/2] hw/xen: Add "mode" parameter to xen-block devices

2025-02-07 Thread David Woodhouse
From: David Woodhouse Block devices don't work in PV Grub (0.9x) if there is no mode specified. It complains: "Error ENOENT when reading the mode" Signed-off-by: David Woodhouse --- hw/block/xen-block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/block/xen-block.c b/hw/block/xen-b

[PATCH] rust: restrict missing_const_for_fn to qemu_api crate

2025-02-07 Thread Paolo Bonzini
missing_const_for_fn is not necessarily useful or good. For example in a private API you can always add const later, and in a public API it can be unnecessarily restrictive to annotate everything with const (blocking further improvements to the API). Nevertheless, QEMU turns it on because qemu_ap

[PATCH] rust: pl011: use default set of lints

2025-02-07 Thread Paolo Bonzini
Being the first crate added to QEMU, pl011 has a rather restrictive Clippy setup. This can be sometimes a bit too heavy on its suggestions, for example error: this could be a `const fn` --> hw/char/pl011/src/device.rs:382:5 | 382 | / fn set_read_trigger(&mut self) { 383 | | sel

Re: [RFC PATCH v2 2/8] io: tls: Add qio_channel_tls_bye

2025-02-07 Thread Daniel P . Berrangé
On Fri, Feb 07, 2025 at 11:27:52AM -0300, Fabiano Rosas wrote: > Add a task dispatcher for gnutls_bye similar to the > qio_channel_tls_handshake_task(). The gnutls_bye() call might be > interrupted and so it needs to be rescheduled. > > The migration code will make use of this to help the migratio

Re: Call for GSoC internship project ideas

2025-02-07 Thread Helge Deller
Hi Stefan, On 1/28/25 17:16, Stefan Hajnoczi wrote: How to propose your idea -- Reply to this email with the following project idea template filled in: Would something like this be acceptable? === Develop a driver to emulate an existing network-, scsi- or graphic-

Re: [RFC PATCH v2 5/8] crypto: Remove qcrypto_tls_session_get_handshake_status

2025-02-07 Thread Daniel P . Berrangé
On Fri, Feb 07, 2025 at 11:27:55AM -0300, Fabiano Rosas wrote: > The correct way of calling qcrypto_tls_session_handshake() requires > calling qcrypto_tls_session_get_handshake_status() right after it so > there's no reason to have a separate method. > > Refactor qcrypto_tls_session_handshake() to

[PATCH] tests/functional: Convert the aarch64 xen test to the functional framework

2025-02-07 Thread Thomas Huth
This test just needs the adaption for the asset handling, then we can move it to the functional framework. Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 1 + .../test_aarch64_xen.py} | 7

Re: Call for GSoC internship project ideas

2025-02-07 Thread Stefan Hajnoczi
On Fri, Feb 7, 2025 at 9:39 AM Helge Deller wrote: > > Hi Stefan, > > On 1/28/25 17:16, Stefan Hajnoczi wrote: > > How to propose your idea > > -- > > Reply to this email with the following project idea template filled in: > > Would something like this be acceptable? Y

Re: [RFC PATCH v2 6/8] io: Plumb read flags into qio_channel_read_all_eof

2025-02-07 Thread Daniel P . Berrangé
On Fri, Feb 07, 2025 at 11:27:56AM -0300, Fabiano Rosas wrote: > We want to pass flags into qio_channel_tls_readv() but some functions > along the way don't take a flags argument. Plumb the flags through. > > No functional change. > > Signed-off-by: Fabiano Rosas > --- > diff --git a/include/io

Re: [PATCH v4 2/4] qdev-properties: Accept bool for OnOffAuto

2025-02-07 Thread Markus Armbruster
Akihiko Odaki writes: [...] > Let me go back to the discussion of the bool/OnOffAuto problem below: > > The values the command line syntax accepts are on/yes/true/y and > off/no/false/n. > > For the command line syntax, you can always use on/off whether the type is > bool or OnOffAuto. In my o

Re: [PATCH v2 4/8] hw/boards: Remove all invalid uses of auto_create_sdcard=true

2025-02-07 Thread Markus Armbruster
Philippe Mathieu-Daudé writes: > On 5/2/25 08:03, Markus Armbruster wrote: >> Philippe Mathieu-Daudé writes: >> >>> MachineClass::auto_create_sdcard is only useful to automatically >>> create a SD card, attach a IF_SD block drive to it and plug the >>> card onto a SD bus. Only the ARM and RISCV

Re: Call for GSoC internship project ideas

2025-02-07 Thread Stefan Hajnoczi
On Fri, Feb 7, 2025 at 7:35 AM Hanna Czenczek wrote: > > On 28.01.25 17:16, Stefan Hajnoczi wrote: > > Dear QEMU and KVM communities, > > QEMU will apply for the Google Summer of Code internship > > program again this year. Regular contributors can submit project > > ideas that they'd like to ment

Re: [PATCH 14/15] arm/cpu: Add sysreg generation scripts

2025-02-07 Thread Marc Zyngier
On Fri, 07 Feb 2025 11:02:47 +, Cornelia Huck wrote: > > From: Eric Auger > > Introduce scripts that automate the generation of system register > definitions from a given linux source tree arch/arm64/tools/sysreg. > > Invocation of > ./update-aarch64-sysreg-code.sh $PATH_TO_LINUX_SOURCE_TR

Re: [PATCH v4 08/33] migration/multifd: Allow premature EOF on TLS incoming channels

2025-02-07 Thread Fabiano Rosas
Peter Xu writes: > On Fri, Feb 07, 2025 at 10:17:19AM -0300, Fabiano Rosas wrote: >> Peter Xu writes: >> >> > On Thu, Feb 06, 2025 at 02:32:12PM -0300, Fabiano Rosas wrote: >> >> > In any case we'd still need some kind of a compatibility behavior for >> >> > the TLS bit stream emitted by older

Re: [PATCH 07/10] rust/timer/hpet: define hpet_cfg

2025-02-07 Thread Zhao Liu
On Wed, Jan 29, 2025 at 11:58:46AM +0100, Paolo Bonzini wrote: > Date: Wed, 29 Jan 2025 11:58:46 +0100 > From: Paolo Bonzini > Subject: Re: [PATCH 07/10] rust/timer/hpet: define hpet_cfg > > > > On Sat, Jan 25, 2025 at 1:32 PM Zhao Liu wrote: > > @@ -5,6 +5,7 @@ edition = "2021" > > authors =

[RFC PATCH v2 7/8] io: Add a read flag for relaxed EOF

2025-02-07 Thread Fabiano Rosas
Add a read flag that can inform a channel that it's ok to receive an EOF at any moment. Channels that have some form of strict EOF tracking, such as TLS session termination, may choose to ignore EOF errors with the use of this flag. This is being added for compatibility with older migration stream

[RFC PATCH v2 8/8] migration/multifd: Add a compat property for TLS termination

2025-02-07 Thread Fabiano Rosas
We're currently changing the way the source multifd migration handles the shutdown of the multifd channels when TLS is in use to perform a clean termination by calling gnutls_bye(). Older src QEMUs will always close the channel without terminating the TLS session. New dst QEMUs treat an unclean te

[RFC PATCH v2 5/8] crypto: Remove qcrypto_tls_session_get_handshake_status

2025-02-07 Thread Fabiano Rosas
The correct way of calling qcrypto_tls_session_handshake() requires calling qcrypto_tls_session_get_handshake_status() right after it so there's no reason to have a separate method. Refactor qcrypto_tls_session_handshake() to inform the status in its own return value and alter the callers accordin

[RFC PATCH v2 4/8] migration: Check migration error after loadvm

2025-02-07 Thread Fabiano Rosas
We're currently only checking the QEMUFile error after qemu_loadvm_state(). Check the migration error as well to avoid missing errors that might be set by the multifd recv thread. This doesn't break compat between 9.2 and 10.0 because 9.2 still has the multifd recv threads stuck at sync when the s

[RFC PATCH v2 2/8] io: tls: Add qio_channel_tls_bye

2025-02-07 Thread Fabiano Rosas
Add a task dispatcher for gnutls_bye similar to the qio_channel_tls_handshake_task(). The gnutls_bye() call might be interrupted and so it needs to be rescheduled. The migration code will make use of this to help the migration destination identify a premature EOF. Once the session termination is i

[RFC PATCH v2 6/8] io: Plumb read flags into qio_channel_read_all_eof

2025-02-07 Thread Fabiano Rosas
We want to pass flags into qio_channel_tls_readv() but some functions along the way don't take a flags argument. Plumb the flags through. No functional change. Signed-off-by: Fabiano Rosas --- hw/remote/mpqemu-link.c | 2 +- include/io/channel.h | 6 ++ io/channel.c

[RFC PATCH v2 1/8] crypto: Allow gracefully ending the TLS session

2025-02-07 Thread Fabiano Rosas
QEMU's TLS session code provides no way to call gnutls_bye() to terminate a TLS session. Callers of qcrypto_tls_session_read() can choose to ignore a GNUTLS_E_PREMATURE_TERMINATION error by setting the gracefulTermination argument. The QIOChannelTLS ignores the premature termination error whenever

[RFC PATCH v2 3/8] migration/multifd: Terminate the TLS connection

2025-02-07 Thread Fabiano Rosas
The multifd recv side has been getting a TLS error of GNUTLS_E_PREMATURE_TERMINATION at the end of migration when the send side closes the sockets without ending the TLS session. This has been masked by the code not checking the migration error after loadvm. Start ending the TLS session at multifd

[RFC PATCH v2 0/8] crypto,io,migration: Add support to gnutls_bye()

2025-02-07 Thread Fabiano Rosas
v2: Added the premature_ok logic; Added compat property for QEMU <9.1; Refactored the existing handshake code; CI run: https://gitlab.com/farosas/qemu/-/pipelines/1660800456 v1: https://lore.kernel.org/r/20250206175824.22664-1-faro...@suse.de Hi, We've been discussing a way to stop multifd rec

Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable nested SMMUv3

2025-02-07 Thread Jason Gunthorpe
On Fri, Feb 07, 2025 at 12:21:54PM +, Shameerali Kolothum Thodi wrote: > Just wondering whether we can have something like the > vfio_register_iommu_driver() for iommufd subsystem by which it can directly > access iommu drivers ops(may be a restricted set). I very much want to try hard to av

Re: [PATCH 06/10] rust: add bindings for timer

2025-02-07 Thread Zhao Liu
> > +pub use bindings::QEMUTimer; > > + > > +use crate::{ > > +bindings::{ > > +self, qemu_clock_get_ns, timer_del, timer_init_full, timer_mod, > > QEMUClockType, > > +QEMUTimerListGroup, > > +}, > > +callbacks::FnCall, > > +}; > > + > > +impl QEMUTimer { > > +pub f

<    1   2   3   >