Re: [PATCH 3/4] hw/misc/iotkit-sysinfo: make sys_config2 configurable for SSE-310
Peter Maydell <[email protected]> Fri, 31 Jul 2026 12:23:01 +0100
| Newsgroups | org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <CAFEAcA9d2SgtXvgRfBZiaZ8GgivLVJowKFccShLvjE6Qrb9rtw@mail.gmail.com> |
On Fri, 24 Jul 2026 at 00:36, Simon Xu <[email protected]> wrote: > > Add sys_config2 as QEMU property like sys_config. > - Modify the sys_config2 register on the SSE-310 for the NPU configurations. > - Currently sys_config2 is configured to report Ethos-U55 as the NPU type. Ah, here's sys_config2. For v2, if you say in the previous patch "this implements all the sysinfo changes for SSE-310 except for ..." then you clue reviewers in to the fact that they should expect that to be added later in the series. > > Reviewed-by: Owen Giles <[email protected]> > Reviewed-by: Robert Elliott <[email protected]> > Signed-off-by: Simon Xu <[email protected]> > --- > hw/arm/armsse.c | 21 +++++++++++++++++++++ > hw/misc/iotkit-sysinfo.c | 11 +++++++++++ > include/hw/misc/iotkit-sysinfo.h | 2 ++ > 3 files changed, 34 insertions(+) > > diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c > index 1847c73322..cf8f6c25d1 100644 > --- a/hw/arm/armsse.c > +++ b/hw/arm/armsse.c > @@ -806,6 +806,22 @@ static uint32_t armsse_sys_config_value(ARMSSE *s, const ARMSSEInfo *info) > return sys_config; > } > > +static uint32_t armsse_sys_config2_value(ARMSSE *s, const ARMSSEInfo *info) > +{ > + /* Return the SYS_CONFIG2 value for this SSE */ > + uint32_t sys_config2; > + > + switch (info->sse_version) { > + case ARMSSE_SSE310: > + sys_config2 = 0; > + sys_config2 = deposit32(sys_config2, 0, 3, 1); /* NPU0 = Ethos-U55 */ We don't implement the NPU0, though, so we should not advertise that it is present. Putting in all the machinery for the property as this patch does is fine, but since we always want to report 0 I'm also OK with hardcoding 0 in the sysinfo device the way we do for SYS_CONFIG1. > + break; > + default: > + g_assert_not_reached(); > + } > + return sys_config2; > +} > + > /* Clock frequency in HZ of the 32KHz "slow clock" */ > #define S32KCLK (32 * 1000) > > @@ -1496,6 +1512,11 @@ static void armsse_realize(DeviceState *dev, Error **errp) > info->sse_version, &error_abort); > object_property_set_int(OBJECT(&s->sysinfo), "IIDR", > info->iidr, &error_abort); > + if (info->sse_version == ARMSSE_SSE310) { > + object_property_set_int(OBJECT(&s->sysinfo), "SYS_CONFIG2", > + armsse_sys_config2_value(s, info), > + &error_abort); > + } You don't need to make this conditional on sse_version. The property always exists on the sysinfo device. If you add cases for ARMSSE_IOTKIT, ARMSSE_SSE200, ARM_SSE300 that return 0, then we will set the property to 0 (and the sysinfo device won't use the value anyway). > if (!sysbus_realize(sbd, errp)) { > return; > } > diff --git a/hw/misc/iotkit-sysinfo.c b/hw/misc/iotkit-sysinfo.c > index 21e161bdc2..0905949ef7 100644 > --- a/hw/misc/iotkit-sysinfo.c > +++ b/hw/misc/iotkit-sysinfo.c > @@ -31,6 +31,7 @@ > REG32(SYS_VERSION, 0x0) > REG32(SYS_CONFIG, 0x4) > REG32(SYS_CONFIG1, 0x8) > +REG32(SYS_CONFIG2, 0xc) > REG32(IIDR, 0xfc8) > REG32(PID4, 0xfd0) > REG32(PID5, 0xfd4) > @@ -87,6 +88,15 @@ static uint64_t iotkit_sysinfo_read(void *opaque, hwaddr offset, > goto bad_read; > } > break; > + case A_SYS_CONFIG2: > + switch (s->sse_version) { > + case ARMSSE_SSE310: > + return s->sys_config2; > + break; > + default: > + goto bad_read; > + } > + break; > case A_IIDR: > switch (s->sse_version) { > case ARMSSE_SSE300: > @@ -144,6 +154,7 @@ static const MemoryRegionOps iotkit_sysinfo_ops = { > static const Property iotkit_sysinfo_props[] = { > DEFINE_PROP_UINT32("SYS_VERSION", IoTKitSysInfo, sys_version, 0), > DEFINE_PROP_UINT32("SYS_CONFIG", IoTKitSysInfo, sys_config, 0), > + DEFINE_PROP_UINT32("SYS_CONFIG2", IoTKitSysInfo, sys_config2, 0), > DEFINE_PROP_UINT32("sse-version", IoTKitSysInfo, sse_version, 0), > DEFINE_PROP_UINT32("IIDR", IoTKitSysInfo, iidr, 0), > }; > diff --git a/include/hw/misc/iotkit-sysinfo.h b/include/hw/misc/iotkit-sysinfo.h > index 36dc702c53..1c1b2758d9 100644 > --- a/include/hw/misc/iotkit-sysinfo.h > +++ b/include/hw/misc/iotkit-sysinfo.h > @@ -16,6 +16,7 @@ > * QEMU interface: > * + QOM property "SYS_VERSION": value to use for SYS_VERSION register > * + QOM property "SYS_CONFIG": value to use for SYS_CONFIG register > + * + QOM property "SYS_CONFIG2": value to use for SYS_CONFIG2 register > * + sysbus MMIO region 0: the system information register bank > */ > > @@ -38,6 +39,7 @@ struct IoTKitSysInfo { > /* Properties */ > uint32_t sys_version; > uint32_t sys_config; > + uint32_t sys_config2; > uint32_t sse_version; > uint32_t iidr; > }; thanks -- PMM