[PATCH 0/1] accel/kvm: set coalesced_mmio_ring to NULL after kvm_run is unmapped

2025-02-13 Thread Sid Manning
Encountered a segfault while exiting because kvm_flush_coalesced_mmio_buffer was getting called after do_kvm_destroy_vcpu unmapped cpu->kvm_run. kvm_state->coalesced_mmio_ring is an offset from cpu->kvm_run so it needs to be set to NULL after kvm_run is unmapped to avoid getting dereferenced by kv

[PATCH 1/1] accel/kvm: set coalesced_mmio_ring to NULL after kvm_run is unmapped

2025-02-13 Thread Sid Manning
kvm_flush_coalesced_mmio_buffer explicitly checks for this to be non-null. Since kvm_init_vcpu sets this as an offset from the mapped cpu->kvm_run it should be reset to NULL after kvm_run is unmapped. Signed-off-by: Sid Manning --- accel/kvm/kvm-all.c | 2 ++ 1 file changed, 2 insertions(+) di

Re: [PATCH 0/3] tests/qtest/ufs-test: Add MCQ tests

2025-02-13 Thread Fabiano Rosas
Jeuk Kim writes: > This series adds test support for UFS Multi-Circular Queue (MCQ) mode in > QEMU. > It includes MCQ initialization tests, a bitmap-based slot allocation method, > and cleanup of unused code. > > Jeuk Kim (3): > tests/qtest/ufs-test: Cleanup unused code > tests/qtest/ufs

Re: [PATCH v8 0/3] Poisoned memory recovery on reboot

2025-02-13 Thread William Roche
On 2/11/25 23:35, Peter Xu wrote: On Tue, Feb 11, 2025 at 09:27:04PM +, “William Roche wrote: From: William Roche Here is a very simplified version of my fix only dealing with the recovery of huge pages on VM reset. --- This set of patches fixes an existing bug with hardware memory error

Re: [PATCH] target/sparc: Fix gdbstub incorrectly handling registers f32-f62

2025-02-13 Thread Richard Henderson
On 2/13/25 11:03, Mikael Szreder wrote: Sorry. As you correctly pointed out there is no f33 register. I wrote f33, when I really meant f34. I believe the index of f32 is 64 and f34 is 65. This is confirmed when looking at the XML description of the registers in GDB:

Re: [PATCH] target/sparc: Fix gdbstub incorrectly handling registers f32-f62

2025-02-13 Thread Mikael Szreder
Sorry. As you correctly pointed out there is no f33 register. I wrote f33, when I really meant f34. I believe the index of f32 is 64 and f34 is 65. This is confirmed when looking at the XML description of the registers in GDB:

Re: [PULL 00/29] Misc HW patches for 2025-02-12

2025-02-13 Thread Stefan Hajnoczi
On Wed, Feb 12, 2025 at 10:54 AM Philippe Mathieu-Daudé wrote: > > The following changes since commit f9edf32ea2e18a56de5d92f57e9d10565c822367: > > Merge tag 'pull-request-2025-02-11' of https://gitlab.com/thuth/qemu into > staging (2025-02-11 13:27:32 -0500) > > are available in the Git reposi

Re: Question Regarding the PowerPC arch Support

2025-02-13 Thread Atharv Dubey
On Fri, 14 Feb, 2025, 00:05 Thomas Huth, wrote: > On 13/02/2025 19.18, Atharv Dubey wrote: > > Hello, > > > > I am new user to qemu and wanted to ask if qemu supports AHCI mode in > > PowerPC emulation. > > Hi, > > it seems like the "powernv" machine of qemu-system-ppc64 supports AHCI, > but >

Re: Question Regarding the PowerPC arch Support

2025-02-13 Thread Thomas Huth
On 13/02/2025 19.18, Atharv Dubey wrote: Hello, I am new user to qemu and wanted to ask if qemu supports AHCI mode in PowerPC emulation. Hi, it seems like the "powernv" machine of qemu-system-ppc64 supports AHCI, but I don't have a clue how to use it. So let's put qemu-...@nongnu.org in CC

Re: [PATCH 1/1] mem/cxl-type3: Add a default value of sn

2025-02-13 Thread Fan Ni
On Thu, Feb 13, 2025 at 03:09:05PM +0800, Yuquan Wang wrote: > On Tue, Feb 11, 2025 at 09:26:55AM +, Jonathan Cameron wrote: > > On Tue, 11 Feb 2025 10:24:13 +0800 > > Yuquan Wang wrote: > > > > > The previous default value of sn is UI64_NULL which would cause the > > > cookie of nd_interleav

Question Regarding the PowerPC arch Support

2025-02-13 Thread Atharv Dubey
Hello, I am new user to qemu and wanted to ask if qemu supports AHCI mode in PowerPC emulation. Regards, Atharv Dubey

