@samitouri / QOSamiQemu / commits / ffcbeb1f5a

hw/misc/aspeed_scu: Introduce Aspeed2700SCUState

Introduce Aspeed2700SCUState as an AST2700-specific subclass of AspeedSCUState. Currently, AST1700 and AST2700 reuse the generic AspeedSCUState. However, AST2700 requires SCU functionality that is specific to the platform, particularly for interactions with its coprocessors. Introduce a dedicated Aspeed2700SCUState to provide an extension point for AST2700-specific functionality while keeping the generic AspeedSCUState unchanged. Subsequent patches will migrate AST2700 users to the new subclass and move AST2700-specific code into it. No functional change. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Link: https://lore.kernel.org/qemu-devel/20260717084559.3477061-2-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Jamin Lin committed Jul 17, 2026 at 08:46 UTC ffcbeb1f5a954284519a9ea1942466042b106544
2 files changed +12 -1
hw/misc/aspeed_scu.c
+7 -1
@@ -930,6 +930,11 @@ static void aspeed_ast2700_scu_reset_hold(Object *obj, ResetType type)
930 s->regs[AST2700_HW_STRAP1] = s->hw_strap1;
931 }
932
933 +static void aspeed_2700_scu_realize(DeviceState *dev, Error **errp)
934 +{
935 + aspeed_scu_realize(dev, errp);
936 +}
937 +
938 static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
939 {
940 DeviceClass *dc = DEVICE_CLASS(klass);
@@ -937,6 +942,7 @@ static void aspeed_2700_scu_class_init(ObjectClass *klass, const void *data)
942 AspeedSCUClass *asc = ASPEED_SCU_CLASS(klass);
943
944 dc->desc = "ASPEED 2700 System Control Unit";
945 + dc->realize = aspeed_2700_scu_realize;
946 rc->phases.hold = aspeed_ast2700_scu_reset_hold;
947 asc->resets = ast2700_a0_resets;
948 asc->calc_hpll = aspeed_2600_scu_calc_hpll;
@@ -1161,7 +1167,7 @@ static const TypeInfo aspeed_scu_types[] = {
1167 {
1168 .name = TYPE_ASPEED_2700_SCU,
1169 .parent = TYPE_ASPEED_SCU,
1164 - .instance_size = sizeof(AspeedSCUState),
1170 + .instance_size = sizeof(Aspeed2700SCUState),
1171 .class_init = aspeed_2700_scu_class_init,
1172 },
1173 {
include/hw/misc/aspeed_scu.h
+5
@@ -20,6 +20,7 @@ OBJECT_DECLARE_TYPE(AspeedSCUState, AspeedSCUClass, ASPEED_SCU)
20 #define TYPE_ASPEED_2500_SCU TYPE_ASPEED_SCU "-ast2500"
21 #define TYPE_ASPEED_2600_SCU TYPE_ASPEED_SCU "-ast2600"
22 #define TYPE_ASPEED_2700_SCU TYPE_ASPEED_SCU "-ast2700"
23 +OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2700SCUState, ASPEED_2700_SCU)
24 #define TYPE_ASPEED_2700_SCUIO TYPE_ASPEED_SCU "io" "-ast2700"
25 #define TYPE_ASPEED_1030_SCU TYPE_ASPEED_SCU "-ast1030"
26
@@ -41,6 +42,10 @@ struct AspeedSCUState {
42 uint32_t hw_prot_key;
43 };
44
45 +struct Aspeed2700SCUState {
46 + AspeedSCUState parent_obj;
47 +};
48 +
49 #define AST2400_A1_SILICON_REV 0x02010303U
50 #define AST2500_A1_SILICON_REV 0x04010303U
51 #define AST2600_A3_SILICON_REV 0x05030303U