FIELD(ICC_IDR0_EL1, PRI_BITS, 4, 4)
FIELD(ICC_IDR0_EL1, GCIE_LEGACY, 8, 4)
+FIELD(ICC_CR0, EN, 0, 1)
+FIELD(ICC_CR0, LINK, 1, 1)
+FIELD(ICC_CR0, LINK_IDLE, 2, 1)
+FIELD(ICC_CR0, IPPT, 32, 6)
+FIELD(ICC_CR0, PID, 38, 1)
+
/*
* We implement 24 bits of interrupt ID, the mandated 5 bits of priority,
* and no legacy GICv3.3 vcpu interface (yet)
return gic_running_prio(env, gicv5_current_phys_domain(env));
}
+/* ICC_CR0_EL1 is also banked */
+static uint64_t gic_icc_cr0_el1_read(CPUARMState *env, const ARMCPRegInfo *ri)
+{
+ GICv5Domain domain = gicv5_logical_domain(env);
+ return env->gicv5_cpuif.icc_cr0[domain];
+}
+
+static void gic_icc_cr0_el1_write(CPUARMState *env, const ARMCPRegInfo *ri,
+ uint64_t value)
+{
+ /*
+ * For our implementation the link to the IRI is always connected,
+ * so LINK and LINK_IDLE are always 1. Without EL3, PID and IPPT
+ * are RAZ/WI, so the only writeable bit is the main enable bit EN.
+ */
+ GICv5Domain domain = gicv5_logical_domain(env);
+ value &= R_ICC_CR0_EN_MASK;
+ value |= R_ICC_CR0_LINK_MASK | R_ICC_CR0_LINK_IDLE_MASK;
+
+ env->gicv5_cpuif.icc_cr0[domain] = value;
+}
+
+static void gic_icc_cr0_el1_reset(CPUARMState *env, const ARMCPRegInfo *ri)
+{
+ /* The link is always connected so we reset with LINK and LINK_IDLE set */
+ for (int i = 0; i < ARRAY_SIZE(env->gicv5_cpuif.icc_cr0); i++) {
+ env->gicv5_cpuif.icc_cr0[i] =
+ R_ICC_CR0_LINK_MASK | R_ICC_CR0_LINK_IDLE_MASK;
+ }
+}
+
static const ARMCPRegInfo gicv5_cpuif_reginfo[] = {
/*
* Barrier: wait until the effects of a cpuif system register
.writefn = gic_icc_apr_el1_write,
.resetfn = gic_icc_apr_el1_reset,
},
+ { .name = "ICC_CR0_EL1", .state = ARM_CP_STATE_AA64,
+ .opc0 = 3, .opc1 = 1, .crn = 12, .crm = 0, .opc2 = 1,
+ .access = PL1_RW, .type = ARM_CP_IO | ARM_CP_NO_RAW,
+ .readfn = gic_icc_cr0_el1_read,
+ .writefn = gic_icc_cr0_el1_write,
+ .resetfn = gic_icc_cr0_el1_reset,
+ },
{ .name = "ICC_HAPR_EL1", .state = ARM_CP_STATE_AA64,
.opc0 = 3, .opc1 = 1, .crn = 12, .crm = 0, .opc2 = 3,
.access = PL1_R, .type = ARM_CP_IO | ARM_CP_NO_RAW,