Skip to contentSkip to conversation

aspeed queue

GIT PULL Applied Cédric Le Goater 2 participants 11 messages May 12 – May 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The following changes since commit 5e61afe211e82a9af15a8794a0bd29bb574e953b:

Merge tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2026-05-11 10:49:53 -0400)

are available in the Git repository at:

https://github.com/legoater/qemu/ tags/pull-aspeed-20260512

for you to fetch changes up to 04d249d1efbbecc74eb82d26558c78d5a3b43630:

hw/i3c/dw-i3c: Fix BCR/DCR extraction and PID assembly during ENTDAA (2026-05-12 09:36:23 +0200)

----------------------------------------------------------------
aspeed queue:

* Security fixes for HACE hash engine and SBC OTP controller
* Bug fix of the I3C controller
* Removal of BMC machines (fby35, fp5280g2-bmc, qcom-*, sonorapass-bmc) deprecated in QEMU 10.2

----------------------------------------------------------------
Ashish Anand (1):
hw/i3c/dw-i3c: Fix BCR/DCR extraction and PID assembly during ENTDAA

Cédric Le Goater (6):
aspeed/hace: Fix out-of-bounds read in has_padding() aspeed/hace: Prevent total_req_len overflow
hw/arm: Remove sonorapass-bmc machine
hw/arm: Remove qcom-dc-scm-v1-bmc and qcom-firework-bmc machines hw/arm: Remove fp5280g2-bmc machine
hw/arm: Remove fby35 machine

Kane Chen (2):
hw/misc/aspeed_sbc: Add bounds checking for OTP write operations aspeed/hace: Fix mapped address may not be unmapped issue

 MAINTAINERS                            |   2 -
 docs/about/deprecated.rst              |  37 ------
 docs/about/removed-features.rst        |  38 +++++-
 docs/system/arm/aspeed.rst             |   8 +-
 docs/system/arm/fby35.rst              |  52 ---------
 docs/system/target-arm.rst             |   1 -
 include/hw/i3c/i3c.h                   |   7 ++
 hw/arm/aspeed_ast2500_fp5280g2.c       |  88 --------------
 hw/arm/aspeed_ast2500_sonorapass.c     | 102 -----------------
 hw/arm/aspeed_ast2600_qcom-dc-scm-v1.c |  55 ---------
 hw/arm/aspeed_ast2600_qcom-firework.c  |  91 ---------------
 hw/arm/fby35.c                         | 203 ---------------------------------
 hw/i3c/dw-i3c.c                        |  16 ++-
 hw/misc/aspeed_hace.c                  |  90 ++++++++++++---
 hw/misc/aspeed_sbc.c                   |  12 +-
 hw/nvram/aspeed_otp.c                  |  13 +--
 hw/arm/meson.build                     |   7 +-
 17 files changed, 141 insertions(+), 681 deletions(-)
 delete mode 100644 docs/system/arm/fby35.rst
 delete mode 100644 hw/arm/aspeed_ast2500_fp5280g2.c
 delete mode 100644 hw/arm/aspeed_ast2500_sonorapass.c
 delete mode 100644 hw/arm/aspeed_ast2600_qcom-dc-scm-v1.c
 delete mode 100644 hw/arm/aspeed_ast2600_qcom-firework.c
 delete mode 100644 hw/arm/fby35.c
#1 lore raw

[PULL 1/9] hw/misc/aspeed_sbc: Add bounds checking for OTP write operations

From: Kane Chen <[email protected]>

There is a mismatch between the Aspeed OTP model and the Aspeed SBC model in how the guest-provided address is handled. aspeed_sbc_otp_prog() passes a word-indexed address directly to address_space_write() without converting it to a byte offset, whereas aspeed_otp_write() expects a byte offset and applies an additional shift (otp_addr << 2). This double-shift confusion means that an out-of-range word address can lead to a write beyond the allocated storage.

Fix this by adding bounds checking on the word offset before converting to byte offset and passing to address_space_write(). This matches the existing bounds check in aspeed_sbc_otp_read().

Cc Kane-Chen-AS <[email protected]>
Fixes 1a00754ccf15 ("hw/misc: Add Aspeed Secure Boot Controller model")

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3436

---
 hw/misc/aspeed_sbc.c  | 12 ++++++++++--
 hw/nvram/aspeed_otp.c | 13 ++++++-------
 2 files changed, 16 insertions(+), 9 deletions(-)
