40942 Commits

Author SHA1 Message Date
Peter Maydell
7df28e4c41 Merge tag 'hppa-more-v11-fixes-pull-request' of https://github.com/hdeller/qemu-hppa into staging
HPPA patches for qemu-v11

A few late fixes for the HPPA architecture for QEMU v11:
- graphics support was broken for 64-bit machines. This series adds
  support for VGA graphics for Linux guests
- the various memory ranges were not correctly implemented
- TOC/NMI was not working on 64-bit machines
- minor 64-bit HP-UX boot fixes (but HP-UX 64-bit still crashes)

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCacwXxAAKCRD3ErUQojoP
# X7NxAQCBszDUKsNX5KiB+cxW1AfT1Gyzo4q9T0NNULO5v2Fn7gD/YVzgtZ6F+crK
# 1eG1R0aVekPmx+NClsCLvy/dX1YmTww=
# =L+6i
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Mar 31 19:51:48 2026 BST
# gpg:                using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F
# gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown]
# gpg:                 aka "Helge Deller <deller@kernel.org>" [unknown]
# gpg:                 aka "Helge Deller <deller@debian.org>" [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: 4544 8228 2CD9 10DB EF3D  25F8 3E5F 3D04 A7A2 4603
#      Subkey fingerprint: BCE9 123E 1AD2 9F07 C049  BBDE F712 B510 A23A 0F5F

* tag 'hppa-more-v11-fixes-pull-request' of https://github.com/hdeller/qemu-hppa:
  target/hppa: Update SeaBIOS-hppa to version 24
  hw/hppa: Implement memory ranges
  target/hppa: Fix TOC handler for 64-bit CPUs
  hw/pci-host/astro: Add GMMIO mapping
  hw/pci-host/astro: Fix LMMIO DIRECT mappings
  hw/pci-host/astro: Implement LMMIO registers
  hw/pci-host/astro: Fix initial addresses in IOC
  hw/pci-host/astro: Make astro address arrays accessible for other users

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-31 20:46:13 +01:00
Helge Deller
4a84032a26 hw/hppa: Implement memory ranges
All 64-bit PA-RISC machines split the memory into (up to 3) different
memory ranges, which are mapped at specific addresses.  This patch
mimics the mapping as it's done on physical machines, which includes the
3.75 GB split for C3700, and 1 GB split for newer 64-bit PAT machines
like the A400.

SeaBIOS-hppa needs to know how the memory split is done, so add a new
memsplit_addr variable which stores the specific split address and hand
this over to SeaBIOS-hppa via fwcfg.

Signed-off-by: Helge Deller <deller@gmx.de>
2026-03-31 20:22:25 +02:00
Helge Deller
a45862947e hw/pci-host/astro: Add GMMIO mapping
Implement the GMMIO mapping.

Signed-off-by: Helge Deller <deller@gmx.de>
2026-03-31 20:22:25 +02:00
Helge Deller
12cd2e5ec1 hw/pci-host/astro: Fix LMMIO DIRECT mappings
Fix the existing code which has the mask wrong.
Implement the direct mapping via overlapping subregion with priority 3
to make sure the direct mapping gets precedence over the LMMIO region.

Signed-off-by: Helge Deller <deller@gmx.de>
2026-03-31 20:22:25 +02:00
Helge Deller
4f5367f0a2 hw/pci-host/astro: Implement LMMIO registers
Add code to adjust the memory mapping windows according to the LMMIO registers
in Astro.  This allows SeaBIOS-hppa to configure Astro depending on existing
PCI cards, and especially makes it possible to enable a VGA PCI card.

Signed-off-by: Helge Deller <deller@gmx.de>
2026-03-31 20:22:25 +02:00
Helge Deller
64f676beea hw/pci-host/astro: Fix initial addresses in IOC
F-Extend the LMMIO and IOS distributed addresses.
Use the 44-bit address for the IOS distributed address.

Signed-off-by: Helge Deller <deller@gmx.de>
2026-03-31 20:22:25 +02:00
Helge Deller
a3210e056d hw/pci-host/astro: Make astro address arrays accessible for other users
Move the tables out of astro_realize(). This is needed because follow-up
patches will need those tables.

Signed-off-by: Helge Deller <deller@gmx.de>
2026-03-31 20:22:25 +02:00
Peter Maydell
7a2dc48276 Merge tag 'for-upstream' of https://gitlab.com/kmwolf/qemu into staging
Block layer patches

- ide: Fix potential assertion failure on VM stop for PIO read error
- scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
- vhost-user-blk-server: fix opt_io_size=1 causing severe Windows I/O degradation
- monitor: Fix deadlock in monitor_cleanup
- Fix filename references in comments

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCgAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmnL4dURHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9aG/BAAiZ1XYu46Ct9+IdopoPYhEK+T7m7PuEUR
# KJPvdp0J6mVwVBehUjacmKvCtBQUbUF8x7PD6NMF3Q+7qkVqhmngbb4s5ks/zUQi
# MxZTJF1Yps9EZ6mI3bA6caV9PzegQSOA4p+RhOXaDt7lhXhBFt6lCVFVB5eCma+a
# 1dOxAbKD6geftaMvB1uQu5qYAtclATw1Gl4YSkdaO+UKGizce6YdKYOvFwU53EvO
# 4cRrrVzk7i5act61HcwT6xNSFJ+Fgmwcn+EiD0Uw/hOFzf8nXNS0DME7QJKjr6Ug
# Adv/439sUk5J1A//S3liSQ8D9SZBdi2yS7quMy4ggbwz9CqQvUi3ejenpOJtn8yG
# ylyhHmd4dnr8QC1Zf/3SbZ1hbLWn69y+rmV+e2uJF59bpWRMvqxeJX+D4DPe5LZp
# E8pckNmqkqkBfsPuM0nzW5qdPmkioZ+i2pEgAQ99tkUlcfFLvrlEaCr9AVKgDcZn
# B2HjaZPLrZtXEKMtKM4RXt7h8F33Zxnvy8chSdqW6J0BaWvPtFO7bJn2elAgibum
# ZBigvhfwkw9xxzlGmudTbNMz8Fnpc/KBue8bhzDkOe4AybcVwuefG3VIyI8tLkG9
# IoHxbeQM6+yHXjrvn3OLWLJ7HQ0EyBsRE9cpZN4p/3rSS5G7RWfNdAIuzwLamZQ3
# lmzdXf9++1E=
# =JiFt
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Mar 31 16:01:41 2026 BST
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* tag 'for-upstream' of https://gitlab.com/kmwolf/qemu:
  block: Fix crash after setting latency historygram with single bin
  vhost-user-blk-server: fix opt_io_size=1 causing severe Windows I/O degradation
  monitor: Fix deadlock in monitor_cleanup
  block: Fix references in bdrv_bsc_*() function comments
  scsi: Don't consider LOGICAL UNIT NOT SUPPORTED guest recoverable
  ide: Fix potential assertion failure on VM stop for PIO read error

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-31 17:51:08 +01:00
Helge Deller
6a0e2db073 hw/hppa: Disable Artist graphics card on 64-bit machines
The original Artist graphics used the GSC bus, was often installed in old
32-bit machines (e.g. 715) and can not be used on 64-bit machines.
This is why this patch makes the artist driver dependend on the Lasi chip,
which was never used in a 64-bit machine.