[PATCH 12/12] virtio-scsi: handle ctrl virtqueue in main loop

2025-02-13 Thread Stefan Hajnoczi
Previously the ctrl virtqueue was handled in the AioContext where SCSI requests are processed. When IOThread Virtqueue Mapping was added things become more complicated because SCSI requests could run in other AioContexts. Simplify by handling the ctrl virtqueue in the main loop where reset operati

[PATCH 01/12] scsi-disk: drop unused SCSIDiskState->bh field

2025-02-13 Thread Stefan Hajnoczi
Commit 71544d30a6f8 ("scsi: push request restart to SCSIDevice") removed the only user of SCSIDiskState->bh. Signed-off-by: Stefan Hajnoczi --- hw/scsi/scsi-disk.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index e7f738b484..caf6c1437f 100644 ---

[PATCH 08/12] virtio-blk: extract cleanup_iothread_vq_mapping() function

2025-02-13 Thread Stefan Hajnoczi
This is the cleanup function that must be called after apply_iothread_vq_mapping() succeeds. virtio-scsi will need this function too, so extract it. Signed-off-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff -

[PATCH 11/12] virtio-scsi: add iothread-vq-mapping parameter

2025-02-13 Thread Stefan Hajnoczi
Allow virtio-scsi virtqueues to be assigned to different IOThreads. This makes it possible to take advantage of host multi-queue block layer scalability by assigning virtqueues that have affinity with vCPUs to different IOThreads that have affinity with host CPUs. The same feature was introduced fo

[PATCH 09/12] virtio-blk: tidy up iothread_vq_mapping functions

2025-02-13 Thread Stefan Hajnoczi
Use noun_verb() function naming instead of verb_noun() because the former is the most common naming style for APIs. The next commit will move these functions into a header file so that virtio-scsi can call them. Shorten iothread_vq_mapping_apply()'s iothread_vq_mapping_list argument to just "list"

[PATCH 03/12] scsi: track per-SCSIRequest AioContext

2025-02-13 Thread Stefan Hajnoczi
Until now, a SCSIDevice's I/O requests have run in a single AioContext. In order to support multiple IOThreads it will be necessary to move to the concept of a per-SCSIRequest AioContext. Signed-off-by: Stefan Hajnoczi --- include/hw/scsi/scsi.h | 1 + hw/scsi/scsi-bus.c | 1 + hw/scsi/scs

[PATCH 07/12] virtio-scsi: perform TMFs in appropriate AioContexts

2025-02-13 Thread Stefan Hajnoczi
With IOThread Virtqueue Mapping there will be multiple AioContexts processing SCSI requests. scsi_req_cancel() and other SCSI request operations must be performed from the AioContext where the request is running. Introduce a virtio_scsi_defer_tmf_to_aio_context() function and the necessary VirtIOS

[PATCH 10/12] virtio: extract iothread-vq-mapping.h API

2025-02-13 Thread Stefan Hajnoczi
The code that builds an array of AioContext pointers indexed by the virtqueue is not specific to virtio-blk. virtio-scsi will need to do the same thing, so extract the functions. Signed-off-by: Stefan Hajnoczi --- include/hw/virtio/iothread-vq-mapping.h | 45 hw/block/virtio-blk.c

[PATCH 02/12] dma: use current AioContext for dma_blk_io()

2025-02-13 Thread Stefan Hajnoczi
In the past a single AioContext was used for block I/O and it was fetched using blk_get_aio_context(). Nowadays the block layer supports running I/O from any AioContext and multiple AioContexts at the same time. Remove the dma_blk_io() AioContext argument and use the current AioContext instead. Th

[PATCH 05/12] virtio-scsi: introduce event and ctrl virtqueue locks

2025-02-13 Thread Stefan Hajnoczi
Virtqueues are not thread-safe. Until now this was not a major issue since all virtqueue processing happened in the same thread. The ctrl queue's Task Management Function (TMF) requests sometimes need the main loop, so a BH was used to schedule the virtqueue completion back in the thread that has v

[PATCH v3 6/9] migration: Don't set FAILED state when cancelling

2025-02-13 Thread Fabiano Rosas
The expected outcome from qmp_migrate_cancel() is that the source migration goes to the terminal state MIGRATION_STATUS_CANCELLED. Anything different from this is a bug when cancelling. Make sure there is never a state transition from an unspecified state into FAILED. Code that sets FAILED, should

[PATCH 04/12] scsi: introduce requests_lock

2025-02-13 Thread Stefan Hajnoczi
SCSIDevice keeps track of in-flight requests for device reset and Task Management Functions (TMFs). The request list requires protection so that multi-threaded SCSI emulation can be implemented in commits that follow. Signed-off-by: Stefan Hajnoczi --- include/hw/scsi/scsi.h | 7 ++- hw/scsi/s

