[PATCH for-9.0] nanomips: fix warnings with GCC 14

2024-04-08 Thread Paolo Bonzini
GCC 14 shows -Wshadow=local warnings if an enum conflicts with a local variable (including a parameter). To avoid this, move the problematic enum and all of its dependencies after the hundreds of functions that have a parameter named "instruction". Signed-off-by: Paolo Bonzini --- disas/nanomip

Re: [PATCH-for-9.1 2/2] hw/sd/sdcard: Assert @data_offset is in range

2024-04-08 Thread Peter Maydell
On Mon, 8 Apr 2024 at 15:18, Philippe Mathieu-Daudé wrote: > > Prevent out-of-bound access with assertions. > > Signed-off-by: Philippe Mathieu-Daudé > --- > hw/sd/sd.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/hw/sd/sd.c b/hw/sd/sd.c > index 16d8d52a78..c081211582

Re: [PATCH] kvm: error out of kvm_irqchip_add_msi_route() in case of full route table

2024-04-08 Thread Paolo Bonzini
Queued, thanks. Paolo

Re: [PATCH-for-9.0 3/4] hw/char/virtio-serial-bus: Protect from DMA re-entrancy bugs

2024-04-08 Thread Michael S. Tsirkin
On Mon, Apr 08, 2024 at 01:04:11PM +0200, Philippe Mathieu-Daudé wrote: > On 8/4/24 12:08, Michael S. Tsirkin wrote: > > On Mon, Apr 08, 2024 at 09:14:39AM +0200, Philippe Mathieu-Daudé wrote: > > > On 4/4/24 21:13, Philippe Mathieu-Daudé wrote: > > > > Replace qemu_bh_new_guarded() by virtio_bh_ne

[PULL 0/2] target-arm queue

2024-04-08 Thread Peter Maydell
org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240408 for you to fetch changes up to 19b254e86a900dc5ee332e3ac0baf9c521301abf: target/arm: Use correct SecuritySpace for AArch64 AT ops at EL3 (2024-04-08 15:38:53 +0100)

[PULL 1/2] target/arm: Fix CNTPOFF_EL2 trap to missing EL3

2024-04-08 Thread Peter Maydell
From: Pierre-Clément Tosi EL2 accesses to CNTPOFF_EL2 should only ever trap to EL3 if EL3 is present, as described by the reference manual (for MRS): /* ... */ elsif PSTATE.EL == EL2 then if Halted() && HaveEL(EL3) && /*...*/ then UNDEFINED; elsif HaveEL(EL3) && SCR_EL3

[PULL 2/2] target/arm: Use correct SecuritySpace for AArch64 AT ops at EL3

2024-04-08 Thread Peter Maydell
When we do an AT address translation operation, the page table walk is supposed to be performed in the context of the EL we're doing the walk for, so for instance an AT S1E2R walk is done for EL2. In the pseudocode an EL is passed to AArch64.AT(), which calls SecurityStateAtEL() to find the securi

[RFC v3 1/6] virtio: Add bool to VirtQueueElement

2024-04-08 Thread Jonah Palmer
Add the boolean 'filled' member to the VirtQueueElement structure. The use of this boolean will signify if the element has been written to the used / descriptor ring or not. This boolean is used to support the VIRTIO_F_IN_ORDER feature. Signed-off-by: Jonah Palmer --- include/hw/virtio/virtio.h

[RFC v3 4/6] virtio: virtqueue_ordered_flush - VIRTIO_F_IN_ORDER support

2024-04-08 Thread Jonah Palmer
Add VIRTIO_F_IN_ORDER feature support for virtqueue_flush operations. The goal of the virtqueue_flush operation when the VIRTIO_F_IN_ORDER feature has been negotiated is to write elements to the used/descriptor ring in-order and then update used_idx. The function iterates through the VirtQueueEle

[RFC v3 2/6] virtio: virtqueue_pop - VIRTIO_F_IN_ORDER support

2024-04-08 Thread Jonah Palmer
Add VIRTIO_F_IN_ORDER feature support in virtqueue_split_pop and virtqueue_packed_pop. VirtQueueElements popped from the available/descritpor ring are added to the VirtQueue's used_elems array in-order and in the same fashion as they would be added the used and descriptor rings, respectively. Thi

[RFC v3 6/6] virtio: Add VIRTIO_F_IN_ORDER property definition

2024-04-08 Thread Jonah Palmer
Extend the virtio device property definitions to include the VIRTIO_F_IN_ORDER feature. The default state of this feature is disabled, allowing it to be explicitly enabled where it's supported. Acked-by: Eugenio Pérez Signed-off-by: Jonah Palmer --- include/hw/virtio/virtio.h | 4 +++- 1 file