Note that there exists a variant of Artist for the PCI-bus (Visualize-EG PCI).
It has quite some differences in the registers, and would require that we write
a PCI ROM for it, so that Linux and HP-UX would be able to use it.

Instead, for now, users can simply use a standard VGA or ATI PCI graphics card
on Linux.  This can be enabled on the command line with "-device ati-vga" or
"-device VGA".  If the "-nographic" option is omitted, a PCI OCHI controller
with USB keyboard and USB mouse will be added automatically.

This fixes graphics support on 64-bit hppa machines and allows us to boot up a
64-bit Linux installation with VGA graphics.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260330211859.19317-3-deller@kernel.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-03-31 15:12:45 +02:00
Helge Deller
508a870550 hw/pci-host/astro: Update copyright and documentation link
Update the link to the documentation, which was still pointing to the
Wiki page. In the meantime the PA-RISC wiki was converted to a
read-the-docs website.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260330211859.19317-2-deller@kernel.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-03-31 15:12:45 +02:00
BALATON Zoltan
6af42f7c50 ati-vga: Add upper limit to x-linear-aper-size property
Coverity warns in CID 1645968 about possible integer overflow. This
should never happen but to ensure that, add an upper limit on the
x-linear-aper-size. This may not silence the warning but makes sure
users cannot cause an overflow.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <541ffffdaa4c67b9dcbca6c2498e69b137bce95d.1774904832.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-03-31 15:12:45 +02:00
BALATON Zoltan
3b4acaf9e6 ati-vga: Silence warning about operator precedence
Coverity in CID 1645969 warns about possible operator precendence
issue which is a false positive in this case but simplify the
expression to silence the warning.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <24161ec41f118ad097387f8a84897dee7b4747b8.1774904832.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-03-31 15:12:45 +02:00
Shivang Upadhyay
ba48bff09f ppc/pnv: generate dtb after machine initialization is complete
Currently, the machine dtb is generated in pnv_init(), before all devices
are fully initialized. This can result in an incomplete dtb for the system,
as seen in bug [1].

Fix this by deferring dtb generation until machine initialization is complete,
using the machine_init_done_notifier hook.

[1] https://lore.kernel.org/all/20260323231612.GA2637687@ax162/

Cc: Aditya Gupta <adityag@linux.ibm.com>
Cc: Harsh Prateek Bora <harshpb@linux.ibm.com>
Cc: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-stable@nongnu.org
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: a16d4c2f16 ("ppc/pnv: fix dumpdtb option")
Signed-off-by: Shivang Upadhyay <shivangu@linux.ibm.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20260327124136.983955-1-shivangu@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-03-31 15:12:45 +02:00
Kevin Wolf
59c1d31136 ide: Fix potential assertion failure on VM stop for PIO read error
ide_sector_read() as well as its callers neglect to call ide_set_retry()
before starting I/O. If the I/O fails, this means that the retry
information is stale. In particular, ide_handle_rw_error() has an
assertion that s->bus->retry_unit == s->unit, which can fail if either
there was no previous request or it came from another device on the bus.
If the assertion weren't there, a wrong request would be retried after
resuming the VM.

Fix this by adding a ide_set_retry() call to ide_sector_read().

This affects only reads because ide_transfer_start() does call
ide_set_retry(). For writes, the data transfer comes first and the I/O
is only started when the data has been read into s->io_buffer, so by
that time, ide_set_retry() has been called. For reads, however, the I/O
comes first and only then the data is transferred to the guest, so the
call in ide_transfer_start() is too late.

Buglink: https://redhat.atlassian.net/browse/RHEL-153537
Reported-by: Tingting Mao <timao@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20260326165124.138593-1-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-31 14:25:21 +02:00
Peter Maydell
36212b4e85 hw/arm/xilinx_zynq: Use strcasecmp to parse boot-mode option values
In zynq_set_boot_mode() where we parse the string the user has set
the boot-mode option to, we use strncasecmp(str, "qspi", 4) and so
on.  This is wrong, because it means that we will ignore any trailing
junk on the end of the option string, and handle
 -machine boot-mode=sdXYZZY
the same as
 -machine boot-mode=sd

In the documentation we say:
 Supported values are ``jtag``, ``sd``, ``qspi`` and ``nor``.
and that's obviously what we meant to implement.

The correct tool for this job is a simple strcasecmp operation.
Switch to that.

We use the g_ascii_strcasecmp() rather than plain strcasecmp()
because we're comparing ASCII strings here and don't want the
potentially locale-specific behaviour that strcasecmp() implies (and
we're trying to standardize on the glib function for this kind of
string comparison).

Fixes: 7df3747c92 ("hw/arm/xilinx_zynq: Add boot-mode property")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20260327145012.907264-1-peter.maydell@linaro.org
2026-03-30 16:18:07 +01:00
Peter Maydell
a0721c099b hw/net/rocker: Avoid double-free of l2_flood.group_ids
In of_dpa_cmd_add_l2_flood(), we allocate memory for the
group->l2_flood.group_ids array, freeing any previous array.
However, in the error-exit path we free the group_ids memory but do
not clear the pointer to NULL.  This means that if the guest causes
us to take the error-exit path and then later call the function
again, we will try again to free the memory we already freed.

Fix this by clearing the group_ids pointer in the error exit
path, so we maintain the invariant of "either it points at
allocated memory, or it is NULL" (both being valid to g_free()).