[PATCH 06/12] virtio-scsi: protect events_dropped field

2025-02-13 Thread Stefan Hajnoczi
The block layer can invoke the resize callback from any AioContext that is processing requests. The virtqueue is already protected but the events_dropped field also needs to be protected against races. Cover it using the event virtqueue lock because it is closely associated with accesses to the vir

[PATCH v3 3/9] migration: Change migrate_fd_ to migration_

2025-02-13 Thread Fabiano Rosas
Remove all instances of _fd_ from the migration generic code. These functions have grown over time and the _fd_ part is now just confusing. migration_fd_error() -> migration_error() makes it a little vague. Since it's only used for migration_connect() failures, change it to migration_connect_set_e

[PATCH 00/12] virtio-scsi: add iothread-vq-mapping parameter

2025-02-13 Thread Stefan Hajnoczi
Implement --device virtio-scsi-pci,iothread-vq-mapping= support so that virtqueues can be assigned to different IOThreads. This improves SMP guest scalability where I/O-intensive applications can become bottlenecked on a single IOThread. The following benchmark results show the effect of iothread-

[PATCH v3 7/9] tests/qtest/migration: Introduce migration_test_add_suffix

2025-02-13 Thread Fabiano Rosas
Introduce a new migration_test_add_suffix to allow programmatic creation of tests based on a suffix. Pass the test name into the test so it can know which variant to run. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- tests/qtest/migration/migration-util.c | 24

[PATCH v3 9/9] migration: Update migrate_cancel documentation

2025-02-13 Thread Fabiano Rosas
Update the migrate_cancel command documentation with a few words about postcopy and the expected state of the machine after migration. Acked-by: Markus Armbruster Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- qapi/migration.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH v3 1/9] migration: Set migration error outside of migrate_cancel

2025-02-13 Thread Fabiano Rosas
There's no point passing the error into migration cancel only for it to call migrate_set_error(). Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 7 ++- migration/migration.h | 2 +- migration/ram.c | 4 +++- 3 files changed, 6 insertions(+), 7 deletions

[PATCH v3 5/9] migration: Reject qmp_migrate_cancel after postcopy

2025-02-13 Thread Fabiano Rosas
After postcopy has started, it's not possible to recover the source machine in case a migration error occurs because the destination has already been changing the state of the machine. For that same reason, it doesn't make sense to try to cancel the migration after postcopy has started. Reject the

[PATCH v3 4/9] migration: Fix hang after error in destination setup phase

2025-02-13 Thread Fabiano Rosas
If the destination side fails at migration_ioc_process_incoming() before starting the coroutine, it will report the error but QEMU will not exit. Set the migration state to FAILED and exit the process if exit-on-error allows. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2633 Reported-b

[PATCH v3 0/9] migration: Fix issues during qmp_migrate_cancel

2025-02-13 Thread Fabiano Rosas
changes from v2: Added more if != CANCELLING where it was missing. We have other work [1] pending around migration states, so I've kept this simple for correctness only. CI run: https://gitlab.com/farosas/qemu/-/pipelines/1670135398 1- https://lore.kernel.org/r/20250110100707.4805-1-shivam.kum..

[PATCH v3 2/9] migration: Unify migration_cancel and migrate_fd_cancel

2025-02-13 Thread Fabiano Rosas
There's no need for two separate functions and this _fd_ is a historic artifact that makes little sense nowadays. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 18 +++--- migration/trace-events | 2 +- 2 files changed, 8 insertions(+), 12 deletions

[PATCH v3 8/9] tests/qtest/migration: Add a cancel test

2025-02-13 Thread Fabiano Rosas
The qmp_migrate_cancel() command is poorly tested and code inspection reveals that there might be concurrency issues with its usage. Add a test that runs a migration and calls qmp_migrate_cancel() at specific moments. In order to make the test more deterministic, instead of calling qmp_migrate_can

Re: [PATCH 1/6] tcg: Introduce the 'z' constraint for a hardware zero register

2025-02-13 Thread Richard Henderson
On 2/13/25 07:45, Philippe Mathieu-Daudé wrote: On 12/2/25 04:46, Richard Henderson wrote: For loongarch, mips, riscv and sparc, a zero register is available all the time.  For aarch64, register index 31 depends on context: sometimes it is the stack pointer, and sometimes it is the zero register

Re: [PATCH v4] hw/arm/virt: Support larger highmem MMIO regions

2025-02-13 Thread Eric Auger
On 2/12/25 3:54 PM, Matthew R. Ochs wrote: > The MMIO region size required to support virtualized environments with > large PCI BAR regions can exceed the hardcoded limit configured in QEMU. > For example, a VM with multiple NVIDIA Grace-Hopper GPUs passed through > requires more MMIO memory th

