summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamin Lin <jamin_lin@aspeedtech.com>2026-09-01 08:52:47 +0000
committerCédric Le Goater <clg@redhat.com>2026-09-05 07:05:11 +0200
commit85d2429e5a8c3f70b0aaa56708903a5237070163 (patch)
tree8c1352c955f729c1f884bf7de4d191dd38c8a5c2
parentc65ba3272d944f76acdcc60f428c0177d13d42d1 (diff)
downloadqemu-85d2429e5a8c3f70b0aaa56708903a5237070163.tar.gz
qemu-85d2429e5a8c3f70b0aaa56708903a5237070163.zip
hw/arm/aspeed_ast10x0: Wire SEC SRAM to the SBC model
Introduce the "has_ecdsa" class attribute and enable it for the AST10x0 SBC, as ECDSA is only supported on this platform. Add an "sram" link property to the SBC model and initialize a dedicated address space for accessing the SEC SRAM. This will be used by the ECDSA verify command to read the public key, signature, and digest from SRAM. Wrap the SEC SRAM in a container mapped at offset 0. This allows the ECDSA engine added in a later patch to access the SRAM using relative offsets without requiring the SBC model to know the SRAM's system address. 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/20260901085238.995968-8-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
-rw-r--r--hw/arm/aspeed_ast10x0.c7
-rw-r--r--hw/misc/aspeed_sbc.c11
-rw-r--r--include/hw/misc/aspeed_sbc.h4
3 files changed, 21 insertions, 1 deletions
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
index 5165dcce59..aeb5a4423d 100644
--- a/hw/arm/aspeed_ast10x0.c
+++ b/hw/arm/aspeed_ast10x0.c
@@ -250,8 +250,11 @@ static bool aspeed_soc_ast10x0_realize(Aspeed10x0SoCState *a, Error **errp)
error_propagate(errp, err);
return false;
}
+ memory_region_init(&s->sram_container[1], OBJECT(s), "sec.sram-container",
+ sc->sram_size[1]);
+ memory_region_add_subregion(&s->sram_container[1], 0, &s->sram[1]);
memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SRAM1],
- &s->sram[1]);
+ &s->sram_container[1]);
/* SCU */
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
@@ -350,6 +353,8 @@ static bool aspeed_soc_ast10x0_realize(Aspeed10x0SoCState *a, Error **errp)
}
/* Secure Boot Controller */
+ object_property_set_link(OBJECT(&s->sbc), "sram", OBJECT(&s->sram[1]),
+ &error_abort);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->sbc), errp)) {
return false;
}
diff --git a/hw/misc/aspeed_sbc.c b/hw/misc/aspeed_sbc.c
index 7397d9bbf0..f10f7ac578 100644
--- a/hw/misc/aspeed_sbc.c
+++ b/hw/misc/aspeed_sbc.c
@@ -306,6 +306,14 @@ static void aspeed_sbc_realize(DeviceState *dev, Error **errp)
}
}
+ if (sc->has_ecdsa) {
+ if (!s->sram) {
+ error_setg(errp, TYPE_ASPEED_SBC ": 'sram' link not set");
+ return;
+ }
+ address_space_init(&s->sram_as, s->sram, TYPE_ASPEED_SBC ".sram");
+ }
+
memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_sbc_ops, s,
TYPE_ASPEED_SBC, ASPEED_SBC_NR_REGS << 2);
@@ -325,6 +333,8 @@ static const VMStateDescription vmstate_aspeed_sbc = {
static const Property aspeed_sbc_properties[] = {
DEFINE_PROP_BOOL("emmc-abr", AspeedSBCState, emmc_abr, 0),
DEFINE_PROP_UINT32("signing-settings", AspeedSBCState, signing_settings, 0),
+ DEFINE_PROP_LINK("sram", AspeedSBCState, sram,
+ TYPE_MEMORY_REGION, MemoryRegion *),
};
static void aspeed_sbc_class_init(ObjectClass *klass, const void *data)
@@ -355,6 +365,7 @@ static void aspeed_ast10x0_sbc_class_init(ObjectClass *klass, const void *data)
dc->desc = "AST10X0 Secure Boot Controller";
sc->has_otp = true;
+ sc->has_ecdsa = true;
}
static const TypeInfo aspeed_sbc_types[] = {
diff --git a/include/hw/misc/aspeed_sbc.h b/include/hw/misc/aspeed_sbc.h
index eea6e2b27f..756c612356 100644
--- a/include/hw/misc/aspeed_sbc.h
+++ b/include/hw/misc/aspeed_sbc.h
@@ -40,12 +40,16 @@ struct AspeedSBCState {
uint32_t regs[ASPEED_SBC_NR_REGS];
AspeedOTPState otp;
+
+ MemoryRegion *sram;
+ AddressSpace sram_as;
};
struct AspeedSBCClass {
SysBusDeviceClass parent_class;
bool has_otp;
+ bool has_ecdsa;
};
#endif /* ASPEED_SBC_H */