Cc: qemu-stable@nongnu.org
Fixes: dc488f8880 ("rocker: add new rocker switch device")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3253
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260324193530.375628-1-peter.maydell@linaro.org
2026-03-30 16:18:06 +01:00
Peter Maydell
dd3ee9c63d Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* more WHPX fixes and documentation
* hpet: fix bounds check for s->timer[]
* hpet: lower HPET_MAX_TIMERS to 24
* lsi53c895a: keep SCSIRequest alive during DMA
* lsi53c895a: keep device alive during SCRIPTS execution
* hw/acpi: fix save/restore for MIPS Malta machine

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmnKTQ0UHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroNDAQgAry87O2EtgZBK8084Rn41+8w7Hx4K
# HmKGGLRHunZgOPPbFtLFj8sjmZGqV6MuELf8zBIwheJiaWyp9SqPN2FtwldEwLsG
# C37MsUS02SbfPrJPuAMaDsfeFknHaV/pUWiZIYr5S5+dKckz8P9RUZghCVKBmwyL
# mapNE7/++A2HCX2FnABmAsMMo+kt425kCmkDFryJQ9R7j8vjYo2sHn+WpDRjOLYS
# 0K7a5HBCwE+TrdZC1Q3J17VMhX/sFL/Ms8ByIhwJa+WimZoF/roaDBiK/0iUfVlg
# 196U0rvejdymAMWqIU462fyHvVkeW50FCHjTccmqnrIbFEdL4CFZlnrNxQ==
# =JIqb
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 30 11:14:37 2026 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  hw/acpi: Do not save/load cpuhp state unconditionally
  lsi53c895a: keep SCSIRequest alive during DMA
  lsi53c895a: keep lsi_request alive as long as the SCSIRequest
  lsi53c895a: keep lsi_request and SCSIRequest in local variables
  lsi53c895a: do not do anything else if a reset is requested by writing ISTAT0
  lsi53c895a: keep a reference to the device while SCRIPTS execute
  hpet: lower HPET_MAX_TIMERS to 24
  hpet: fix bounds check for s->timer[]
  target/i386: emulate: remove redundant logging for unmapped MMIO access
  whpx: i386: trace unsupported MSR accesses
  docs: add WHPX section with initial info
  meson.build: remove i386-softmmu WHPX support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-30 13:54:56 +01:00
Peter Maydell
fb66da4053 Merge tag 'pull-aspeed-20260330' of https://github.com/legoater/qemu into staging
aspeed queue:

* Complete lost interrupts fix in the Aspeed I2C model
* Fix a vlan tag insertion issue in the ftgmac100 model

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmnKYwYACgkQUaNDx8/7
# 7KHzlw/+OxlsY72otFxNbLWtQEOTQvWPDXvTbKsjlVtZalLM7BE/X+EqG6i9pDmj
# Reujd32F5pDX0pLzvFDqKgkQsFPW2F8jPpVMHDzZZkAjH0F5cckP/GO91WFC1F0x
# w7xlh9LKvw/LQcamR3Ptpb9+zuvG+p0O2tg+dmzUDzYwTt/Y7N25gnK9lUNup1qT
# T68Yy5Wa2YkW0J4/BGHOe9wxdM8tHz5izM69sTrb3nDnryiMWwNyMVIcDI1RyM53
# xMy2sMs/SpjxBYIl8+xfiGMGizjwVIyISb3aMC/OtLMMzxZ7PUaGSZLe63qB4kJF
# nBJ5LRxXTvsA74m9/rNk9S28lTtF4j14YVbMKj9hzt+YZzTumu20wfsTY63qja9K
# XWFqKoyD7Hrwt1grAYLWEl4mTNZNgby6091eNOWdYhv2Ogb3JWrTckCtDPWiJpeo
# c6Q9dewUSY0GDA5+2mOcVcDq4zcbZvVqdXqYH2EUasbmMLre/k/Q4zd7AOsC6U9V
# kPnd+cLPnIxMRBlzVKi/Sg2Non8QHsa/EgPyKYny9A4zGHgpGOAloSsRmv/xW3kH
# PFMpz/wIqudjpa0kJtsbE+v5iRixOTpr8oA8E8dPz8lrW9oVbRmqyQHKpIHOILq9
# M6WDnwxJDUqZS8w8Hk1hJMriQUpYPabYdwiWWdnPeyj9cWGuHFU=
# =ZxRl
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 30 12:48:22 2026 BST
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [full]
# gpg:                 aka "Cédric Le Goater <clg@kaod.org>" [full]
# Primary key fingerprint: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1

* tag 'pull-aspeed-20260330' of https://github.com/legoater/qemu:
  net/ftgmac100: preserve full VLAN TCI in TX tag insertion
  hw/i2c/aspeed_i2c: reset and migrate pending_intr_sts

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-30 13:54:48 +01:00
Zhao Liu
0f254f70d4 hw/acpi: Do not save/load cpuhp state unconditionally
Commit 7aa563630b ("pc: Start with modern CPU hotplug interface
by default") removed the .needed callback (vmstate_test_use_cpuhp)
from vmstate_cpuhp_state in both piix4.c and ich9.c.

However, PIIX4 is also used by non-PC boards - MIPS Malta, which does
not select CONFIG_ACPI_CPU_HOTPLUG. For MIPS Malta, the linker resolves
vmstate_cpu_hotplug to the stub one in acpi-cpu-hotplug-stub.c, which is
a zero-initialized VMStateDescription with .fields == NULL.

Before commit 7aa563630b, .needed() of PIIX4's vmstate_cpuhp_state
returned false for MIPS Malta since PIIX4PMState always initialized the
field cpu_hotplug_legacy as true. Malta implicitly relies on this
initial value to bypass vmstate_cpuhp_state. However, this is unstable
because Malta itself does not support CPU hotplugging, whether via the
legacy way or the modern way.

Commit 7aa563630b removed .needed() check for vmstate_cpuhp_state,
this broke the existing dependency that Malta had relied on, forcing
Malta to save and load vmstate_cpuhp_state during the save/load process,
which in turn caused a segmentation fault due to NULL fields in the
stub-compiled code.

Fix this by bringing back the .needed = cpuhp_needed callback for
vmstate_cpuhp_state of PIIX4, that checks
MachineClass::has_hotpluggable_cpus. Boards that do not support CPU
hotplug (only MIPS Malta) will skip this subsection entirely, which
is both correct and consistent with the previous behavior.

At the same time, add a similar .needed() check to ICH9. Although no
boards with ICH9 are affected by this issue, this helps avoid potential
issues in the future.

Reproducer (MIPS Malta):
  $ qemu-img create -f qcow2 dummy.qcow2 32M
  $ qemu-system-mipsel -nographic \
      -drive if=none,format=qcow2,file=dummy.qcow2
  [Type "C-a c" to get the "(qemu)" monitor prompt)]
  (qemu) savevm foo    # segfault

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: 7aa563630b ("pc: Start with modern CPU hotplug interface by default")
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3360
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/r/20260330053008.2721532-1-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
d459131ff5 lsi53c895a: keep SCSIRequest alive during DMA
Reentrant MMIO can cause the SCSIRequest to be completed, at which
point lsi_request_orphan would drop the last reference.  Anything
that happens afterwards would access freed data.  Keep a reference
to the SCSIRequest and, through req->hba_private, to the lsi_request*
for as long as DMA runs.

