Commit Graph
134914 Commits
Author SHA1 Message Date
Emmanuel Blot e41e23f7a7 docs/system/arm/aspeed: add the sanmiguel-bmc machine
The Facebook SanMiguel BMC machine is supported by hw/arm but has never
been listed in the Aspeed documentation. Add it to the AST2600 machine
table.

Reviewed-by: Jamin Lin <jaminlin1207@gmail.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
Link: https://lore.kernel.org/qemu-devel/20261015-bmc-minerva-v3-2-7d50c8a108e5@free.fr
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Emmanuel Blot 191128528c docs/system/arm/aspeed: add the catalina-bmc machine
The Facebook Catalina BMC machine is supported by hw/arm but has never
been listed in the Aspeed documentation. Add it to the AST2600 machine
table.

While at it, shorten the document title. Listing every machine name in
the title duplicates the tables right below it, and made the title (and
its underline) grow past 350 columns. The machine list stays available
where it is readable, in the per-SoC tables.

Reviewed-by: Jamin Lin <jaminlin1207@gmail.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
Link: https://lore.kernel.org/qemu-devel/20261015-bmc-minerva-v3-1-7d50c8a108e5@free.fr
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 1fe4175dd7 docs/system/arm/aspeed: Add AST1080 Platform Root of Trust evaluation board
Update the Aspeed AST10x0 documentation to include the AST1080
evaluation board.

The documentation now describes:
- AST1080 as a Platform Root of Trust processor
- AST1080 Cortex-M4F CPU frequency running at 400 MHz

Also add the ast1080-evb machine entry to the supported AST10x0 SoC
based machine list.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-10-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 90f3384c72 tests/functional/arm/aspeed: Add AST1080 test with ASPEED MCU FW Hub v01.00
Add a functional test for the ASPEED AST1080 EVB using the
Zephyr firmware from ASPEED MCU FW Hub v01.00.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-9-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin f910474f67 hw/arm/aspeed_ast1040_evb: Add AST1080 EVB machine support
Add a new machine definition ast1080-evb to support the Aspeed AST1080
evaluation board. The new EVB reuses the same BIC framework used by
AST1040, as both SoCs share the same core peripherals and controller
designs.

The AST1080 EVB machine initializes the ast1080-a0 SoC.
This enables QEMU to boot and emulate firmware images for AST1080-based
platforms.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-8-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 213409bc0c hw/arm/aspeed_ast1040: Add AST1080 I2C filter as an unimplemented device
The AST1080 provides an SMBus Filter Controller (I2C filter) at
0x74c14000, but the controller is not modeled yet.

This controller is only available on the AST1080. The AST1040 does not
have it, so it is added to the AST1080 specific init and realize
functions instead of the common AST10x0 G2 ones.

Add the register region as an unimplemented device to reflect the
AST1080 memory map.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-7-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin da8d337ba0 hw/arm/aspeed_ast1040: Add AST1080 QSPI filters as unimplemented device
The AST1080 provides three QSPI Filter Controllers (SPI monitors) at
the following addresses:

  QSPI filter #0: 0x74c15000
  QSPI filter #1: 0x74c16000
  QSPI filter #2: 0x74c17000

These controllers are only available on the AST1080. The AST1040 does
not have them, so they are added to the AST1080 specific init and
realize functions instead of the common AST10x0 G2 ones.

The controllers are not modeled yet. Add the register regions as
unimplemented devices to reflect the AST1080 memory map.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-6-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 329107ed37 hw/arm/aspeed_ast1040: Add AST1080 SoC support
Add initial support for the Aspeed AST1080 SoC. The AST1080 reuses most
of the AST1040 peripheral device models, as the two SoCs share nearly
the same controllers including WDT, SCU, GPIO, SGPIO, ADC, I2C, FMC,
and SPI.

The common initialization and realization functions,
aspeed_soc_ast10x0_g2_init() and aspeed_soc_ast10x0_g2_realize(),
introduced in the previous patches are reused, so AST1080 can
instantiate the existing AST1040 device models without defining
duplicate device types.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-5-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin caa779d1a2 hw/misc/aspeed_scu: Add AST1080 A0 silicon revision definition
Add a new silicon revision constant AST1080_A0_SILICON_REV for the
AST1080 SoC. This allows the SCU model and related SoC layers to
identify and handle AST1080 A0 revision properly in the same way as
other Aspeed SoC families.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-4-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin a3f316322b hw/arm/aspeed_ast1040: Add common realize function for AST1040/AST1080 SoCs
AST1040 and AST1080 are the next-generation SoCs of AST1030 and AST1060,
respectively.