Re: [PATCH v8 6/6] hw/ssi/xilinx_spi: Make device endianness configurable

2025-02-13 Thread Richard Henderson
On 2/13/25 04:22, Philippe Mathieu-Daudé wrote: Replace the DEVICE_NATIVE_ENDIAN MemoryRegionOps by a pair of DEVICE_LITTLE_ENDIAN / DEVICE_BIG_ENDIAN. Add the "endianness" property to select the device endianness. This property is unspecified by default, and machines need to make it explicit.

Re: [PATCH v8 5/6] hw/char/xilinx_uartlite: Make device endianness configurable

2025-02-13 Thread Richard Henderson
On 2/13/25 04:22, Philippe Mathieu-Daudé wrote: Replace the DEVICE_NATIVE_ENDIAN MemoryRegionOps by a pair of DEVICE_LITTLE_ENDIAN / DEVICE_BIG_ENDIAN. Add the "endianness" property to select the device endianness. This property is unspecified by default, and machines need to make it explicit.

Re: [PATCH v8 1/6] hw/qdev-properties-system: Introduce EndianMode QAPI enum

2025-02-13 Thread Richard Henderson
On 2/13/25 04:22, Philippe Mathieu-Daudé wrote: Introduce the EndianMode type and the DEFINE_PROP_ENDIAN() macros. Endianness can be BIG, LITTLE or unspecified (default). Reviewed-by: Thomas Huth Acked-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé --- qapi/common.json

Re: [PATCH v8 4/6] hw/timer/xilinx_timer: Make device endianness configurable

2025-02-13 Thread Richard Henderson
On 2/13/25 04:22, Philippe Mathieu-Daudé wrote: Replace the DEVICE_NATIVE_ENDIAN MemoryRegionOps by a pair of DEVICE_LITTLE_ENDIAN / DEVICE_BIG_ENDIAN. Add the "endianness" property to select the device endianness. This property is unspecified by default, and machines need to make it explicit.

Re: [PATCH v8 3/6] hw/net/xilinx_ethlite: Make device endianness configurable

2025-02-13 Thread Richard Henderson
On 2/13/25 04:22, Philippe Mathieu-Daudé wrote: Replace the DEVICE_NATIVE_ENDIAN MemoryRegionOps by a pair of DEVICE_LITTLE_ENDIAN / DEVICE_BIG_ENDIAN. Add the "endianness" property to select the device endianness. This property is unspecified by default, and machines need to make it explicit.

Re: [PATCH v8 2/6] hw/intc/xilinx_intc: Make device endianness configurable

2025-02-13 Thread Richard Henderson
On 2/13/25 04:22, Philippe Mathieu-Daudé wrote: Replace the DEVICE_NATIVE_ENDIAN MemoryRegionOps by a pair of DEVICE_LITTLE_ENDIAN / DEVICE_BIG_ENDIAN. Add the "endianness" property to select the device endianness. This property is unspecified by default, and machines need to make it explicit.

Re: [PATCH] target/sparc: Fix gdbstub incorrectly handling registers f32-f62

2025-02-13 Thread Richard Henderson
On 2/3/25 06:50, Mikael Szreder wrote: The gdbstub implementation for the Sparc architecture would incorectly calculate the the floating point register offset. This would cause register pairs(eg f32,f33) to point to the same value. Fixes: 30038fd81808 ("target-sparc: Change fpr representation

Re: [PATCH] target/loongarch: Add full type support for query-cpu-model-expansion

2025-02-13 Thread Igor Mammedov
On Thu, 13 Feb 2025 17:40:56 +0800 bibo mao wrote: > please discard this patch :( > > libvirt uses static type already on LoongArch platform, there is > compatibility issue. Static type cannot be removed, although I do > not know the difference between static type and full type. looking at loo

[PULL 11/27] rust: irq: define ObjectType for IRQState

2025-02-13 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 08/27] rust: qdev: switch from legacy reset to Resettable

2025-02-13 Thread Paolo Bonzini
Reviewed-by: Zhao Liu 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 de

Re: [PATCH] target/loongarch: Add full type support for query-cpu-model-expansion

2025-02-13 Thread David Hildenbrand
On 13.02.25 17:17, Igor Mammedov wrote: On Thu, 13 Feb 2025 12:48:30 +0100 Markus Armbruster wrote: gaosong writes: Cc: Markus hi, Markus What is the difference between CPU_MODEL_EXPANSION_TYPE_STATIC and CPU_MODEL_EXPANSION_TYPE_FULL? the only difference is that 'static' expansion will

Re: [PATCH] vhost-user-snd: Use virtio_get_config_size()

2025-02-13 Thread Stefano Garzarella
On Thu, 13 Feb 2025 at 16:43, Stefano Garzarella wrote: > > Unrelated to this patch, but since we are talking about > VIRTIO_SND_F_CTLS, I think it would be good to send a patch to Linux to > make it clear that `controls` depends on VIRTIO_SND_F_CTLS. Patch posted here: https://lore.kernel.org/vi

[PULL 14/27] i386/fw_cfg: move hpet_cfg definition to hpet.c

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu HPET device needs to access and update hpet_cfg variable, but now it is defined in hw/i386/fw_cfg.c and Rust code can't access it. Move hpet_cfg definition to hpet.c (and rename it to hpet_fw_cfg). This allows Rust HPET device implements its own global hpet_fw_cfg variable, and wi

Re: [PATCH] target/loongarch: Add full type support for query-cpu-model-expansion

2025-02-13 Thread Igor Mammedov
On Thu, 13 Feb 2025 12:48:30 +0100 Markus Armbruster wrote: > gaosong writes: > > > Cc: Markus > > > > hi, Markus > > > > What is the difference between CPU_MODEL_EXPANSION_TYPE_STATIC and > > CPU_MODEL_EXPANSION_TYPE_FULL? the only difference is that 'static' expansion will not report prop

[PULL 02/27] rust: qom: add reference counting functionality

2025-02-13 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

[PULL 07/27] rust: qdev: make ObjectImpl a supertrait of DeviceImpl

2025-02-13 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 25/27] rust: vmstate: remove redundant link targets