Reported-by: Jihe Wang <wangjihe.mail@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
7c7aaaa342 lsi53c895a: keep lsi_request alive as long as the SCSIRequest
To protect against using the lsi_request after SCSIRequest has been freed,
keep the HBA-private data alive until the last reference to the SCSIRequest
is gone.  Because req->hba_private was used (even if just for an assertion)
to check that the request was still either current or queued, add a boolean
field that is set when the SCSIRequest is cancelled or completed, which
is when the lsi_request would have been unqueued.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
1ca38f84e1 lsi53c895a: keep lsi_request and SCSIRequest in local variables
Protect against changes from reentrant device MMIO during DMA, by always
operating on the same request.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
64807c84e8 lsi53c895a: do not do anything else if a reset is requested by writing ISTAT0
If the device is reset, anything that is done before will not really
be visible.  So do the reset and exit immediately if that is one
of the requests in the value written to ISTAT0.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:17 +02:00
Paolo Bonzini
4862d2c951 lsi53c895a: keep a reference to the device while SCRIPTS execute
SCRIPTS execution can trigger PCI device unplug and consequently
a use-after-free after the unplug returns.  Avoid this by keeping
the device alive.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3090
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:25 +02:00
Paolo Bonzini
24b9ebd5f1 hpet: fix bounds check for s->timer[]
Fix an off-by-one issue in QEMU's HPET read and write MMIO handlers.
Both handlers check timer_id > s->num_timers instead of timer_id >=
s->num_timers, allowing a guest to access one timer beyond the valid
range.

The affected slot is initialized properly in hpet_realize, which goes
through all HPET_MAX_TIMERS elements of the array, so even though
it is not reset in hpet_reset() the bug does not cause any use of
uninitialized host memory.  Because of this, and also because (even
though HPET_MAX_TIMERS is 32) the HPET only has room for 24 timers in
its MMIO region, the bug has no security implications.

Commit 869b0afa4f ("rust/hpet: Drop BqlCell wrapper for num_timers",
2025-06-06) silently fixed the same bug in rust/hw/timer/hpet/src/device.rs.

Reported-by: Yuma Kurogome, Ricerca Security, Inc. <yumak@ricsec.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:25 +02:00
linhuang
9160305d92 net/ftgmac100: preserve full VLAN TCI in TX tag insertion
The VLAN tag insertion helper took vlan_tci as an 8-bit value, while
the descriptor provides a 16-bit VLAN TCI. This truncated egress tags
and caused VLAN ID corruption (for example, 4088/0x0ff8 became
248/0x00f8 at the receiver).

Change vlan_tci to uint16_t in the TX VLAN insertion path so the full
802.1Q TCI is preserved and transmitted correctly.