The AST1030 and AST1060 SoCs share common realization through
aspeed_soc_ast10x0_realize(). Similarly, introduce
aspeed_soc_ast10x0_g2_realize() to provide common realization for the
AST1040 and AST1080 SoCs.

Move the shared AST1040 realization into the new common function so that
it can be reused when adding AST1080 support. The PECI and eSPI
controllers are only available on the AST1040, so their realization is
kept in aspeed_soc_ast1040_realize().

No functional changes.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-3-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin e86997e4cb hw/arm/aspeed_ast1040: Add common init function for AST1040/AST1080 SoCs
AST1040 and AST1080 are the next-generation SoCs of AST1030 and AST1060,
respectively.

The AST1030 and AST1060 SoCs share common initialization through
aspeed_soc_ast10x0_init(). Similarly, introduce
aspeed_soc_ast10x0_g2_init() to provide common initialization for the
AST1040 and AST1080 SoCs.

Move the shared AST1040 initialization into the new common function so
that it can be reused when adding AST1080 support. The PECI and eSPI
controllers are only available on the AST1040, so their initialization
is kept in aspeed_soc_ast1040_init().

No functional changes.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261015063625.186708-2-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin e8212ed5be tests/functional/arm/test_aspeed_ast1040: Update AST1040 image to aspeed-mcu-fw-hub v01.00
Previously, ASPEED hosted the AST1040 pre-built image in the Zephyr GitHub repository
as a temporary solution for QEMU functional tests.

ASPEED now provides official AST1040/AST1080 pre-built images in the aspeed-mcu-fw-hub
repository, starting with release v01.00.

Update the AST1040 functional test to use the official pre-built image from
aspeed-mcu-fw-hub instead of the Zephyr repository.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-14-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 490ced3466 tests/qtest/aspeed_smc: Add AST1040 SMC tests
Add SMC qtests for the AST1040 EVB using a 4 MiB W25Q33PW flash
connected to FMC CS0.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-13-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 020cfdc06f hw/arm/aspeed_ast1040: Add Caliptra as an unimplemented device
The AST1040 provides a Caliptra Wrapper at 0x74200000 with
a size of 1MB, but it is not modeled yet.

Add the Caliptra register region as an unimplemented device to reflect the
AST1040 memory map.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-12-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin c03ad62548 hw/arm/aspeed_ast1040: Add I3C as an unimplemented device
The AST1040 provides an I3C at 0x74c20000, but the controller is not
modeled yet.

Add the I3C register region as an unimplemented device to reflect the
AST1040 memory map.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-11-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 61ae25a2e7 hw/arm/aspeed_ast1040: Add Anti-Tamper Controller (ATC) as an unimplemented device
The AST1040 provides an Anti-Tamper Controller (ATC) at 0x74c35000,
but the controller is not modeled yet.

Add the ATC register region as an unimplemented device to reflect the
AST1040 memory map.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-10-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin dd2dcdeacc hw/arm/aspeed_ast1040: Add OTP as an unimplemented device
The AST1040 provides an OTP controller at 0x74c07000, but the controller
is not modeled yet.

Add the OTP register region as an unimplemented device to reflect the
AST1040 memory map.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-9-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin d0c081548b hw/arm/aspeed_ast1040: Add FMC and SPI filters as unimplemented devices
The AST1040 provides filter register regions for the FMC, SPI0 and SPI1
controllers at the following addresses:

FMC filter: 0x74000400
SPI0 filter: 0x74010400
SPI1 filter: 0x74020400

These filters are not modeled yet. Add the register regions as
unimplemented devices to reflect the AST1040 memory map.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-8-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin f78d90187c hw/arm/aspeed_ast1040: Add FMC and SPI controllers
Add the FMC, SPI0 and SPI1 controllers to the AST1040 SoC. Map their
register and flash memory regions, connect their interrupts, and link
the DMA DRAM region to internal Hyper RAM.

The AST1040 supports two SPI controllers, SPI0 and SPI1.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-7-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 76f3f6e67d hw/ssi/aspeed_smc: Add AST1040 FMC and SPI controllers
The AST1040 FMC and SPI controllers are compatible with the AST2700
controllers, but use different flash window. Therefore, the AST2700
controller types cannot be reused directly for AST1040.

Add dedicated AST1040 FMC, SPI0 and SPI1 controller types with the
appropriate parameter settings.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-6-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:19 +01:00
Jamin Lin 4530b40b5b hw/misc/aspeed_scu: Correct AST1040 A0 revision ID
Correct the AST1040 A0 silicon revision ID from 0x81000000 to 0x80000000.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-5-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:18 +01:00
Jamin Lin cc425fcfce hw/block/m25p80: Add Winbond W25Q33PW flash
The W25Q32DW and W25Q33PW use the same JEDEC ID (0xef6016), but
have different part names.

