]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
2 days agoui/gtk: Fix focus loss on re-attachment with single VC
Dongwon Kim [Wed, 20 May 2026 00:26:45 +0000 (17:26 -0700)] 
ui/gtk: Fix focus loss on re-attachment with single VC

When QEMU is launched with a single virtual console (e.g., using
--nodefaults), detaching and then closing the detached window leaves
the main window's notebook without an active focus target which makes
keyboard unfunctional on re-attached VC.

Fix this by explicitly calling gtk_widget_grab_focus on the active
VC's focus widget during the window close handler.

Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Message-ID: <20260520002645.1910740-1-dongwon.kim@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 days agoui/input: Remove unused QKeyCode helpers and keymaps
Akihiko Odaki [Wed, 20 May 2026 06:48:12 +0000 (15:48 +0900)] 
ui/input: Remove unused QKeyCode helpers and keymaps

Their users have migrated to Linux key codes.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-29-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/console: Remove qemu_text_console_put_qcode()
Akihiko Odaki [Wed, 20 May 2026 06:48:11 +0000 (15:48 +0900)] 
ui/console: Remove qemu_text_console_put_qcode()

It is no longer used.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-28-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoqemu-keymap: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:10 +0000 (15:48 +0900)] 
qemu-keymap: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-27-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/vnc: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:09 +0000 (15:48 +0900)] 
ui/vnc: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-26-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/spice: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:08 +0000 (15:48 +0900)] 
ui/spice: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-25-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/sdl2: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:07 +0000 (15:48 +0900)] 
ui/sdl2: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-24-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/keymaps: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:06 +0000 (15:48 +0900)] 
ui/keymaps: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-23-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input-linux: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:05 +0000 (15:48 +0900)] 
ui/input-linux: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-22-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input-legacy: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:04 +0000 (15:48 +0900)] 
ui/input-legacy: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-21-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input-barrier: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:03 +0000 (15:48 +0900)] 
ui/input-barrier: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-20-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/gtk: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:02 +0000 (15:48 +0900)] 
ui/gtk: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-19-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/dbus: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:01 +0000 (15:48 +0900)] 
ui/dbus: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-18-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/cocoa: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:48:00 +0000 (15:48 +0900)] 
ui/cocoa: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-17-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoreplay: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:59 +0000 (15:47 +0900)] 
replay: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-16-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>
[ Marc-André - update replay-dump.py ]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 days agohw/arm/aspeed: anacapa: add FRU EEPROM data
William de Abreu Pinho [Tue, 19 May 2026 17:48:40 +0000 (10:48 -0700)] 
hw/arm/aspeed: anacapa: add FRU EEPROM data

Use frugen to generate FRU data for the following components: HPM MB,
R-PDB, L-PDB, SCM, BSM, R Bridge Board, L Bridge Board, and HPM board
ID.

Signed-off-by: William de Abreu Pinho <williamdapinho@gmail.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260519-add-anacapa-machine-v3-3-56c23993a20a@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 days agohw/arm/aspeed: add anacapa-bmc machine
William de Abreu Pinho [Tue, 19 May 2026 17:48:39 +0000 (10:48 -0700)] 
hw/arm/aspeed: add anacapa-bmc machine

Add the Facebook Anacapa BMC machine.  The I2C topology is based on the
Linux kernel device tree [1].  Hardware strap register values are taken
from real hardware.

A functional test is included using the OpenBMC image built from [2],
similar to the tests for bletchley-bmc and catalina-bmc.

[1]: https://github.com/torvalds/linux/blob/76b4ec8efdc3887cdbf730da2e55881fc1a18770/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-anacapa.dts
[2]: https://github.com/openbmc/openbmc/commit/8e22df918eaaa5d83143471d24ef0eeb1c1e3c7c

Signed-off-by: William de Abreu Pinho <williamdapinho@gmail.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260519-add-anacapa-machine-v3-2-56c23993a20a@gmail.com
[ clg: docs/system/arm/aspeed.rst : fixed 'Aspeed family boards' title change ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 days agotests/functional/aspeed: introduce FacebookAspeedTest
William de Abreu Pinho [Tue, 19 May 2026 17:48:38 +0000 (10:48 -0700)] 
tests/functional/aspeed: introduce FacebookAspeedTest

Facebook OpenBMC Images include an early script [1] that lowers the
console log level to warning.  This suppresses the "Hostname set to"
message from the serial console.  Introduce FacebookAspeedTest (a
subclass of AspeedTest), that waits for login prompt instead.  Update
bletchley-bmc and catalina-bmc to use the new class.

This is also used by the anacapa-bmc machine introduced in the following
patch.

[1]: https://github.com/openbmc/openbmc/blob/6a56a45931fb7015a3fc18553415909105b484d6/meta-facebook/recipes-phosphor/initrdscripts/phosphor-static-norootfs-init/999-reduce-printk

Signed-off-by: William de Abreu Pinho <williamdapinho@gmail.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260519-add-anacapa-machine-v3-1-56c23993a20a@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 days agotests/functional/arm/test_aspeed_ast2600_sdk: Add USB EHCI test for AST2600 SDK
Jamin Lin [Mon, 4 May 2026 02:53:44 +0000 (02:53 +0000)] 
tests/functional/arm/test_aspeed_ast2600_sdk: Add USB EHCI test for AST2600 SDK

Add a functional test to verify USB EHCI support on the AST2600
SDK machine by attaching a USB keyboard device and checking its
enumeration via lsusb.

This introduces a helper routine that runs lsusb in the guest
and validates that the emulated "QEMU USB Keyboard" is detected.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260504025342.1452605-2-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 days agohw/misc/aspeed_scu: Fix AST2600_RNG definitions
Cédric Le Goater [Tue, 12 May 2026 20:58:36 +0000 (22:58 +0200)] 
hw/misc/aspeed_scu: Fix AST2600_RNG definitions

Commit e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support") introduced
a typo on the definitions of the Random Number Generator registers.
Fix that.

The implementation of RNG_CTRL and RNG_DATA should be rechecked on HW
since the QEMU implementation always generates random data, regardless
of RNG_CTRL. A comment in aspeed_ast2600_scu_read() admits uncertainty
about the behavior :

    /*
     * On hardware, RNG_DATA works regardless of the state of the
     * enable bit in RNG_CTRL
     *
     * TODO: Check this is true for ast2600
     */

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/2350
Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support")
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 days agohw/m68k/next-kbd: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:58 +0000 (15:47 +0900)] 
hw/m68k/next-kbd: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-15-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agohw/input/virtio-input: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:57 +0000 (15:47 +0900)] 
hw/input/virtio-input: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-14-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agohw/input/ps2: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:56 +0000 (15:47 +0900)] 
hw/input/ps2: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-13-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agohw/input/hid: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:55 +0000 (15:47 +0900)] 
hw/input/hid: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-12-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agohw/input/adb-kbd: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:54 +0000 (15:47 +0900)] 
hw/input/adb-kbd: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-11-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agohw/display/xenfb: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:53 +0000 (15:47 +0900)] 
hw/display/xenfb: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-10-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agohw/char/escc: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:52 +0000 (15:47 +0900)] 
hw/char/escc: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-9-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agohw/arm/musicpal: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:51 +0000 (15:47 +0900)] 
hw/arm/musicpal: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-8-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/kbd-state: Use Linux key codes
Akihiko Odaki [Wed, 20 May 2026 06:47:50 +0000 (15:47 +0900)] 
ui/kbd-state: Use Linux key codes

