@samitouri / QOSamiQemu / commits / ef540c1d30

target/arm: GICv5 cpuif: Implement PPI priority registers

Implement the GICv5 registers which hold the priority of the PPIs. Each 64-bit register has the priority fields for 8 PPIs, so there are 16 registers in total. This would be a lot of duplication if we wrote it out statically in the array, so instead create each register via a loop in define_gicv5_cpuif_regs(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Message-id: 20260327111700.795099-41-peter.maydell@linaro.org

Peter Maydell committed Mar 27, 2026 at 11:16 UTC ef540c1d301d5129fdccb5ad414131c9c090a362
2 files changed +25
target/arm/cpu.h
+2
@@ -607,6 +607,8 @@ typedef struct CPUArchState {
607 uint64_t ppi_hm[GICV5_NUM_PPIS / 64];
608 uint64_t ppi_pend[GICV5_NUM_PPIS / 64];
609 uint64_t ppi_enable[GICV5_NUM_PPIS / 64];
610 + /* The PRIO regs have 1 byte per PPI, so 8 PPIs to a register */
611 + uint64_t ppi_priority[GICV5_NUM_PPIS / 8];
612 } gicv5_cpuif;
613
614 struct {
target/arm/tcg/gicv5-cpuif.c
+23
@@ -225,6 +225,12 @@ static void gic_ppi_enable_write(CPUARMState *env, const ARMCPRegInfo *ri,
225 raw_write(env, ri, value);
226 }
227
228 +static void gic_ppi_priority_write(CPUARMState *env, const ARMCPRegInfo *ri,
229 + uint64_t value)
230 +{
231 + raw_write(env, ri, value);
232 +}
233 +
234 static const ARMCPRegInfo gicv5_cpuif_reginfo[] = {
235 /*
236 * Barrier: wait until the effects of a cpuif system register
@@ -382,5 +388,22 @@ void define_gicv5_cpuif_regs(ARMCPU *cpu)
388 {
389 if (cpu_isar_feature(aa64_gcie, cpu)) {
390 define_arm_cp_regs(cpu, gicv5_cpuif_reginfo);
391 +
392 + /*
393 + * There are 16 ICC_PPI_PRIORITYR<n>_EL1 regs, so define them
394 + * programmatically rather than listing them all statically.
395 + */
396 + for (int i = 0; i < 16; i++) {
397 + g_autofree char *name = g_strdup_printf("ICC_PPI_PRIORITYR%d_EL1", i);
398 + ARMCPRegInfo ppi_prio = {
399 + .name = name, .state = ARM_CP_STATE_AA64,
400 + .opc0 = 3, .opc1 = 0, .crn = 12,
401 + .crm = 14 + (i >> 3), .opc2 = i & 7,
402 + .access = PL1_RW, .type = ARM_CP_IO,
403 + .fieldoffset = offsetof(CPUARMState, gicv5_cpuif.ppi_priority[i]),
404 + .writefn = gic_ppi_priority_write, .raw_writefn = raw_write,
405 + };
406 + define_one_arm_cp_reg(cpu, &ppi_prio);
407 + }
408 }
409 }