Add the SFDP data table for the Winbond W25Q33PW flash device. The table
was generated from a real device under Linux by dumping the SFDP content
using the following command:

Example:

```
hexdump -v -e '8/1 "0x%02x, " "\n"' \
    /sys/bus/spi/devices/spi1.0/spi-nor/sfdp
```

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-4-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:18 +01:00
Jamin Lin 92fd703df1 hw/ssi/aspeed_smc: Fix AST2700 DMA flash address mask
The DMA flash address register (SPI084) holds the offset of the
flash access within the controller's flash window. The AST2700 FMC,
SPI0 and SPI1 controllers use a dma_flash_mask of 0x2FFFFFFC, which
clears bit 28, and SPI2 uses 0x0FFFFFFC, which limits DMA to the
first 256MB of the window.

With the default segment layout, FMC CS2 is mapped at offset
0x10000000. A DMA read from that offset is masked to 0x0 and returns
data from CS0 instead of CS2.

The Linux driver programs SPI084 with the window offset masked by
0x7fffffff, so bit 28 is a valid address bit.

Set dma_flash_mask to 0x3FFFFFFC for all AST2700 controllers to cover
the full 1GB flash window.

Fixes: bdb3748dba ("aspeed/smc: Add AST2700 support")
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-3-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:18 +01:00
Jamin Lin 188f092144 hw/ssi/aspeed_smc: Fix AST2700 segment end address decoding
The AST2700 Address Decoding Range Registers (SPI030 - SPI03C) define
the end address as an exclusive upper bound, with a unit of 64KB:

  StartAdr <= CEx < EndAdr

When the start address equals the end address, the decoding is
disabled.

However, aspeed_2700_smc_segment_to_reg() and
aspeed_2700_smc_reg_to_segment() treat the end address as inclusive.

The end offset is programmed as (addr + size - 1) and an extra 64KB is
added back when decoding it. As a result, every segment is 64KB larger
than the range defined by the register and overlaps the next chip
select.

The issue can be reproduced by booting an AST2700 ASPEED SDK image
with "-d guest_errors", which reports a lot of segment overlap errors
such as:

  aspeed_smc_flash_set_segment: new segment for CS0 is not aligned :
    [ 0x100000000 - 0x108010000 ]
  aspeed_smc_flash_overlap: new segment CS1 [ 0x108000000 - 0x110010000 ]
    overlaps with CS0 [ 0x100000000 - 0x108010000 ]

Fix the segment helpers to use an exclusive end address, so that the
decoded segments match the definition in the AST2700 datasheet.

Fixes: bdb3748dba ("aspeed/smc: Add AST2700 support")
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20261028023154.48395-2-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-10-31 06:52:18 +01:00
Richard Henderson 4075aa42da Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging
Pull request

virtio-blk serial truncation deprecation by Kevin Wolf and a qed block driver
fix for CVE-2026-118594.

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmrk8S8ACgkQnKSrs4Gr
# c8iOVgf/T1KrkxCdQlFn8ELWcBS742OdgBHrRjL+kVufTZ5fdF+CVHXvliYFLVLh
# L8pziGQqJpztnDLe7JKArISW5CNbAFpYOujt8WdL13l300kxFKOpoBj2NFjT0WGa
# QxRsHT7jZyCDyWdrhNfUVFeHGDsFfzo6NSYIP8LDgS3XyYREWSiLCbpeRZD9E7l2
# 7f2HngvNPbSI55h4Nq++adkzjFCaFjeVt3AEO5Zo80erLZz7GVPIyfSg2TjcdYWB
# kZGpouhsKNSHeP/aYoccEaKB3QTJ0Op4rEYY5G+k0uszotXrNtpTFB3mqJUy/D6D
# Zf73t1Zv6zZoiBK+r0VN7j6djixmqQ==
# =pkm0
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 30 Oct 2026 02:34:07 PM CDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [unknown]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.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: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  virtio-blk-test: Test truncated serial
  virtio-blk: Deprecate silent truncation of serial
  virtio-blk-test: Add a basic GET_ID test case
  virtio-blk: Implement full NUL padding for GET_ID
  qed: fix incorrect denominator in qed_bytes_to_clusters() (CVE-2026-118594)

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 15:26:36 -05:00
Kevin Wolf 0a7dca50fd virtio-blk-test: Test truncated serial
Only 20 bytes are written to the passed buffer and the returned string
doesn't have a NUL terminator.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20261029231001.194240-5-kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-10-30 15:31:33 -04:00
Kevin Wolf 6ea787b258 virtio-blk: Deprecate silent truncation of serial
Commit a8686a9b, which made serial a qdev property instead of relying on
-drive options, accidentally allowed specifying serial strings of
arbitraty length while the virtio-blk protocol can only communicate 20
characters to the guest. This means that a longer serial number on the
command line is silently truncated to 20 characters from the guest
perspective.