hw/misc/aspeed_sbc.c +10 -2
index 065e822e70d9..e5dab1c7bb7c 100644
@@ -159,9 +159,17 @@ static bool aspeed_sbc_otp_prog(AspeedSBCState *s,
     MemTxResult ret;
     AspeedOTPState *otp = &s->otp;
     uint32_t value = s->regs[R_CAMP1];
+    uint32_t otp_offset = otp_addr << 2;
 
-    ret = address_space_write(&otp->as, otp_addr, MEMTXATTRS_UNSPECIFIED,
-                        &value, sizeof(value));
+    if (otp_addr >= OTP_TOTAL_DWORD_COUNT) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "Invalid OTP addr 0x%x\n",
+                      otp_addr);
+        return false;
+    }
+
+    ret = address_space_write(&otp->as, otp_offset, MEMTXATTRS_UNSPECIFIED,
+                              &value, sizeof(value));
     if (ret != MEMTX_OK) {
         qemu_log_mask(LOG_GUEST_ERROR,
                       "Failed to write OTP memory, addr = %x\n",
hw/nvram/aspeed_otp.c +6 -7
index a60289000c37..1a9d3841b8d6 100644
@@ -57,12 +57,12 @@ static bool valid_program_data(uint32_t otp_addr,
     return has_programmable_bits != 0;
 }
 
-static bool program_otpmem_data(void *opaque, uint32_t otp_addr,
+static bool program_otpmem_data(void *opaque, hwaddr otp_offset,
                              uint32_t prog_bit, uint32_t *value)
 {
     AspeedOTPState *s = opaque;
+    uint32_t otp_addr = otp_offset >> 2;
     bool is_odd = otp_addr & 1;
-    uint32_t otp_offset = otp_addr << 2;
 
     memcpy(value, s->storage + otp_offset, sizeof(uint32_t));
 
@@ -79,26 +79,25 @@ static bool program_otpmem_data(void *opaque, uint32_t otp_addr,
     return true;
 }
 
-static void aspeed_otp_write(void *opaque, hwaddr otp_addr,
+static void aspeed_otp_write(void *opaque, hwaddr otp_offset,
                                 uint64_t val, unsigned size)
 {
     AspeedOTPState *s = opaque;
-    uint32_t otp_offset, value;
+    uint32_t value;
 
-    if (!program_otpmem_data(s, otp_addr, val, &value)) {
+    if (!program_otpmem_data(s, otp_offset, val, &value)) {
         qemu_log_mask(LOG_GUEST_ERROR,
                       "%s: Failed to program data, value = %x, bit = %"PRIx64"\n",
                       __func__, value, val);
         return;
     }
 
-    otp_offset = otp_addr << 2;
     memcpy(s->storage + otp_offset, &value, size);
 
     if (s->blk) {
         if (blk_pwrite(s->blk, otp_offset, size, &value, 0) < 0) {
             qemu_log_mask(LOG_GUEST_ERROR,
-                          "%s: Failed to write %x to %x\n",
+                          "%s: Failed to write %x to %"HWADDR_PRIx"\n",
                           __func__, value, otp_offset);
 
             return;
Signature · 1 line
2.54.0
#2 lore raw

[PULL 5/9] hw/arm: Remove sonorapass-bmc machine

In reply to Cédric Le Goater

The sonorapass-bmc machine was deprecated in QEMU 10.2 and is now removed in QEMU 11.1.

This OCP SonoraPass BMC lab server never entered production and can be replaced by the ast2500-evb machine with appropriate fmc-model and I2C device configuration via command line.

---
 docs/about/deprecated.rst          |   9 ---
 docs/about/removed-features.rst    |  10 ++-
 docs/system/arm/aspeed.rst         |   5 +-
 hw/arm/aspeed_ast2500_sonorapass.c | 102 -----------------------------
 hw/arm/meson.build                 |   1 -
 5 files changed, 11 insertions(+), 116 deletions(-)
 delete mode 100644 hw/arm/aspeed_ast2500_sonorapass.c
docs/about/deprecated.rst +0 -9
index 5551bd12ad83..cc75afe55d95 100644
@@ -250,15 +250,6 @@ deprecated; use the new name ``dtb-randomness`` instead. The new name
 better reflects the way this property affects all random data within
 the device tree blob, not just the ``kaslr-seed`` node.
 
-Arm ``sonorapass-bmc`` machine (since 10.2)
-'''''''''''''''''''''''''''''''''''''''''''
-
-The ``sonorapass-bmc`` machine represents a lab server that never
-entered production. Since it does not rely on any specific device
-models, it can be replaced by the ``ast2500-evb`` machine using the
-``fmc-model`` option to specify the flash type. The I2C devices
-connected to the board can be defined via the QEMU command line.
-
 Arm ``qcom-dc-scm-v1-bmc`` and ``qcom-firework-bmc`` machine (since 10.2)
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
docs/about/removed-features.rst +9 -1
index 626162022a8c..02e3c06b2988 100644
@@ -1112,7 +1112,7 @@ This machine was removed because it was unused. Alternative AST2500 based
 OpenPOWER machines are ``witherspoon-bmc`` and ``romulus-bmc``.
 
 ppc ``taihu`` machine (removed in 7.2)
-'''''''''''''''''''''''''''''''''''''''''''''
+''''''''''''''''''''''''''''''''''''''
 
 This machine was removed because it was partially emulated and 405
 machines are very similar. Use the ``ref405ep`` machine instead.
@@ -1186,6 +1186,14 @@ Arm ``highbank`` and ``midway`` machines (removed in 11.0)
 There were no known users left for these machines. If you just want to
 boot a Cortex-A15 or Cortex-A9 Linux, use the ``virt`` machine instead.
 
+Arm ``sonorapass-bmc`` machine (removed in 11.1)
+''''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``sonorapass-bmc`` machine represents a lab server that never
+entered production. It can be replaced by the ``ast2500-evb`` machine
+using the ``fmc-model`` option to specify the flash type. The I2C
+devices connected to the board can be defined via the QEMU command
+line.
 
 linux-user mode CPUs
 --------------------
docs/system/arm/aspeed.rst +2 -3
index d0054a7dbb88..1871f31713d4 100644
@@ -1,5 +1,5 @@
-Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``gb200nvl-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``sonorapass-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
-===================================================================================================================================================================================================================================================================================================================================================================================================================
+Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``gb200nvl-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
+===============================================================================================================================================================================================================================================================================================================================================================================================
 
 The QEMU Aspeed machines model BMCs of various OpenPOWER systems and
 Aspeed evaluation boards. They are based on different releases of the
@@ -22,7 +22,6 @@ AST2500 SoC based machines :
 - ``ast2500-evb``          Aspeed AST2500 Evaluation board
 - ``romulus-bmc``          OpenPOWER Romulus POWER9 BMC
 - ``witherspoon-bmc``      OpenPOWER Witherspoon POWER9 BMC
-- ``sonorapass-bmc``       OCP SonoraPass BMC
 - ``fp5280g2-bmc``         Inspur FP5280G2 BMC
 - ``g220a-bmc``            Bytedance G220A BMC
 - ``yosemitev2-bmc``       Facebook YosemiteV2 BMC
hw/arm/aspeed_ast2500_sonorapass.c deleted +0 -102

102 lines not on this page · raw message

hw/arm/meson.build +0 -1
index 84b8ec5fb5ab..098015357ddc 100644
@@ -50,7 +50,6 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
   'aspeed_ast2500_romulus.c',
-  'aspeed_ast2500_sonorapass.c',
   'aspeed_ast2500_supermicro-x11spi.c',
   'aspeed_ast2500_tiogapass.c',
   'aspeed_ast2500_witherspoon.c',
Signature · 1 line
2.54.0
#3 lore raw

[PULL 3/9] aspeed/hace: Prevent total_req_len overflow

In reply to Cédric Le Goater

In accumulate mode, total_req_len is incremented with plen (hwaddr) for each hash request. Repeated additions can overflow total_req_len (uint32_t) and potentially bypass validation checks in has_padding().

Add a helper function to detect overflow before incrementing total_req_len and reject the request if overflow would occur.

---
 hw/misc/aspeed_hace.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
hw/misc/aspeed_hace.c +19 -2
index ef698b3ecb72..0504d61cbf0a 100644
@@ -205,6 +205,19 @@ static uint64_t hash_get_source_addr(AspeedHACEState *s)
     return src_addr;
 }
 
+static bool hash_accumulate_len(AspeedHACEState *s, hwaddr plen)
+{
+    if (plen > UINT32_MAX - s->total_req_len) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: total_req_len overflow, current=0x%x, adding=0x%"
+                      HWADDR_PRIx "\n", __func__, s->total_req_len, plen);
+        return false;
+    }
+
+    s->total_req_len += plen;
+    return true;
+}
+
 static int hash_prepare_direct_iov(AspeedHACEState *s, struct iovec *iov,
                                    bool acc_mode, bool *acc_final_request)
 {
@@ -232,7 +245,9 @@ static int hash_prepare_direct_iov(AspeedHACEState *s, struct iovec *iov,
     iov_idx = 1;
 
     if (acc_mode) {
-        s->total_req_len += plen;
+        if (!hash_accumulate_len(s, plen)) {
+            return -1;
+        }
 
         if (has_padding(s, &iov[0], plen, &total_msg_len,
                         &pad_offset)) {
@@ -299,7 +314,9 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct iovec *iov,
 
         iov[iov_idx].iov_base = haddr;
         if (acc_mode) {
-            s->total_req_len += plen;
+            if (!hash_accumulate_len(s, plen)) {
+                return -1;
+            }
 
             if (has_padding(s, &iov[iov_idx], plen, &total_msg_len,
                             &pad_offset)) {
Signature · 1 line
2.54.0
#4 lore raw

[PULL 2/9] aspeed/hace: Fix out-of-bounds read in has_padding()

In reply to Cédric Le Goater

The has_padding() function reads the last 8 bytes of a DMA buffer without validating req_len. req_len is guest-controlled (via R_HASH_SRC_LEN register or scatter-gather entries) and values less than 8 cause integer underflow. This can result in an out-of-bounds read of QEMU process memory.

Add a check to ensure req_len >= 8 before accessing the buffer.

---
 hw/misc/aspeed_hace.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/misc/aspeed_hace.c +8 -0
index 23e8030cd966..ef698b3ecb72 100644
@@ -154,6 +154,14 @@ static bool has_padding(AspeedHACEState *s, struct iovec *iov,
                         hwaddr req_len, uint32_t *total_msg_len,
                         uint32_t *pad_offset)
 {
+    /* Need at least 8 bytes to read the total message length field */
+    if (req_len < 8) {
+        qemu_log_mask(LOG_GUEST_ERROR,
+                      "%s: invalid request length=0x%" HWADDR_PRIx "\n",
+                      __func__, req_len);
+        return false;
+    }
+
     *total_msg_len = (uint32_t)(ldq_be_p(iov->iov_base + req_len - 8) / 8);
     /*
      * SG_LIST_LEN_LAST asserted in the request length doesn't mean it is the
Signature · 1 line
2.54.0
#5 lore raw

[PULL 7/9] hw/arm: Remove fp5280g2-bmc machine

In reply to Cédric Le Goater

The fp5280g2-bmc machine was deprecated in QEMU 10.2 and is now removed in QEMU 11.1.

This Inspur FP5280G2 BMC board does not rely on specific device models and can be replaced by the ast2500-evb machine with appropriate fmc-model and I2C device configuration via command line.

---
 docs/about/deprecated.rst        |  8 ---
 docs/about/removed-features.rst  |  8 +++
 docs/system/arm/aspeed.rst       |  5 +-
 hw/arm/aspeed_ast2500_fp5280g2.c | 88 --------------------------------
 hw/arm/meson.build               |  1 -
 5 files changed, 10 insertions(+), 100 deletions(-)
 delete mode 100644 hw/arm/aspeed_ast2500_fp5280g2.c
docs/about/deprecated.rst +0 -8
index bbb4a9886fbc..e416f3d8a74b 100644
@@ -250,14 +250,6 @@ deprecated; use the new name ``dtb-randomness`` instead. The new name
 better reflects the way this property affects all random data within
 the device tree blob, not just the ``kaslr-seed`` node.
 
-Arm ``fp5280g2-bmc`` machine (since 10.2)
-'''''''''''''''''''''''''''''''''''''''''
-
-The ``fp5280g2-bmc`` machine does not rely on any specific device
-models, it can be replaced by the ``ast2500-evb`` machine using the
-``fmc-model`` option to specify the flash type. The I2C devices
-connected to the board can be defined via the QEMU command line.
-
 Arm ``fby35`` machine (since 10.2)
 ''''''''''''''''''''''''''''''''''
 
docs/about/removed-features.rst +8 -0
index b9e9d43dada3..2da8283d0e1e 100644
@@ -1205,6 +1205,14 @@ machine using the ``fmc-model`` option to specify the flash type. The
 I2C devices connected to the board can be defined via the QEMU command
 line.
 
+Arm ``fp5280g2-bmc`` machine (removed in 11.1)
+''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``fp5280g2-bmc`` machine does not rely on any specific device
+models, it can be replaced by the ``ast2500-evb`` machine using the
+``fmc-model`` option to specify the flash type. The I2C devices
+connected to the board can be defined via the QEMU command line.
+
 linux-user mode CPUs
 --------------------
 
docs/system/arm/aspeed.rst +2 -3
index cbaab5edd65c..df2f539b0257 100644
@@ -1,5 +1,5 @@
-Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``gb200nvl-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
-================================================================================================================================================================================================================================================================================================================================================
+Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``gb200nvl-bmc``, ``fby35-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
+==============================================================================================================================================================================================================================================================================================================================
 
 The QEMU Aspeed machines model BMCs of various OpenPOWER systems and
 Aspeed evaluation boards. They are based on different releases of the
@@ -22,7 +22,6 @@ AST2500 SoC based machines :
 - ``ast2500-evb``          Aspeed AST2500 Evaluation board
 - ``romulus-bmc``          OpenPOWER Romulus POWER9 BMC
 - ``witherspoon-bmc``      OpenPOWER Witherspoon POWER9 BMC
-- ``fp5280g2-bmc``         Inspur FP5280G2 BMC
 - ``g220a-bmc``            Bytedance G220A BMC
 - ``yosemitev2-bmc``       Facebook YosemiteV2 BMC
 - ``tiogapass-bmc``        Facebook Tiogapass BMC
hw/arm/aspeed_ast2500_fp5280g2.c deleted +0 -88

88 lines not on this page · raw message

hw/arm/meson.build +0 -1
index 2be74b575efc..063abf2cf654 100644
@@ -47,7 +47,6 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2400_quanta-q71l.c',
   'aspeed_ast2400_supermicrox11.c',
   'aspeed_ast2500_evb.c',
-  'aspeed_ast2500_fp5280g2.c',
   'aspeed_ast2500_g220a.c',
   'aspeed_ast2500_romulus.c',
   'aspeed_ast2500_supermicro-x11spi.c',
Signature · 1 line
2.54.0
#6 lore raw

[PULL 4/9] aspeed/hace: Fix mapped address may not be unmapped issue

In reply to Cédric Le Goater

From: Kane Chen <[email protected]>

In the do_hash_operation, the code may be returned earlier because hash_prepare_sg_iov or hash_prepare_direct_iov may return a failure. When this condition is happened, current code flow doesn't go through later code segments. Finally, it causes the mapped address isn't unmapped properly.

This change unmaps any mapped addresses when an error occurs, preventing a resource leak.

---
 hw/misc/aspeed_hace.c | 63 ++++++++++++++++++++++++++++++-------------
 1 file changed, 45 insertions(+), 18 deletions(-)
hw/misc/aspeed_hace.c +45 -18
index 0504d61cbf0a..a322905cb37b 100644
@@ -218,8 +218,19 @@ static bool hash_accumulate_len(AspeedHACEState *s, hwaddr plen)
     return true;
 }
 
+static void hash_iov_unmap(AspeedHACEState *s, struct iovec *iov,
+                           hwaddr *mapped_lens, int iov_count)
+{
+    for (; iov_count > 0; iov_count--) {
+        address_space_unmap(&s->dram_as, iov[iov_count - 1].iov_base,
+                            mapped_lens[iov_count - 1], false,
+                            mapped_lens[iov_count - 1]);
+    }
+}
+
 static int hash_prepare_direct_iov(AspeedHACEState *s, struct iovec *iov,
-                                   bool acc_mode, bool *acc_final_request)
+                                   bool acc_mode, bool *acc_final_request,
+                                   hwaddr *mapped_lens)
 {
     uint32_t total_msg_len;
     uint32_t pad_offset;
@@ -243,9 +254,11 @@ static int hash_prepare_direct_iov(AspeedHACEState *s, struct iovec *iov,
 
     iov[0].iov_base = haddr;
     iov_idx = 1;
+    mapped_lens[0] = plen;
 
     if (acc_mode) {
         if (!hash_accumulate_len(s, plen)) {
+            hash_iov_unmap(s, iov, mapped_lens, 1);
             return -1;
         }
 
@@ -265,7 +278,8 @@ static int hash_prepare_direct_iov(AspeedHACEState *s, struct iovec *iov,
 }
 
 static int hash_prepare_sg_iov(AspeedHACEState *s, struct iovec *iov,
-                               bool acc_mode, bool *acc_final_request)
+                               bool acc_mode, bool *acc_final_request,
+                               hwaddr *mapped_lens)
 {
     uint32_t total_msg_len;
     uint32_t pad_offset;
@@ -275,6 +289,7 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct iovec *iov,
     int iov_idx;
     hwaddr plen;
     void *haddr;
+    int iov_mapped = 0;
 
     src = hash_get_source_addr(s);
     for (iov_idx = 0; !(len & SG_LIST_LEN_LAST); iov_idx++) {
@@ -282,7 +297,7 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct iovec *iov,
             qemu_log_mask(LOG_GUEST_ERROR,
                           "%s: Failed to set end of sg list marker\n",
                           __func__);
-            return -1;
+            goto fail;
         }
 
         len = address_space_ldl_le(&s->dram_as, src,
@@ -307,15 +322,17 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct iovec *iov,
                           "%s: Unable to map address, sg_addr=0x%x, "
                           "plen=0x%" HWADDR_PRIx "\n",
                           __func__, sg_addr, plen);
-            return -1;
+            goto fail;
         }
 
         src += SG_LIST_ENTRY_SIZE;
 
         iov[iov_idx].iov_base = haddr;
+        iov_mapped = iov_idx + 1;
+        mapped_lens[iov_idx] = plen;
         if (acc_mode) {
             if (!hash_accumulate_len(s, plen)) {
-                return -1;
+                goto fail;
             }
 
             if (has_padding(s, &iov[iov_idx], plen, &total_msg_len,
@@ -332,6 +349,10 @@ static int hash_prepare_sg_iov(AspeedHACEState *s, struct iovec *iov,
     }
 
     return iov_idx;
+
+fail:
+    hash_iov_unmap(s, iov, mapped_lens, iov_mapped);
+    return -1;
 }
 
 static uint64_t hash_get_digest_addr(AspeedHACEState *s)
@@ -350,6 +371,7 @@ static uint64_t hash_get_digest_addr(AspeedHACEState *s)
 static void hash_write_digest_and_unmap_iov(AspeedHACEState *s,
                                             struct iovec *iov,
                                             int iov_idx,
+                                            hwaddr *mapped_lens,
                                             uint8_t *digest_buf,
                                             size_t digest_len)
 {
@@ -369,15 +391,12 @@ static void hash_write_digest_and_unmap_iov(AspeedHACEState *s,
         hace_hexdump("digest", (char *)digest_buf, digest_len);
     }
 
-    for (; iov_idx > 0; iov_idx--) {
-        address_space_unmap(&s->dram_as, iov[iov_idx - 1].iov_base,
-                            iov[iov_idx - 1].iov_len, false,
-                            iov[iov_idx - 1].iov_len);
-    }
+    hash_iov_unmap(s, iov, mapped_lens, iov_idx);
 }
 
 static void hash_execute_non_acc_mode(AspeedHACEState *s, int algo,
-                                      struct iovec *iov, int iov_idx)
+                                      struct iovec *iov, int iov_idx,
+                                      hwaddr *mapped_lens)
 {
     g_autofree uint8_t *digest_buf = NULL;
     Error *local_err = NULL;
@@ -389,15 +408,17 @@ static void hash_execute_non_acc_mode(AspeedHACEState *s, int algo,
                       "%s: qcrypto hash bytesv failed : %s",
                       __func__, error_get_pretty(local_err));
         error_free(local_err);
+        hash_iov_unmap(s, iov, mapped_lens, iov_idx);
         return;
     }
 
-    hash_write_digest_and_unmap_iov(s, iov, iov_idx, digest_buf, digest_len);
+    hash_write_digest_and_unmap_iov(s, iov, iov_idx, mapped_lens,
+                                    digest_buf, digest_len);
 }
 
 static void hash_execute_acc_mode(AspeedHACEState *s, int algo,
                                   struct iovec *iov, int iov_idx,
-                                  bool final_request)
+                                  bool final_request, hwaddr *mapped_lens)
 {
     g_autofree uint8_t *digest_buf = NULL;
     Error *local_err = NULL;
@@ -411,6 +432,7 @@ static void hash_execute_acc_mode(AspeedHACEState *s, int algo,
             qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto hash new failed : %s",
                           __func__, error_get_pretty(local_err));
             error_free(local_err);
+            hash_iov_unmap(s, iov, mapped_lens, iov_idx);
             return;
         }
     }
@@ -419,6 +441,7 @@ static void hash_execute_acc_mode(AspeedHACEState *s, int algo,
         qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto hash updatev failed : %s",
                       __func__, error_get_pretty(local_err));
         error_free(local_err);
+        hash_iov_unmap(s, iov, mapped_lens, iov_idx);
         return;
     }
 
@@ -438,22 +461,25 @@ static void hash_execute_acc_mode(AspeedHACEState *s, int algo,
         s->total_req_len = 0;
     }
 
-    hash_write_digest_and_unmap_iov(s, iov, iov_idx, digest_buf, digest_len);
+    hash_write_digest_and_unmap_iov(s, iov, iov_idx, mapped_lens,
+                                    digest_buf, digest_len);
 }
 
 static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
                               bool acc_mode)
 {
     QEMU_UNINITIALIZED struct iovec iov[ASPEED_HACE_MAX_SG];
+    hwaddr mapped_lens[ASPEED_HACE_MAX_SG] = { 0 };
     bool acc_final_request = false;
     int iov_idx = -1;
 
     /* Prepares the iov for hashing operations based on the selected mode */
     if (sg_mode) {
-        iov_idx = hash_prepare_sg_iov(s, iov, acc_mode, &acc_final_request);
+        iov_idx = hash_prepare_sg_iov(s, iov, acc_mode, &acc_final_request,
+                                      mapped_lens);
     } else {
         iov_idx = hash_prepare_direct_iov(s, iov, acc_mode,
-                                          &acc_final_request);
+                                          &acc_final_request, mapped_lens);
     }
 
     if (iov_idx <= 0) {
@@ -468,9 +494,10 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
 
     /* Executes the hash operation */
     if (acc_mode) {
-        hash_execute_acc_mode(s, algo, iov, iov_idx, acc_final_request);
+        hash_execute_acc_mode(s, algo, iov, iov_idx, acc_final_request,
+                              mapped_lens);
     } else {
-        hash_execute_non_acc_mode(s, algo, iov, iov_idx);
+        hash_execute_non_acc_mode(s, algo, iov, iov_idx, mapped_lens);
     }
 }
 
Signature · 1 line
2.54.0
#7 lore raw

[PULL 9/9] hw/i3c/dw-i3c: Fix BCR/DCR extraction and PID assembly during ENTDAA

In reply to Cédric Le Goater

From: Ashish Anand <[email protected]>

The target_info union in dw_i3c_addr_assign_cmd() declares pid, bcr, and dcr as separate union members, causing them to all alias b[0] rather than their correct positions in the ENTDAA response buffer. This results in dw_i3c_update_char_table() being called with BCR and DCR both read from b[0] instead of b[6] and b[7] respectively, corrupting the device characteristics table on every ENTDAA operation. Fix by replacing the broken members with uint64_t d and extracting fields per the I3C spec ENTDAA wire format.

Additionally, dw_i3c_update_char_table() incorrectly splits PID across LOC1 and LOC2 at bit 32. Per the Linux kernel HCI driver (drivers/i3c/master/mipi-i3c-hci/dct_v1.c), the DCT layout requires LOC1 to hold pid[47:16] and LOC2 to hold pid[15:0]. Fix the split accordingly.

---
 include/hw/i3c/i3c.h |  7 +++++++
 hw/i3c/dw-i3c.c      | 16 +++++++---------
 2 files changed, 14 insertions(+), 9 deletions(-)
include/hw/i3c/i3c.h +7 -0
index 6ba90793ad01..dcf8d9b1435b 100644
@@ -138,6 +138,13 @@ struct I3CTarget {
     uint8_t static_address;
     uint8_t dcr;
     uint8_t bcr;
+    /*
+     * Provisioned ID. Since core.c sends this LSB-first during ENTDAA
+     * via (pid >> (offset * 8)) & 0xff, targets must store it
+     * pre-reversed so that pid[47:40] goes on the wire first, as
+     * required by the I3C spec.
+     *  e.g. for a device with pid 0xAABBCCDDEEFF, store 0xFFEEDDCCBBAA.
+     */
     uint64_t pid;
 
     /* CCC State tracking. */
hw/i3c/dw-i3c.c +7 -9
index d87d42be8914..17ff484c5df1 100644
@@ -1459,11 +1459,10 @@ static void dw_i3c_update_char_table(DWI3C *s, uint8_t offset, uint64_t pid,
                                           P_DEV_CHAR_TABLE_START_ADDR) /
                                           sizeof(uint32_t)) +
                                           (offset * sizeof(uint32_t));
-    s->regs[dev_index] = pid & 0xffffffff;
-    pid >>= 32;
+    s->regs[dev_index] = (pid >> 16) & 0xffffffff;
     s->regs[dev_index + 1] = FIELD_DP32(s->regs[dev_index + 1],
                                         DEVICE_CHARACTERISTIC_TABLE_LOC2,
-                                        MSB_PID, pid);
+                                        MSB_PID, pid & 0xffff);
     s->regs[dev_index + 2] = FIELD_DP32(s->regs[dev_index + 2],
                                         DEVICE_CHARACTERISTIC_TABLE_LOC3, DCR,
                                         dcr);
@@ -1507,10 +1506,9 @@ static void dw_i3c_addr_assign_cmd(DWI3C *s, DWI3CAddrAssignCmd cmd)
     for (i = 0; i < cmd.dev_count; i++) {
         uint8_t addr = dw_i3c_target_addr(s, cmd.dev_index + i);
         union {
-            uint64_t pid:48;
-            uint8_t bcr;
-            uint8_t dcr;
+            uint64_t d;
             uint32_t w[2];
+            /* Per I3C spec: b[0]=PID MSB, b[5]=PID LSB, b[6]=BCR, b[7]=DCR */
             uint8_t b[8];
         } target_info;
 
@@ -1544,9 +1542,9 @@ static void dw_i3c_addr_assign_cmd(DWI3C *s, DWI3CAddrAssignCmd cmd)
             err = DW_I3C_RESP_QUEUE_ERR_DAA_NACK;
             break;
         }
-        dw_i3c_update_char_table(s, cmd.dev_index + i,
-                                            target_info.pid, target_info.bcr,
-                                            target_info.dcr, addr);
+        uint64_t pid = be64_to_cpu(target_info.d) >> 16;
+        dw_i3c_update_char_table(s, cmd.dev_index + i, pid, target_info.b[6],
+                                 target_info.b[7], addr);
 
         /* Push the PID, BCR, and DCR to the RX queue. */
         dw_i3c_push_rx(s, target_info.w[0]);
Signature · 1 line
2.54.0
#8 lore raw

[PULL 6/9] hw/arm: Remove qcom-dc-scm-v1-bmc and qcom-firework-bmc machines

In reply to Cédric Le Goater

The qcom-dc-scm-v1-bmc and qcom-firework-bmc machines were deprecated in QEMU 10.2 and are now removed in QEMU 11.1.

These Qualcomm lab servers never entered production and do not rely on specific device models. They can be replaced by the ast2600-evb machine with appropriate fmc-model and I2C device configuration via command line.

---
 docs/about/deprecated.rst              | 10 ---
 docs/about/removed-features.rst        | 10 +++
 docs/system/arm/aspeed.rst             |  6 +-
 hw/arm/aspeed_ast2600_qcom-dc-scm-v1.c | 55 ----------------
 hw/arm/aspeed_ast2600_qcom-firework.c  | 91 --------------------------
 hw/arm/meson.build                     |  2 -
 6 files changed, 12 insertions(+), 162 deletions(-)
 delete mode 100644 hw/arm/aspeed_ast2600_qcom-dc-scm-v1.c
 delete mode 100644 hw/arm/aspeed_ast2600_qcom-firework.c
docs/about/deprecated.rst +0 -10
index cc75afe55d95..bbb4a9886fbc 100644
@@ -250,16 +250,6 @@ deprecated; use the new name ``dtb-randomness`` instead. The new name
 better reflects the way this property affects all random data within
 the device tree blob, not just the ``kaslr-seed`` node.
 
-Arm ``qcom-dc-scm-v1-bmc`` and ``qcom-firework-bmc`` machine (since 10.2)
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-The ``qcom-dc-scm-v1-bmc`` and ``qcom-firework-bmc`` represent lab
-servers that never entered production. Since they do not rely on any
-specific device models, they can be replaced by the ``ast2600-evb``
-machine using the ``fmc-model`` option to specify the flash type. The
-I2C devices connected to the board can be defined via the QEMU command
-line.
-
 Arm ``fp5280g2-bmc`` machine (since 10.2)
 '''''''''''''''''''''''''''''''''''''''''
 
docs/about/removed-features.rst +10 -0
index 02e3c06b2988..b9e9d43dada3 100644
@@ -1195,6 +1195,16 @@ using the ``fmc-model`` option to specify the flash type. The I2C
 devices connected to the board can be defined via the QEMU command
 line.
 
+Arm ``qcom-dc-scm-v1-bmc`` and ``qcom-firework-bmc`` machine (removed in 11.1)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+The ``qcom-dc-scm-v1-bmc`` and ``qcom-firework-bmc`` represent lab
+servers that never entered production. Since they do not rely on any
+specific device models, they can be replaced by the ``ast2600-evb``
+machine using the ``fmc-model`` option to specify the flash type. The
+I2C devices connected to the board can be defined via the QEMU command
+line.
+
 linux-user mode CPUs
 --------------------
 
docs/system/arm/aspeed.rst +2 -4
index 1871f31713d4..cbaab5edd65c 100644
@@ -1,5 +1,5 @@
-Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``gb200nvl-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``qcom-dc-scm-v1-bmc``, ``qcom-firework-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
-===============================================================================================================================================================================================================================================================================================================================================================================================
+Aspeed family boards (``ast2500-evb``, ``ast2600-evb``, ``bletchley-bmc``, ``fuji-bmc``, ``gb200nvl-bmc``, ``fby35-bmc``, ``fp5280g2-bmc``, ``g220a-bmc``, ``palmetto-bmc``, ``quanta-q71l-bmc``, ``rainier-bmc``, ``romulus-bmc``, ``supermicrox11-bmc``, ``supermicrox11spi-bmc``, ``tiogapass-bmc``, ``witherspoon-bmc``, ``yosemitev2-bmc``)
+================================================================================================================================================================================================================================================================================================================================================
 
 The QEMU Aspeed machines model BMCs of various OpenPOWER systems and
 Aspeed evaluation boards. They are based on different releases of the
@@ -35,8 +35,6 @@ AST2600 SoC based machines :
 - ``bletchley-bmc``        Facebook Bletchley BMC
 - ``fby35-bmc``            Facebook fby35 BMC
 - ``gb200nvl-bmc``         Nvidia GB200nvl BMC
-- ``qcom-dc-scm-v1-bmc``   Qualcomm DC-SCM V1 BMC
-- ``qcom-firework-bmc``    Qualcomm Firework BMC
 
 Supported devices
 -----------------
hw/arm/aspeed_ast2600_qcom-dc-scm-v1.c deleted +0 -55

55 lines not on this page · raw message

hw/arm/aspeed_ast2600_qcom-firework.c deleted +0 -91

91 lines not on this page · raw message

hw/arm/meson.build +0 -2
index 098015357ddc..2be74b575efc 100644
@@ -61,8 +61,6 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2600_fby35.c',
   'aspeed_ast2600_fuji.c',
   'aspeed_ast2600_gb200nvl.c',
-  'aspeed_ast2600_qcom-dc-scm-v1.c',
-  'aspeed_ast2600_qcom-firework.c',
   'aspeed_ast2600_rainier.c',
   'aspeed_ast10x0.c',
   'aspeed_ast10x0_evb.c',
Signature · 1 line
2.54.0
#9 lore raw

[PULL 8/9] hw/arm: Remove fby35 machine

In reply to Cédric Le Goater

The fby35 machine was deprecated in QEMU 10.2 and is now removed in QEMU 11.1.

This multi-SoC machine was added as an example of heterogeneous systems, but the models never evolved and no public firmware is available to boot it. Users needing multi-SoC emulation should use the ast2700fc machine instead, which is based on newer AST2700 SoCs with better support.

---
 MAINTAINERS                     |   2 -
 docs/about/deprecated.rst       |  10 --
 docs/about/removed-features.rst |  10 ++
 docs/system/arm/fby35.rst       |  52 --------
 docs/system/target-arm.rst      |   1 -
 hw/arm/fby35.c                  | 203 --------------------------------
 hw/arm/meson.build              |   3 +-
 7 files changed, 11 insertions(+), 270 deletions(-)
 delete mode 100644 docs/system/arm/fby35.rst
 delete mode 100644 hw/arm/fby35.c
MAINTAINERS +0 -2
index 93a1e4e4822e..06788fde5acd 100644
@@ -1276,12 +1276,10 @@ F: include/hw/*/*aspeed*
 F: hw/net/ftgmac100.c
 F: include/hw/net/ftgmac100.h
 F: docs/system/arm/aspeed.rst
-F: docs/system/arm/fby35.rst
 F: docs/specs/aspeed*
 F: tests/functional/*/*aspeed*
 F: tests/*/*aspeed*
 F: tests/*/*ast2700*
-F: hw/arm/fby35.c
 F: pc-bios/ast27x0_bootrom.bin
 F: roms/vbootrom
 
docs/about/deprecated.rst +0 -10
index e416f3d8a74b..bf6182d61c6e 100644
@@ -250,16 +250,6 @@ deprecated; use the new name ``dtb-randomness`` instead. The new name
 better reflects the way this property affects all random data within
 the device tree blob, not just the ``kaslr-seed`` node.
 
-Arm ``fby35`` machine (since 10.2)
-''''''''''''''''''''''''''''''''''
-
-The ``fby35`` machine was originally added as an example of a
-multi-SoC system, with the expectation the models would evolve over
-time in an heterogeneous system. This hasn't happened and no public
-firmware is available to boot it. It can be replaced by the
-``ast2700fc``, another multi-SoC machine based on the newer AST2700
-SoCs which are excepted to receive better support in the future.
-
 
 RISC-V default machine option (since 10.0)
 ''''''''''''''''''''''''''''''''''''''''''
docs/about/removed-features.rst +10 -0
index 2da8283d0e1e..9bd83b183f46 100644
@@ -1213,6 +1213,16 @@ models, it can be replaced by the ``ast2500-evb`` machine using the
 ``fmc-model`` option to specify the flash type. The I2C devices
 connected to the board can be defined via the QEMU command line.
 
+Arm ``fby35`` machine (removed in 11.1)
+'''''''''''''''''''''''''''''''''''''''
+
+The ``fby35`` machine was originally added as an example of a
+multi-SoC system, with the expectation the models would evolve over
+time in an heterogeneous system. This hasn't happened and no public
+firmware is available to boot it. It can be replaced by the
+``ast2700fc``, another multi-SoC machine based on the newer AST2700
+SoCs which are excepted to receive better support in the future.
+
 linux-user mode CPUs
 --------------------
 
docs/system/arm/fby35.rst deleted +0 -52

52 lines not on this page · raw message

docs/system/target-arm.rst +0 -1
index c57102a4149f..e34492402f0a 100644
@@ -87,7 +87,6 @@ Board-specific documentation
    arm/cubieboard
    arm/emcraft-sf2
    arm/exynos
-   arm/fby35
    arm/musicpal
    arm/kzm
    arm/nrf
hw/arm/fby35.c deleted +0 -203

203 lines not on this page · raw message

hw/arm/meson.build +1 -2
index 063abf2cf654..80068f70bb9c 100644
@@ -62,8 +62,7 @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
   'aspeed_ast2600_gb200nvl.c',
   'aspeed_ast2600_rainier.c',
   'aspeed_ast10x0.c',
-  'aspeed_ast10x0_evb.c',
-  'fby35.c'))
+  'aspeed_ast10x0_evb.c'))
 arm_common_ss.add(when: ['CONFIG_ASPEED_SOC', 'TARGET_AARCH64'], if_true: files(
   'aspeed_ast1700.c',
   'aspeed_ast27x0.c',
Signature · 1 line
2.54.0