133a1ca73SRicardo Koller /* SPDX-License-Identifier: GPL-2.0 */ 233a1ca73SRicardo Koller /* 333a1ca73SRicardo Koller * ARM Generic Interrupt Controller (GIC) v3 specific defines 433a1ca73SRicardo Koller */ 533a1ca73SRicardo Koller 633a1ca73SRicardo Koller #ifndef SELFTEST_KVM_GICV3_H 733a1ca73SRicardo Koller #define SELFTEST_KVM_GICV3_H 833a1ca73SRicardo Koller 933a1ca73SRicardo Koller #include <asm/sysreg.h> 1033a1ca73SRicardo Koller 1133a1ca73SRicardo Koller /* 1233a1ca73SRicardo Koller * Distributor registers 1333a1ca73SRicardo Koller */ 1433a1ca73SRicardo Koller #define GICD_CTLR 0x0000 1533a1ca73SRicardo Koller #define GICD_TYPER 0x0004 1633a1ca73SRicardo Koller #define GICD_IGROUPR 0x0080 1733a1ca73SRicardo Koller #define GICD_ISENABLER 0x0100 1833a1ca73SRicardo Koller #define GICD_ICENABLER 0x0180 19*17ce617bSRicardo Koller #define GICD_ISPENDR 0x0200 20*17ce617bSRicardo Koller #define GICD_ICPENDR 0x0280 2133a1ca73SRicardo Koller #define GICD_ICACTIVER 0x0380 22*17ce617bSRicardo Koller #define GICD_ISACTIVER 0x0300 2333a1ca73SRicardo Koller #define GICD_IPRIORITYR 0x0400 24*17ce617bSRicardo Koller #define GICD_ICFGR 0x0C00 2533a1ca73SRicardo Koller 2633a1ca73SRicardo Koller /* 2733a1ca73SRicardo Koller * The assumption is that the guest runs in a non-secure mode. 2833a1ca73SRicardo Koller * The following bits of GICD_CTLR are defined accordingly. 2933a1ca73SRicardo Koller */ 3033a1ca73SRicardo Koller #define GICD_CTLR_RWP (1U << 31) 3133a1ca73SRicardo Koller #define GICD_CTLR_nASSGIreq (1U << 8) 3233a1ca73SRicardo Koller #define GICD_CTLR_ARE_NS (1U << 4) 3333a1ca73SRicardo Koller #define GICD_CTLR_ENABLE_G1A (1U << 1) 3433a1ca73SRicardo Koller #define GICD_CTLR_ENABLE_G1 (1U << 0) 3533a1ca73SRicardo Koller 3633a1ca73SRicardo Koller #define GICD_TYPER_SPIS(typer) ((((typer) & 0x1f) + 1) * 32) 3733a1ca73SRicardo Koller #define GICD_INT_DEF_PRI_X4 0xa0a0a0a0 3833a1ca73SRicardo Koller 3933a1ca73SRicardo Koller /* 4033a1ca73SRicardo Koller * Redistributor registers 4133a1ca73SRicardo Koller */ 4233a1ca73SRicardo Koller #define GICR_CTLR 0x000 4333a1ca73SRicardo Koller #define GICR_WAKER 0x014 4433a1ca73SRicardo Koller 4533a1ca73SRicardo Koller #define GICR_CTLR_RWP (1U << 3) 4633a1ca73SRicardo Koller 4733a1ca73SRicardo Koller #define GICR_WAKER_ProcessorSleep (1U << 1) 4833a1ca73SRicardo Koller #define GICR_WAKER_ChildrenAsleep (1U << 2) 4933a1ca73SRicardo Koller 5033a1ca73SRicardo Koller /* 5133a1ca73SRicardo Koller * Redistributor registers, offsets from SGI base 5233a1ca73SRicardo Koller */ 5333a1ca73SRicardo Koller #define GICR_IGROUPR0 GICD_IGROUPR 5433a1ca73SRicardo Koller #define GICR_ISENABLER0 GICD_ISENABLER 5533a1ca73SRicardo Koller #define GICR_ICENABLER0 GICD_ICENABLER 56*17ce617bSRicardo Koller #define GICR_ISPENDR0 GICD_ISPENDR 57*17ce617bSRicardo Koller #define GICR_ISACTIVER0 GICD_ISACTIVER 5833a1ca73SRicardo Koller #define GICR_ICACTIVER0 GICD_ICACTIVER 59*17ce617bSRicardo Koller #define GICR_ICENABLER GICD_ICENABLER 60*17ce617bSRicardo Koller #define GICR_ICACTIVER GICD_ICACTIVER 6133a1ca73SRicardo Koller #define GICR_IPRIORITYR0 GICD_IPRIORITYR 6233a1ca73SRicardo Koller 6333a1ca73SRicardo Koller /* CPU interface registers */ 6433a1ca73SRicardo Koller #define SYS_ICC_PMR_EL1 sys_reg(3, 0, 4, 6, 0) 6533a1ca73SRicardo Koller #define SYS_ICC_IAR1_EL1 sys_reg(3, 0, 12, 12, 0) 6633a1ca73SRicardo Koller #define SYS_ICC_EOIR1_EL1 sys_reg(3, 0, 12, 12, 1) 67*17ce617bSRicardo Koller #define SYS_ICC_DIR_EL1 sys_reg(3, 0, 12, 11, 1) 68*17ce617bSRicardo Koller #define SYS_ICC_CTLR_EL1 sys_reg(3, 0, 12, 12, 4) 6933a1ca73SRicardo Koller #define SYS_ICC_SRE_EL1 sys_reg(3, 0, 12, 12, 5) 7033a1ca73SRicardo Koller #define SYS_ICC_GRPEN1_EL1 sys_reg(3, 0, 12, 12, 7) 7133a1ca73SRicardo Koller 72*17ce617bSRicardo Koller #define SYS_ICV_AP1R0_EL1 sys_reg(3, 0, 12, 9, 0) 73*17ce617bSRicardo Koller 7433a1ca73SRicardo Koller #define ICC_PMR_DEF_PRIO 0xf0 7533a1ca73SRicardo Koller 7633a1ca73SRicardo Koller #define ICC_SRE_EL1_SRE (1U << 0) 7733a1ca73SRicardo Koller 7833a1ca73SRicardo Koller #define ICC_IGRPEN1_EL1_ENABLE (1U << 0) 7933a1ca73SRicardo Koller 8033a1ca73SRicardo Koller #define GICV3_MAX_CPUS 512 8133a1ca73SRicardo Koller 8233a1ca73SRicardo Koller #endif /* SELFTEST_KVM_GICV3_H */ 83