This is obviously bad behaviour. People are specifying longer serials in
practice and guests will see something different than what was
configured. Instead of silent truncation, this should be an error.

Deprecate the silent truncation for now as a first step towards making
it an error later.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20261029231001.194240-4-kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-10-30 15:31:33 -04:00
Kevin Wolf b5fabdc072 virtio-blk-test: Add a basic GET_ID test case
This covers the simple common case with no surprises: A serial that is
shorter than 20 characters and can fit in the request buffer.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20261029231001.194240-3-kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-10-30 15:31:33 -04:00
Kevin Wolf 024fc1966d virtio-blk: Implement full NUL padding for GET_ID
The spec requires not only NUL termination of the device ID string, but
NUL padding:

    VIRTIO_BLK_T_GET_ID requests fetch the device ID string from the
    device into data. The device ID string is a NUL-padded ASCII string
    up to 20 bytes long. If the string is 20 bytes long then there is no
    NUL terminator.

Zero out all of the remaining bytes in the request buffer.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20261029231001.194240-2-kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-10-30 15:31:33 -04:00
Stefan Hajnoczi 2a2fc7ea6c qed: fix incorrect denominator in qed_bytes_to_clusters() (CVE-2026-118594)
cluster_size - 1 is often used in bitwise mask operations in qed.h, so
this bug is probably a copy-paste error. qed_bytes_to_clusters() uses a
division and the denominator should be the full cluster_size value.

This bug can be used to leak heap memory to the guest with a QED file
where cluster_size <= 32 KB (the default is 64 KB) and table_size = 8 or
16 (the default is 4).

Fixes: CVE-2026-118594
Fixes: 298800cae7 ("qed: Table, L2 cache, and cluster functions")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4737
Reported-by: oxsignal <awo@kakao.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-10-30 15:26:12 -04:00
Richard Henderson 7f36b1fbeb Merge tag 'pull-tcg-20261030' of https://gitlab.com/rth7680/qemu into staging
accel/tcg: Fix false awakening of gdb
accel/tcg: Do not flush and retry in place in tb_gen_code
tcg: Adjust NONNULL annotation on *_diff functions
tcg: Add tcg_gen_lea_{i32,i64,tl}
target/alpha: Use tcg_gen_lea_i64 for S{4,8}ADD{L,Q}
target/loongarch: Use tcg_gen_lea_tl for ALSL
target/riscv: Use tcg_gen_lea_tl for SH*ADD
target/s390x: Use tcg_gen_lea_i64 in get_address
target/i386: Use tcg_gen_lea_tl in gen_lea_modrm_1
target/mips: Use tcg_gen_lea() for [D]LSA and MXU S32LD*V opcodes

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmrkmGIdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/5Xgf9HJVBSOjBsW69SkQD
# 353u0YoAsfNCly6zSEqevaGqKZxRVwqyI1C6NzlP8e7FraxKphJGdizH6W3LeNia
# M6laDKkcnoPNkHDfHajZAkK8l7Uu7jW7CMf6jN21ZHSjUXf6RV9Oqbx1ZL5HtyF8
# CoGfuQPtruHu8ajPQKyWiCLf+8noDRVLug70lIjF65y7SET/YrbbcySFKZvUzdaV
# hwofOFe785bhKyvWeOGJldo/zP5UsqEn4qYIoeHWyBUIttP9p2E25Dzym4mC0lG/
# n5p5a4x54m4kCi3ORa3kb/zhrAEv7RO3j1lSmnDQdw3mE3nHIPiIqnf163Jg2akg
# AyEBiQ==
# =szoO
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 30 Oct 2026 08:15:14 AM CDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]