Fixes: c2ab73fcbe ("ftgmac100: Fix integer overflow in ftgmac100_do_tx()")
Signed-off-by: linhuang <linhuang@ruijie.com.cn>
Link: https://lore.kernel.org/qemu-devel/1471e413d3589b6734819bda2b59b725b74f273a.d551129b.99fc.47f6.86dc.0759227268a2@feishu.cn
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-03-30 07:36:25 +02:00
GuoHan Zhao
9c32999643 hw/i2c/aspeed_i2c: reset and migrate pending_intr_sts
Commit 7e82393ed0 ("hw/i2c/aspeed: fix lost interrupts on
back-to-back commands") introduced pending_intr_sts to preserve
interrupt bits that collide with already pending status bits.

That deferred interrupt state is consumed later when the guest clears
INTR_STS, but it is not reset in aspeed_i2c_bus_reset() and it is not
part of the bus migration state. A reset can therefore leave stale
deferred bits behind, and migration can silently drop them.

Clear pending_intr_sts on reset and include it in VMState while keeping
compatibility with older migration streams.

Fixes: 7e82393ed0 ("hw/i2c/aspeed: fix lost interrupts on back-to-back commands")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Link: https://lore.kernel.org/qemu-devel/20260325085450.126595-1-zhaoguohan@kylinos.cn
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-03-30 07:36:25 +02:00
Thomas Huth
af4eea83d2 hw/display/cirrus_vga_isa: Disable global_vmstate by default for new machines
In the long run, we would like to get rid of the code that allows to
register migration state globally, so set global_vmstate to false when
using the isa-cirrus-vga device with new machines, and only enable it
for older machines to avoid breaking the migration there.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260326154850.301609-1-thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Thomas Huth
d7189d4009 hw/display/vga-isa: Fix migration of the isa-vga device
QEMU currently crashes when migrating a guest that uses the
isa-vga device as display. This happens because vga_isa_class_initfn()
registers a vmsd for vmstate_vga_common that operates on VGACommonState.
But the isa-vga device is derived from ISADevice, not from VGACommonState,
so the migration code tries to fill in the data for VGACommonState to
the memory that is a ISADevice instead, which is of cause causing trouble.

We need an indirection here as it's also e.g. done in vga-pci.c, so
that the migration data gets filled into the right location.

While we're at it, also drop the "global_vmstate = true" here. Since
migration was broken for this device during the last 15 years (!) anyway,
we don't have to worry about maintaining backward compatibility with this
switch for older versions of QEMU anymore.

Fixes: 7435b791ca ("vga-isa: convert to qdev")
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260326113457.159065-1-thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Peter Maydell
770f50c14f Merge tag 'pull-nvme-20260326' of https://gitlab.com/birkelund/qemu into staging
nvme queue

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmnE7OEACgkQTeGvMW1P
# Delfsgf/Z1L/MTif4pciPpSqvSo0D4NtaGCdqJDe+meA2/Z93SWokjDk21DoQ0qb
# A3ZdOE0jNGF3pjpWA82OWzVdk3Lur12tYvPq8HpnmoR76Ou3ZqQJlLXcLuT5jkHH
# hFJZRfu4gIGKS8Fks+MKsqwH+oB6bNpvXN87T6IpzF2U9aPqNM00wa678ALUDbjr
# rZBA7Zp0eyhCyKgB2IU+3X70tr4gQ0ZxkQrXAenzF2uWz1qsOCCvoSZvmFR8DDRV
# H5uG4fFvDXn+AceCbu/guvCtf6tiQ0cNr+SStb3DktxUU9BR3LaWXHtxlH4ic5sm
# xbc4dCE1tHo5sytu3nw/enWgSqqsYw==
# =Qmni
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Mar 26 08:22:57 2026 GMT
# gpg:                using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [full]
# gpg:                 aka "Klaus Jensen <k.jensen@samsung.com>" [full]
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#      Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'pull-nvme-20260326' of https://gitlab.com/birkelund/qemu:
  hw/nvme: fix heap-buffer-overflow in nvme_abort
  hw/nvme: re-enable wzds bit in namespace dlfeat

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-26 10:26:39 +00:00
Kaixuan Li
eb5cc99aff hw/nvme: fix heap-buffer-overflow in nvme_abort
In nvme_abort(), the submission queue pointer is dereferenced from the
guest-controlled sqid before validating it with nvme_check_sqid():

    NvmeSQueue *sq = n->sq[sqid];

Since sqid is a 16-bit value (range 0-65535) taken directly from CDW10,
and n->sq[] is typically only max_ioqpairs+1 (65) entries, a malicious
guest can trigger an out-of-bounds heap read by sending an Abort command
with a large sqid.

ASan reports this as heap-buffer-overflow in nvme_abort.

Fix this by moving the array dereference to after the nvme_check_sqid()
bounds validation.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3348
Fixes: 75209c071a ("hw/nvme: actually implement abort")
Cc: qemu-stable@nongnu.org
Signed-off-by: Kaixuan Li <kaixuanli@ntu.edu.sg>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
2026-03-26 09:14:35 +01:00
Pankaj Raghav
55720ba97d hw/nvme: re-enable wzds bit in namespace dlfeat
dlfeat was changed from 0x9 to 0x1 when PI support was added.
It was removed because we can't rely on unmap and have to physically
clear it to get the checksums right but that doesnt mean that we do not
support the bit.

The spec says that if wzds is enabled, then the controller supports
deallocate (DEAC) on write zeroes. But DEAC bit in write zeroes command
is only a hint, the controller might choose to physically write zeroes in
those areas.

As we are sending write zeroes command with BDRV_REQ_MAY_UNMAP to the
underlying block device anyway (if the unmap operation is supported),
change the dlfeat value back to 0x9.

A new flag FALLOC_FL_WRITE_ZEROES has been introduced in linux for
fallocate which will use the wzds bit in dlfeat to quickly zeroout extents
using unmap operation whenever possible[1].

[1] https://lore.kernel.org/linux-fsdevel/20250619111806.3546162-1-yi.zhang@huaweicloud.com/

Fixes: 146f720c55 ("hw/block/nvme: end-to-end data protection")
Suggested-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
2026-03-26 09:14:35 +01:00
Jenny Guanni Qu
cb1e8c18df hw/audio/sb16: validate VMState fields in post_load
The SB16 VMState loads in_index and out_data_len as raw INT32
values with no bounds validation. A crafted migration stream or
VM snapshot can set these to values exceeding their respective
buffer sizes (in2_data[10] and out_data[50]), causing heap OOB
write in dsp_write() and heap OOB read in dsp_read().

Add bounds checks in sb16_post_load() to reject invalid values
before they can be used as array indices.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3326
Reported-by: Jenny Guanni Qu <qguanni@gmail.com>
Signed-off-by: Jenny Guanni Qu <qguanni@gmail.com>
Link: https://lore.kernel.org/r/20260318192918.65481-1-qguanni@gmail.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-25 18:22:27 +01:00
Paolo Bonzini
3060e9b93b treewide: replace qemu_hw_version() with QEMU_HW_VERSION
The version is never set on 2.5+ machine types, so qemu_hw_version() and
qemu_set_hw_version() are not needed anymore.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-25 18:22:27 +01:00
Peter Maydell
345e26093f Merge tag 'pull-target-arm-20260324' of https://gitlab.com/pm215/qemu into staging
target-arm queue:
 * linux-user/i386/signal.c: Correct definition of target_fpstate_32
 * hw/dma/pl080: Fix transfer logic in PL080
 * hw/arm/smmuv3-accel: Switch to OnOffAuto properties
 * qemu-options.hx: Document arm-smmuv3 device's accel properties

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmnCqXcZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3iVhD/9SpxvYu22WidW7vO0g0Zct
# tEtSbEPO8BhXrJywEVlSMKUUQab8+eJLohftN+uLMIIEB81gWMqL6jZDA54Jk2dZ
# Pb1QiZ7CKLo52VYmZQLqgDCk/i8E71BxFGXadBQLVWIc0K8uNc0CY/1UgkyYyMSn
# eJcF4CuDjxs5cwYQwgLEQTweAH1Ki6LH+FQQWndp6LilpYXI9prFtvELtrMS7ow1
# xaUBf1FRKuJx3Dmi1QLvLGGK5c6gNu2Fbjb/l2xWeSSLG8dOx8NrmOaV3gLKlT7n
# uwZMGfWJ5HNQNfBdVmGaqu8ymYuxaEW6u9Iz8s8uLew4TJNTfuiQ5MOhS6bQULrG
# a21M13CYOjT3pSCZ647f9YI1roRonu2Q309B0ZJS8i5bG0pLpoUWLjcaF6yKYiXl
# Vifjfb2ffVnCu0XsVPDi4b/O9wJCsRNQ2L8GrCryXWmKOUbtBGw3A9Ybe6phiYkk
# 5pZYp97JPF8bwri8tnSoqjh6NseGhGSmG+qPP1I9RJ7vVPIEu+AaTT5o8byUOQPH
# xwyJYZSc1EdlgsMMwJIZ5lKW5y3RfKGVpeBnedItOC6vmrOP5kwlUZ5ZPe/PEYfR
# cG4xMKdBXq00ehGmnLsdOTnovwiDrvByoMJBXY9e6nA8tVuJlVHA5wHOsh+BvJzI
# NezPKYi5fY7KhkESB+3adQ==
# =lN4U
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Mar 24 15:10:47 2026 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# gpg:                 aka "Peter Maydell <peter@archaic.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20260324' of https://gitlab.com/pm215/qemu:
  qemu-options.hx: Document arm-smmuv3 device's accel properties
  hw/arm/smmuv3-accel: Change "oas" property type to OasMode
  qdev: Add an OasMode property type
  hw/arm/smmuv3-accel: Change "ssidsize" property type to SsidSizeMode
  qdev: Add a SsidSizeMode property type
  hw/arm/smmuv3-accel: Change "ril" property type to OnOffAuto
  hw/arm/smmuv3-accel: Change "ats" property type to OnOffAuto
  hw/arm/smmuv3-accel: Check ATS compatibility between host and guest
  hw/dma/pl080: Fix transfer logic in PL080
  linux-user/i386/signal.c: Correct definition of target_fpstate_32
  target/arm: fix s2prot not set for two-stage PMSA translations

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 15:14:12 +00:00
Peter Maydell
d6037114ed Merge tag 'pull-aspeed-20260324' of https://github.com/legoater/qemu into staging
aspeed queue:

* Rework Aspeed SMC mem ops to improve error handling
* Fix race in Aspeed I2C model
* Disable kernel crypto self-tests in AST2700 boot tests

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmnChl4ACgkQUaNDx8/7
# 7KGAMg//Q/omDX+VVqLX9loRiM5uA3q7PIt58cED/h9zJK2OP7xLgGzGTfU2RQxW
# bqLA69PNueIdxJP4+0Y1VOvTs9cW1YJ73RX7kEH7PgQyQrWNCw7ZG7wlZiemljcN
# PqPwBm0UKfwlZnAKFiY/43/UnOxB06pFHreQSNtNK0D3EXpRQ7D7BjMI/yYN56hG
# 1RKvVV3WFk9NZP1W4ewf/5XevY2KRiY1NLokQmV8NCZntT6EVYpdwSW9P/l8kQrX
# TJf7VRwoToNjJ2yASJ5MvWFr0lucqtV8XHC2bXqFQJiIKe8dhNuo8gVr7bHvSNrd
# EWHdsW3cNnyUVhwtQAOEweag+S5K5r1+CNsxl4nJZK13dN+/ztfct7tnKqnV7Nsz
# LKTJ4dS7h3WzLtbSKk58uQJdRo66jX/1VmtlCGD8iUjRhGIjIlXqGrV2iEWR5oZI
# fsk83fIhBp5BF1IH7mrPicWFIy3oKVedbLK6eThaD3VsXcezitUaG5Se3ryzpBZE
# mJpm0NQD7YKwyon9koLwUbjAcY/FIx1i5VnYkvc0+8E10VONP5sI0UEaFr5zKhAJ
# UwF2T+odh3orRkEqcKQ0gc/TmKYkfqp9ecJrvFlu3o2w5hd+6DUpndfgvFIb/DEl
# i99acUCLcHhJfjVlAKls+5R1alV/4wqf9ERlcjgQKrD8lTXY0mA=
# =LI3x
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Mar 24 12:41:02 2026 GMT
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [full]
# gpg:                 aka "Cédric Le Goater <clg@kaod.org>" [full]
# Primary key fingerprint: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1

* tag 'pull-aspeed-20260324' of https://github.com/legoater/qemu:
  hw/i2c/aspeed_i2c: Remove assert
  hw/ssi/aspeed_smc: Convert mem ops to read/write_with_attrs for error handling
  tests/functional/aarch64/test_aspeed: Disable kernel crypto self-tests in AST2700 boot tests
  MAINTAINERS: Add Kane Chen as reviewer for Aspeed machines
  hw/i2c/aspeed: fix lost interrupts on back-to-back commands

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 15:14:04 +00:00
Nathan Chen
c2ff1305cc hw/arm/smmuv3-accel: Change "oas" property type to OasMode
Change accel SMMUv3 OAS property from uint8_t to OasMode. The
'auto' value is not implemented, as this commit is meant to
set the property to the correct type and avoid breaking JSON/QMP
when the auto mode is introduced. A future patch will implement
resolution of 'auto' value to match the host SMMUv3 OAS value.

The conversion of the "oas" property type to OnOffAuto is an
incompatible change for JSON/QMP when a uint8_t value is expected for
"oas", but this property is new in 11.0 and this patch is
submitted as a fix to the property type.

Fixes: a015ac990f ("hw/arm/smmuv3-accel: Add property to specify OAS bits")
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-8-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:30 +00:00
Nathan Chen
d3d2de3d22 qdev: Add an OasMode property type
Introduce a new enum type property allowing to set an Output Address
Size. Values are auto, 32, 36, 40, 42, 44, 48, 52, and 56, where a
value of N specifies an N-bit OAS.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-7-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Nathan Chen
ffded86bdd hw/arm/smmuv3-accel: Change "ssidsize" property type to SsidSizeMode
Change accel SMMUv3 SSIDSIZE property from uint8_t to SsidSizeMode.
The 'auto' value is not implemented, as this commit is meant to set the
property to the correct type and avoid breaking JSON/QMP when the auto
mode is introduced. A future patch will implement resolution of 'auto'
value to match the host SMMUv3 SSIDSIZE value.

The conversion of the "ssidsize" property type to OnOffAuto is an
incompatible change for JSON/QMP when a uint8_t value is expected for
"ssidsize", but this property is new in 11.0 and this patch is
submitted as a fix to the property type.

Fixes: b8c6f8a69d ("hw/arm/smmuv3-accel: Make SubstreamID support configurable")
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-6-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Nathan Chen
3a3dd64e63 qdev: Add a SsidSizeMode property type
Introduce a new enum type property allowing to set a Substream ID size
for HW-accelerated smmuv3. Values are auto and 0..20. The auto value
allows SSID size property to be derived from host IOMMU capabilities.
A value of 0 disables SubstreamID, while non-zero values specify the
SSID size in bits.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-5-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Nathan Chen
1a76cc3933 hw/arm/smmuv3-accel: Change "ril" property type to OnOffAuto
Change accel SMMUv3 RIL property from bool to OnOffAuto. The 'auto'
value is not implemented, as this commit is meant to set the property
to the correct type and avoid breaking JSON/QMP when the auto mode is
introduced. A future patch will implement resolution of the 'auto'
value to match the host SMMUv3 RIL support.

The conversion of the RIL property type to OnOffAuto is an
incompatible change for JSON/QMP when a bool value is expected for
"ril", but the "ril" property is new in 11.0 and this patch is
submitted as a fix to the property type.

Fixes: bd715ff5bd ("hw/arm/smmuv3-accel: Add a property to specify RIL support")
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-4-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Nathan Chen
9f8a8e0f2c hw/arm/smmuv3-accel: Change "ats" property type to OnOffAuto
Change accel SMMUv3 ATS property from bool to OnOffAuto. The 'auto'
value is not implemented, as this commit is meant to set the property
to the correct type and avoid breaking JSON/QMP when the auto mode is
introduced. A future patch will implement resolution of the 'auto'
value to match the host SMMUv3 ATS support.

The conversion of the ATS property type to OnOffAuto is an
incompatible change for JSON/QMP when a bool value is expected for
"ats", but the "ats" property is new in 11.0 and this patch is
submitted as a fix to the property type.

Fixes: f7f5013a55 ("hw/arm/smmuv3-accel: Add support for ATS")
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-3-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Nathan Chen
dc86d45232 hw/arm/smmuv3-accel: Check ATS compatibility between host and guest
Compare the host SMMUv3 ATS support bit with the guest SMMUv3 ATS support
bit in IDR0 and fail the compatibility check if ATS support is opted as
enabled on the guest SMMUv3 when it is not supported on host SMMUv3.

Fixes: f7f5013a55 ("hw/arm/smmuv3-accel: Add support for ATS")
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-2-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Tao Ding
5a2fa06b09 hw/dma/pl080: Fix transfer logic in PL080
The logic in the PL080 for transferring data has multiple bugs:

 * The TransferSize field in the channel control register counts
   in units of the source width; because our loop may do multiple
   source loads if the destination width is greater than the
   source width, we need to decrement it by (xsize / swidth),
   not by 1, each loop

 * It is documented in the TRM that it is a software error to program
   the source and destination width such that SWidth < DWidth and
   TransferSize * SWidth is not a multiple of DWidth. (This would
   mean that there isn't enough data to do a full final destination
   write.) We weren't doing anything sensible with this case.
   The TRM doesn't document what the hardware actually does (though
   it drops some hints that suggest that it probably over-reads
   from the source).

 * In the loop to write to the destination, each loop adds swidth
   to  ch->dest for each loop and also uses (ch->dest + n) as the
   destination address. This moves the destination address on
   further than we should each time round the loop, and also
   is incrementing ch->dest by swidth when it should be dwidth.