[RFC v3 0/6] virtio,vhost: Add VIRTIO_F_IN_ORDER support

2024-04-08 Thread Jonah Palmer
The goal of these patches is to add support to a variety of virtio and vhost devices for the VIRTIO_F_IN_ORDER transport feature. This feature indicates that all buffers are used by the device in the same order in which they were made available by the driver. These patches attempt to implement a g

Re: [PATCH 1/2] Fix typo to allow migrate_qmp_fail command with 'channels' argument

2024-04-08 Thread Peter Xu
Hey, Het, On Sun, Apr 07, 2024 at 01:21:24PM +, Het Gala wrote: > Fixes: (tests/qtest/migration: Add negative tests to validate migration QAPIs) I think I get your intention to provide two fixup patches on top of migration-next, which indeed would be preferred so that I can squash them into t

[RFC v3 5/6] vhost, vhost-user: Add VIRTIO_F_IN_ORDER to vhost feature bits

2024-04-08 Thread Jonah Palmer via
Add support for the VIRTIO_F_IN_ORDER feature across a variety of vhost devices. The inclusion of VIRTIO_F_IN_ORDER in the feature bits arrays for these devices ensures that the backend is capable of offering and providing support for this feature, and that it can be disabled if the backend does n

[RFC v3 3/6] virtio: virtqueue_ordered_fill - VIRTIO_F_IN_ORDER support

2024-04-08 Thread Jonah Palmer
Add VIRTIO_F_IN_ORDER feature support for virtqueue_fill operations. The goal of the virtqueue_fill operation when the VIRTIO_F_IN_ORDER feature has been negotiated is to search for this now-used element, set its length, and mark the element as filled in the VirtQueue's used_elems array. By marki

Re: [PATCH 2/2] Call args->connect_channels to actually test multifd_tcp_channels_none qtest

2024-04-08 Thread Peter Xu
On Sun, Apr 07, 2024 at 01:21:25PM +, Het Gala wrote: > Earlier, without args->connect_channels, multifd_tcp_channels_none would > call uri internally even though connect_channels was introduced in > function definition. To actually call 'migrate' QAPI with modified syntax, > args->connect_chan

[PATCH-for-9.0?] backends/cryptodev: Do not abort for invalid session ID

2024-04-08 Thread Philippe Mathieu-Daudé
Instead of aborting when a session ID is invalid, report an error and return VIRTIO_CRYPTO_INVSESS ("Invalid session id"). Reproduced using: $ cat << EOF | qemu-system-i386 -display none \ -machine q35,accel=qtest -m 512M -nodefaults \ -object cryptodev-backend-builtin,id=cryptodev0 \

Re: [PATCH-for-9.0? 0/3] hw/block/nand: Fix out-of-bound access in NAND block buffer

2024-04-08 Thread Mauro Matteo Cascella
On Mon, Apr 8, 2024 at 10:36 AM Philippe Mathieu-Daudé wrote: > > Fix for https://gitlab.com/qemu-project/qemu/-/issues/1446 Does hw/block/nand meet the security requirements for CVE assignment? => https://www.qemu.org/docs/master/system/security.html > Philippe Mathieu-Daudé (3): > hw/block/

[PATCH v2 05/18] yank: only build if needed

2024-04-08 Thread Paolo Bonzini
The yank feature is not used in user emulation. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/meson.build b/util/meson.build index 0ef9886be04..2ad57b10ba2 100644 --- a/util/meson.b

[PATCH v2 06/18] util/qemu-config: Extract QMP commands to qemu-config-qmp.c

2024-04-08 Thread Paolo Bonzini
From: Philippe Mathieu-Daudé QMP is irrelevant for user emulation. Extract the code related to QMP in a different source file, which won't be build for user emulation binaries. This avoid pulling pointless code. Signed-off-by: Philippe Mathieu-Daudé Message-ID: <20240404194757.9343-5-phi...@lin

[PATCH v2 10/18] hw/usb: move stubs out of stubs/

2024-04-08 Thread Paolo Bonzini
Since the USB stubs are needed exactly when the Kconfig symbols are not enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB. Signed-off-by: Paolo Bonzini --- stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0 hw/usb/meson.build| 2 +- stubs/meson.build

[PATCH v2 07/18] hw/core: Move system emulation files to system_ss

2024-04-08 Thread Paolo Bonzini
hotplug.c, qdev-hotplug.c and reset.c are not used by user emulation and need not be included in hwcore_ss. Move them to system_ss, where they belong, by letting the linker pull in the stubs when needed. Signed-off-by: Paolo Bonzini --- {hw/core => stubs}/hotplug-stubs.c | 0 hw/core/meson.bui

[PATCH v2 14/18] memory-device: move stubs out of stubs/

