From: Kane Chen <kane_chen@aspeedtech.com>
To: "Cédric Le Goater" <clg@kaod.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Steven Lee" <steven_lee@aspeedtech.com>,
"Troy Lee" <leetroy@gmail.com>,
"Jamin Lin" <jamin_lin@aspeedtech.com>,
"Andrew Jeffery" <andrew@codeconstruct.com.au>,
"Joel Stanley" <joel@jms.id.au>,
"open list:ASPEED BMCs" <qemu-arm@nongnu.org>,
"open list:All patches CC here" <qemu-devel@nongnu.org>
Cc: Troy Lee <troy_lee@aspeedtech.com>, Kane Chen <kane_chen@aspeedtech.com>
Subject: [PATCH v2 3/3] hw/misc/aspeed_sbc: Derive secure boot state from OTP config
Date: Fri, 18 Sep 2026 06:53:51 +0000 [thread overview]
Message-ID: <20260918065347.3713868-4-kane_chen@aspeedtech.com> (raw)
In-Reply-To: <20260918065347.3713868-1-kane_chen@aspeedtech.com>
The secure boot state is currently controlled by the
"signing-settings" machine property instead of the OTP configuration.
Derive SECURE_BOOT_EN and R_QSR from the OTP configuration when the
registers are read.
Remove the "signing-settings" property as the secure boot state is now
derived from OTP.
Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
include/hw/misc/aspeed_sbc.h | 2 --
hw/misc/aspeed_sbc.c | 22 +++++++++++++---------
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/include/hw/misc/aspeed_sbc.h b/include/hw/misc/aspeed_sbc.h
index b210ffb8aa..7f3fa7062f 100644
--- a/include/hw/misc/aspeed_sbc.h
+++ b/include/hw/misc/aspeed_sbc.h
@@ -32,8 +32,6 @@ OBJECT_DECLARE_TYPE(AspeedSBCState, AspeedSBCClass, ASPEED_SBC)
struct AspeedSBCState {
SysBusDevice parent;
- uint32_t signing_settings;
-
MemoryRegion iomem;
uint32_t regs[ASPEED_SBC_NR_REGS];
diff --git a/hw/misc/aspeed_sbc.c b/hw/misc/aspeed_sbc.c
index 6cec9ad3da..ad4c2b4b1d 100644
--- a/hw/misc/aspeed_sbc.c
+++ b/hw/misc/aspeed_sbc.c
@@ -79,6 +79,8 @@
#define MODE_REGISTER_A (0x3000)
#define MODE_REGISTER_B (0x5000)
+static bool aspeed_sbc_otp_read(AspeedSBCState *s, uint32_t otp_addr);
+
static uint64_t aspeed_sbc_read(void *opaque, hwaddr addr, unsigned int size)
{
AspeedSBCState *s = ASPEED_SBC(opaque);
@@ -102,8 +104,16 @@ static uint64_t aspeed_sbc_read(void *opaque, hwaddr addr, unsigned int size)
val &= ~ABR_EN;
}
+ if (aspeed_otp_read_config(&s->otp, 0) & BIT(1)) {
+ val |= SECURE_BOOT_EN;
+ } else {
+ val &= ~SECURE_BOOT_EN;
+ }
+
return val;
}
+ case R_QSR:
+ return aspeed_otp_read_config(&s->otp, 0);
default:
return s->regs[addr];
}
@@ -406,16 +416,11 @@ static void aspeed_sbc_reset_hold(Object *obj, ResetType type)
memset(s->regs, 0, sizeof(s->regs));
/*
- * ABR_EN is derived from OTP on every read, see aspeed_sbc_read().
- * Set secure boot enabled with RSA4096_SHA256.
+ * ABR_EN and SECURE_BOOT_EN are derived from OTP on every read, see
+ * aspeed_sbc_read(), since the SBC status register is just a
+ * reflection of the OTP fuse state.
*/
s->regs[R_STATUS] = OTP_IDLE | OTP_MEM_IDLE;
-
- if (s->signing_settings) {
- s->regs[R_STATUS] &= SECURE_BOOT_EN;
- }
-
- s->regs[R_QSR] = s->signing_settings;
}
static void aspeed_sbc_instance_init(Object *obj)
@@ -468,7 +473,6 @@ static const VMStateDescription vmstate_aspeed_sbc = {
};
static const Property aspeed_sbc_properties[] = {
- DEFINE_PROP_UINT32("signing-settings", AspeedSBCState, signing_settings, 0),
DEFINE_PROP_LINK("sram", AspeedSBCState, sram,
TYPE_MEMORY_REGION, MemoryRegion *),
};
--
2.43.0
next prev parent reply other threads:[~2026-09-18 6:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 6:53 [PATCH v2 0/3] hw/misc/aspeed_sbc: Fix ABR and secure boot state reporting Kane Chen
2026-09-18 6:53 ` [PATCH v2 1/3] hw/nvram/aspeed_otp, hw/misc/aspeed_sbc: Consolidate OTP layout definitions Kane Chen
2026-09-18 6:53 ` [PATCH v2 2/3] hw/misc/aspeed_sbc: Derive ABR state from OTP config straps Kane Chen
2026-09-18 6:53 ` Kane Chen [this message]
2026-09-18 12:57 ` [PATCH v2 0/3] hw/misc/aspeed_sbc: Fix ABR and secure boot state reporting Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260918065347.3713868-4-kane_chen@aspeedtech.com \
--to=kane_chen@aspeedtech.com \
--cc=andrew@codeconstruct.com.au \
--cc=clg@kaod.org \
--cc=jamin_lin@aspeedtech.com \
--cc=joel@jms.id.au \
--cc=leetroy@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=steven_lee@aspeedtech.com \
--cc=troy_lee@aspeedtech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.