This patch fixes these problems:
 * decrement TransferSize by the correct amount
 * log and ignore the transfer size mismatch case
 * correct the loop logic for the destination writes

A repro case which exercises some of this is as follows.  It
configures swidth to 1 byte, dwidth to 4 bytes, and transfer size 4,
for a transfer from 0x00000000 to 0x000010000.  Examining the
destination memory in the QEMU monitor should show that the
source data 0x44332211 has all been copied, but before this
fix it is not:

    ./qemu-system-arm -M versatilepb -m 128M -nographic -S \
    -device loader,addr=0x00000000,data=0x44332211,data-len=4 \
    -device loader,addr=0x00001000,data=0x00000000,data-len=4 \
    -device loader,addr=0x10130030,data=0x00000001,data-len=4 \
    -device loader,addr=0x10130100,data=0x00000000,data-len=4 \
    -device loader,addr=0x10130104,data=0x00001000,data-len=4 \
    -device loader,addr=0x10130108,data=0x00000000,data-len=4 \
    -device loader,addr=0x1013010C,data=0x9e47f004,data-len=4 \
    -device loader,addr=0x10130110,data=0x0000c001,data-len=4

Without this patch the QEMU monitor shows:
    (qemu) xp /1wx 0x00001000
    00001000: 0x00002211