2024-04-08 Thread Paolo Bonzini
Since the memory-device stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/mem/. Signed-off-by: Paolo Bonzini --- stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0 hw/mem/meson.build| 1 + stubs/meson.build

[PATCH v2 08/18] hw: Include minimal source set in user emulation build

2024-04-08 Thread Paolo Bonzini
From: Philippe Mathieu-Daudé Only the files in hwcore_ss[] are required to link a user emulation binary. Have meson process the hw/ sub-directories if system emulation is selected, otherwise directly process hw/core/ to get hwcore_ss[], which is the only set required by user emulation. This rem

[PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs

2024-04-08 Thread Paolo Bonzini
Even though monitor_get_fd() has to remain separate because it is mocked by tests/unit/test-util-sockets, monitor_fdsets_cleanup() is logically part of the stubs for monitor/fds.c, so move it there. Signed-off-by: Paolo Bonzini --- stubs/fdset.c| 6 ++ stubs/monitor-internal.c |

[PATCH v2 03/18] ebpf: Restrict to system emulation

2024-04-08 Thread Paolo Bonzini
From: Philippe Mathieu-Daudé eBPF is not used in user emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Message-ID: <20240404194757.9343-2-phi...@linaro.org> Signed-off-by: Paolo Bonzini --- ebpf/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH v2 09/18] stubs: remove obsolete stubs

2024-04-08 Thread Paolo Bonzini
These file define functions are are not called from common code anymore. Delete those functions and, if applicable, the entire files. Signed-off-by: Paolo Bonzini --- include/sysemu/sysemu.h | 2 -- stubs/isa-bus.c | 7 --- stubs/module-opts.c | 2 -- stubs/monitor-core.c

[PATCH v2 15/18] colo: move stubs out of stubs/

2024-04-08 Thread Paolo Bonzini
Since the colo stubs are needed exactly when the build options are not enabled, move them together with the code they stub. Signed-off-by: Paolo Bonzini --- stubs/colo.c => migration/colo-stubs.c | 0 stubs/colo-compare.c => net/colo-stubs.c | 0 migration/meson.build| 2 ++

Re: [PATCH v2 02/18] tests: only build plugins if TCG is enabled

2024-04-08 Thread Philippe Mathieu-Daudé
On 8/4/24 17:53, Paolo Bonzini wrote: There is no way to use them for testing, if all the available accelerators use hardware virtualization. Signed-off-by: Paolo Bonzini --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé

[PATCH v2 0/7] buildsys: Start shrinking qemu-user build process

