43
FIELD(ICC_IDR0_EL1, PRI_BITS, 4, 4)
44
FIELD(ICC_IDR0_EL1, GCIE_LEGACY, 8, 4)
45
46
+FIELD(ICC_CR0, EN, 0, 1)
47
+FIELD(ICC_CR0, LINK, 1, 1)
48
+FIELD(ICC_CR0, LINK_IDLE, 2, 1)
49
+FIELD(ICC_CR0, IPPT, 32, 6)
50
+FIELD(ICC_CR0, PID, 38, 1)
51
+
52
/*
53
* We implement 24 bits of interrupt ID, the mandated 5 bits of priority,
54
* and no legacy GICv3.3 vcpu interface (yet)
352
return gic_running_prio(env, gicv5_current_phys_domain(env));
353
}
354
355
+/* ICC_CR0_EL1 is also banked */
356
+static uint64_t gic_icc_cr0_el1_read(CPUARMState *env, const ARMCPRegInfo *ri)
357
+{
358
+ GICv5Domain domain = gicv5_logical_domain(env);
359
+ return env->gicv5_cpuif.icc_cr0[domain];
360
+}
361
+
362
+static void gic_icc_cr0_el1_write(CPUARMState *env, const ARMCPRegInfo *ri,
363
+ uint64_t value)
364
+{
365
+ /*
366
+ * For our implementation the link to the IRI is always connected,
367
+ * so LINK and LINK_IDLE are always 1. Without EL3, PID and IPPT
368
+ * are RAZ/WI, so the only writeable bit is the main enable bit EN.
369
+ */
370
+ GICv5Domain domain = gicv5_logical_domain(env);
371
+ value &= R_ICC_CR0_EN_MASK;
372
+ value |= R_ICC_CR0_LINK_MASK | R_ICC_CR0_LINK_IDLE_MASK;
373
+
374
+ env->gicv5_cpuif.icc_cr0[domain] = value;
375
+}
376
+
377
+static void gic_icc_cr0_el1_reset(CPUARMState *env, const ARMCPRegInfo *ri)
378
+{
379
+ /* The link is always connected so we reset with LINK and LINK_IDLE set */
380
+ for (int i = 0; i < ARRAY_SIZE(env->gicv5_cpuif.icc_cr0); i++) {
381
+ env->gicv5_cpuif.icc_cr0[i] =
382
+ R_ICC_CR0_LINK_MASK | R_ICC_CR0_LINK_IDLE_MASK;
383
+ }
384
+}
385
+
386
static const ARMCPRegInfo gicv5_cpuif_reginfo[] = {
387
/*
388
* Barrier: wait until the effects of a cpuif system register
541
.writefn = gic_icc_apr_el1_write,
542
.resetfn = gic_icc_apr_el1_reset,
543
},
544
+ { .name = "ICC_CR0_EL1", .state = ARM_CP_STATE_AA64,
545
+ .opc0 = 3, .opc1 = 1, .crn = 12, .crm = 0, .opc2 = 1,
546
+ .access = PL1_RW, .type = ARM_CP_IO | ARM_CP_NO_RAW,
547
+ .readfn = gic_icc_cr0_el1_read,
548
+ .writefn = gic_icc_cr0_el1_write,
549
+ .resetfn = gic_icc_cr0_el1_reset,
550
+ },
551
{ .name = "ICC_HAPR_EL1", .state = ARM_CP_STATE_AA64,
552
.opc0 = 3, .opc1 = 1, .crn = 12, .crm = 0, .opc2 = 3,
553
.access = PL1_R, .type = ARM_CP_IO | ARM_CP_NO_RAW,