@samitouri / QOSamiQemu / commits / 7bb309ed43

hw/arm/aspeed_ast27x0: Pass realized PSP SoC to SSP/TSP initialization

Pass the realized PSP SoC to the SSP/TSP initialization helpers instead of retrieving it from the MachineState. This makes the dependency explicit, since the SSP and TSP coprocessors use resources owned by the PSP SoC, including the UARTs, SRAM, SCU and SCUIO. The PSP SoC must therefore be realized before the coprocessors are initialized. 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-6-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Jamin Lin committed Jul 17, 2026 at 08:46 UTC 7bb309ed43b06a75f8904011e7385379f4377c67
1 file changed +16 -10
hw/arm/aspeed_ast27x0-fc.c
+16 -10
@@ -134,11 +134,9 @@ static bool ast2700fc_ca35_init(MachineState *machine, Error **errp)
134 return true;
135 }
136
137 -static bool ast2700fc_ssp_init(MachineState *machine, Error **errp)
137 +static bool ast2700fc_ssp_init(Ast2700FCState *s, AspeedSoCState *psp,
138 + Error **errp)
139 {
139 - Ast2700FCState *s = AST2700FC(machine);
140 - AspeedSoCState *psp = ASPEED_SOC(&s->ca35);
141 -
140 s->ssp_sysclk = clock_new(OBJECT(s), "SSP_SYSCLK");
141 clock_set_hz(s->ssp_sysclk, 200000000ULL);
142
@@ -166,11 +164,9 @@ static bool ast2700fc_ssp_init(MachineState *machine, Error **errp)
164 return true;
165 }
166
169 -static bool ast2700fc_tsp_init(MachineState *machine, Error **errp)
167 +static bool ast2700fc_tsp_init(Ast2700FCState *s, AspeedSoCState *psp,
168 + Error **errp)
169 {
171 - Ast2700FCState *s = AST2700FC(machine);
172 - AspeedSoCState *psp = ASPEED_SOC(&s->ca35);
173 -
170 s->tsp_sysclk = clock_new(OBJECT(s), "TSP_SYSCLK");
171 clock_set_hz(s->tsp_sysclk, 200000000ULL);
172
@@ -200,9 +196,19 @@ static bool ast2700fc_tsp_init(MachineState *machine, Error **errp)
196
197 static void ast2700fc_init(MachineState *machine)
198 {
199 + Ast2700FCState *s = AST2700FC(machine);
200 + AspeedSoCState *psp;
201 +
202 ast2700fc_ca35_init(machine, &error_abort);
204 - ast2700fc_ssp_init(machine, &error_abort);
205 - ast2700fc_tsp_init(machine, &error_abort);
203 +
204 + /*
205 + * SSP and TSP use resources owned by the PSP SoC, such as UART,
206 + * SRAM, SCU and SCUIO. Therefore the PSP SoC must be realized
207 + * before the coprocessors are initialized.
208 + */
209 + psp = ASPEED_SOC(&s->ca35);
210 + ast2700fc_ssp_init(s, psp, &error_abort);
211 + ast2700fc_tsp_init(s, psp, &error_abort);
212 }
213
214 static void ast2700fc_class_init(ObjectClass *oc, const void *data)