2024-04-08 Thread Paolo Bonzini
Some files (especially from hw/core/, stubs/ and util/) are built for user mode emulation unnecessarily; they are not needed by any code that is part of qemu-user. The bulk of the patch (commits 6-17) puts stubs/ on a diet both in general (moving stubs out into specific subdirectories and away fro

Re: [PATCH v2 05/18] yank: only build if needed

2024-04-08 Thread Philippe Mathieu-Daudé
On 8/4/24 17:53, Paolo Bonzini wrote: The yank feature is not used in user emulation. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/meson.build b/util/meson.build index 0ef9886b

[PATCH v2 12/18] semihosting: move stubs out of stubs/

2024-04-08 Thread Paolo Bonzini
Since the semihosting stubs are needed exactly when the Kconfig symbols are not needed, move them to semihosting/ and conditionalize them on CONFIG_SEMIHOSTING and/or CONFIG_SYSTEM_ONLY. Signed-off-by: Paolo Bonzini --- stubs/semihost-all.c => semihosting/stubs-all.c | 0 stubs/semihost.c => sem

[PATCH v2 13/18] ramfb: move stubs out of stubs/

2024-04-08 Thread Paolo Bonzini
Since the ramfb stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/display/ and compile them when ramfb.c is absent. Signed-off-by: Paolo Bonzini --- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build| 2 +- stubs/meson.build

[PATCH v2 16/18] stubs: split record/replay stubs further

2024-04-08 Thread Paolo Bonzini
replay.c symbols are only needed by user mode emulation, with the exception of replay_mode that is needed by both user mode emulation (by way of qemu_guest_getrandom) and block layer tools (by way of util/qemu-timer.c). Since it is needed by libqemuutil rather than specific files that are part of

[PATCH v2 17/18] stubs: include stubs only if needed

2024-04-08 Thread Paolo Bonzini
Currently it is not documented anywhere why some functions need to be stubbed. Group the files in stubs/meson.build according to who needs them, both to reduce the size of the compilation and to clarify the use of stubs. Signed-off-by: Paolo Bonzini --- stubs/{monitor.c => monitor-internal.c} |

[PATCH v2 01/18] meson: do not link pixman automatically into all targets

2024-04-08 Thread Paolo Bonzini
The dependency on pixman is listed manually in all sourcesets that need it. There is no need to bring into libqemuutil, since there is nothing in util/ that needs pixman either. Reported-by: Michael Tokarev Signed-off-by: Paolo Bonzini --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 d

[PATCH v2 02/18] tests: only build plugins if TCG is enabled

2024-04-08 Thread Paolo Bonzini
There is no way to use them for testing, if all the available accelerators use hardware virtualization. Signed-off-by: Paolo Bonzini --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/meson.build b/tests/meson.build index 0a6f96f8f84..acb6807094b 1006

[PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches

2024-04-08 Thread Paolo Bonzini
Try not to test code that is not used by user mode emulation, or by the block layer, unless they are being compiled; and fix test-timed-average which was not compiled with --disable-system --enable-tools. This is by no means complete, it only touches the more blatantly wrong cases. Signed-off-by:

[PATCH v2 11/18] hw/virtio: move stubs out of stubs/

2024-04-08 Thread Paolo Bonzini
Since the virtio memory device stubs are needed exactly when the Kconfig symbol is not enabled, they can be placed in hw/virtio/ and conditionalized on CONFIG_VIRTIO_MD. Signed-off-by: Paolo Bonzini --- stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c | 0 hw/virtio/meson.build

Re: [PATCH v2 10/18] hw/usb: move stubs out of stubs/

2024-04-08 Thread Philippe Mathieu-Daudé
On 8/4/24 17:53, Paolo Bonzini wrote: Since the USB stubs are needed exactly when the Kconfig symbols are not enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB. Signed-off-by: Paolo Bonzini --- stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0 hw/usb/meson.build

Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/

2024-04-08 Thread Philippe Mathieu-Daudé
On 8/4/24 17:53, Paolo Bonzini wrote: Since the ramfb stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/display/ and compile them when ramfb.c is absent. Signed-off-by: Paolo Bonzini --- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build

[PATCH v5 for-9.0? 0/2] Fix NBD TLS poll in coroutine

2024-04-08 Thread Eric Blake
v4 was here: https://lists.gnu.org/archive/html/qemu-devel/2024-04/msg00624.html Since then: add some asserts [Vladimir], add second patch with more coroutine_fn annotations [Vladimir] Eric Blake (1): nbd/server: Mark negotiation functions as coroutine_fn Zhu Yangyang (1): nbd/server: do not

[PATCH v5 1/2] nbd/server: do not poll within a coroutine context

2024-04-08 Thread Eric Blake
From: Zhu Yangyang Coroutines are not supposed to block. Instead, they should yield. The client performs TLS upgrade outside of an AIOContext, during synchronous handshake; this still requires g_main_loop. But the server responds to TLS upgrade inside a coroutine, so a nested g_main_loop is wro

[PATCH v5 2/2] nbd/server: Mark negotiation functions as coroutine_fn

2024-04-08 Thread Eric Blake
nbd_negotiate() is already marked coroutine_fn. And given the fix in the previous patch to have nbd_negotiate_handle_starttls not create and wait on a g_main_loop (as that would violate coroutine constraints), it is worth marking the rest of the related static functions reachable only during optio

Re: [PATCH-for-9.1 v2 2/3] migration: Remove RDMA protocol handling

2024-04-08 Thread Peter Xu
On Mon, Apr 08, 2024 at 04:07:20PM +0200, Jinpu Wang wrote: > Hi Peter, Jinpu, Thanks for joining the discussion. > > On Tue, Apr 2, 2024 at 11:24 PM Peter Xu wrote: > > > > On Mon, Apr 01, 2024 at 11:26:25PM +0200, Yu Zhang wrote: > > > Hello Peter und Zhjian, > > > > > > Thank you so much fo

Re: [PATCH for-9.0] nanomips: fix warnings with GCC 14

2024-04-08 Thread Richard Henderson
On 4/8/24 04:25, Paolo Bonzini wrote: GCC 14 shows -Wshadow=local warnings if an enum conflicts with a local variable (including a parameter). To avoid this, move the problematic enum and all of its dependencies after the hundreds of functions that have a parameter named "instruction". Signed-o

Re: [PATCH-for-9.0? 1/3] hw/block/nand: Factor nand_load_iolen() method out

2024-04-08 Thread Richard Henderson
On 4/7/24 22:36, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé --- hw/block/nand.c | 32 +++- 1 file changed, 19 insertions(+), 13 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH-for-9.0? 2/3] hw/block/nand: Have blk_load() return boolean indicating success

2024-04-08 Thread Richard Henderson
On 4/7/24 22:36, Philippe Mathieu-Daudé wrote: Signed-off-by: Philippe Mathieu-Daudé --- hw/block/nand.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) Reviewed-by: Richard Henderson r~