2025-02-13 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/vmstate.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rust/qemu-api/src/vmstate.rs b/rust/qemu-api/src/vmstate.rs index 164effc6553..c6dfb609356 100644 --- a/rust/qemu-api/src/vmstate.rs +++ b/rust/qemu-api/src/vmsta

[PULL 13/27] rust: pl011: convert pl011_create to safe Rust

2025-02-13 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. Reviewed-by: Zhao Liu Signed-off-by: P

[PULL 10/27] rust: bindings for MemoryRegionOps

2025-02-13 Thread Paolo Bonzini
Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- docs/devel/rust.rst | 1 + 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 + r

Re: [PATCH 4/9] target/microblaze: Use uint64_t for CPUMBState.ear

2025-02-13 Thread Richard Henderson
On 2/13/25 04:42, Philippe Mathieu-Daudé wrote: On 12/2/25 23:01, Richard Henderson wrote: Use an explicit 64-bit type for EAR. Signed-off-by: Richard Henderson ---   target/microblaze/cpu.h   | 2 +-   target/microblaze/translate.c | 2 +-   2 files changed, 2 insertions(+), 2 deletions(-)

[PULL 19/27] rust: add bindings for timer

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu Add timer bindings to help handle idiomatic Rust callbacks. Additionally, wrap QEMUClockType in ClockType binding to avoid unsafe calls in device code. Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250210030051.2562726-7-zhao1@intel.com Signed-off-by: Paolo Bonzi

[PULL 00/27] rust, Windows patches for 2025-02-13

2025-02-13 Thread Paolo Bonzini
The following changes since commit de278e54aefed143526174335f8286f7437d20be: Merge tag 'pull-loongarch-20250212' of https://gitlab.com/bibo-mao/qemu into staging (2025-02-12 09:16:36 -0500) are available in the Git repository at: https://gitlab.com/bonzini/qemu.git tags/for-upstream for yo

[PULL 06/27] rust: qom: allow initializing interface vtables

2025-02-13 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

[PULL 18/27] rust: add bindings for memattrs

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu The MemTxAttrs structure contains bitfield members, and bindgen is unable to generate an equivalent macro definition for MEMTXATTRS_UNSPECIFIED. Therefore, manually define a global constant variable MEMTXATTRS_UNSPECIFIED to support calls from Rust code. Signed-off-by: Zhao Liu

[PULL 23/27] i386: enable rust hpet for pc when rust is enabled

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu Add HPET configuration in PC's Kconfig options, and select HPET device (Rust version) if Rust is supported. Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250210030051.2562726-11-zhao1@intel.com Signed-off-by: Paolo Bonzini --- configs/devices/i386-softmmu/defaul

[PULL 22/27] rust/timer/hpet: add qom and qdev APIs support

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu Implement QOM & QAPI support for HPET device. Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250210030051.2562726-10-zhao1@intel.com Signed-off-by: Paolo Bonzini --- rust/hw/timer/hpet/src/fw_cfg.rs | 2 - rust/hw/timer/hpet/src/hpet.rs | 278

[PULL 01/27] rust: docs: document naming convention

2025-02-13 Thread Paolo Bonzini
As agreed in the "vtables and procedural macros" thread on the mailing list. Signed-off-by: Paolo Bonzini --- docs/devel/rust.rst | 44 1 file changed, 44 insertions(+) diff --git a/docs/devel/rust.rst b/docs/devel/rust.rst index 390aae43866..8a7