QemuInputEvent now stores Linux key codes for key events. Use those
codes directly instead of translating between internal key code
representations.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-7-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/console: Add qemu_text_console_put_linux()
Akihiko Odaki [Wed, 20 May 2026 06:47:49 +0000 (15:47 +0900)] 
ui/console: Add qemu_text_console_put_linux()

Add a text console helper that accepts Linux input key codes and use it
as the common implementation for qemu_text_console_put_qcode(). This lets
callers that already use Linux key codes avoid converting them back to
QKeyCode.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-6-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input: Prohibit sending KEY_RESERVED
Akihiko Odaki [Wed, 20 May 2026 06:47:48 +0000 (15:47 +0900)] 
ui/input: Prohibit sending KEY_RESERVED

xenfb and virtio-input no longer need key mapping because they operate
on Linux key codes, but removing the key mapping code loses the ability
to filter out KEY_RESERVED. Drop KEY_RESERVED at the common input event
entry point so the logic is shared by both devices and no downstream
input handler receives KEY_RESERVED accidentally.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-5-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input: Use Linux key codes for internal key events
Akihiko Odaki [Wed, 20 May 2026 06:47:47 +0000 (15:47 +0900)] 
ui/input: Use Linux key codes for internal key events

Linux input key codes are a better internal representation than
QKeyCode:

- With Linux input key codes as the internal representation, keys
  previously lost solely because the middle layer between event sources
  and sinks used QKeyCode will be preserved, since Linux key codes
  cover all keys that those sources and sinks use. For example,
  KEY_KPJPCOMMA cannot be represented with QKeyCode, but it is widely
  supported by event sources and sinks since it is included in linux,
  atset1, atset2, usb, x11, osx, qnum (derived from atset1),
  xorgxquartz, and xorgevdev (derived from linux).

- They make it possible to pass through Linux host key codes to Linux
  guests to preserve all key inputs.

- They simplify consumers by avoiding QKeyCode aliases, namely
  asterisk/kp_multiply and sysrq/print.

This matches the approach used by virtio and Xen.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-4-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input: Store QKeyCode directly in QemuInputKeyEvent
Akihiko Odaki [Wed, 20 May 2026 06:47:46 +0000 (15:47 +0900)] 
ui/input: Store QKeyCode directly in QemuInputKeyEvent