Re: [PATCH-for-9.0? 3/3] hw/block/nand: Fix out-of-bound access in NAND block buffer

2024-04-08 Thread Richard Henderson
On 4/7/24 22:36, Philippe Mathieu-Daudé wrote: nand_command() and nand_getio() don't check @offset points into the block, nor the available data length (s->iolen) is not negative. In order to fix: - check the offset is in range in nand_blk_load_NAND_PAGE_SIZE(), - do not set @iolen if blk_load(

Re: [PATCH v2 01/18] meson: do not link pixman automatically into all targets

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: The dependency on pixman is listed manually in all sourcesets that need it. There is no need to bring into libqemuutil, since there is nothing in util/ that needs pixman either. Reported-by: Michael Tokarev Signed-off-by: Paolo Bonzini --- meson.build | 2

Re: [PATCH v2 04/18] tests/unit: match some unit tests to corresponding feature switches

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: Try not to test code that is not used by user mode emulation, or by the block layer, unless they are being compiled; and fix test-timed-average which was not compiled with --disable-system --enable-tools. This is by no means complete, it only touches the mor

Re: [PATCH v2 05/18] yank: only build if needed

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: The yank feature is not used in user emulation. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH-for-9.0] hw/sd/sdhci: Discard excess of data written to Buffer Data Port register

2024-04-08 Thread Peter Maydell
On Mon, 8 Apr 2024 at 13:34, Peter Maydell wrote: > > On Thu, 4 Apr 2024 at 09:56, Philippe Mathieu-Daudé wrote: > > diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c > > index c5e0bc018b..2dd88fa139 100644 > > --- a/hw/sd/sdhci.c > > +++ b/hw/sd/sdhci.c > > @@ -552,7 +552,7 @@ static void sdhci_write_b

Re: [PATCH v2 07/18] hw/core: Move system emulation files to system_ss

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: hotplug.c, qdev-hotplug.c and reset.c are not used by user emulation and need not be included in hwcore_ss. Move them to system_ss, where they belong, by letting the linker pull in the stubs when needed. Signed-off-by: Paolo Bonzini --- {hw/core => stubs}

Re: [PATCH v2 09/18] stubs: remove obsolete stubs

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: These file define functions are are not called from common code anymore. Delete those functions and, if applicable, the entire files. Signed-off-by: Paolo Bonzini --- include/sysemu/sysemu.h | 2 -- stubs/isa-bus.c | 7 --- stubs/module-op

Re: [PATCH v2 10/18] hw/usb: move stubs out of stubs/

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: Since the USB stubs are needed exactly when the Kconfig symbols are not enabled, they can be placed in hw/usb/ and conditionalized on CONFIG_USB. Signed-off-by: Paolo Bonzini --- stubs/usb-dev-stub.c => hw/usb/bus-stub.c | 0 hw/usb/meson.build

Re: [PATCH v2 11/18] hw/virtio: move stubs out of stubs/

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: Since the virtio memory device stubs are needed exactly when the Kconfig symbol is not enabled, they can be placed in hw/virtio/ and conditionalized on CONFIG_VIRTIO_MD. Signed-off-by: Paolo Bonzini --- stubs/virtio-md-pci.c => hw/virtio/virtio-md-stubs.c

Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: Since the ramfb stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/display/ and compile them when ramfb.c is absent. Signed-off-by: Paolo Bonzini --- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build

Re: [PATCH v2 14/18] memory-device: move stubs out of stubs/

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: Since the memory-device stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/mem/. Signed-off-by: Paolo Bonzini --- stubs/memory_device.c => hw/mem/memory-device-stubs.c | 0 hw/mem/meson.build

Re: [PATCH v2 13/18] ramfb: move stubs out of stubs/

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: Since the ramfb stubs are needed exactly when the Kconfig symbols are not needed, move them to hw/display/ and compile them when ramfb.c is absent. Signed-off-by: Paolo Bonzini --- stubs/ramfb.c => hw/display/ramfb-stubs.c | 0 hw/display/meson.build

Re: [PATCH v2 16/18] stubs: split record/replay stubs further

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: replay.c symbols are only needed by user mode emulation, with the exception of replay_mode that is needed by both user mode emulation (by way of qemu_guest_getrandom) and block layer tools (by way of util/qemu-timer.c). Since it is needed by libqemuutil rath

Re: [PATCH v2 18/18] stubs: move monitor_fdsets_cleanup with other fdset stubs

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: Even though monitor_get_fd() has to remain separate because it is mocked by tests/unit/test-util-sockets, monitor_fdsets_cleanup() is logically part of the stubs for monitor/fds.c, so move it there. Signed-off-by: Paolo Bonzini --- stubs/fdset.c