[PULL 16/27] rust/irq: Add a helper to convert [InterruptSource] to pointer

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu This is useful when taking an InterruptSource slice and passing it to C function. Suggested-by: Paolo Bonzini Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250210030051.2562726-4-zhao1@intel.com Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/irq.rs | 6

[PULL 24/27] rust: qemu_api: add a documentation header for all modules

2025-02-13 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- rust/qemu-api/src/assertions.rs | 4 rust/qemu-api/src/bindings.rs | 2 ++ rust/qemu-api/src/c_str.rs | 8 rust/qemu-api/src/offset_of.rs | 7 +++ rust/qemu-api/src/prelude.rs| 2 ++ rust/qemu-api/src/sysbus.rs | 2 ++ rust/qemu-a

[PULL 04/27] rust: callbacks: allow passing optional callbacks as ()

2025-02-13 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

[PULL 03/27] rust: qom: add object creation functionality

2025-02-13 Thread Paolo Bonzini
The basic object lifecycle test can now be implemented using safe code! Reviewed-by: Zhao Liu 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/

[PULL 21/27] rust/timer/hpet: add basic HPET timer and HPETState

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu Add the HPETTimer and HPETState (HPET timer block), along with their basic methods and register definitions. This is in preparation for supporting the QAPI interfaces. Note, wrap all items in HPETState that may be changed in the callback called by C code into the BqlCell/BqlRefCe

[PULL 09/27] rust: bindings: add Send and Sync markers for types that have bindings

2025-02-13 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

[PULL 26/27] rust: fix doctests

2025-02-13 Thread Paolo Bonzini
Doctests were not being run by CI, and have broken. Fix them. Signed-off-by: Paolo Bonzini --- .gitlab-ci.d/buildtest.yml| 6 ++ rust/qemu-api/src/vmstate.rs | 2 +- rust/qemu-api/src/zeroable.rs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.d/buildte

[PULL 12/27] rust: chardev, qdev: add bindings to qdev_prop_set_chr

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

[PULL 27/27] ui/sdl2: reenable the SDL2 Windows keyboard hook procedure

2025-02-13 Thread Paolo Bonzini
From: Volker Rümelin Windows only: The libSDL2 Windows message loop needs the libSDL2 Windows low level keyboard hook procedure to grab the left and right Windows keys correctly. Reenable the SDL2 Windows keyboard hook procedure. Since SDL2 2.30.4 the SDL2 keyboard hook procedure also filters o

[PULL 20/27] rust/timer/hpet: define hpet_fw_cfg

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu Define HPETFwEntry structure with the same memory layout as hpet_fw_entry in C. Further, define the global hpet_cfg variable in Rust which is the same as the C version. This hpet_cfg variable in Rust will replace the C version one and allows both Rust code and C code to access it.

[PULL 15/27] rust/qdev: add the macro to define bit property

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu HPET device (Rust device) needs to define the bit type property. Add a variant of define_property macro to define bit type property. Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250210030051.2562726-3-zhao1@intel.com Signed-off-by: Paolo Bonzini --- rust/qemu-

[PULL 17/27] rust: add bindings for gpio_{in|out} initialization

2025-02-13 Thread Paolo Bonzini
From: Zhao Liu Wrap qdev_init_gpio_{in|out} as methods in DeviceMethods. And for qdev_init_gpio_in, based on FnCall, it can support idiomatic Rust callback without the need for C style wrapper. Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20250210030051.2562726-5-zhao1@intel.com

[PULL 05/27] rust: qdev: add clock creation

2025-02-13 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

Re: [PATCH 5/6] tcg/riscv: Use 'z' constraint

2025-02-13 Thread Philippe Mathieu-Daudé
On 13/2/25 16:50, Philippe Mathieu-Daudé wrote: On 12/2/25 04:46, Richard Henderson wrote: Replace target-specific 'Z' with generic 'z'. Signed-off-by: Richard Henderson ---   tcg/riscv/tcg-target-con-set.h | 10 +-   tcg/riscv/tcg-target-con-str.h |  1 -   tcg/riscv/tcg-target.c.inc   

Re: [PATCH 6/6] tcg/sparc64: Use 'z' constraint

2025-02-13 Thread Philippe Mathieu-Daudé
On 12/2/25 04:46, Richard Henderson wrote: Replace target-specific 'Z' with generic 'z'. Signed-off-by: Richard Henderson --- tcg/sparc64/tcg-target-con-set.h | 12 ++-- tcg/sparc64/tcg-target-con-str.h | 1 - tcg/sparc64/tcg-target.c.inc | 12 ++-- 3 files changed, 12