Since commit af07e5ff02ae ("ui: convert key events to QKeyCodes
immediately"), all internal key events are expected to be represented as
QKeyCode. Replace KeyValue in QemuInputKeyEvent with QKeyCode to enforce
that and simplify key code retrieval.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-3-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input: Remove QAPI wrappers from QemuInputEvent
Akihiko Odaki [Wed, 20 May 2026 06:47:45 +0000 (15:47 +0900)] 
ui/input: Remove QAPI wrappers from QemuInputEvent

QAPI represents union members with wrapper structs and pointer
indirections. They are useful at the QMP boundary, but unnecessary for
QEMU's internal input events and make handlers more verbose.

Define QemuInputEvent as a plain internal tagged union and convert input
handlers, queues, and replay code to access payloads directly.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-2-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui/input: Introduce QemuInputEvent typedef
Akihiko Odaki [Wed, 20 May 2026 06:47:44 +0000 (15:47 +0900)] 
ui/input: Introduce QemuInputEvent typedef

Add QemuInputEvent as the input subsystem's name for InputEvent and use
it in input handler, queue, and replay interfaces.

This prepares for decoupling QEMU's internal input event representation
from the QAPI InputEvent type.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260520-input-v3-1-7c9e4c7abe34@rsg.ci.i.u-tokyo.ac.jp>

2 days agoui: fix validation of VNC extended clipboard data length
Heechan Kang [Tue, 12 May 2026 09:55:43 +0000 (10:55 +0100)] 
ui: fix validation of VNC extended clipboard data length

QEMU's VNC extended clipboard handler inflates a client-controlled
compressed clipboard payload. The code checks the declared text size
against the total inflated buffer size:

    if (tsize < size)

but then copies from:

    tbuf = buf + 4;
    qemu_clipboard_set_data(..., tsize, tbuf, true);

The correct bound is the remaining data length after the 4-byte length
field, not the total inflated buffer length.

As a result, a VNC client can make QEMU copy up to 3 bytes past the end
of the inflated heap buffer. With a second VNC client, those copied
bytes are observable through the normal VNC extended clipboard PROVIDE
path.

Fixes: CVE-2026-8343
Reported-by: Heechan Kang <gganji11@naver.com>
Reported-by: Feifan Qian <bea1e@proton.me>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Heechan Kang <gganji11@naver.com>
[DB: added #include and 'return' statements]
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260512095543.459949-1-berrange@redhat.com>

2 days agoui/vnc: fix OOB read updating VNC update frequency stats
Daniel P. Berrangé [Thu, 21 May 2026 10:33:53 +0000 (11:33 +0100)] 
ui/vnc: fix OOB read updating VNC update frequency stats

Incorrect loop bounds in vnc_update_freq result in iterating past the
last row and past the last column in the VNC stats array. With suitably
chosen dimensions this could be a OOB read that accesses memory beyond
the VncDisplay struct that the stats array is embedded in.

Should this hit a guard page, it could trigger a guest crash. If it
does not, then the VNC frequency stats will be updated with garbage.

Fixes: CVE-2026-48003
Reported-by: boy juju <agx1657748706@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-5-berrange@redhat.com>

2 days agoui/vnc: fix OOB write in lossy rect worker code
Daniel P. Berrangé [Thu, 21 May 2026 10:33:52 +0000 (11:33 +0100)] 
ui/vnc: fix OOB write in lossy rect worker code

Incorrect calculation of the boundary condition when tracking lossy
rectangles in the worker thread will result in an OOB write which
can corrupt further worker state, and/or trigger any guard pages
that may lie beyond the VncWorker struct. This can be triggered
through careful choice of the display resolution in the guest
OS by an unprivileged user.

Fixes: CVE-2026-48002
Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-4-berrange@redhat.com>
[Marc-André - added assert() suggest by philmd@linaro.org]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 days agoui/vnc: fix OOB write in VNC stats array
Daniel P. Berrangé [Thu, 21 May 2026 10:33:51 +0000 (11:33 +0100)] 
ui/vnc: fix OOB write in VNC stats array

The VncSurface struct maintains update statistics in an array:

    VncRectStat stats[VNC_STAT_ROWS][VNC_STAT_COLS];

where the dimensions are defined as:

  #define VNC_STAT_RECT  64
  #define VNC_STAT_COLS (VNC_MAX_WIDTH / VNC_STAT_RECT)
  #define VNC_STAT_ROWS (VNC_MAX_HEIGHT / VNC_STAT_RECT)

If VNC_MAX_WIDTH / VNC_MAX_HEIGHT are not an exact multiple of
VNC_STAT_REC, the COLS/ROWS will be undersized by 1.

Unfortunately:

  #define VNC_MAX_HEIGHT 2160

is not a multiple of 64, so there is potential for OOB reads and
writes in the 'stats' array, if the guest surface is over 2112
pixels in height. An array overflow occurs when vnc_update_stats()
records new statistics, either scribbling over data later in the
VncDisplay struct that 'stats' is embedded in, or performing an
OOB write on the allocated struct memory.

Fixes: CVE-2026-48002
Reported-by: boy juju <agx1657748706@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-3-berrange@redhat.com>

2 days agoui/vnc: fix OOB read access in VNC SASL mechname array
Daniel P. Berrangé [Thu, 21 May 2026 10:33:50 +0000 (11:33 +0100)] 
ui/vnc: fix OOB read access in VNC SASL mechname array

When reading the SASL mechname array off the VNC connection, if
malicious, the received data may contain embedded NULs. If this
happens the memory buffer returned by g_strndup may be shorter
than the original data. Unfortunately the code continued to
index into this buffer with an offset equal to the original
length. This is a potential OOB read of the array.

Fixes: 5847d9e1 (ui/vnc: simplify and avoid strncpy)
Reported-by: boy juju <agx1657748706@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260521103353.1645561-2-berrange@redhat.com>

2 days agoui/vt100: add vt100_fini() check
Marc-André Lureau [Wed, 13 May 2026 06:03:37 +0000 (10:03 +0400)] 
ui/vt100: add vt100_fini() check

vt100_fini() is called unconditonally from qemu_text_console_finalize(),
but it may not have been vt100_init()/opened: fix the crash in that case.

Fixes: 8fa294482eb ("ui/console-vc: move VT100 state machine ...")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 days agoui/vt100: Take byte as uint8_t in bh_utf8_decode()
Peter Maydell [Tue, 12 May 2026 10:42:10 +0000 (11:42 +0100)] 
ui/vt100: Take byte as uint8_t in bh_utf8_decode()

The bh_utf8_decode() UTF8 decoder takes its next byte as a "uint32_t
byte" parameter, but it assumes it to be in bounds as it immediately
indexes into its array with it.

Use "uint8_t" as the argument type instead. This moves us away from
the upstream implementation slightly, but it is the same type as
we use in the one callsite, and it makes it clear that we can't
be indexing off the end of the array with this guest-derived data.

This probably helps make Coverity a bit happier (CID 1659590).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260512104210.3330835-3-peter.maydell@linaro.org>

2 days agoui/vt100: Standardize on uint8_t for "ch" byte variables
Peter Maydell [Tue, 12 May 2026 10:42:09 +0000 (11:42 +0100)] 
ui/vt100: Standardize on uint8_t for "ch" byte variables

The vt100 code is rather confused about how it handles bytes of data
to be sent to the terminal:
 * vt100_input() takes a buffer of uint8_t
 * each byte is passed to vt100_putchar(), which takes "int ch"
 * that calls vt100_put_one(), which also takes "int ch"
 * vt100_put_one() sets TextCell::ch, which is uint8_t again
 * various places pass the TextCell:ch value to vt100_putcharxy(),
   which takes "int ch" again, but uses it unchecked as an
   index into a 256-entry array

This confuses Coverity (e.g. CID 1659590) and the reader, who may be
unsure whether the "int" variable really does hold only valid byte
values 0..255 and whether we need to bounds-check before doing array
dereferences.

Standardize on keeping known-byte data in uint8_t all the way
through.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260512104210.3330835-2-peter.maydell@linaro.org>

3 days agolinux-user/sh4: add VDSO support for sh4 and sh4eb
Matt Turner [Sat, 23 May 2026 11:41:28 +0000 (07:41 -0400)] 
linux-user/sh4: add VDSO support for sh4 and sh4eb

Provides replacement VDSO with sigreturn trampolines
(__kernel_sigreturn, __kernel_rt_sigreturn) and syscall stubs
(clock_gettime, clock_gettime64, clock_getres, gettimeofday).

Both LE and BE blobs are committed and selected at compile time via
TARGET_BIG_ENDIAN. The BE variant requires an sh4eb-unknown-linux-gnu
toolchain; sh4-unknown-linux-gnu does not support -mb.

CFI register numbers follow GCC's SH_DEBUGGER_REGNO:
PR=17, GBR=18, MACH=20, MACL=21, FPUL=23, FPSCR=24, FR0-15=25-40.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
3 days agolinux-user/riscv: add coredump support
Matt Turner [Thu, 21 May 2026 18:43:21 +0000 (14:43 -0400)] 
linux-user/riscv: add coredump support

Define HAVE_ELF_CORE_DUMP and target_elf_gregset_t in target_elf.h,
mirroring struct user_regs_struct: pc followed by x1 (ra) through
x31 (t6).  Implement elf_core_copy_regs() in elfload.c to populate
the gregset from CPURISCVState.

Without this, bprm->core_dump is NULL for RISC-V targets.  When a
guest signal goes unhandled, dump_core_and_abort() skips the core
write and falls through to die_with_signal(), which re-raises the
signal to the host.  The host kernel then writes an x86-64 core file
for the qemu-riscv64 process instead of a RISC-V guest core.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
3 days agolinux-user/mips: use tswap32 in elf_core_copy_regs
Matt Turner [Thu, 21 May 2026 18:41:03 +0000 (14:41 -0400)] 
linux-user/mips: use tswap32 in elf_core_copy_regs

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
3 days agolinux-user/mips64: fix mipsn32 elf_core_copy_regs entry width
Matt Turner [Thu, 21 May 2026 18:41:02 +0000 (14:41 -0400)] 
linux-user/mips64: fix mipsn32 elf_core_copy_regs entry width

For mipsn32 (TARGET_ABI32=y, TARGET_LONG_BITS=64):
  abi_ulong = uint32_t (4 bytes) — for pointers and ABI-sized fields
  target_ulong = uint64_t (8 bytes) — for general-purpose registers

linux-user/elfload.c allocates target_elf_prstatus using the
mips64/target_elf.h definition where target_elf_gregset_t has
target_ulong reserved[45] (8 bytes each, 360 bytes total).

However, in linux-user/mips64/elfload.c, #include "target_elf.h" inside
the included mips/elfload.c resolves to mips/target_elf.h (compiler
searches the file's own directory first), where the union uses abi_ulong
reserved[45].  For mipsn32 this gives 4-byte entries (180 bytes), not
the 8-byte entries (360 bytes) that elfload.c actually allocated.

Writing via r->reserved[34] therefore lands at byte offset 34*4=136
instead of the correct 34*8=272, silently zeroing the EPC in the core
file.

Fix by casting the pointer to target_ulong * so writes always use 8-byte
slots and land at the offsets matching the allocated layout.

This does not change behavior for mips64 (N64) where abi_ulong already
equals target_ulong (both 8 bytes).

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Helge Deller <deller@gmx.de>
3 days agolinux-user/mips64: fix elf_core_copy_regs register layout in core files
Matt Turner [Thu, 21 May 2026 18:41:01 +0000 (14:41 -0400)] 
linux-user/mips64: fix elf_core_copy_regs register layout in core files

mips64/elfload.c uses #include "../mips/elfload.c" to share code. When
the compiler processes mips/elfload.c the quoted #include "target_elf.h"
resolves relative to the including file's directory, so it picks up
mips/target_elf.h instead of mips64/target_elf.h.  mips/target_elf.h
pulls in mips/target_ptrace.h, whose target_pt_regs has a pad0[6] field
before regs[].  As a result elf_core_copy_regs writes:

  r->pt.regs[i]   -> reserved[6+i]   (shifted by 6 from the correct index)
  r->pt.cp0_epc   -> reserved[40]    (correct mips64 N64 index is 34)

The Linux kernel and glibc both use the mips64 N64 layout (no pad0): EPC
at reserved[34].  Debuggers and libunwind reading the core with N64
constants therefore see a completely wrong register set — EPC points to
GP, RA holds the branch target instead of the link address, etc.

Fix by:
 - Guarding the mips32 elf_core_copy_regs in mips/elfload.c with #ifndef
   TARGET_MIPS64 so it is not compiled for mips64/mipsn32 targets.
 - Providing a mips64-specific elf_core_copy_regs in mips64/elfload.c
   that writes directly to r->reserved[i] with the correct N64 indices,
   bypassing the struct field names that are tainted by the wrong header
   include.

The mipsn32 (TARGET_ABI_MIPSN32) and mips64el targets are covered by the
same mips64/elfload.c and benefit from the same fix.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Helge Deller <deller@gmx.de>
3 days agolinux-user/hppa: add coredump support
Matt Turner [Thu, 21 May 2026 05:56:45 +0000 (01:56 -0400)] 
linux-user/hppa: add coredump support

Add HAVE_ELF_CORE_DUMP, target_elf_gregset_t (80 entries matching
arch/parisc/include/uapi/asm/ptrace.h), and elf_core_copy_regs().

The struct layout matches the kernel's struct user_regs_struct:
  gr[0..31]    at indices [0..31]   (PSW in gr[0])
  sr[0..7]     at indices [32..39]
  iaoq[0..1]   at indices [40..41]  (instruction address queue)
  iasq[0..1]   at indices [42..43]
  sar          at index   [44]      (shift amount / CR11)
  iir          at index   [45]      (interrupt instruction register)
  isr          at index   [46]      (interrupt space register)
  ior          at index   [47]      (interrupt offset register)
  ipsw         at index   [48]      (interrupt PSW / CR22)
  cr0          at index   [49]      (recovery counter)
  cr24_31[8]   at indices [50..57]
  cr8_15[6]    at indices [58..63]
  pad[16]      at indices [64..79]

elf_core_copy_regs() saves GRs, IAOQ (front/back), and SAR.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
3 days agoMerge tag 'pbouvier/pr/docs-20260522' of https://gitlab.com/p-b-o/qemu into staging
Stefan Hajnoczi [Sun, 24 May 2026 11:45:19 +0000 (07:45 -0400)] 
Merge tag 'pbouvier/pr/docs-20260522' of https://gitlab.com/p-b-o/qemu into staging

Changes:
- [PATCH] docs/code-provenance: Fix formatting of *-by tags (=?utf-8?q?J=2E_Neusch=C3=A4fer?= <j.neuschaefer@9elements.com>)
Link: https://lore.kernel.org/qemu-devel/20260520-prov-v1-1-7a58af334b9c@9elements.com
- [PATCH] docs/devel/qom: Fix some editing errors (=?utf-8?q?J=2E_Neusch=C3=A4fer?= <j.neuschaefer@9elements.com>)
Link: https://lore.kernel.org/qemu-devel/20260520-qom-v1-1-baad87fefe4f@9elements.com
- [PATCH] docs/devel: Fix typo (s/exist paths/exit paths/) (=?utf-8?q?J=2E_Neusch=C3=A4fer?= <j.neuschaefer@9elements.com>)
Link: https://lore.kernel.org/qemu-devel/20260520-exist-v1-1-535f929a87ae@9elements.com
# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEN8FWlNi6l2Sxlz/btEQ30ZwoYt8FAmoQpgYACgkQtEQ30Zwo
# Yt/58wwAqfxoN1Smg7Y7bEd5OuVxP8zFlL2KBFKR27N2df4VSFJl1fTnAKXgaaNj
# dm1RB6xLGmfyukXsy7ZZ7syVdsu5VjLtzoZMSt9IgIZ2KVfUMryuWkW9qcXqtiMe
# pFO4sxII1lTbY3rt7jJWvdeN0SY9jVnh0PwZOCaq68yMuAF3kDG4wHWfWmo7EqAw
# PmGrBLTS9CyKQDTK6S2UnOTtYSnhYfTdLDUvDo2dkxR0G91hHn0WcQPPuT0I4VaO
# Ft2Kav5lxHs/Q6NjSwfEflfkGrAm3jwoVSEZwMJyrirRpWOgcUfz0t3E7mMiRRuc
# fhI+qkwcIvFi7FiODMVByJ/MOvs+vpQnXOLze4oeVMrU7NVGF3H5uvJpAVlVy4gX
# BNuRG8FO8Epa+66DLlQAHcyNXt5/zemcvfkNLTSHFSOijbtTAan7VYuKY31fco25
# +i+Xq8nXX8Lr77Qs1aYxXCWV+ZwOAxmFWnIlfwNXkgr1iRKOlYvWmZoh0fAIax9P
# Vjsq0Hew
# =M9D4
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 22 May 2026 14:52:54 EDT
# gpg:                using RSA key 37C15694D8BA9764B1973FDBB44437D19C2862DF
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 37C1 5694 D8BA 9764 B197  3FDB B444 37D1 9C28 62DF

* tag 'pbouvier/pr/docs-20260522' of https://gitlab.com/p-b-o/qemu:
  docs/devel: Fix typo (s/exist paths/exit paths/)
  docs/devel/qom: Fix some editing errors
  docs/code-provenance: Fix formatting of *-by tags

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 days agoMerge tag 'pull-fpu-20260522' of https://gitlab.com/rth7680/qemu into staging
Stefan Hajnoczi [Sun, 24 May 2026 11:45:07 +0000 (07:45 -0400)] 
Merge tag 'pull-fpu-20260522' of https://gitlab.com/rth7680/qemu into staging

fpu: Export partsN_{scalbn,muladd}
fpu: Export floatN_minmax
fpu: Simplifications to muladd, addsub
fpu: Introduce exp_scalbn
fpu: Introduce FloatExceptionFlags
fpu: Use float_status accessors everywhere
fpu: Compress float_status with bitfields
fpu: Fixes for E4M3 vs NaNs
target/alpha: Remove CONFIG_SOFTFLOAT_INLINE
target/alpha: Use FloatExceptionFlags
target/s390x: Move float{32,64}_s390_divide_to_integer

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmoQn7MdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV90UAgAi5CiZ1Tty9NFzDto
# CHhpqSybOworRgxb02vMYU+OvM11VBRbqaIjiIX7B6SFiEEefxv00+n2qRM1P5+T
# Sk4UwMA6r07yxL45sAXvUzL0+qjAHxulBAVClUNWA5bCcG0/2tb8R3yI+ZJ8PgFi
# M1+AdbPNo9vNJdh27sLa3i9Atz6Z28GzksB/zLv+WJGEeE5d/UQCtaGjXRYoQAoV
# vDsNHdU8tym9NZl3FpsuPfZeuQkSbpm72vYa9F4m7lvcZO878JsgdiFcd8BM/EnT
# HVmSsltwTdttm1wILsp9XklCMzKZvC/q2m+cmwzRUpv2U0rION6pq0B32sItYXi+
# tFY8vA==
# =j/fN
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 22 May 2026 14:25:55 EDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-fpu-20260522' of https://gitlab.com/rth7680/qemu: (30 commits)
  fpu: Export floatN_minmax
  fpu: Fix NaN encoding for E4M3 in parts64_uncanon
  fpu: Introduce float_status.e4m3_nan_is_snan
  fpu: Reorg float_status
  fpu: Add accessors for rebias_{underflow,overflow}
  fpu: Use get_float_default_nan_pattern in partsN_default_nan
  fpu: Use get_default_nan_mode everywhere
  fpu: Use {get,set}_flush_inputs_to_zero everywhere
  fpu: Use accessors for ftz_before_rounding
  fpu: Use {get,set}_flush_to_zero everywhere
  fpu: Use accessors for tininess_before_rounding
  fpu: Use get_float_infzeronan_rule in partsN_pick_nan_muladd
  fpu: Use get_float_3nan_prop_rule in partsN_pick_nan_muladd
  fpu: Use get_float_2nan_prop_rule in partsN_pick_nan
  fpu: Use get_floatx80_behaviour everywhere
  fpu: Use of {get,set}_floatx80_rounding_precision everywhere
  fpu: Use {get,set}_float_rounding_mode everywhere
  fpu: Introduce FloatSNaNRule
  fpu: Introduce frac_msb_is_snan
  target/alpha: Use FloatExceptionFlags
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 days agoMerge tag 'pull-riscv-to-apply-20260522' of https://github.com/alistair23/qemu into...
Stefan Hajnoczi [Sun, 24 May 2026 11:44:52 +0000 (07:44 -0400)] 
Merge tag 'pull-riscv-to-apply-20260522' of https://github.com/alistair23/qemu into staging

RISC-V PR for 11.1.

* Remove spike as default machine
* Deprecate the shakti_c machine
* Set MISA.[C|X] based on the selected extensions
* Update Maintainers for OpenSBI Firmware
* Update OpenSBI to v1.8.1
* Avoid RISCVCPU copy in PMU FDT setup
* A collection of specification compliance improvements
* Fix Svnapot 64KB pages
* Handle source overlap of vector widening reduction instructions
* Check interrupt in SiFive UART after txctrl register is written
* Fix medeleg[11] read-only zero bit for M-mode ECALL
* Fix tail handling for vmv.s.x and vfmv.s.f
* Update the local AIA interrupt mask
* Add KVM support for Zicbop and BFloat16 extensions
* Fix the IOMMU FSC SV32 capability check
* Avoid caching PCI device IDs in the IOMMU
* Implement Microchip mpfs ioscb PLLs and sysreg clock dividers
* Remove the internal CPU riscv_cpu_* arrays
* Fix IOCOUNTINH.CY toggle detection
* Fix the read of pmpaddr(0-63) CSRs
* Make hpmcounterh return the upper 32-bits
* Minor fixes and enhancements of RISC-V AIA devices
* Re-process IOMMU command queue after clearing CMD_ILL

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEaukCtqfKh31tZZKWr3yVEwxTgBMFAmoPnQkACgkQr3yVEwxT
# gBMudxAAvN8XD1zauMzk62tkXCmVA5fjqtTqu4Ytp8Pe3P7ZX9FZP6Alcw+G+zEd
# QQdIeHTzxzs77LO5VLKlLS807W5by9eMQDPOWvCRk2rQWJfgbxYq//dJNOPpJfR1
# ptDsvnxonfn8lh34Bm7nI+UaznRVSr3mSts8LN5R9GANLHRPYbJbtSRb2qSGBPzP
# ynNvuD0tmt9gXf+j9O9qr5DkoRoiZdoRTGdQ9a/eWlxP/eNvPzq0c74ToPpz3Obv
# 6z/ICImKZGL36W8B73FbGy30EySihdPTcLSQHqsUZ+mYtj+6WGtIbIoZkaugnfml
# M8DuukT6sO8GdZy7cFnxhThsnZ+HEylzpjHHWYJlvY9uUniM0wrCavCc0lvUm71A
# Mi0yASlmv6kXotxtmz+UZF6/h7vTJHXvEo/g9cwshSVjxYDhHf8GtIYVegLTTeoP
# z1UfpdepH6fe9E8cf6DUSwr1syODSf0qjiKVMVMxb/OMEk3qEB0uwbG+X1Ecs9s1
# SQo6cp5TdiSjzP87MyMDeTeaS6FQrkVEkXXgcpFf1W/R0zRuj/JW89sGCJvS7Tqk
# +bH4pNnzXTBNxuGrb3zZSC0yWdroSiqyT+9g/JlQMY9tBvnoY8p7Ck7g07nLhVSf
# Cj4C0SXRMSj8eHn2+pDqjZn1RUfG2mRAD+8yYWqZ2GvU2X/yhx8=
# =SSwl
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 21 May 2026 20:02:17 EDT
# gpg:                using RSA key 6AE902B6A7CA877D6D659296AF7C95130C538013
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6AE9 02B6 A7CA 877D 6D65  9296 AF7C 9513 0C53 8013

* tag 'pull-riscv-to-apply-20260522' of https://github.com/alistair23/qemu: (48 commits)
  hw/riscv: riscv-iommu: Re-process command queue after clearing CMD_ILL
  hw/intc: riscv_aplic: add trace events of APLIC read/write function
  hw/intc: riscv_imsic: Add reset API to IMSIC
  hw/intc: riscv_aplic: Add reset API to APLIC
  hw/intc: riscv_aplic: Fix level trigger IRQ in direct delivery mode
  target/riscv: Make hpmcounterh return the upper 32-bits
  hw/riscv/virt-acpi-build: Fix off-by-one error in RIMT ID mapping
  target/riscv/csr.c: fix read of pmpaddr(0-63) CSRs
  hw/riscv/riscv-iommu: Fix IOCOUNTINH.CY toggle detection
  target/riscv/cpu: remove riscv_cpu_* arrays
  target/riscv/tcg: use isa_edata_arr[] to create user props
  target/riscv: do not set defaults in cpu prop callback
  target/riscv/tcg: use cfg_offset as cpu_set_multi_ext cb opaque
  target/riscv/tcg: use isa_edata_arr[] to enable max exts
  target/riscv/kvm: use isa_edata_arr[] for unavailable props
  target/riscv/tcg: use isa_edata_arr[] in riscv_cpu_update_misa_x()
  target/riscv: remove riscv_cpu_named_features[]
  target/riscv/cpu.c: remove riscv_cpu_enable_named_feat()
  target/riscv/tcg: use only isa_edata_arr[] in cpu_cfg_ext_get_name()
  target/riscv/tcg: treat all exts equally in cpu_disable_priv_spec_isa_exts
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 days agoMerge tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu into staging
Stefan Hajnoczi [Sun, 24 May 2026 11:44:37 +0000 (07:44 -0400)] 
Merge tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu into staging

Misc patches for iotests, qom, crypt & io

 * Fix client side anoymous TLS credentials
 * Fix return value semantics for qio_channel_flush
 * Add ID validation of internal QOM constructor
 * Fix ability to create internal QOM objects
   without a parent
 * Merge user creatable object constructor into
   main QOM file
 * Print reason for skipping I/O tests
 * Remove redundant meson suits for I/O tests
 * Add optional suites for many block drivers I/O tests
 * Run I/O tests for 10 block drivers in GitLab CI
 * Fix sudo check for LUKS I/O test
 * Mark I/O test 151, 181, 185, 308 as flaky

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE2vOm/bJrYpEtDo4/vobrtBUQT98FAmoPDUkACgkQvobrtBUQ
# T9+ZGQ/+PUFHFBgKHqb8kVNpKE1MJ+FDiwgRKHq0oSHdyO+lTzbAUZOM/2B/VSTu
# vJijLHEGalCRjMoZgRcRVtXaJGKoem7tXTe/giX+CiULSAD8cHcZ657imzPmjEPk
# +oEPgTRpbPTWbxgUS6Y5lztYgJz84Tkhs/lTr3Y8mOHUcVPJXYe0OClP+DXQJvu4
# I12EkKUA7+FA1UiwYR0Hkq5ZfED48VygVnCVpb12ggri3BrwAuk9SNaAGbz0EbNm
# uYrmneLVAey/Y3XW9NxJ056KNF10Mpcmj2lhJuUu9lyfw/jNeicwESC6MNEMK0Pq
# ttq9t3J+osotwElrFnrh7tWusGDloJArpcZbL6xNQ5r3vDrlnviUeUJZOfs7wDLZ
# LOFhi0xJLN3Gk9Cms+xcaTmQRf5/1DBZUTxG3vFqqjNzNOzuJOPseviXw5lDau2g
# sTVPX77VpOCV8JJoetZuoloBOxiLB4fbt4uY812t4Ru5vrt2o7F36aeBekgRB9lZ
# SvS+fuj5rLiPjvLoI76HQ8uzEDtJGp7h3LoIDO47pQJRZ7jfc6kbLioZptmxlfSf
# i5LEa/hido+o11QvnEZ8aMfdUoQZAJsHtNLrzPwOl1NnFBYmX/GBk2vO6xrmoqUO
# aykd/gWzH/NhZ3eq+cZlI4iEQSOaLFySzq39jdz77bBAzhI38nI=
# =Onca
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 21 May 2026 09:48:57 EDT
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu: (29 commits)
  qom: drop user_creatable_add_type method
  qom: allow object_new_with_prop* to trigger module loading
  qom: fix ability to create objects without a parent
  qom: add object_new_with_props_from_qdict
  qom: move object_set_prop_keyval into object.c
  qom: have object_set_props_keyval return bool
  qom: shorten name of object_set_properties_from_keyval
  qom: make errp last param in methods taking va_list
  qom: validate ID format when creating objects
  hw/vfio-user: use a valid object ID for iothread
  qom: add trace events for object/property lifecycle
  gitlab: remove I/O tests from build-tcg-disabled job
  gitlab: add jobs for thorough block tests
  iotests: mark 151, 181, 185 & 308 as flaky tests
  iotests: fix check for sudo access in LUKS I/O test
  iotests: validate dmsetup result in test 128
  iotests: use 'driver' as collective term for either format or protocol
  iotests: add nbd and luks to the I/O test suites
  docs/devel/testing: expand documentation for 'make check-block'
  iotests: add a meson suite / make target per block I/O tests format
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4 days agoppc/spapr: Make Power11 as default cpu for pseries
Aditya Gupta [Thu, 21 May 2026 20:08:44 +0000 (01:38 +0530)] 
ppc/spapr: Make Power11 as default cpu for pseries

With Power11 being the newest supportied Power processor in QEMU, and
sufficiently tested, make Power11 as default CPU type for pseries
machine

Retain Power10 as default CPU for pseries-11.0 and older versions

Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Misbah Anjum N <misanjum@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260521200844.1449023-3-adityag@linux.ibm.com
[harshpb: commit title, Amit's email updated]
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
4 days agoppc/pnv: Make PowerNV11 as the default powernv machine
Aditya Gupta [Thu, 21 May 2026 20:08:43 +0000 (01:38 +0530)] 
ppc/pnv: Make PowerNV11 as the default powernv machine

With Power11 being the newest supported Power processor in QEMU, and
sufficiently tested, set powernv machine as an alias to powernv11
machine

Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Misbah Anjum N <misanjum@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260521200844.1449023-2-adityag@linux.ibm.com
[harshpb: corrected Amit's email for Tested-by tag]
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
4 days agotarget/ppc/kvm: Fix const violation when trimming CPU alias suffix
Amit Machhiwal [Mon, 18 May 2026 17:25:15 +0000 (22:55 +0530)] 
target/ppc/kvm: Fix const violation when trimming CPU alias suffix

GCC 16 tightens diagnostics around const correctness and now correctly
rejects attempts to modify strings referenced through const-qualified
pointers. In kvm_ppc_register_host_cpu_type(), ppc_cpu_aliases[i].model
is defined as const char *, but the code was using strstr() on it and
then modifying the returned pointer in-place to strip
POWERPC_CPU_TYPE_SUFFIX.

This results in a write through a pointer derived from const data,
triggering a build failure with GCC 16:

  error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
        suffix = strstr(ppc_cpu_aliases[i].model, POWERPC_CPU_TYPE_SUFFIX);
               ^

Fix this by changing suffix to 'const gchar *' and using g_strstr_len()
to locate the suffix, then allocating a new string with g_strndup() (to
copy only the prefix) or g_strdup() (to copy the entire name if no
suffix exists). This maintains const correctness throughout while
preserving the original functionality.

No functional change intended.

Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260518172517.12466-2-amachhiw@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
4 days agoppc/pnv: Fix uninitialized MpiplProcDumpArea struct
Shivang Upadhyay [Fri, 8 May 2026 14:20:29 +0000 (19:50 +0530)] 
ppc/pnv: Fix uninitialized MpiplProcDumpArea struct

Fix Coverity CID 1658041 by using designated initializers to prevent
uninitialized memory from being written to guest.

Cc: Aditya Gupta <adityag@linux.ibm.com>
Cc: Harsh Prateek Bora <harshpb@linux.ibm.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Shivang Upadhyay <shivangu@linux.ibm.com>"
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260508142029.624039-1-shivangu@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
4 days agoppc/spapr: Skip system reset for quiesced CPUs
Shivang Upadhyay [Mon, 11 May 2026 09:50:55 +0000 (15:20 +0530)] 
ppc/spapr: Skip system reset for quiesced CPUs

During DLPAR CPU hotplug, newly added CPUs start in RTAS stopped state
(quiesced). If a kexec crash occurs before the guest starts these CPUs
via start-cpu RTAS call, H_SIGNAL_SYS_RESET_ALL_OTHERS will reset them
anyway, causing the kdump kernel to hang:

  [    5.519483][    T1] Processor 0 is stuck.
  [   11.089481][    T1] Processor 1 is stuck.

The hypervisor should only reset CPUs that the guest has started. The
cpu->env.quiesced flag tracks RTAS stopped state - CPUs in this state
are already inactive and should not be reset.

Skip system reset for quiesced CPUs to prevent kdump hangs during CPU
hotplug operations.

Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Harsh Prateek Bora <harshpb@linux.ibm.com>
Cc: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
Reported-by: Anushree Mathur <anushree.mathur@linux.vnet.ibm.com>
Suggested-by: Vishal Chourasia <vishalc@linux.ibm.com>
Reviewed-by: Vishal Chourasia <vishalc@linux.ibm.com>
Signed-off-by: Shivang Upadhyay <shivangu@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260511095055.82495-1-shivangu@linux.ibm.com
[harshpb: expanded comment to elobarate more on the rationale]
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
4 days agodocs/devel: Fix typo (s/exist paths/exit paths/)
J. Neuschäfer [Wed, 20 May 2026 06:44:12 +0000 (08:44 +0200)] 
docs/devel: Fix typo (s/exist paths/exit paths/)

In the discussion of control flow through a function, "exit paths" were meant.

Signed-off-by: J. Neuschäfer <j.neuschaefer@9elements.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260520-exist-v1-1-535f929a87ae@9elements.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
4 days agodocs/devel/qom: Fix some editing errors
J. Neuschäfer [Wed, 20 May 2026 11:15:20 +0000 (13:15 +0200)] 
docs/devel/qom: Fix some editing errors

"devices have an two additional [...]" -> "devices have two additional",
and also a case of "were" vs. "where".

Signed-off-by: J. Neuschäfer <j.neuschaefer@9elements.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260520-qom-v1-1-baad87fefe4f@9elements.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
4 days agodocs/code-provenance: Fix formatting of *-by tags
J. Neuschäfer [Wed, 20 May 2026 11:25:49 +0000 (13:25 +0200)] 
docs/code-provenance: Fix formatting of *-by tags

Applying both ``code`` and **bold** formatting doesn't have the intended
outcome, instead Sphinx emits the backticks into the HTML.

Use only **bold** formatting to fix the HTML output.

Signed-off-by: J. Neuschäfer <j.neuschaefer@9elements.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260520-prov-v1-1-7a58af334b9c@9elements.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
5 days agofpu: Export floatN_minmax
Richard Henderson [Sat, 16 May 2026 22:13:10 +0000 (15:13 -0700)] 
fpu: Export floatN_minmax

Allow target access to routines using the minmax flags.
Make the existing min/max wrappers inline.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Fix NaN encoding for E4M3 in parts64_uncanon
Richard Henderson [Tue, 19 May 2026 16:15:31 +0000 (09:15 -0700)] 
fpu: Fix NaN encoding for E4M3 in parts64_uncanon

There is only one NaN fractional encoding for E4M3.  Retain the
incoming sign, but force the outgoing fraction to the unique value.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Introduce float_status.e4m3_nan_is_snan
Richard Henderson [Tue, 19 May 2026 15:43:57 +0000 (08:43 -0700)] 
fpu: Introduce float_status.e4m3_nan_is_snan

Introduce a separate control from float_snan_rule
that applies only to the OCP E4M3 format.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Reorg float_status
Richard Henderson [Fri, 1 May 2026 12:18:35 +0000 (22:18 +1000)] 
fpu: Reorg float_status

Use bitfields to compress float_status from 18 bytes down to 8 bytes.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Add accessors for rebias_{underflow,overflow}
Richard Henderson [Fri, 1 May 2026 10:52:13 +0000 (20:52 +1000)] 
fpu: Add accessors for rebias_{underflow,overflow}

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use get_float_default_nan_pattern in partsN_default_nan
Richard Henderson [Fri, 1 May 2026 10:42:55 +0000 (20:42 +1000)] 
fpu: Use get_float_default_nan_pattern in partsN_default_nan

Move get_float_default_nan_pattern to softfloat-specialize.c.inc,
since there are no external users.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use get_default_nan_mode everywhere
Richard Henderson [Fri, 1 May 2026 10:36:14 +0000 (20:36 +1000)] 
fpu: Use get_default_nan_mode everywhere

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use {get,set}_flush_inputs_to_zero everywhere
Richard Henderson [Fri, 1 May 2026 10:15:49 +0000 (20:15 +1000)] 
fpu: Use {get,set}_flush_inputs_to_zero everywhere

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use accessors for ftz_before_rounding
Richard Henderson [Fri, 1 May 2026 10:05:59 +0000 (20:05 +1000)] 
fpu: Use accessors for ftz_before_rounding

Drop FloatFTZDetection and use #defines, like we do for
tininess_before_rounding.  Rename get_float_ftz_detection
to get_ftz_before_rounding and move to softfloat.c, as
there are no external users.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use {get,set}_flush_to_zero everywhere
Richard Henderson [Fri, 1 May 2026 09:40:37 +0000 (19:40 +1000)] 
fpu: Use {get,set}_flush_to_zero everywhere

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use accessors for tininess_before_rounding
Richard Henderson [Fri, 1 May 2026 09:21:21 +0000 (19:21 +1000)] 
fpu: Use accessors for tininess_before_rounding

Rename get_float_detect_tininess to get_tininess_before_rounding
and move to softfloat.c, as there are no external users.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use get_float_infzeronan_rule in partsN_pick_nan_muladd
Richard Henderson [Fri, 1 May 2026 07:04:46 +0000 (17:04 +1000)] 
fpu: Use get_float_infzeronan_rule in partsN_pick_nan_muladd

Deduplicate the uses to a local variable.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use get_float_3nan_prop_rule in partsN_pick_nan_muladd
Richard Henderson [Fri, 1 May 2026 06:42:01 +0000 (16:42 +1000)] 
fpu: Use get_float_3nan_prop_rule in partsN_pick_nan_muladd

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use get_float_2nan_prop_rule in partsN_pick_nan
Richard Henderson [Fri, 1 May 2026 06:37:41 +0000 (16:37 +1000)] 
fpu: Use get_float_2nan_prop_rule in partsN_pick_nan

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use get_floatx80_behaviour everywhere
Richard Henderson [Fri, 1 May 2026 06:29:00 +0000 (16:29 +1000)] 
fpu: Use get_floatx80_behaviour everywhere

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use of {get,set}_floatx80_rounding_precision everywhere
Richard Henderson [Fri, 1 May 2026 06:16:33 +0000 (16:16 +1000)] 
fpu: Use of {get,set}_floatx80_rounding_precision everywhere

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use {get,set}_float_rounding_mode everywhere
Richard Henderson [Fri, 1 May 2026 05:58:46 +0000 (15:58 +1000)] 
fpu: Use {get,set}_float_rounding_mode everywhere

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Introduce FloatSNaNRule
Richard Henderson [Fri, 1 May 2026 04:19:04 +0000 (14:19 +1000)] 
fpu: Introduce FloatSNaNRule

Merge snan_bit_is_one and no_signaling_nans into one control.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Introduce frac_msb_is_snan
Richard Henderson [Fri, 8 May 2026 21:15:45 +0000 (16:15 -0500)] 
fpu: Introduce frac_msb_is_snan

Unify handling of the two snan parameters, letting the
caller simply extract the msb.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agotarget/alpha: Use FloatExceptionFlags
Richard Henderson [Fri, 1 May 2026 03:09:43 +0000 (13:09 +1000)] 
target/alpha: Use FloatExceptionFlags

Fixes a bug in which we were still using uint8_t.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Introduce FloatExceptionFlags
Richard Henderson [Fri, 1 May 2026 03:05:01 +0000 (13:05 +1000)] 
fpu: Introduce FloatExceptionFlags

We have, in the past, used any of uint8_t, uint16_t or int
to hold the set of exception flags.  Use a typedef instead.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agotarget/alpha: Remove CONFIG_SOFTFLOAT_INLINE
Richard Henderson [Fri, 1 May 2026 02:54:26 +0000 (12:54 +1000)] 
target/alpha: Remove CONFIG_SOFTFLOAT_INLINE

Don't peek into float_status internals.
Fix the helper calls that were missing an argument.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Introduce exp_scalbn
Richard Henderson [Tue, 28 Apr 2026 22:49:46 +0000 (08:49 +1000)] 
fpu: Introduce exp_scalbn

Avoid exponent overflow as well as checking that we don't lose information with
opposing scaling.  Use it in partsN(scalbn) and partsN(round_to_int_normal).

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agotarget/s390x: Move float{32,64}_s390_divide_to_integer
Richard Henderson [Sun, 26 Apr 2026 02:37:41 +0000 (12:37 +1000)] 
target/s390x: Move float{32,64}_s390_divide_to_integer

Now that we've exposed enough infrastructure, this can be
implemented in the backend that needs it.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Use parts64_round_to_int in parts_s390_divide_to_integer
Richard Henderson [Sat, 25 Apr 2026 13:48:12 +0000 (23:48 +1000)] 
fpu: Use parts64_round_to_int in parts_s390_divide_to_integer

We will not expose parts_round_to_int_normal.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Simplify 0 +/- N case in parts_addsub
Richard Henderson [Sun, 26 Apr 2026 07:26:18 +0000 (17:26 +1000)] 
fpu: Simplify 0 +/- N case in parts_addsub

Consolidate the tests for zero and anynorm.
Add comments for a few cases.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Hoist nan check in partsN_addsub
Richard Henderson [Sun, 26 Apr 2026 06:23:30 +0000 (16:23 +1000)] 
fpu: Hoist nan check in partsN_addsub

The nan test had been down below because it was unlikely.
But if we have to have one anyway because of denormals,
we might as well take care of them right away.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Return struct from parts{64,128}_muladd
Richard Henderson [Sun, 26 Apr 2026 02:18:20 +0000 (12:18 +1000)] 
fpu: Return struct from parts{64,128}_muladd

At the same time, export.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Reorganize partsN(muladd)
Richard Henderson [Tue, 28 Apr 2026 00:13:45 +0000 (10:13 +1000)] 
fpu: Reorganize partsN(muladd)

Check the likely case of normal product and normal or
zero addend first; shift NaN and infinity detection down;
end with zero product + addend.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agofpu: Return struct from parts{64,128}_scalbn
Richard Henderson [Tue, 28 Apr 2026 07:03:08 +0000 (17:03 +1000)] 
fpu: Return struct from parts{64,128}_scalbn

At the same time, export.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5 days agohw/riscv: riscv-iommu: Re-process command queue after clearing CMD_ILL
Jay Chang [Mon, 18 May 2026 07:01:43 +0000 (15:01 +0800)] 
hw/riscv: riscv-iommu: Re-process command queue after clearing CMD_ILL

When software clears CMD_ILL or CQMF error bits by writing 1 to CQCSR,
the IOMMU should re-check the command queue and continue processing
pending commands if head != tail.

Per RISC-V IOMMU specification :
If command-queue access leads to a memory fault then the
command-queue-memory-fault bit is set to 1 and the commandqueue
stalls until this bit is cleared. To re-enable command
processing, software should clear this bit by writing 1.

Signed-off-by: Jay Chang <jay.chang@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Message-ID: <20260518070143.8405-1-jay.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agohw/intc: riscv_aplic: add trace events of APLIC read/write function
Jim Shu [Tue, 28 Apr 2026 16:01:03 +0000 (00:01 +0800)] 
hw/intc: riscv_aplic: add trace events of APLIC read/write function

Add the trace events for APLIC read/write functions.

Signed-off-by: Jim Shu <jim.shu@sifive.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260428160103.3551125-5-jim.shu@sifive.com>
[ Changes by AF:
 - Init val to zero to avoid uninitialised build errors
]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agohw/intc: riscv_imsic: Add reset API to IMSIC
Jim Shu [Tue, 28 Apr 2026 16:01:02 +0000 (00:01 +0800)] 
hw/intc: riscv_imsic: Add reset API to IMSIC

Clearing IMSIC registers and qemu_irq in the reset function

Signed-off-by: Jim Shu <jim.shu@sifive.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260428160103.3551125-4-jim.shu@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agohw/intc: riscv_aplic: Add reset API to APLIC
Jim Shu [Tue, 28 Apr 2026 16:01:01 +0000 (00:01 +0800)] 
hw/intc: riscv_aplic: Add reset API to APLIC

Clearing APLIC registers and qemu_irq in the reset function

Signed-off-by: Jim Shu <jim.shu@sifive.com>
Signed-off-by: Fea.Wang <fea.wang@sifive.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260428160103.3551125-3-jim.shu@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agohw/intc: riscv_aplic: Fix level trigger IRQ in direct delivery mode
Jim Shu [Tue, 28 Apr 2026 16:01:00 +0000 (00:01 +0800)] 
hw/intc: riscv_aplic: Fix level trigger IRQ in direct delivery mode

According to the AIA spec ch4.7 ("Precise effects on interrupt-pending
bits"), pending bit of APLIC should be set/cleared whenever the
rectified input value is high/low in the both level-trigger mode
and direct delivery mode.

Currently, QEMU APLIC only clears the pending bit when interrupt is
claimed in APLIC, but not clears it when the rectified input value is
low. (e.g. IRQ source signal is low in the LEVEL_HIGH/Level1 mode).
The software may receive an additional IRQ if the peripheral
triggers one after the software clears the APLIC IRQ but before it
clears the peripheral's IRQ.

Thus, we also clear the pending bit via the rectified input value in the
level-trigger mode.

This change doesn't affect MSI delivery mode. Calling
riscv_aplic_msi_irq_update() when IRQ pending is low will do nothing.

Signed-off-by: Jim Shu <jim.shu@sifive.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260428160103.3551125-2-jim.shu@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agotarget/riscv: Make hpmcounterh return the upper 32-bits
Portia Stephens [Tue, 19 May 2026 04:33:52 +0000 (14:33 +1000)] 
target/riscv: Make hpmcounterh return the upper 32-bits

The counter value was not being bitshifted for a hpmcounterh read
resulting in hpmcounterh returning the bottom 32-bits.

Fixes: cfc96df65e01 ("target/riscv: Remove upper_half from riscv_pmu_ctr_get_fixed_counters_val")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3498
Cc: qemu-stable@nongnu.org
Signed-off-by: Portia Stephens <portias@oss.tenstorrent.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260519043352.3685866-1-stephensportia@gmail.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agohw/riscv/virt-acpi-build: Fix off-by-one error in RIMT ID mapping
Zishun Yi [Tue, 12 May 2026 06:23:10 +0000 (14:23 +0800)] 
hw/riscv/virt-acpi-build: Fix off-by-one error in RIMT ID mapping

In build_rimt(), the calculation of `num_ids` for the ID mapping array
incorrectly uses the same formula (`0xffff - s->pci_iommu_bdf`) for both
System IOMMU and PCI IOMMU topologies.

For a System IOMMU, `s->pci_iommu_bdf` is 0. This results in a `num_ids`
value of 0xffff. Since the source ID base starts at 0, the mapping only
covers Requester IDs from 0 to 0xfffe. The final valid PCI Requester ID
(0xffff) is erroneously omitted from the RIMT table.

Fix this by decoupling the `num_ids` calculation. For System IOMMUs,
explicitly set `num_ids` to 0x10000 to cover the entire PCI Requester ID
space.

This issue was discovered and reported by SpecHunter, an AI-driven
architecture specification analysis tool.

Link: https://github.com/yizishun/rv-isa-sec/blob/c78dacf66c8acd677b3538c837fde310bb71a97b/output/riscv-server-platform/pr-102/qemu.txt#L32
Signed-off-by: Zishun Yi <vulab@iscas.ac.cn>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260512062310.348208-1-vulab@iscas.ac.cn>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agotarget/riscv/csr.c: fix read of pmpaddr(0-63) CSRs
Daniel Henrique Barboza [Thu, 14 May 2026 12:33:42 +0000 (09:33 -0300)] 
target/riscv/csr.c: fix read of pmpaddr(0-63) CSRs

The priv spec defines, for RV64, that the upper 10 bits of
pmpaddr0-pmpaddr63 are WARL and are supposed to be cleared.

After this patch, using the bug reproducer in [1], writing
ffffffffffffffff in pmpaddr0 and reading it back now results in
003fffffffffffff.  Here's the 'diff -cp' dump before and after
this change:

*************** IN:
*** 5272,5278 ****
   pmpcfg10 0000000000000000
   pmpcfg12 0000000000000000
   pmpcfg14 0000000000000000
!  pmpaddr0 ffffffffffffffff
   pmpaddr1 0000000000000000
   pmpaddr2 0000000000000000
   pmpaddr3 0000000000000000
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260514123342.2139464-1-daniel.barboza@oss.qualcomm.com>

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5 days agohw/riscv/riscv-iommu: Fix IOCOUNTINH.CY toggle detection
Fangyu Yu [Sat, 9 May 2026 07:49:41 +0000 (15:49 +0800)] 
hw/riscv/riscv-iommu: Fix IOCOUNTINH.CY toggle detection

Fix IOCOUNTINH.CY toggle detection by comparing normalized CY bit
rather than XORing whole register with boolean.

Fixes: 2cf2a6c027ba ("hw/riscv/riscv-iommu: add IOCOUNTINH mmio writes")
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Message-ID: <20260509074941.99295-1-fangyu.yu@linux.alibaba.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>