Re: [PATCH v2 02/18] tests: only build plugins if TCG is enabled

2024-04-08 Thread Richard Henderson
On 4/8/24 05:53, Paolo Bonzini wrote: There is no way to use them for testing, if all the available accelerators use hardware virtualization. Signed-off-by: Paolo Bonzini --- tests/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH v2 16/18] stubs: split record/replay stubs further

2024-04-08 Thread Paolo Bonzini
On Mon, Apr 8, 2024 at 6:59 PM Richard Henderson wrote: > > On 4/8/24 05:53, Paolo Bonzini wrote: > > replay.c symbols are only needed by user mode emulation, with the > > exception of replay_mode that is needed by both user mode emulation > > (by way of qemu_guest_getrandom) and block layer tools

Re: [PATCH v4] hw/virtio: Fix packed virtqueue flush used_idx

2024-04-08 Thread Eugenio Perez Martin
On Sun, Apr 7, 2024 at 3:56 AM Wafer wrote: > Let me suggest a more generic description for the patch: In the event of writing many chains of descriptors, the device must write just the id of the last buffer in the descriptor chain, skip forward the number of descriptors in the chain, and then r

[PULL 14/35] target/sh4: add missing CHECK_NOT_DELAY_SLOT

2024-04-08 Thread Richard Henderson
From: Zack Buhman CHECK_NOT_DELAY_SLOT is correctly applied to the branch-related instructions, but not to the PC-relative mov* instructions. I verified the existence of an illegal slot exception on a SH7091 when any of these instructions are attempted inside a delay slot. This also matches the

[PULL 02/35] linux-user: Fix waitid return of siginfo_t and rusage

2024-04-08 Thread Richard Henderson
The copy back to siginfo_t should be conditional only on arg3, not the specific values that might have been written. The copy back to rusage was missing entirely. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2262 Signed-off-by: Richard Henderson --- linux-user/syscall.c | 22 +

[PULL 09/35] target/hppa: Fix IIAOQ, IIASQ for pa2.0

2024-04-08 Thread Richard Henderson
The contents of IIAOQ depend on PSW_W. Follow the text in "Interruption Instruction Address Queues", pages 2-13 through 2-15. Tested-by: Sven Schnelle Tested-by: Helge Deller Reported-by: Sven Schnelle Fixes: b10700d826c ("target/hppa: Update IIAOQ, IIASQ for pa2.0") Signed-off-by: Richard Hend

[PULL 20/35] accel/tcg: Add insn_start to DisasContextBase

2024-04-08 Thread Richard Henderson
This is currently target-specific for many; begin making it target independent. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/exec/translator.h | 3 +++ accel/tcg/translator.c| 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/exec/translator.h

[PULL 15/35] target/m68k: Map FPU exceptions to FPSR register

2024-04-08 Thread Richard Henderson
From: Keith Packard Add helpers for reading/writing the 68881 FPSR register so that changes in floating point exception state can be seen by the application. Call these helpers in pre_load/post_load hooks to synchronize exception state. Signed-off-by: Keith Packard Reviewed-by: Richard Henders

[PULL 01/35] tcg/optimize: Do not attempt to constant fold neg_vec

2024-04-08 Thread Richard Henderson
Split out the tail of fold_neg to fold_neg_no_const so that we can avoid attempting to constant fold vector negate. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2150 Signed-off-by: Richard Henderson --- tcg/optimize.c| 17 - tests/tcg/aarch64/test-2

[PULL 29/35] util/bufferiszero: Remove AVX512 variant

2024-04-08 Thread Richard Henderson
From: Alexander Monakov Thanks to early checks in the inline buffer_is_zero wrapper, the SIMD routines are invoked much more rarely in normal use when most buffers are non-zero. This makes use of AVX512 unprofitable, as it incurs extra frequency and voltage transition periods during which the CPU

[PULL 17/35] target/m68k: Perform the semihosting test during translate

2024-04-08 Thread Richard Henderson
Replace EXCP_HALT_INSN by EXCP_SEMIHOSTING. Perform the pre- and post-insn tests during translate, leaving only the actual semihosting operation for the exception. Signed-off-by: Richard Henderson --- target/m68k/cpu.h | 2 +- target/m68k/op_helper.c | 14 ++--- target/m68k/trans

[PULL 07/35] linux-user: Add FITRIM ioctl

2024-04-08 Thread Richard Henderson
From: Michael Vogt Tiny patch to add the missing FITRIM ioctl. Signed-off-by: Michael Vogt Message-Id: <20240403092048.16023-2-michael.v...@gmail.com> Signed-off-by: Richard Henderson --- linux-user/ioctls.h| 3 +++ linux-user/syscall_defs.h | 1 + linux-user/syscall_types.h | 5