Re: [PATCH 5/6] tcg/riscv: Use 'z' constraint

2025-02-13 Thread Philippe Mathieu-Daudé
On 12/2/25 04:46, Richard Henderson wrote: Replace target-specific 'Z' with generic 'z'. Signed-off-by: Richard Henderson --- tcg/riscv/tcg-target-con-set.h | 10 +- tcg/riscv/tcg-target-con-str.h | 1 - tcg/riscv/tcg-target.c.inc | 12 ++-- 3 files changed, 11 inserti

Re: [PATCH 4/6] tcg/mips: Use 'z' constraint

2025-02-13 Thread Philippe Mathieu-Daudé
On 12/2/25 04:46, Richard Henderson wrote: Replace target-specific 'Z' with generic 'z'. Signed-off-by: Richard Henderson --- tcg/mips/tcg-target-con-set.h | 26 ++--- tcg/mips/tcg-target-con-str.h | 1 - tcg/mips/tcg-target.c.inc | 44 ++

Re: [PATCH 3/6] tcg/loongarch64: Use 'z' constraint

2025-02-13 Thread Philippe Mathieu-Daudé
On 12/2/25 04:46, Richard Henderson wrote: Replace target-specific 'Z' with generic 'z'. Signed-off-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 15 ++--- tcg/loongarch64/tcg-target-con-str.h | 1 - tcg/loongarch64/tcg-target.c.inc | 32 -

Re: [PATCH 1/6] tcg: Introduce the 'z' constraint for a hardware zero register

2025-02-13 Thread Philippe Mathieu-Daudé
On 12/2/25 04:46, Richard Henderson wrote: For loongarch, mips, riscv and sparc, a zero register is available all the time. For aarch64, register index 31 depends on context: sometimes it is the stack pointer, and sometimes it is the zero register. Introduce a new general-purpose constraint whi

Re: [PATCH] vhost-user-snd: Use virtio_get_config_size()

