@samitouri / QOSamiQemu / commits / 394ad2e928

target/arm: GICv5 cpuif: Implement PPI handling mode register

In the GICv5 the handling mode of a PPI is not software configurable; it is reported via read-only CPU interface registers ICC_PPI_HMR0_EL1 and ICC_PPI_HMR1_EL1. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Message-id: 20260327111700.795099-38-peter.maydell@linaro.org

Peter Maydell committed Mar 27, 2026 at 11:16 UTC 394ad2e928c571cfbd202c562b220cca7d555707
2 files changed +23
target/arm/cpu.h
+1
@@ -604,6 +604,7 @@ typedef struct CPUArchState {
604 uint64_t icc_icsr_el1;
605 /* Most PPI registers have 1 bit per PPI, so 64 PPIs to a register */
606 uint64_t ppi_active[GICV5_NUM_PPIS / 64];
607 + uint64_t ppi_hm[GICV5_NUM_PPIS / 64];
608 } gicv5_cpuif;
609
610 struct {
target/arm/tcg/gicv5-cpuif.c
+22
@@ -50,6 +50,16 @@ FIELD(ICC_IDR0_EL1, GCIE_LEGACY, 8, 4)
50 ((4 << R_ICC_IDR0_EL1_PRI_BITS_SHIFT) | \
51 (1 << R_ICC_IDR0_EL1_ID_BITS_SHIFT))
52
53 +/*
54 + * PPI handling modes are fixed and not software configurable.
55 + * R_CFSKX defines them for the architected PPIs: they are all Level,
56 + * except that PPI 24 (CTIIRQ) is IMPDEF and PPI 3 (SW_PPI) is Edge.
57 + * For unimplemented PPIs the field is RES0. The PPI register bits
58 + * are 1 for Level and 0 for Edge.
59 + */
60 +#define PPI_HMR0_RESET (~(1ULL << GICV5_PPI_SW_PPI))
61 +#define PPI_HMR1_RESET (~0ULL)
62 +
63 static GICv5Common *gicv5_get_gic(CPUARMState *env)
64 {
65 return env->gicv5state;
@@ -292,6 +302,18 @@ static const ARMCPRegInfo gicv5_cpuif_reginfo[] = {
302 .fieldoffset = offsetof(CPUARMState, gicv5_cpuif.ppi_active[1]),
303 .writefn = gic_ppi_sactive_write,
304 },
305 + { .name = "ICC_PPI_HMR0_EL1", .state = ARM_CP_STATE_AA64,
306 + .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 10, .opc2 = 0,
307 + .access = PL1_R, .type = ARM_CP_IO | ARM_CP_NO_RAW,
308 + .fieldoffset = offsetof(CPUARMState, gicv5_cpuif.ppi_hm[0]),
309 + .resetvalue = PPI_HMR0_RESET,
310 + },
311 + { .name = "ICC_PPI_HMR1_EL1", .state = ARM_CP_STATE_AA64,
312 + .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 10, .opc2 = 1,
313 + .access = PL1_R, .type = ARM_CP_IO | ARM_CP_NO_RAW,
314 + .fieldoffset = offsetof(CPUARMState, gicv5_cpuif.ppi_hm[1]),
315 + .resetvalue = PPI_HMR1_RESET,
316 + },
317 };
318
319 void define_gicv5_cpuif_regs(ARMCPU *cpu)