[PULL 08/35] linux-user: replace calloc() with g_new0()

2024-04-08 Thread Richard Henderson
From: Nguyen Dinh Phi Use glib allocation as recommended by the coding convention Signed-off-by: Nguyen Dinh Phi Message-Id: <20240317171747.1642207-1-phind@gmail.com> Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- linux-user/main.c | 6 +- 1 file changed, 1 insertion(

[PULL 21/35] target/arm: Use insn_start from DisasContextBase

2024-04-08 Thread Richard Henderson
To keep the multiple update check, replace insn_start with insn_start_updated. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/arm/tcg/translate.h | 12 ++-- target/arm/tcg/translate-a64.c | 2 +- target/arm/tcg/translate.c | 2 +- 3 files chang

[PULL 04/35] linux-user: do_setsockopt: make ip_mreq local to the place it is used and inline target_to_host_ip_mreq()

2024-04-08 Thread Richard Henderson
From: Michael Tokarev ip_mreq is declared at the beginning of do_setsockopt(), while it is used in only one place. Move its declaration to that very place and replace pointer to alloca()-allocated memory with the structure itself. target_to_host_ip_mreq() is used only once, inline it. This cha

[PULL 23/35] target/i386: Preserve DisasContextBase.insn_start across rewind

2024-04-08 Thread Richard Henderson
When aborting translation of the current insn, restore the previous value of insn_start. Acked-by: Paolo Bonzini Signed-off-by: Richard Henderson --- target/i386/tcg/translate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c inde

[PULL 31/35] util/bufferiszero: Remove useless prefetches

2024-04-08 Thread Richard Henderson
From: Alexander Monakov Use of prefetching in bufferiszero.c is quite questionable: - prefetches are issued just a few CPU cycles before the corresponding line would be hit by demand loads; - they are done for simple access patterns, i.e. where hardware prefetchers can perform better; - th

[PULL 34/35] util/bufferiszero: Introduce biz_accel_fn typedef

2024-04-08 Thread Richard Henderson
Signed-off-by: Richard Henderson --- util/bufferiszero.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util/bufferiszero.c b/util/bufferiszero.c index c9a7ded016..eb8030a3f0 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -26,7 +26,8 @@ #include "qemu

[PULL 18/35] target/m68k: Support semihosting on non-ColdFire targets

2024-04-08 Thread Richard Henderson
From: Keith Packard According to the m68k semihosting spec: "The instruction used to trigger a semihosting request depends on the m68k processor variant. On ColdFire, "halt" is used; on other processors (which don't implement "halt"), "bkpt #0" may be used." Add support for non-CodeFire proc

[PULL 26/35] target/s390x: Use insn_start from DisasContextBase

2024-04-08 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/s390x/tcg/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c index 57b7db1ee9..90a74ee795 100644 --- a/target/s390x/tcg/tran

[PULL 11/35] target/sh4: Merge mach and macl into a union

2024-04-08 Thread Richard Henderson
Allow host access to the entire 64-bit accumulator. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/sh4/cpu.h | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 9211da6bde..d928bcf006 1006

[PULL 27/35] accel/tcg: Improve can_do_io management

2024-04-08 Thread Richard Henderson
We already attempted to set and clear can_do_io before the first and last insns, but only used the initial value of max_insns and the call to translator_io_start to find those insns. Now that we track insn_start in DisasContextBase, and now that we have emit_before_op, we can wait until we have fi

[PULL 28/35] util/bufferiszero: Remove SSE4.1 variant

2024-04-08 Thread Richard Henderson
From: Alexander Monakov The SSE4.1 variant is virtually identical to the SSE2 variant, except for using 'PTEST+JNZ' in place of 'PCMPEQB+PMOVMSKB+CMP+JNE' for testing if an SSE register is all zeroes. The PTEST instruction decodes to two uops, so it can be handled only by the complex decoder, and

[PULL 30/35] util/bufferiszero: Reorganize for early test for acceleration

2024-04-08 Thread Richard Henderson
From: Alexander Monakov Test for length >= 256 inline, where is is often a constant. Before calling into the accelerated routine, sample three bytes from the buffer, which handles most non-zero buffers. Signed-off-by: Alexander Monakov Signed-off-by: Mikhail Romanov Message-Id: <20240206204809

[PULL 16/35] target/m68k: Pass semihosting arg to exit

2024-04-08 Thread Richard Henderson
From: Keith Packard Instead of using d0 (the semihost function number), use d1 (the provide exit status). Signed-off-by: Keith Packard Reviewed-by: Peter Maydell Message-Id: <20230802161914.395443-2-kei...@keithp.com> Signed-off-by: Richard Henderson --- target/m68k/m68k-semi.c | 4 ++-- 1 f

[PULL 12/35] target/sh4: Fix mac.l with saturation enabled

2024-04-08 Thread Richard Henderson
From: Zack Buhman The saturation arithmetic logic in helper_macl is not correct. I tested and verified this behavior on a SH7091. Signed-off-by: Zack Buhman Message-Id: <20240404162641.27528-2-z...@buhman.org> [rth: Reformat helper_macl, add a test case.] Signed-off-by: Richard Henderson Revie

[PULL 00/35] misc patch queue

2024-04-08 Thread Richard Henderson
40404' of https://github.com/mcayland/qemu into staging (2024-04-04 15:28:06 +0100) are available in the Git repository at: https://gitlab.com/rth7680/qemu.git tags/pull-misc-20240408 for you to fetch changes up to 50dbeda88ab71f9d426b7f4b126c79c44860e475: util/bufferiszero

[PULL 10/35] target/sh4: mac.w: memory accesses are 16-bit words

2024-04-08 Thread Richard Henderson
From: Zack Buhman Before this change, executing a code sequence such as: mova tblm,r0 movr0,r1 mova tbln,r0 clrs clrmac mac.w @r0+,@r1+ mac.w @r0+,@r1+ .align 4 tblm:.word 0x1234

[PULL 13/35] target/sh4: Fix mac.w with saturation enabled

2024-04-08 Thread Richard Henderson
From: Zack Buhman The saturation arithmetic logic in helper_macw is not correct. I tested and verified this behavior on a SH7091. Reviewd-by: Yoshinori Sato Signed-off-by: Zack Buhman Message-Id: <20240405233802.29128-3-z...@buhman.org> [rth: Reformat helper_macw, add a test case.] Signed-off-

[PULL 03/35] linux-user: do_setsockopt: fix SOL_ALG.ALG_SET_KEY

2024-04-08 Thread Richard Henderson
From: Michael Tokarev This setsockopt accepts zero-lengh optlen (current qemu implementation does not allow this). Also, there's no need to make a copy of the key, it is enough to use lock_user() (which accepts zero length already). Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2197 F

[PULL 06/35] linux-user: do_setsockopt: eliminate goto in switch for SO_SNDTIMEO

2024-04-08 Thread Richard Henderson
From: Michael Tokarev There's identical code for SO_SNDTIMEO and SO_RCVTIMEO, currently implemented using an ugly goto into another switch case. Eliminate that using arithmetic if, making code flow more natural. Signed-off-by: Michael Tokarev Message-Id: <20240331100737.2724186-5-...@tls.msk.r

[PULL 19/35] tcg: Add TCGContext.emit_before_op

2024-04-08 Thread Richard Henderson
Allow operations to be emitted via normal expanders into the middle of the opcode stream. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 6 ++ tcg/tcg.c | 14 -- 2 files changed, 18 insertions(

[PULL 05/35] linux-user: do_setsockopt: make ip_mreq_source local to the place where it is used

2024-04-08 Thread Richard Henderson
From: Michael Tokarev Signed-off-by: Michael Tokarev Message-Id: <20240331100737.2724186-4-...@tls.msk.ru> Signed-off-by: Richard Henderson --- linux-user/syscall.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cca9c

[PULL 24/35] target/microblaze: Use insn_start from DisasContextBase

2024-04-08 Thread Richard Henderson
Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 4e52ef32db..fc451befae 100644 --- a/target/microb

[PULL 25/35] target/riscv: Use insn_start from DisasContextBase

2024-04-08 Thread Richard Henderson
To keep the multiple update check, replace insn_start with insn_start_updated. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/riscv/translate.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/target/riscv/translate.c b/target/risc

[PULL 35/35] util/bufferiszero: Simplify test_buffer_is_zero_next_accel

2024-04-08 Thread Richard Henderson
Because the three alternatives are monotonic, we don't need to keep a couple of bitmasks, just identify the strongest alternative at startup. Signed-off-by: Richard Henderson --- util/bufferiszero.c | 56 ++--- 1 file changed, 22 insertions(+), 34 deletion

[PULL 33/35] util/bufferiszero: Improve scalar variant

2024-04-08 Thread Richard Henderson
Split less-than and greater-than 256 cases. Use unaligned accesses for head and tail. Avoid using out-of-bounds pointers in loop boundary conditions. Signed-off-by: Richard Henderson --- util/bufferiszero.c | 85 +++-- 1 file changed, 51 insertions(+), 34

[PULL 22/35] target/hppa: Use insn_start from DisasContextBase

2024-04-08 Thread Richard Henderson
To keep the multiple update check, replace insn_start with insn_start_updated. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/hppa/translate.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/tr

<    1   2   3   >