2025-02-13 Thread Stefano Garzarella
Unrelated to this patch, but since we are talking about VIRTIO_SND_F_CTLS, I think it would be good to send a patch to Linux to make it clear that `controls` depends on VIRTIO_SND_F_CTLS. For example in linux/include/uapi/linux/virtio_blk.h we have: struct virtio_blk_config { /* The capac

Re: [PATCH] vhost-user-snd: Use virtio_get_config_size()

2025-02-13 Thread Stefano Garzarella
For the title, what about this? vhost-user-snd: fix incorrect config_size computation Or something like that, just to make clear that we are fixing a real issue. On Thu, Feb 13, 2025 at 02:25:13PM +0100, Matias Ezequiel Vara Larsen wrote: Use virtio_get_config_size() rather than sizeof(stru

Re: [PATCH] hw/virtio/virtio-nsm: Respond with correct length

2025-02-13 Thread Philippe Mathieu-Daudé
On 13/2/25 12:45, Alexander Graf wrote: When we return a response packet from NSM, we need to indicate its length according to the content of the response. Prior to this patch, we returned the length of the source buffer, which may confuse guest code that relies on the response size. Fix it by r

Re: [PATCH] target/sparc: Fix gdbstub incorrectly handling registers f32-f62

2025-02-13 Thread Mikael Szreder
Ping On February 3, 2025 3:50:56 PM GMT+01:00, Mikael Szreder wrote: >The gdbstub implementation for the Sparc architecture would incorectly > calculate the the floating point register offset. >This would cause register pairs(eg f32,f33) to point to the same value. > >Fixes: 30038fd81808 ("target

Re: [PATCH 2/4] target/i386: Use correct type for get_float_exception_flags() values

2025-02-13 Thread Philippe Mathieu-Daudé
On 13/2/25 15:26, Peter Maydell wrote: The softfloat get_float_exception_flags() function returns 'int', but in various places in target/i386 we incorrectly store the returned value into a uint8_t. This currently has no ill effects because i386 doesn't care about any of the float_flag enum value

Re: [PATCH v3 0/7] physmem: teach cpu_memory_rw_debug() to write to more memory regions

2025-02-13 Thread Peter Xu
On Thu, Feb 13, 2025 at 12:26:42AM +0100, Stefan Zabka wrote: > Sorry for the delayed engagement, I failed to apply the patch set from the > mailing list and had to remember that David had published this change set on > GitHub. > > Tested-by: Stefan Zabka > > This addresses my initial use case o

Re: [PATCH] vhost-user-snd: Use virtio_get_config_size()

2025-02-13 Thread Philippe Mathieu-Daudé
On 13/2/25 14:25, Matias Ezequiel Vara Larsen wrote: Use virtio_get_config_size() rather than sizeof(struct virtio_snd_config) for the config_size in the vhost-user-snd frontend. The frontend shall rely on device features for the size of the device configuration space. This fixes an issue introdu

[PATCH v2] target/riscv: remove warnings about Smdbltrp/Smrnmi being disabled

2025-02-13 Thread Clément Léger
As raised by Richard Henderson, these warnings are displayed in user only as well. Since they aren't really useful for the end-user, remove them and add a "TODO" note in the leading comments. Signed-off-by: Clément Léger --- v2: - Remove Tommy bouncing mail from the recipient list - Entirely r

Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum

2025-02-13 Thread BALATON Zoltan
On Thu, 13 Feb 2025, Thomas Huth wrote: On 13/02/2025 14.59, BALATON Zoltan wrote: On Thu, 13 Feb 2025, Thomas Huth wrote: On 12/02/2025 23.34, BALATON Zoltan wrote: [...] So then can the behaviour of NATIVE_ENDIAN be changed to look at the machine endianness instead of replacing it with a co

Re: [PATCH v3 09/23] hw/uefi: add var-service-core.c

2025-02-13 Thread Gerd Hoffmann
On Thu, Feb 13, 2025 at 11:14:03AM +0100, Alexander Graf wrote: > > > I don't think so. The firmware driver knows this actually is normal ram > > and can setup mappings and memory attributes accordingly. The situation > > is a bit different from vga memory bars which are handled by pci bus > > m

Re: [PATCH v2] vfio: Add property documentation

2025-02-13 Thread Cédric Le Goater
On 2/13/25 15:45, Eric Auger wrote: Hi Cédric, On 2/13/25 2:50 PM, Cédric Le Goater wrote: Investigate the git history to uncover when and why the VFIO properties were introduced and update the models. This is mostly targeting vfio-pci device, since vfio-plateform, vfio-ap and vfio-ccw devices

Re: [PATCH v2] vfio: Add property documentation

2025-02-13 Thread Cédric Le Goater
On 2/13/25 15:17, BALATON Zoltan wrote: On Thu, 13 Feb 2025, Cédric Le Goater wrote: Investigate the git history to uncover when and why the VFIO properties were introduced and update the models. This is mostly targeting vfio-pci device, since vfio-plateform, vfio-ap and vfio-ccw Typo: vfio-pl

Re: [PATCH] target/riscv: silent warnings about Smdbltrp/Smrnmi being disabled

2025-02-13 Thread Philippe Mathieu-Daudé
On 13/2/25 12:32, Daniel Henrique Barboza wrote: On 2/13/25 4:52 AM, Clément Léger wrote: As raised by Richard Henderson, these warnings are displayed in user only as well. Disable them for CONFIG_USER_ONLY. Signed-off-by: Clément Léger --- I'm second guessing having these warnings at all.

Re: [PATCH v2] vfio: Add property documentation

2025-02-13 Thread Eric Auger
Hi Cédric, On 2/13/25 2:50 PM, Cédric Le Goater wrote: > Investigate the git history to uncover when and why the VFIO > properties were introduced and update the models. This is mostly > targeting vfio-pci device, since vfio-plateform, vfio-ap and vfio-ccw > devices are simpler. > > Organize the

Re: [PATCH 06/11] tcg/ppc: Drop addrhi from prepare_host_addr

2025-02-13 Thread Philippe Mathieu-Daudé
On 5/2/25 05:03, Richard Henderson wrote: The guest address will now always fit in one register. Signed-off-by: Richard Henderson --- tcg/ppc/tcg-target.c.inc | 75 1 file changed, 23 insertions(+), 52 deletions(-) Reviewed-by: Philippe Mathieu-Daud

Re: [PATCH 01/11] tcg: Drop support for two address registers in gen_ldst

2025-02-13 Thread Philippe Mathieu-Daudé
On 5/2/25 05:03, Richard Henderson wrote: Signed-off-by: Richard Henderson --- tcg/tcg-op-ldst.c | 22 -- 1 file changed, 4 insertions(+), 18 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

[RFC PATCH] elfload: Fix alignment when unmapping excess reservation

2025-02-13 Thread Fabiano Rosas
When complying with the alignment requested in the ELF and unmapping the excess reservation, having align_end not aligned to the guest page causes the unmap to be rejected by the alignment check at target_munmap and later brk adjustments hit an EEXIST. Fix by aligning the start of region to be unm

Re: [PATCH 04/11] tcg/i386: Drop addrhi from prepare_host_addr

2025-02-13 Thread Philippe Mathieu-Daudé
On 5/2/25 05:03, Richard Henderson wrote: The guest address will now always fit in one register. Signed-off-by: Richard Henderson --- tcg/i386/tcg-target.c.inc | 56 ++- 1 file changed, 20 insertions(+), 36 deletions(-) Reviewed-by: Philippe Mathieu-Daud

  1   2   >