arm: add Cortex-M85, SSE-310, and mps3-an555
v3 cover arm: add Cortex-M85, SSE-310, and mps3-an555
This patch series aims to add the Arm Cortex-M85 CPU, SSE-310 Subsystem, and mps3-an555 FPGA board.
v2 -> v3
Removed ppuintstat variable in iotkit-sysctl
Moved add GPIOALT2 register patch before add mps3-an555 patch Add gpioalt2 state field to new vmstate subsection for migration Rebased onto master which includes bug fixes to existing models
in armsse.c and mps2-tz.c
Patches 1, 3, 8 still needs review
Simon Xu (9):
target/arm/tcg/cpu-v7m.c: add cortex-m85 model
hw/arm/armsse: add Arm Corstone SSE-310
hw/misc/iotkit-sysctl.c: add SSE-310 support
hw/misc/iotkit-secctl.c: fix AHB secure read
hw/misc/iotkit-secctl.c: add SSE-310 support
hw/misc/iotkit-secctl.c: use GNU C case ranges
hw/misc/iotkit-sysinfo.c: add SSE-310 support
hw/misc/mps2-fpgaio.c: add GPIOALT2 register
hw/arm/mps2-tz.c add Arm mps3-an555 board
docs/system/arm/mps2.rst | 6 +- hw/arm/armsse.c | 208 +++++++++++++++++++++++++++++++- hw/arm/mps2-tz.c | 162 ++++++++++++++++++++++++- hw/misc/iotkit-secctl.c | 132 ++++++-------------- hw/misc/iotkit-sysctl.c | 88 ++++++++++++-- hw/misc/iotkit-sysinfo.c | 22 +++- hw/misc/mps2-fpgaio.c | 35 ++++++ include/hw/arm/armsse-version.h | 2 + include/hw/arm/armsse.h | 9 +- include/hw/misc/mps2-fpgaio.h | 2 + target/arm/tcg/cpu-v7m.c | 41 +++++++ 11 files changed, 587 insertions(+), 120 deletions(-)
Signature · 1 line
2.53.0
PATCH v3 1/9 target/arm/tcg/cpu-v7m.c: add cortex-m85 model
Add Arm Cortex-M85 CPU, modeld after the existing M55 CPU. The new M85 feature PACBTI is not implemented in QEMU and the midr value is based off the r1p1 product revision identifier.
Arm Cortex-M85 TRM:
https://developer.arm.com/documentation/101924/0101/
Message-Id: <[email protected]>
--- target/arm/tcg/cpu-v7m.c | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
target/arm/tcg/cpu-v7m.c +41 -0
@@ -237,6 +237,45 @@ static void cortex_m55_initfn(Object *obj) cpu->ctr =0x8303c003 ; } +static void cortex_m85_initfn (Object *obj) +{ +ARMCPU *cpu =ARM_CPU (obj); +ARMISARegisters *isar = &cpu->isar; + +/* QEMU currently does not support the PACBTI feature */ +set_feature (&cpu->env,ARM_FEATURE_V8 ); +set_feature (&cpu->env,ARM_FEATURE_V8_1M ); +set_feature (&cpu->env,ARM_FEATURE_M ); +set_feature (&cpu->env,ARM_FEATURE_M_MAIN ); +set_feature (&cpu->env,ARM_FEATURE_M_SECURITY ); +set_feature (&cpu->env,ARM_FEATURE_THUMB_DSP ); + cpu->midr =0x411fd231 ;/* r1p1 */ + cpu->revidr =0 ; + cpu->pmsav7_dregion =16 ; + cpu->sau_sregion =8 ; +/* These are the MVFR* values for the FPU + full MVE configuration */ + cpu->isar.mvfr0 =0x10110221 ; + cpu->isar.mvfr1 =0x12100211 ; + cpu->isar.mvfr2 =0x00000040 ; +SET_IDREG (isar,ID_PFR0 ,0x20000030 ); +SET_IDREG (isar,ID_PFR1 ,0x00000230 ); +SET_IDREG (isar,ID_DFR0 ,0x10200000 ); +SET_IDREG (isar,ID_AFR0 ,0x00000000 ); +SET_IDREG (isar,ID_MMFR0 ,0x00111040 ); +SET_IDREG (isar,ID_MMFR1 ,0x00000000 ); +SET_IDREG (isar,ID_MMFR2 ,0x01000000 ); +SET_IDREG (isar,ID_MMFR3 ,0x00000011 ); +SET_IDREG (isar,ID_ISAR0 ,0x01103110 ); +SET_IDREG (isar,ID_ISAR1 ,0x02212000 ); +SET_IDREG (isar,ID_ISAR2 ,0x20232232 ); +SET_IDREG (isar,ID_ISAR3 ,0x01111131 ); +SET_IDREG (isar,ID_ISAR4 ,0x01310132 ); +SET_IDREG (isar,ID_ISAR5 ,0x00000000 ); +SET_IDREG (isar,ID_ISAR6 ,0x00000000 ); +SET_IDREG (isar,CLIDR ,0x00000000 );/* caches not implemented */ + cpu->ctr =0x8303c003 ; +} +static const TCGCPUOps arm_v7m_tcg_ops = {/* ARM processors have a weak memory model */ .guest_default_memory_order =0 ,
@@ -290,6 +329,8 @@ static const ARMCPUInfo arm_v7m_cpus[] = { .class_init = arm_v7m_class_init }, { .name = "cortex-m55", .initfn = cortex_m55_initfn, .class_init = arm_v7m_class_init }, + { .name = "cortex-m85", .initfn = cortex_m85_initfn, + .class_init = arm_v7m_class_init }, };static void arm_v7m_cpu_register_types (void )
Signature · 1 line
2.53.0
Re: [PATCH v3 1/9] target/arm/tcg/cpu-v7m.c: add cortex-m85 model
Quoted 21 lines · Simon Xu
Add Arm Cortex-M85 CPU, modeld after the existing M55 CPU. The new M85 feature PACBTI is not implemented in QEMU and the midr value is based off the r1p1 product revision identifier.
Arm Cortex-M85 TRM:
https://developer.arm.com/documentation/101924/0101/Reviewed-by Owen Giles <[email protected]>Reviewed-by Robert Elliott <[email protected]>Signed-off-by Simon Xu <[email protected]>Message-Id: <[email protected]>
--- target/arm/tcg/cpu-v7m.c | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)target/arm/tcg/cpu-v7m.c +0
-0
target/arm/tcg/cpu-v7m.c static void cortex_m55_initfn(Object *obj) · line 245
Quoted 9 lines
target/arm/tcg/cpu-v7m.c +6
-0@@ -237,6 +237,45 @@ static void cortex_m55_initfn(Object *obj) cpu->ctr =0x8303c003 ; } +static void cortex_m85_initfn (Object *obj) +{ +ARMCPU *cpu =ARM_CPU (obj); +ARMISARegisters *isar = &cpu->isar; + +/* QEMU currently does not support the PACBTI feature */
Looking at the M85 TRM, PACBTI is a configurable feature there (that is, you can have a real hardware M85 without it). So I think we're OK to start with a Cortex-M85 which doesn't implement PACBTI yet, and add that afterwards. We'll have to add a note to the an555 docs that we don't implement it yet, because the AN555 does configure its CPU to have PACBTI.
We can improve the comment about this:
+ /*
+ * Real Cortex-M85 CPUs can be configured with or without PACBTI. + * If PACBTI is present then ID_ISAR5[23:20] read as 0b0100, + * indicating that QARMA3 is used. QEMU does not yet implement + * PACBTI emulation for M-profile, so we report as a "no-PACBTI" + * CPU for now. + */
but otherwise
On the Linaro side, Richard Henderson is planning to have a look at emulation of PACBTI for M-profile, which should fill in this missing piece.
thanks
-- PMM
PATCH v3 2/9 hw/arm/armsse: add Arm Corstone SSE-310
In reply to Simon XuAdd baseline Arm Corstone SSE-310 model.
Device list changes between SSE-310 and SSE-300:
New NPU0 Power Policy Unit and Configuration interface. All other devices are the same.
Update comments in include/hw/arm/armsse.h to include SSE-300 and SSE-310 and their respective documentations. New SSE-310 IRQ mapping. sys_version and iidr values from the "SSE-310 with M85 and U55 FPGA" documentation for the mps3-an555. Refractor comments and code pertaining to both the SSE-300 and SSE-310.
Arm Corstone SSE-310 TRM:
https://developer.arm.com/documentation/102778/0000/
Message-Id: <[email protected]>
--- hw/arm/armsse.c | 208 +++++++++++++++++++++++++++++++- include/hw/arm/armsse-version.h | 2 + include/hw/arm/armsse.h | 9 +- 3 files changed, 211 insertions(+), 8 deletions(-)
hw/arm/armsse.c +202 -6
@@ -26,7 +26,7 @@#include "hw/core/qdev-clock.h" /* -* The SSE-300 puts some devices in different places to the +* The SSE-300 and SSE-310 put some devices in different places to the * SSE-200 (and original IoTKit). We use an array of these structs * to define how each variant lays out these devices. (Parts of the * SoC that are the same for all variants aren't handled via these
@@ -118,6 +118,18 @@ static const Property sse300_properties[] = { DEFINE_PROP_UINT32("CPU0_MPU_S", ARMSSE, cpu_mpu_s[0], 8), }; +static const Property sse310_properties[] = { +DEFINE_PROP_LINK ("memory" ,ARMSSE , board_memory,TYPE_MEMORY_REGION , + MemoryRegion *), +DEFINE_PROP_UINT32 ("EXP_NUMIRQ" ,ARMSSE , exp_numirq,64 ), +DEFINE_PROP_UINT32 ("SRAM_ADDR_WIDTH" ,ARMSSE , sram_addr_width,21 ), +DEFINE_PROP_UINT32 ("init-svtor" ,ARMSSE , init_svtor,0x10000000 ), +DEFINE_PROP_BOOL ("CPU0_FPU" ,ARMSSE , cpu_fpu[0 ], true), +DEFINE_PROP_BOOL ("CPU0_DSP" ,ARMSSE , cpu_dsp[0 ], true), +DEFINE_PROP_UINT32 ("CPU0_MPU_NS" ,ARMSSE , cpu_mpu_ns[0 ],8 ), +DEFINE_PROP_UINT32 ("CPU0_MPU_S" ,ARMSSE , cpu_mpu_s[0 ],8 ), +}; +static const ARMSSEDeviceInfo iotkit_devices[] = { { .name ="timer0" ,
@@ -480,6 +492,146 @@ static const ARMSSEDeviceInfo sse300_devices[] = { } }; +static const ARMSSEDeviceInfo sse310_devices[] = { + { + .name ="timer0" , + .type =TYPE_SSE_TIMER , + .index =0 , + .addr =0x48000000 , + .ppc =0 , + .ppc_port =0 , + .irq =3 , + }, + { + .name ="timer1" , + .type =TYPE_SSE_TIMER , + .index =1 , + .addr =0x48001000 , + .ppc =0 , + .ppc_port =1 , + .irq =4 , + }, + { + .name ="timer2" , + .type =TYPE_SSE_TIMER , + .index =2 , + .addr =0x48002000 , + .ppc =0 , + .ppc_port =2 , + .irq =5 , + }, + { + .name ="timer3" , + .type =TYPE_SSE_TIMER , + .index =3 , + .addr =0x48003000 , + .ppc =0 , + .ppc_port =5 , + .irq =27 , + }, + { + .name ="s32ktimer" , + .type =TYPE_CMSDK_APB_TIMER , + .index =0 , + .addr =0x4802f000 , + .ppc =1 , + .ppc_port =0 , + .irq =2 , + .slowclk = true, + }, + { + .name ="s32kwatchdog" , + .type =TYPE_CMSDK_APB_WATCHDOG , + .index =0 , + .addr =0x5802e000 , + .ppc =NO_PPC , + .irq =NMI_0 , + .slowclk = true, + }, + { + .name ="watchdog" , + .type =TYPE_UNIMPLEMENTED_DEVICE , + .index =0 , + .addr =0x48040000 , + .size =0x2000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="armsse-sysinfo" , + .type =TYPE_IOTKIT_SYSINFO , + .index =0 , + .addr =0x48020000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="armsse-sysctl" , + .type =TYPE_IOTKIT_SYSCTL , + .index =0 , + .addr =0x58021000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="SYS_PPU" , + .type =TYPE_UNIMPLEMENTED_DEVICE , + .index =1 , + .addr =0x58022000 , + .size =0x1000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="CPU0CORE_PPU" , + .type =TYPE_UNIMPLEMENTED_DEVICE , + .index =2 , + .addr =0x58023000 , + .size =0x1000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="MGMT_PPU" , + .type =TYPE_UNIMPLEMENTED_DEVICE , + .index =3 , + .addr =0x58028000 , + .size =0x1000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="DEBUG_PPU" , + .type =TYPE_UNIMPLEMENTED_DEVICE , + .index =4 , + .addr =0x58029000 , + .size =0x1000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="NPU0_PPU" , + .type =TYPE_UNIMPLEMENTED_DEVICE , + .index =5 , + .addr =0x5802a000 , + .size =0x1000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name ="NPU0_CFG" , + .type =TYPE_UNIMPLEMENTED_DEVICE , + .index =6 , + .addr =0x40004000 , + .size =0x1000 , + .ppc =NO_PPC , + .irq =NO_IRQ , + }, + { + .name =NULL , + } +}; +/* Is internal IRQ n shared between CPUs in a multi-core SSE ? */ static const bool sse200_irq_is_common[32 ] = { [0 ...5 ] = true,
@@ -507,6 +659,20 @@ static const bool sse300_irq_is_common[32] = {/* 30, 31: reserved */ }; +static const bool sse310_irq_is_common[32 ] = { + [0 ...5 ] = true, +/* 6-8: reserved */ + [9 ...12 ] = true, +/* 13: reserved */ + [14 ] = true, +/* 15: reserved */ + [16 ] = true, +/* 17-26: reserved */ + [27 ] = true, +/* 28, 29: per-CPU CTI interrupts */ +/* 30, 31: reserved */ +}; +static const ARMSSEInfo armsse_variants[] = { { .name =TYPE_IOTKIT ,
@@ -574,6 +740,28 @@ static const ARMSSEInfo armsse_variants[] = { .devinfo = sse300_devices, .irq_is_common = sse300_irq_is_common, }, + { + .name = TYPE_SSE310, + .sse_version = ARMSSE_SSE310, + .cpu_type = ARM_CPU_TYPE_NAME("cortex-m85"), + .sram_banks = 2, + .sram_bank_base = 0x21000000, + .num_cpus = 1, + .sys_version = 0x7e10043b, + .iidr = 0x74e0043b, + .cpuwait_rst = 0, + .has_mhus = false, + .has_cachectrl = false, + .has_cpusecctrl = true, + .has_cpuid = true, + .has_cpu_pwrctrl = true, + .has_sse_counter = true, + .has_tcms = true, + .props = sse310_properties, + .props_count = ARRAY_SIZE(sse310_properties), + .devinfo = sse310_devices, + .irq_is_common = sse310_irq_is_common, + } };static uint32_t armsse_sys_config_value (ARMSSE *s,const ARMSSEInfo *info)
@@ -604,6 +792,14 @@ static uint32_t armsse_sys_config_value(ARMSSE *s, const ARMSSEInfo *info) sys_config =deposit32 (sys_config,4 ,5 , s->sram_addr_width); sys_config =deposit32 (sys_config,16 ,3 ,3 );/* CPU0 = Cortex-M55 */ break ; +case ARMSSE_SSE310 : + sys_config =0 ; + sys_config =deposit32 (sys_config,0 ,4 , info->sram_banks); + sys_config =deposit32 (sys_config,4 ,5 , s->sram_addr_width); + sys_config =deposit32 (sys_config,10 ,1 ,0 );/* No CoreSight SoC */ + sys_config =deposit32 (sys_config,11 ,2 ,0 );/* Basic level PI */ + sys_config =deposit32 (sys_config,16 ,3 ,4 );/* CPU0 = Cortex-M85 */ +break ;default :g_assert_not_reached (); }
@@ -1205,7 +1401,7 @@ static void armsse_realize(DeviceState *dev, Error **errp)qdev_connect_gpio_out (DEVICE (&s->nmi_orgate),0 ,qdev_get_gpio_in_named (DEVICE (&s->armv7m),"NMI" ,0 )); -/* The SSE-300 has a System Counter / System Timestamp Generator */ +/* The SSE-300/SSE-310 has a System Counter / System Timestamp Generator */ if (info->has_sse_counter) {SysBusDevice *sbd =SYS_BUS_DEVICE (&s->sse_counter);
@@ -1225,12 +1421,12 @@ static void armsse_realize(DeviceState *dev, Error **errp) }if (info->has_tcms) { -/* The SSE-300 has an ITCM at 0x0000_0000 and a DTCM at 0x2000_0000 */ -memory_region_init_ram (&s->itcm,NULL ,"sse300-itcm" ,512 * KiB, errp); +/* The SSE-300/SSE-310 has an ITCM at 0x0000_0000 and a DTCM at 0x2000_0000 */ +memory_region_init_ram (&s->itcm,NULL ,"itcm" ,512 * KiB, errp);if (*errp) {return ; } -memory_region_init_ram (&s->dtcm,NULL ,"sse300-dtcm" ,512 * KiB, errp); +memory_region_init_ram (&s->dtcm,NULL ,"dtcm" ,512 * KiB, errp);if (*errp) {return ; }
@@ -1461,7 +1657,7 @@ static void armsse_realize(DeviceState *dev, Error **errp)* 0x50010000: L1 icache control registers * 0x50011000: CPUSECCTRL (CPU local security control registers) * 0x4001f000 and 0x5001f000: CPU_IDENTITY register block -* The SSE-300 has an extra: +* The SSE-300 and SSE-310 have an extra: * 0x40012000 and 0x50012000: CPU_PWRCTRL register block */ if (info->has_cachectrl) {
include/hw/arm/armsse-version.h +2 -0
@@ -25,6 +25,7 @@ enum {ARMSSE_IOTKIT =0 ,ARMSSE_SSE200 =200 ,ARMSSE_SSE300 =300 , + ARMSSE_SSE310 = 310 };static inline bool armsse_version_valid (uint32_t sse_version)
@@ -33,6 +34,7 @@ static inline bool armsse_version_valid(uint32_t sse_version)case ARMSSE_IOTKIT :case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 :return true;default :return false;
include/hw/arm/armsse.h +7 -2
@@ -11,12 +11,16 @@/* * This is a model of the Arm "Subsystems for Embedded" family of -* hardware, which include the IoT Kit and the SSE-050, SSE-100 and -* SSE-200. Currently we model: +* hardware, which include the IoT Kit and the SSE-050, SSE-100, +* SSE-200, SSE-300, and SSE-310. Currently we model: * - the Arm IoT Kit which is documented in * https://developer.arm.com/documentation/ecm0601256/latest * - the SSE-200 which is documented in * https://developer.arm.com/documentation/101104/latest/ +* - the SSE-300 which is documented in +* https://support.arm.com/documentation/101773/latest/ +* - the SSE-310 which is documented in +* https://support.arm.com/documentation/102778/latest/ * * The IoTKit contains: * a Cortex-M33
@@ -127,6 +131,7 @@ OBJECT_DECLARE_TYPE(ARMSSE, ARMSSEClass,#define TYPE_IOTKIT "iotkit"#define TYPE_SSE200 "sse-200"#define TYPE_SSE300 "sse-300" +#define TYPE_SSE310 "sse-310"/* We have an IRQ splitter and an OR gate input for each external PPC * and the 2 internal PPCs
Signature · 1 line
2.53.0
PATCH v3 3/9 hw/misc/iotkit-sysctl.c: add SSE-310 support
In reply to Simon XuAdd SSE-310 case statements for reads and writes.
Add new SSE-310 PIDR and CLIDR values.
Add new SSE-310 PPUINTSTAT register as RAZ with LOG_UMIMP on reads and RO on writes.
Message-Id: <[email protected]>
---
v2 -> v3
Remove ppuintstat field from IoTKitSysCtl state struct as the register is RO and have it return "r = 0" on reads. This way we can avoid adding an unnecessary vmstate subsection for ppuintstat.
--- hw/misc/iotkit-sysctl.c | 88 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 8 deletions(-)
hw/misc/iotkit-sysctl.c +80 -8
@@ -51,6 +51,7 @@ REG32(CPUWAIT, 0x118) REG32(NMI_ENABLE, 0x11c) /* BUSWAIT in IoTKit */ REG32(WICCTRL, 0x120) REG32(EWCTRL, 0x124) +REG32(PPUINTSTAT, 0x128) REG32(PWRCTRL, 0x1fc) FIELD(PWRCTRL, PPU_ACCESS_UNLOCK, 0, 1)FIELD (PWRCTRL ,PPU_ACCESS_FILTER ,1 ,1 )
@@ -87,6 +88,12 @@ static const int sse200_sysctl_id[] = { 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ }; +static const int sse310_sysctl_id[] = { +0x04 ,0x00 ,0x00 ,0x00 ,/* PID4..PID7 */ +0x54 ,0xb8 ,0x4b ,0x00 ,/* PID0..PID3 */ +0x0d ,0xf0 ,0x05 ,0xb1 ,/* CID0..CID3 */ +}; +/* * Set the initial secure vector table offset address for the core. * This will take effect when the CPU next resets.
@@ -118,6 +125,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->scsecctrl;break ;default :
@@ -130,6 +138,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->fclk_div;break ;default :
@@ -142,6 +151,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->sysclk_div;break ;default :
@@ -154,6 +164,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->clock_force;break ;default :
@@ -180,6 +191,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->initsvtor1;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : goto bad_offset;default :g_assert_not_reached ();
@@ -192,6 +204,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->cpuwait;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :/* In SSE300 this is reserved (for INITSVTOR2) */ goto bad_offset;default :
@@ -208,6 +221,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->nmi_enable;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :/* In SSE300 this is reserved (for INITSVTOR3) */ goto bad_offset;default :
@@ -221,7 +235,8 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->wicctrl;break ;case ARMSSE_SSE300 : -/* In SSE300 this offset is CPUWAIT */ +case ARMSSE_SSE310 : +/* In SSE300 and SSE310 this offset is CPUWAIT */ r = s->cpuwait;break ;default :
@@ -236,19 +251,36 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->ewctrl;break ;case ARMSSE_SSE300 : -/* In SSE300 this offset is NMI_ENABLE */ +case ARMSSE_SSE310 : +/* In SSE300 and SSE310 this offset is NMI_ENABLE */ r = s->nmi_enable;break ;default :g_assert_not_reached (); }break ; +case A_PPUINTSTAT : +switch (s->sse_version) { +case ARMSSE_IOTKIT : +case ARMSSE_SSE200 : +case ARMSSE_SSE300 : + goto bad_offset; +case ARMSSE_SSE310 : +qemu_log_mask (LOG_UNIMP , +"IoTKit SysCtl PPUINTSTAT unimplemented\n" ); + r =0 ; +break ; +default : +g_assert_not_reached (); + } +break ;case A_PWRCTRL :switch (s->sse_version) {case ARMSSE_IOTKIT :case ARMSSE_SSE200 : goto bad_offset;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->pwrctrl;break ;default :
@@ -261,6 +293,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->pdcm_pd_sys_sense;break ;default :
@@ -273,7 +306,8 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset,case ARMSSE_SSE200 : goto bad_offset;case ARMSSE_SSE300 : - r = s->pdcm_pd_cpu0_sense; +case ARMSSE_SSE310 : + r = s->pdcm_pd_cpu0_sense;break ;default :g_assert_not_reached ();
@@ -287,6 +321,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->pdcm_pd_sram0_sense;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : goto bad_offset;default :g_assert_not_reached ();
@@ -300,6 +335,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->pdcm_pd_sram1_sense;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : goto bad_offset;default :g_assert_not_reached ();
@@ -313,6 +349,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->pdcm_pd_sram2_sense;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->pdcm_pd_vmr0_sense;break ;default :
@@ -327,6 +364,7 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset, r = s->pdcm_pd_sram3_sense;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : r = s->pdcm_pd_vmr1_sense;break ;default :
@@ -342,6 +380,9 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset,case ARMSSE_SSE300 : r = sse200_sysctl_id[(offset -A_PID4 ) /4 ];break ; +case ARMSSE_SSE310 : + r = sse310_sysctl_id[(offset -A_PID4 ) /4 ]; +break ;default :g_assert_not_reached (); }
@@ -367,7 +408,8 @@ static uint64_t iotkit_sysctl_read(void *opaque, hwaddr offset,static void cpuwait_write (IoTKitSysCtl *s,uint32_t value) { -int num_cpus = (s->sse_version ==ARMSSE_SSE300 ) ?1 :2 ; +int num_cpus = (s->sse_version ==ARMSSE_SSE300 || + s->sse_version ==ARMSSE_SSE310 ) ?1 :2 ;int i;for (i =0 ; i < num_cpus; i++) {
@@ -418,7 +460,8 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset,case A_INITSVTOR0 :switch (s->sse_version) {case ARMSSE_SSE300 : -/* SSE300 has a LOCK bit which prevents further writes when set */ +case ARMSSE_SSE310 : +/* SSE300 and SSE310 have a LOCK bit which prevents further writes */ if (s->initsvtor0 &R_INITSVTOR0_LOCK_MASK ) {qemu_log_mask (LOG_GUEST_ERROR ,"IoTKit INITSVTOR0 write when register locked\n" );
@@ -443,6 +486,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset,cpuwait_write (s, value);break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :/* In SSE300 this is reserved (for INITSVTOR2) */ goto bad_offset;default :
@@ -457,7 +501,8 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->wicctrl = value;break ;case ARMSSE_SSE300 : -/* In SSE300 this offset is CPUWAIT */ +case ARMSSE_SSE310 : +/* In SSE300 and SSE310 this offset is CPUWAIT */ cpuwait_write (s, value);break ;default :
@@ -485,6 +530,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl SCSECCTRL unimplemented\n" ); s->scsecctrl = value;break ;
@@ -498,6 +544,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl FCLK_DIV unimplemented\n" ); s->fclk_div = value;break ;
@@ -511,6 +558,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl SYSCLK_DIV unimplemented\n" ); s->sysclk_div = value;break ;
@@ -524,6 +572,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl CLOCK_FORCE unimplemented\n" ); s->clock_force = value;break ;
@@ -540,6 +589,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset,set_init_vtor (1 , s->initsvtor1);break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : goto bad_offset;default :g_assert_not_reached ();
@@ -554,7 +604,8 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->ewctrl = value;break ;case ARMSSE_SSE300 : -/* In SSE300 this offset is NMI_ENABLE */ +case ARMSSE_SSE310 : +/* In SSE300 and SSE310 this offset is NMI_ENABLE */ qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl NMI_ENABLE unimplemented\n" ); s->nmi_enable = value;break ;
@@ -562,12 +613,25 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset,g_assert_not_reached (); }break ; +case A_PPUINTSTAT : +switch (s->sse_version) { +case ARMSSE_IOTKIT : +case ARMSSE_SSE200 : +case ARMSSE_SSE300 : + goto bad_offset; +case ARMSSE_SSE310 : + goto ro_offset; +default : +g_assert_not_reached (); + } +break ;case A_PWRCTRL :switch (s->sse_version) {case ARMSSE_IOTKIT :case ARMSSE_SSE200 : goto bad_offset;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :if (!(s->pwrctrl &R_PWRCTRL_PPU_ACCESS_UNLOCK_MASK )) {qemu_log_mask (LOG_GUEST_ERROR ,"IoTKit PWRCTRL write when register locked\n" );
@@ -585,6 +649,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, goto bad_offset;case ARMSSE_SSE200 :case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl PDCM_PD_SYS_SENSE unimplemented\n" ); s->pdcm_pd_sys_sense = value;
@@ -599,6 +664,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset,case ARMSSE_SSE200 : goto bad_offset;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl PDCM_PD_CPU0_SENSE unimplemented\n" ); s->pdcm_pd_cpu0_sense = value;
@@ -617,6 +683,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->pdcm_pd_sram0_sense = value;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : goto bad_offset;default :g_assert_not_reached ();
@@ -632,6 +699,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->pdcm_pd_sram1_sense = value;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 : goto bad_offset;default :g_assert_not_reached ();
@@ -647,6 +715,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->pdcm_pd_sram2_sense = value;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl PDCM_PD_VMR0_SENSE unimplemented\n" ); s->pdcm_pd_vmr0_sense = value;
@@ -665,6 +734,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->pdcm_pd_sram3_sense = value;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :qemu_log_mask (LOG_UNIMP ,"IoTKit SysCtl PDCM_PD_VMR1_SENSE unimplemented\n" ); s->pdcm_pd_vmr1_sense = value;
@@ -683,6 +753,7 @@ static void iotkit_sysctl_write(void *opaque, hwaddr offset, s->nmi_enable = value;break ;case ARMSSE_SSE300 : +case ARMSSE_SSE310 :/* In SSE300 this is reserved (for INITSVTOR3) */ goto bad_offset;default :
@@ -769,7 +840,8 @@ static bool sse300_needed(void *opaque) {IoTKitSysCtl *s =IOTKIT_SYSCTL (opaque); -return s->sse_version ==ARMSSE_SSE300 ; +return s->sse_version ==ARMSSE_SSE300 || + s->sse_version ==ARMSSE_SSE310 ; }static const VMStateDescription iotkit_sysctl_sse300_vmstate = {
Signature · 1 line
2.53.0
Re: [PATCH v3 3/9] hw/misc/iotkit-sysctl.c: add SSE-310 support
Quoted 10 lines · Simon Xu
Add SSE-310 case statements for reads and writes.
Add new SSE-310 PIDR and CLIDR values.
Add new SSE-310 PPUINTSTAT register as RAZ withLOG_UMIMPon reads and RO on writes.Reviewed-by Owen Giles <[email protected]>Reviewed-by Robert Elliott <[email protected]>Signed-off-by Simon Xu <[email protected]>Message-Id: <[email protected]>
thanks
-- PMM
PATCH v3 4/9 hw/misc/iotkit-secctl.c: fix AHB secure read
In reply to Simon XuFix AHB secure privilege to read AHB instead of APB.
Message-Id: <[email protected]>
--- hw/misc/iotkit-secctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/iotkit-secctl.c +1 -1
@@ -195,7 +195,7 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,case A_AHBSPPPCEXP1 :case A_AHBSPPPCEXP2 :case A_AHBSPPPCEXP3 : - r = s->apbexp[offset_to_ppc_idx (offset)].sp; + r = s->ahbexp[offset_to_ppc_idx (offset)].sp;break ;case A_APBSPPPC0 :case A_APBSPPPC1 :
Signature · 1 line
2.53.0
PATCH v3 5/9 hw/misc/iotkit-secctl.c: add SSE-310 support
In reply to Simon XuAdd SSE-310 secure and non-secure ID registers.
Message-Id: <[email protected]>
--- hw/misc/iotkit-secctl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
hw/misc/iotkit-secctl.c +18 -0
@@ -109,6 +109,18 @@ static const uint8_t iotkit_secctl_ns_sse300_idregs[] = { 0x0d, 0xf0, 0x05, 0xb1, }; +static const uint8_t iotkit_secctl_s_sse310_idregs[] = { +0x04 ,0x00 ,0x00 ,0x00 , +0x52 ,0xb8 ,0x3b ,0x00 , +0x0d ,0xf0 ,0x05 ,0xb1 , +}; + +static const uint8_t iotkit_secctl_ns_sse310_idregs[] = { +0x04 ,0x00 ,0x00 ,0x00 , +0x53 ,0xb8 ,0x3b ,0x00 , +0x0d ,0xf0 ,0x05 ,0xb1 , +}; +/* The register sets for the various PPCs (AHB internal, APB internal, * AHB expansion, APB expansion) are all set up so that they are
@@ -232,6 +244,9 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,case ARMSSE_SSE300 : r = iotkit_secctl_s_sse300_idregs[(offset -A_PID4 ) /4 ];break ; +case ARMSSE_SSE310 : + r = iotkit_secctl_s_sse310_idregs[(offset -A_PID4 ) /4 ]; +break ;default : r = iotkit_secctl_s_idregs[(offset -A_PID4 ) /4 ];break ;
@@ -499,6 +514,9 @@ static MemTxResult iotkit_secctl_ns_read(void *opaque, hwaddr addr,case ARMSSE_SSE300 : r = iotkit_secctl_ns_sse300_idregs[(offset -A_PID4 ) /4 ];break ; +case ARMSSE_SSE310 : + r = iotkit_secctl_ns_sse310_idregs[(offset -A_PID4 ) /4 ]; +break ;default : r = iotkit_secctl_ns_idregs[(offset -A_PID4 ) /4 ];break ;
Signature · 1 line
2.53.0
PATCH v3 6/9 hw/misc/iotkit-secctl.c: use GNU C case ranges
In reply to Simon XuReplace case fall throughs with case ranges when register addresses are continous.
Message-Id: <[email protected]>
--- hw/misc/iotkit-secctl.c | 112 ++++++---------------------------------- 1 file changed, 16 insertions(+), 96 deletions(-)
hw/misc/iotkit-secctl.c +16 -96
@@ -187,36 +187,24 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,case A_BRGINTEN : r = s->brginten;break ; -case A_AHBNSPPCEXP0 : -case A_AHBNSPPCEXP1 : -case A_AHBNSPPCEXP2 : -case A_AHBNSPPCEXP3 : + case A_AHBNSPPCEXP0 ... A_AHBNSPPCEXP3: r = s->ahbexp[offset_to_ppc_idx (offset)].ns;break ;case A_APBNSPPC0 :case A_APBNSPPC1 : r = s->apb[offset_to_ppc_idx (offset)].ns;break ; -case A_APBNSPPCEXP0 : -case A_APBNSPPCEXP1 : -case A_APBNSPPCEXP2 : -case A_APBNSPPCEXP3 : + case A_APBNSPPCEXP0 ... A_APBNSPPCEXP3: r = s->apbexp[offset_to_ppc_idx (offset)].ns;break ; -case A_AHBSPPPCEXP0 : -case A_AHBSPPPCEXP1 : -case A_AHBSPPPCEXP2 : -case A_AHBSPPPCEXP3 : + case A_AHBSPPPCEXP0 ... A_AHBSPPPCEXP3: r = s->ahbexp[offset_to_ppc_idx (offset)].sp;break ;case A_APBSPPPC0 :case A_APBSPPPC1 : r = s->apb[offset_to_ppc_idx (offset)].sp;break ; -case A_APBSPPPCEXP0 : -case A_APBSPPPCEXP1 : -case A_APBSPPPCEXP2 : -case A_APBSPPPCEXP3 : + case A_APBSPPPCEXP0 ... A_APBSPPPCEXP3: r = s->apbexp[offset_to_ppc_idx (offset)].sp;break ;case A_SECMSCINTSTAT :
@@ -228,18 +216,7 @@ static MemTxResult iotkit_secctl_s_read(void *opaque, hwaddr addr,case A_NSMSCEXP : r = s->nsmscexp;break ; -case A_PID4 : -case A_PID5 : -case A_PID6 : -case A_PID7 : -case A_PID0 : -case A_PID1 : -case A_PID2 : -case A_PID3 : -case A_CID0 : -case A_CID1 : -case A_CID2 : -case A_CID3 : + case A_PID4 ... A_CID3:switch (s->sse_version) {case ARMSSE_SSE300 : r = iotkit_secctl_s_sse300_idregs[(offset -A_PID4 ) /4 ];
@@ -389,10 +366,7 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,case A_BRGINTEN : s->brginten = value &0xffff0000 ;break ; -case A_AHBNSPPCEXP0 : -case A_AHBNSPPCEXP1 : -case A_AHBNSPPCEXP2 : -case A_AHBNSPPCEXP3 : + case A_AHBNSPPCEXP0 ... A_AHBNSPPCEXP3: ppc = &s->ahbexp[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_ns_write (ppc, value);break ;
@@ -401,17 +375,11 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr, ppc = &s->apb[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_ns_write (ppc, value);break ; -case A_APBNSPPCEXP0 : -case A_APBNSPPCEXP1 : -case A_APBNSPPCEXP2 : -case A_APBNSPPCEXP3 : + case A_APBNSPPCEXP0 ... A_APBNSPPCEXP3: ppc = &s->apbexp[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_ns_write (ppc, value);break ; -case A_AHBSPPPCEXP0 : -case A_AHBSPPPCEXP1 : -case A_AHBSPPPCEXP2 : -case A_AHBSPPPCEXP3 : + case A_AHBSPPPCEXP0 ... A_AHBSPPPCEXP3: ppc = &s->ahbexp[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_sp_write (ppc, value);break ;
@@ -420,10 +388,7 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr, ppc = &s->apb[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_sp_write (ppc, value);break ; -case A_APBSPPPCEXP0 : -case A_APBSPPPCEXP1 : -case A_APBSPPPCEXP2 : -case A_APBSPPPCEXP3 : + case A_APBSPPPCEXP0 ... A_APBSPPPCEXP3: ppc = &s->apbexp[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_sp_write (ppc, value);break ;
@@ -444,18 +409,7 @@ static MemTxResult iotkit_secctl_s_write(void *opaque, hwaddr addr,case A_BRGINTSTAT :case A_AHBNSPPC0 :case A_AHBSPPPC0 : -case A_PID4 : -case A_PID5 : -case A_PID6 : -case A_PID7 : -case A_PID0 : -case A_PID1 : -case A_PID2 : -case A_PID3 : -case A_CID0 : -case A_CID1 : -case A_CID2 : -case A_CID3 : + case A_PID4 ... A_CID3:qemu_log_mask (LOG_GUEST_ERROR ,"IoTKit SecCtl S block write: " "read-only offset 0x%x\n" , offset);
@@ -482,34 +436,17 @@ static MemTxResult iotkit_secctl_ns_read(void *opaque, hwaddr addr,case A_AHBNSPPPC0 : r =0 ;break ; -case A_AHBNSPPPCEXP0 : -case A_AHBNSPPPCEXP1 : -case A_AHBNSPPPCEXP2 : -case A_AHBNSPPPCEXP3 : + case A_AHBNSPPPCEXP0 ... A_AHBNSPPPCEXP3: r = s->ahbexp[offset_to_ppc_idx (offset)].nsp;break ;case A_APBNSPPPC0 :case A_APBNSPPPC1 : r = s->apb[offset_to_ppc_idx (offset)].nsp;break ; -case A_APBNSPPPCEXP0 : -case A_APBNSPPPCEXP1 : -case A_APBNSPPPCEXP2 : -case A_APBNSPPPCEXP3 : + case A_APBNSPPPCEXP0 ... A_APBNSPPPCEXP3: r = s->apbexp[offset_to_ppc_idx (offset)].nsp;break ; -case A_PID4 : -case A_PID5 : -case A_PID6 : -case A_PID7 : -case A_PID0 : -case A_PID1 : -case A_PID2 : -case A_PID3 : -case A_CID0 : -case A_CID1 : -case A_CID2 : -case A_CID3 : + case A_PID4 ... A_CID3:switch (s->sse_version) {case ARMSSE_SSE300 : r = iotkit_secctl_ns_sse300_idregs[(offset -A_PID4 ) /4 ];
@@ -560,10 +497,7 @@ static MemTxResult iotkit_secctl_ns_write(void *opaque, hwaddr addr, }switch (offset) { -case A_AHBNSPPPCEXP0 : -case A_AHBNSPPPCEXP1 : -case A_AHBNSPPPCEXP2 : -case A_AHBNSPPPCEXP3 : + case A_AHBNSPPPCEXP0 ... A_AHBNSPPPCEXP3: ppc = &s->ahbexp[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_nsp_write (ppc, value);break ;
@@ -572,26 +506,12 @@ static MemTxResult iotkit_secctl_ns_write(void *opaque, hwaddr addr, ppc = &s->apb[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_nsp_write (ppc, value);break ; -case A_APBNSPPPCEXP0 : -case A_APBNSPPPCEXP1 : -case A_APBNSPPPCEXP2 : -case A_APBNSPPPCEXP3 : + case A_APBNSPPPCEXP0 ... A_APBNSPPPCEXP3: ppc = &s->apbexp[offset_to_ppc_idx (offset)];iotkit_secctl_ppc_nsp_write (ppc, value);break ;case A_AHBNSPPPC0 : -case A_PID4 : -case A_PID5 : -case A_PID6 : -case A_PID7 : -case A_PID0 : -case A_PID1 : -case A_PID2 : -case A_PID3 : -case A_CID0 : -case A_CID1 : -case A_CID2 : -case A_CID3 : + case A_PID4 ... A_CID3:qemu_log_mask (LOG_GUEST_ERROR ,"IoTKit SecCtl NS block write: " "read-only offset 0x%x\n" , offset);
Signature · 1 line
2.53.0
PATCH v3 7/9 hw/misc/iotkit-sysinfo.c: add SSE-310 support
In reply to Simon XuAdd SSE-310 PIDR and CIDR registers. Add sys_config2 register and always report 0 on read as we do not implement the NPU.
Message-Id: <[email protected]>
--- hw/misc/iotkit-sysinfo.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
hw/misc/iotkit-sysinfo.c +21 -1
@@ -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 )
@@ -58,6 +59,12 @@ static const int sysinfo_sse300_id[] = { 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */ }; +static const int sysinfo_sse310_id[] = { +0x04 ,0x00 ,0x00 ,0x00 ,/* PID4..PID7 */ +0x58 ,0xb8 ,0x2b ,0x00 ,/* PID0..PID3 */ +0x0d ,0xf0 ,0x05 ,0xb1 ,/* CID0..CID3 */ +}; +static uint64_t iotkit_sysinfo_read (void *opaque,hwaddr offset,unsigned size) {
@@ -68,13 +75,22 @@ static uint64_t iotkit_sysinfo_read(void *opaque, hwaddr offset,case A_SYS_VERSION : r = s->sys_version;break ; -case A_SYS_CONFIG : r = s->sys_config;break ;case A_SYS_CONFIG1 :switch (s->sse_version) {case ARMSSE_SSE300 : +case ARMSSE_SSE310 : +return 0 ; +break ; +default : + goto bad_read; + } +break ; +case A_SYS_CONFIG2 : +switch (s->sse_version) { +case ARMSSE_SSE310 :return 0 ;break ;default :
@@ -84,6 +100,7 @@ static uint64_t iotkit_sysinfo_read(void *opaque, hwaddr offset,case A_IIDR :switch (s->sse_version) {case ARMSSE_SSE300 : +case ARMSSE_SSE310 :return s->iidr;break ;default :
@@ -95,6 +112,9 @@ static uint64_t iotkit_sysinfo_read(void *opaque, hwaddr offset,case ARMSSE_SSE300 : r = sysinfo_sse300_id[(offset -A_PID4 ) /4 ];break ; +case ARMSSE_SSE310 : + r = sysinfo_sse310_id[(offset -A_PID4 ) /4 ]; +break ;default : r = sysinfo_id[(offset -A_PID4 ) /4 ];break ;
Signature · 1 line
2.53.0
PATCH v3 8/9 hw/misc/mps2-fpgaio.c: add GPIOALT2 register
In reply to Simon XuAdd GPIOALT2 register for new an555 board. Implement register access as RW with LOG_UNIMP for writes. Add "has-gpioalt2" property to make each board configurable. Add gpioalt2 vmstate subsection for device state migration.
Message-Id: <[email protected]>
---
v2 -> v3
Move this patch to be before the add mps3-an555 patch Add gpioalt2 field to new vmstate subsection
mps2_fpgaio_gpioalt2_vmstate for migration
Add needed_gpioalt2 function for vmstate subsection Set fpgaio_has_gpioalt2 to false for all existing models
--- hw/arm/mps2-tz.c | 6 ++++++ hw/misc/mps2-fpgaio.c | 35 +++++++++++++++++++++++++++++++++++ include/hw/misc/mps2-fpgaio.h | 2 ++ 3 files changed, 43 insertions(+)
hw/arm/mps2-tz.c +6 -0
@@ -122,6 +122,7 @@ struct MPS2TZMachineClass {uint32_t fpgaio_num_leds;/* Number of LEDs in FPGAIO LED0 register */ bool fpgaio_has_switches;/* Does FPGAIO have SWITCH register? */ bool fpgaio_has_dbgctrl;/* Does FPGAIO have DBGCTRL register? */ +bool fpgaio_has_gpioalt2;/* Does FPGAIO have GPIOALT2 register? */ int numirq;/* Number of external interrupts */ int uart_overflow_irq;/* number of the combined UART overflow IRQ */ uint32_t init_svtor;/* init-svtor setting for SSE */
@@ -494,6 +495,7 @@ static MemoryRegion *make_fpgaio(MPS2TZMachineState *mms, void *opaque,qdev_prop_set_uint32 (DEVICE (fpgaio),"num-leds" , mmc->fpgaio_num_leds);qdev_prop_set_bit (DEVICE (fpgaio),"has-switches" , mmc->fpgaio_has_switches);qdev_prop_set_bit (DEVICE (fpgaio),"has-dbgctrl" , mmc->fpgaio_has_dbgctrl); +qdev_prop_set_bit (DEVICE (fpgaio),"has-gpioalt2" , mmc->fpgaio_has_gpioalt2);sysbus_realize (SYS_BUS_DEVICE (fpgaio), &error_fatal);return sysbus_mmio_get_region (SYS_BUS_DEVICE (fpgaio),0 ); }
@@ -1350,6 +1352,7 @@ static void mps2tz_an505_class_init(ObjectClass *oc, const void *data) mmc->fpgaio_num_leds =2 ; mmc->fpgaio_has_switches = false; mmc->fpgaio_has_dbgctrl = false; + mmc->fpgaio_has_gpioalt2 = false; mmc->numirq =92 ; mmc->uart_overflow_irq =47 ; mmc->init_svtor =0x10000000 ;
@@ -1384,6 +1387,7 @@ static void mps2tz_an521_class_init(ObjectClass *oc, const void *data) mmc->fpgaio_num_leds =2 ; mmc->fpgaio_has_switches = false; mmc->fpgaio_has_dbgctrl = false; + mmc->fpgaio_has_gpioalt2 = false; mmc->numirq =92 ; mmc->uart_overflow_irq =47 ; mmc->init_svtor =0x10000000 ;
@@ -1418,6 +1422,7 @@ static void mps3tz_an524_class_init(ObjectClass *oc, const void *data) mmc->fpgaio_num_leds =10 ; mmc->fpgaio_has_switches = true; mmc->fpgaio_has_dbgctrl = false; + mmc->fpgaio_has_gpioalt2 = false; mmc->numirq =95 ; mmc->uart_overflow_irq =47 ; mmc->init_svtor =0x10000000 ;
@@ -1457,6 +1462,7 @@ static void mps3tz_an547_class_init(ObjectClass *oc, const void *data) mmc->fpgaio_num_leds =10 ; mmc->fpgaio_has_switches = true; mmc->fpgaio_has_dbgctrl = true; + mmc->fpgaio_has_gpioalt2 = false; mmc->numirq =96 ; mmc->uart_overflow_irq =48 ; mmc->init_svtor =0x00000000 ;
hw/misc/mps2-fpgaio.c +35 -0
@@ -31,6 +31,7 @@ REG32(LED0, 0) REG32(DBGCTRL, 4) REG32(BUTTON, 8) +REG32(GPIOALT2, 0xc) REG32(CLK1HZ, 0x10) REG32(CLK100HZ, 0x14)REG32 (COUNTER ,0x18 )
@@ -142,6 +143,9 @@ static uint64_t mps2_fpgaio_read(void *opaque, hwaddr offset, unsigned size)*/ r =0 ;break ; +case A_GPIOALT2 : + r = s->gpioalt2; +break ;case A_PRESCALE : r = s->prescale;break ;
@@ -210,6 +214,14 @@ static void mps2_fpgaio_write(void *opaque, hwaddr offset, uint64_t value, "MPS2 FPGAIO: DBGCTRL unimplemented\n"); s->dbgctrl = value;break ; +case A_GPIOALT2 : +if (!s->has_gpioalt2) { + goto bad_offset; + } +qemu_log_mask (LOG_UNIMP , +"MPS2 FPGAIO: GPIOALT2 unimplemented\n" ); + s->gpioalt2 = value; +break ;case A_PRESCALE :resync_counter (s); s->prescale = value;
@@ -301,6 +313,24 @@ static void mps2_fpgaio_realize(DeviceState *dev, Error **errp) } } +static bool needed_gpioalt2 (void *opaque) +{ +MPS2FPGAIO *s =MPS2_FPGAIO (opaque); + +return s->has_gpioalt2; +} + +static const VMStateDescription mps2_fpgaio_gpioalt2_vmstate = { + .name ="mps2-fpgaio/gpioalt2" , + .version_id =1 , + .minimum_version_id =1 , + .needed = needed_gpioalt2, + .fields = (const VMStateField []) { +VMSTATE_UINT32 (gpioalt2,MPS2FPGAIO ), +VMSTATE_END_OF_LIST () + } +}; +static const VMStateDescription mps2_fpgaio_vmstate = { .name ="mps2-fpgaio" , .version_id =3 ,
@@ -317,6 +347,10 @@ static const VMStateDescription mps2_fpgaio_vmstate = { VMSTATE_INT64(pscntr_sync_ticks, MPS2FPGAIO),VMSTATE_END_OF_LIST () }, + .subsections = (const VMStateDescription *const []) { + &mps2_fpgaio_gpioalt2_vmstate, +NULL + } };static const Property mps2_fpgaio_properties[] = {
@@ -326,6 +360,7 @@ static const Property mps2_fpgaio_properties[] = {DEFINE_PROP_UINT32 ("num-leds" ,MPS2FPGAIO , num_leds,2 ),DEFINE_PROP_BOOL ("has-switches" ,MPS2FPGAIO , has_switches, false),DEFINE_PROP_BOOL ("has-dbgctrl" ,MPS2FPGAIO , has_dbgctrl, false), + DEFINE_PROP_BOOL("has-gpioalt2", MPS2FPGAIO, has_gpioalt2, false), };static void mps2_fpgaio_class_init (ObjectClass *klass,const void *data)
include/hw/misc/mps2-fpgaio.h +2 -0
@@ -40,11 +40,13 @@ struct MPS2FPGAIO {uint32_t num_leds;bool has_switches;bool has_dbgctrl; +bool has_gpioalt2;uint32_t led0;uint32_t prescale;uint32_t misc;uint32_t dbgctrl; +uint32_t gpioalt2;/* QEMU_CLOCK_VIRTUAL time at which counter and pscntr were last synced */ int64_t pscntr_sync_ticks;
Signature · 1 line
2.53.0
Re: [PATCH v3 8/9] hw/misc/mps2-fpgaio.c: add GPIOALT2 register
Quoted 11 lines · Simon Xu
Add GPIOALT2 register for new an555 board. Implement register access as RW with
LOG_UNIMPfor writes. Add "has-gpioalt2" property to make each board configurable. Add gpioalt2 vmstate subsection for device state migration.Reviewed-by Owen Giles <[email protected]>Reviewed-by Robert Elliott <[email protected]>Signed-off-by Simon Xu <[email protected]>Message-Id: <[email protected]>
---
thanks
-- PMM
PATCH v3 9/9 hw/arm/mps2-tz.c add Arm mps3-an555 board
In reply to Simon XuAdd mps3-an555 board modeled after the existing mps3-an547 board. Add UnimplementedDeivceState for timing adapters and qspi controllers in MPS2TZMachineState.
Changes in AN555:
Timing adapters in APB PPC EX0 instead of MPC.
Additional QSPI controllers in AHB PPC EX0.
Additional AHB PPC EX1 with DMA.
Create standalone unimplemented devices for MPC instead of timing adapters. Set fpgaio_has_gpioalt2 to true.
Include documentation for SSE-310 and mps3-an555.
Arm mps3-an555 TRM: https://developer.arm.com/documentation/107642/latest/
Message-Id: <[email protected]>
---
v2 -> v3
Move this patch to be after the add GPIOALT2 patch Set fpgaio_has_gpioalt2 to true for mps3-an555
--- docs/system/arm/mps2.rst | 6 +- hw/arm/mps2-tz.c | 156 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 156 insertions(+), 6 deletions(-)
docs/system/arm/mps2.rst +4 -2
@@ -1,5 +1,5 @@ -Arm MPS2 and MPS3 boards (``mps2-an385``, ``mps2-an386``, ``mps2-an500``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``, ``mps3-an524``, ``mps3-an536``, ``mps3-an547``) -========================================================================================================================================================================= +Arm MPS2 and MPS3 boards (``mps2-an385``, ``mps2-an386``, ``mps2-an500``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``, ``mps3-an524``, ``mps3-an536``, ``mps3-an547``, ``mps3-an555``) +========================================================================================================================================================================================= These board models use Arm M-profile or R-profile CPUs.
@@ -31,6 +31,8 @@ FPGA images using M-profile CPUs: Dual Cortex-M33 on an MPS3, as documented in Arm Application Note AN524 ``mps3-an547`` Cortex-M55 on an MPS3, as documented in Arm Application Note AN547 +``mps3-an555`` + Cortex-M85 on an MPS3, as documented in Arm Application Note AN555 FPGA images using R-profile CPUs:
hw/arm/mps2-tz.c +152 -4
256 lines not on this page · raw message
Signature · 1 line
2.53.0
Quoted 12 lines · Simon Xu
This patch series aims to add the Arm Cortex-M85 CPU, SSE-310 Subsystem, and mps3-an555 FPGA board.
v2 -> v3
Removed ppuintstat variable in iotkit-sysctl
Moved add GPIOALT2 register patch before add mps3-an555 patch Add gpioalt2 state field to new vmstate subsection for migration Rebased onto master which includes bug fixes to existing models
inarmsse.candmps2-tz.c
Patches 1, 3, 8 still needs review
Quoted 1 line
Signed-off-by Simon Xu <[email protected]>
As I discovered today that the Cortex-M85 has PACBTI as a configurable feature in hardware, I'm happier about taking this series before we have proper PACBTI emulation. We've also decided in Linaro that we will add the PACBTI emulation, so hopefully the gap before it appears will not be too large.
So I'm going to take this patchseries into target-arm.next. I made a few minor tweaks (improved comment in patch 1, fixing a few checkpatch.pl nits, documented missing PACBTI in the mps2 board docs page).
Thanks for your work on this!
-- PMM
Sounds good. Thank you Peter for your help with my first experience with open source software! I appreciate your feedback and hope to stay around in the future.
Best regards,
Simon Xu