target/arm: GICv5 cpuif: Implement GIC CDEOI
Implement the GIC CDEOI instruction, which performs a "priority drop", clearing the highest set bit in the APR register. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Message-id: 20260327111700.795099-50-peter.maydell@linaro.org
Peter Maydell committed
Mar 27, 2026 at 11:16 UTC
7070e62c1b2beccc27a32de6fb216a348863717c
2 files changed
+22
target/arm/tcg/gicv5-cpuif.c
+21
@@ -554,6 +554,22 @@ static uint64_t gicr_cdia_read(CPUARMState *env, const ARMCPRegInfo *ri)
554
return hppi.intid | R_GICR_CDIA_VALID_MASK;
555
}
556
557
+static void gic_cdeoi_write(CPUARMState *env, const ARMCPRegInfo *ri,
558
+ uint64_t value)
559
+{
560
+ /*
561
+ * Perform Priority Drop in the current interrupt domain.
562
+ * This is just clearing the lowest set bit in the APR.
563
+ */
564
+ GICv5Domain domain = gicv5_current_phys_domain(env);
565
+ uint64_t *apr = &env->gicv5_cpuif.icc_apr[domain];
566
+
567
+ trace_gicv5_cdeoi(domain);
568
+
569
+ /* clear lowest bit, doing nothing if already zero */
570
+ *apr &= *apr - 1;
571
+}
572
+
573
static const ARMCPRegInfo gicv5_cpuif_reginfo[] = {
574
/*
575
* Barrier: wait until the effects of a cpuif system register
@@ -606,6 +622,11 @@ static const ARMCPRegInfo gicv5_cpuif_reginfo[] = {
622
.access = PL1_W, .type = ARM_CP_IO | ARM_CP_NO_RAW,
623
.writefn = gic_cdrcfg_write,
624
},
625
+ { .name = "GIC_CDEOI", .state = ARM_CP_STATE_AA64,
626
+ .opc0 = 1, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 7,
627
+ .access = PL1_W, .type = ARM_CP_IO | ARM_CP_NO_RAW,
628
+ .writefn = gic_cdeoi_write,
629
+ },
630
{ .name = "GIC_CDHM", .state = ARM_CP_STATE_AA64,
631
.opc0 = 1, .opc1 = 0, .crn = 12, .crm = 2, .opc2 = 1,
632
.access = PL1_W, .type = ARM_CP_IO | ARM_CP_NO_RAW,
target/arm/tcg/trace-events
+1
@@ -5,3 +5,4 @@
5
gicv5_recalc_ppi_hppi(int domain, uint32_t id, uint8_t prio) "domain %d new PPI HPPI id 0x%x prio %u"
6
gicv5_gicr_cdia_fail(int domain, const char *reason) "domain %d CDIA attempt failed: %s"
7
gicv5_gicr_cdia(int domain, uint32_t id) "domain %d CDIA acknowledge of interrupt 0x%x"
8
+gicv5_cdeoi(int domain) "domain %d CDEOI performing priority drop"