Correct result:
    (qemu) xp /1wx 0x00001000
    00001000: 0x44332211

Cc: qemu-stable@nongnu.org
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Tao Ding <dingtao0430@163.com>
[PMM: Wrote up what we are fixing in the commit message]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Peter Maydell
fa4b2e31e6 Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
trivial patches for 2026-03-23

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmnBcJwACgkQgqpKJDse
# lHhYoA//TDcPKICl5nSF7NJFOSABahHNDSXOYmPa6jX5+iViuLPHF5RFV3qUYxUQ
# cfE/jbz9eMWxJHXoCLx1/Y7rT77xQh6pFaKih/KIc1bT4vPXa9/qBAODl3SrW1JK
# 66DIzf9emkSIiJ88Xc0mA0zinSMqp0LmQmDrmPEcoW/bsDRf4QISO2DkGPLBXq7i
# MVodcISznSL5UCJSCPuIz675Hjzeb1WCOldU+OcRlZv1h9ixFWotBeuOzy02OgXZ
# F/i4VDSrwzaFpxDvo/RjCHaUWw47UTphElKdG3dikeMdHxwuomyyBSjRgTPPF7UU
# 77vMgvVwRm2/apP+qjGuU2PZ3ow6UAQ5NSaKOeyHr258i1UOtr2E/Ut0XP7vLTXf
# LkK3oqTw1+jTLq85mois8zWKgCZZ2bxV2GT5/QTxdHCC4lgpew+GAJC3G7+Tgu1j
# 4vCF3d9q9NGLwerwOQYY6dpoZFYwA/wxr5fl6eZXr1yvs9mk9wP0Xc4FSJTkU47G
# CULFn071njzjWUubT+Z3x132AuhJtfxN8Avxsw7Jqey82bMFHVoHqG9EQV8mSjSI
# 2CPKbv9z6EaHYcX8HE4ufQDrfP2WEY+I/4e11wWmpflPEg5efbPIDlJuvPlJ9XF0
# WKUjaTdoH6VE9niwHEHtf4uKId1VNfjVZjorqSJJMkse3VvGnVU=
# =TGAU
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 23 16:55:56 2026 GMT
# gpg:                using RSA key 64AA2AB531D56903366BFEF982AA4A243B1E9478
# gpg: Good signature from "Michael Tokarev <mjt@debian.org>" [full]
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>" [full]
# gpg:                 aka "Michael Tokarev <mjt@tls.msk.ru>" [full]
# Primary key fingerprint: 9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
#      Subkey fingerprint: 64AA 2AB5 31D5 6903 366B  FEF9 82AA 4A24 3B1E 9478

* tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu:
  Fix several typos in documentation (found by codespell)
  docs: Update GitHub URL of libu2f-emu
  Fix include statement for u2f-emu.h
  tests: fix typo in char unit test comment

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 10:41:21 +00:00
Cédric Le Goater
5fca367b89 hw/i2c/aspeed_i2c: Remove assert
According to the Aspeed datasheet, the RX_BUF_LEN_W1T and
TX_BUF_LEN_W1T bits of the A_I2CS_DMA_LEN (0x2c) register allow
firmware to program the TX and RX DMA length (TX_BUF_LEN and
RX_BUF_LEN fields of the same register) separately without the need to
read/modify/write the value.  If RX_BUF_LEN_W1T and TX_BUF_LEN_W1T
bits are 0, then both TX and RX DMA length will be written.

When setting the RX_BUF_LEN field, the TX_BUF_LEN field being set is
not an invalid condition. Remove the assert.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3315
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Link: https://lore.kernel.org/qemu-devel/20260323125545.577653-4-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-03-24 11:19:40 +01:00
Cédric Le Goater
80c5be9458 hw/ssi/aspeed_smc: Convert mem ops to read/write_with_attrs for error handling
Error conditions (invalid flash mode, unwritable flash) now return
MEMTX_ERROR instead of silently succeeding or returning undefined
values.

This allows the memory subsystem to properly propagate transaction
errors to the guest, improving QEMU reliability.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3335
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Link: https://lore.kernel.org/qemu-devel/20260323125545.577653-2-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-03-24 11:19:40 +01:00
Jithu Joseph
7e82393ed0 hw/i2c/aspeed: fix lost interrupts on back-to-back commands
QEMU executes I2C commands synchronously inside the CMD register write
handler. On real hardware each command takes time on the bus, so the
ISR can clear the previous interrupt status before the next completion
arrives. In QEMU, when the guest ISR handles a TX_ACK and immediately
issues the next command by writing to CMD, that command completes
instantly — before the ISR returns to W1C-clear the first TX_ACK.
Since the bit is already set, setting it again is a no-op. The ISR
then clears it, wiping both completions at once. No interrupt fires
for the second command and the driver stalls.

This affects any multi-step I2C transaction: register reads, SMBus
word reads, and PMBus device probes all fail ("Error: Read failed"
from i2cget, -ETIMEDOUT from kernel drivers).

The issue is exposed when the guest kernel includes commit "i2c:
aspeed: Acknowledge Tx done with and without ACK irq late" [1] which
defers W1C acknowledgment of TX_ACK until after the ISR has issued
the next command. This means the old TX_ACK is still set when the
next command completes synchronously, and the subsequent W1C wipes
both completions at once.

The trace below shows `i2cget -y 15 0x50 0x00` (read EEPROM register
0x00) failing without the fix. The first START+TX sets TX_ACK. The
ISR handles it and issues a second TX to send the register address.
That TX completes synchronously while TX_ACK is still set:

  aspeed_i2c_bus_cmd cmd=0x3 start|tx| intr=0x0    # START+TX, clean
  aspeed_i2c_bus_raise_interrupt intr=0x1 ack|      # TX_ACK set
  aspeed_i2c_bus_read  0x10: 0x1                    # ISR reads TX_ACK
  aspeed_i2c_bus_write 0x14: 0x2                    # ISR issues TX cmd
  aspeed_i2c_bus_cmd cmd=0x400002 tx| intr=0x1      # TX runs, TX_ACK already set!
  aspeed_i2c_bus_raise_interrupt intr=0x1 ack|      # re-set is no-op
  aspeed_i2c_bus_write 0x10: 0x1                    # ISR W1C clears TX_ACK
  aspeed_i2c_bus_read  0x10: 0x0                    # LOST — both ACKs wiped

The driver sees INTR_STS=0 and never proceeds to the read phase.

Fix this by tracking interrupt bits that collide with already-pending
bits. Before calling aspeed_i2c_bus_handle_cmd(), save and clear
INTR_STS so that only freshly set bits are visible after the call.
Any overlap between the old and new bits is saved in pending_intr_sts.
When the ISR later W1C-clears the old bits, re-apply the saved
pending bits so the ISR sees them on its next loop iteration.

With the fix, the same operation completes successfully:

  aspeed_i2c_bus_cmd cmd=0x3 start|tx| intr=0x0    # START+TX, clean
  aspeed_i2c_bus_raise_interrupt intr=0x1 ack|      # TX_ACK set
  aspeed_i2c_bus_read  0x10: 0x1                    # ISR reads TX_ACK
  aspeed_i2c_bus_write 0x14: 0x2                    # ISR issues TX cmd
  aspeed_i2c_bus_cmd cmd=0x400002 tx| intr=0x0      # INTR_STS cleared first
  aspeed_i2c_bus_raise_interrupt intr=0x1 ack|      # TX_ACK freshly set
  aspeed_i2c_bus_write 0x10: 0x1                    # ISR W1C clears TX_ACK
  aspeed_i2c_bus_read  0x10: 0x1                    # RE-DELIVERED from pending
  aspeed_i2c_bus_write 0x14: 0x1b                   # ISR proceeds: START+RX
  aspeed_i2c_bus_cmd cmd=0x40001b start|tx|rx|last| # read phase completes
  i2c_recv recv(addr:0x50) data:0x00                # data received

[1] https://lore.kernel.org/all/20231211102217.2436294-3-quan@os.amperecomputing.com/

Signed-off-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com>
Fixes: 1602001195 ("i2c: add aspeed i2c controller")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260311023712.2730185-1-jithu.joseph@oss.qualcomm.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-03-24 11:19:40 +01:00
Stefan Weil
b7ae542de4 Fix several typos in documentation (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
[Mjt: add 2 fixes suggested by Peter: "as a" and "deactivate"]
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-03-23 19:55:24 +03:00
Stefan Weil
4ef8aca3d1 Fix include statement for u2f-emu.h
All examples on https://github.com/Agnoctopus/libu2f-emu/ don't
simply include u2f-emu.h without any added directory.

The additional include directory does not exist when libu2f
was built with meson.

It's up to pkgconfig to make sure that u2f-emu.h is found in any case.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-03-23 19:55:16 +03:00