These definitions are required for correct decoding of APLIC MMIO
accesses and target configuration, and will be used by both the
physical and virtual APLIC implementations.

No functional change is intended by this patch; it only centralises
hardware definitions that were previously missing.

Co-developed-by: Romain Caritey <[email protected]>
Signed-off-by: Oleksii Kurochko <[email protected]>
---
 xen/arch/riscv/include/asm/aplic.h | 35 ++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/xen/arch/riscv/include/asm/aplic.h 
b/xen/arch/riscv/include/asm/aplic.h
index 55cd4a128de7..7e9161d98ceb 100644
--- a/xen/arch/riscv/include/asm/aplic.h
+++ b/xen/arch/riscv/include/asm/aplic.h
@@ -17,6 +17,11 @@
 
 #define APLIC_NUM_REGS 32
 
+#define APLIC_REG_OFFSET_MASK   0x3FFF
+#define APLIC_TARGET_IPRIO_MASK 0xFF
+#define APLIC_TARGET_GUEST_IDX_SHIFT 12
+#define APLIC_TARGET_EIID_MASK  0x7FF
+
 #define APLIC_DOMAINCFG_IE      BIT(8, U)
 #define APLIC_DOMAINCFG_DM      BIT(2, U)
 
@@ -27,6 +32,36 @@
 #define APLIC_SOURCECFG_SM_LEVEL_HIGH   0x6
 #define APLIC_SOURCECFG_SM_LEVEL_LOW    0x7
 
+#define APLIC_DOMAINCFG         0x0000
+#define APLIC_SOURCECFG_BASE    0x0004
+#define APLIC_SOURCECFG_LAST    0x0FFC
+
+#define APLIC_SMSICFGADDR       0x1BC8
+#define APLIC_SMSICFGADDRH      0x1BCC
+
+#define APLIC_SETIP_BASE        0x1C00
+#define APLIC_SETIP_LAST        0x1C7C
+#define APLIC_SETIPNUM          0x1CDC
+
+#define APLIC_CLRIP_BASE        0x1D00
+#define APLIC_CLRIP_LAST        0x1D7C
+#define APLIC_CLRIPNUM          0x1DDC
+
+#define APLIC_SETIE_BASE        0x1E00
+#define APLIC_SETIE_LAST        0x1E7C
+#define APLIC_SETIENUM          0x1EDC
+
+#define APLIC_CLRIE_BASE        0x1F00
+#define APLIC_CLRIE_LAST        0x1F7C
+#define APLIC_CLRIENUM          0x1FDC
+
+#define APLIC_SETIPNUM_LE       0x2000
+
+#define APLIC_GENMSI            0x3000
+
+#define APLIC_TARGET_BASE       0x3004
+#define APLIC_TARGET_LAST       0x3FFC
+
 #define APLIC_TARGET_HART_IDX_SHIFT 18
 
 struct aplic_regs {
-- 
2.53.0


Reply via email to