* tag 'pull-tcg-20261030' of https://gitlab.com/rth7680/qemu:
  tcg/s390x: Implement INDEX_op_lea
  tcg/riscv64: Implement INDEX_op_lea
  tcg/aarch64: Implement INDEX_op_lea
  tcg/loongarch64: Implement INDEX_op_lea
  tcg/loongarch64: Import SLADD insns
  tcg/x86_64: Implement INDEX_op_lea
  tcg/x86_64: Introduce TCG_REG_NONE
  target/i386: Use tcg_gen_lea_tl in gen_lea_modrm_1
  target/s390x: Use tcg_gen_lea_i64 in get_address
  target/riscv: Use tcg_gen_lea_tl for SH*ADD
  target/mips: Use tcg_gen_lea() for [D]LSA and MXU S32LD*V opcodes
  target/loongarch: Use tcg_gen_lea_tl for ALSL
  target/alpha: Use tcg_gen_lea_i64 for S{4,8}ADD{L,Q}
  tcg/optimize: Handle INDEX_op_lea
  tcg: Add tcg_gen_lea_{i32,i64,tl}
  tcg: Add INDEX_op_lea
  accel/tcg: Do not flush and retry in place in tb_gen_code
  accel/tcg: Fix false awakening of gdb
  tcg: Adjust NONNULL annotation on *_diff functions

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 08:16:19 -05:00
Richard Henderson 0e68878f96 tcg/s390x: Implement INDEX_op_lea
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 16aef4431f tcg/riscv64: Implement INDEX_op_lea
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 8ca8296cb1 tcg/aarch64: Implement INDEX_op_lea
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 25fd2d5a64 tcg/loongarch64: Implement INDEX_op_lea
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 86acf8f95f tcg/loongarch64: Import SLADD insns
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 4187b64f5a tcg/x86_64: Implement INDEX_op_lea
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 44fd71bb7e tcg/x86_64: Introduce TCG_REG_NONE
Rather than hard-code -1, or compare < 0, use something
more descriptive.  This also allows more use of TCGReg.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 625ceed816 target/i386: Use tcg_gen_lea_tl in gen_lea_modrm_1
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 8043f027f9 target/s390x: Use tcg_gen_lea_i64 in get_address
While there's no actual shift, use the compound function
to add two registers and an immediate in one step.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 233a08fde8 target/riscv: Use tcg_gen_lea_tl for SH*ADD
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Philippe Mathieu-Daudé 644e5cf7d0 target/mips: Use tcg_gen_lea() for [D]LSA and MXU S32LD*V opcodes
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260831062630.58771-1-philmd@oss.qualcomm.com>
2026-10-30 07:06:16 -05:00
Richard Henderson d032ec068e target/loongarch: Use tcg_gen_lea_tl for ALSL
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 9084c50cdb target/alpha: Use tcg_gen_lea_i64 for S{4,8}ADD{L,Q}
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 988e4a3a16 tcg/optimize: Handle INDEX_op_lea
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson 82e6d899d9 tcg: Add tcg_gen_lea_{i32,i64,tl}
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:16 -05:00
Richard Henderson a075f67f45 tcg: Add INDEX_op_lea
Add an opcode for compound address formation.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:15 -05:00
Stian Halseth 3992091713 accel/tcg: Do not flush and retry in place in tb_gen_code
When the code buffer is full in a serial context, tb_gen_code() flushes
it and retries in place. cpu_exec_loop() then chains its last_tb, now
freed, into the new TB. When that TB is invalidated, tb_jmp_unlink()
follows the stale entry and qemu crashes inside its SIGSEGV handler.

Always queue the flush and leave through cpu_loop_exit(), as before
commit ebf7a5d294. This also brings back the cleanup in
cpu_loop_exit() and cpu_exec_longjmp_cleanup() that the retry skipped.

Since commit 25e5c6a320 ("accel/tcg: Allow cross-page goto_tb
chaining in user-only builds"), user-only builds hit this easily,
e.g. qemu-sparc64 -tb-size 1 on a program writing next to its PLT.

Cc: qemu-stable@nongnu.org
Fixes: ebf7a5d294 ("accel/tcg: Improve buffer overflow in tb_gen_code")
Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Stian Halseth <stian@itx.no>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-10-30 07:06:15 -05:00
Aleksandr Sergeev 33e7c328e0 accel/tcg: Fix false awakening of gdb
In qemu there is a mechanism to cancel execution of tb.
If `cpu->neg.icount_decr` is <0, translation block
will exit in prolog.
E.g. such may happen when RCU thread kicks out vCPU.

If tb is not executed, we shall not raise EXCP_DEBUG,
because no step actually happened.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4766
Signed-off-by: Aleksandr Sergeev <sergeev0xef@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261028072308.839836-1-al.sergeev@syntacore.com>
2026-10-30 07:06:15 -05:00
Richard Henderson 00bf6778e2 tcg: Adjust NONNULL annotation on *_diff functions
In tcg/sparc64 we use tcg_tbrel_diff with NULL as a negative
addend in a relocation.

Fixes: b0b6701a40 ("tcg: Annotate functions in tcg.h with QEMU_*_NONNULL")
Reported-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Tested-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-10-30 07:06:15 -05:00