aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2016-01-05 17:53:33 -0500
committerMarc Zyngier <marc.zyngier@arm.com>2016-02-29 13:34:15 -0500
commit4448932fb09a44d73f820afd8fa145a24b3b3995 (patch)
treecd6a192cfcd466c2d970a77ad755c2415df7e529
parentfa85e25dad0f3f4e7ff2c58a914dcfe53210f680 (diff)
ARM: KVM: Turn CP15 defines to an enum
Just like on arm64, having the CP15 registers expressed as a set of #defines has been very conflict-prone. Let's turn it into an enum, which should make it more manageable. Acked-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--arch/arm/include/asm/kvm_asm.h33
-rw-r--r--arch/arm/include/asm/kvm_host.h39
-rw-r--r--arch/arm/kvm/guest.c1
3 files changed, 39 insertions, 34 deletions
diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h
index 3283a2f63254..083825f12c93 100644
--- a/arch/arm/include/asm/kvm_asm.h
+++ b/arch/arm/include/asm/kvm_asm.h
@@ -21,39 +21,6 @@
21 21
22#include <asm/virt.h> 22#include <asm/virt.h>
23 23
24/* 0 is reserved as an invalid value. */
25#define c0_MPIDR 1 /* MultiProcessor ID Register */
26#define c0_CSSELR 2 /* Cache Size Selection Register */
27#define c1_SCTLR 3 /* System Control Register */
28#define c1_ACTLR 4 /* Auxiliary Control Register */
29#define c1_CPACR 5 /* Coprocessor Access Control */
30#define c2_TTBR0 6 /* Translation Table Base Register 0 */
31#define c2_TTBR0_high 7 /* TTBR0 top 32 bits */
32#define c2_TTBR1 8 /* Translation Table Base Register 1 */
33#define c2_TTBR1_high 9 /* TTBR1 top 32 bits */
34#define c2_TTBCR 10 /* Translation Table Base Control R. */
35#define c3_DACR 11 /* Domain Access Control Register */
36#define c5_DFSR 12 /* Data Fault Status Register */
37#define c5_IFSR 13 /* Instruction Fault Status Register */
38#define c5_ADFSR 14 /* Auxilary Data Fault Status R */
39#define c5_AIFSR 15 /* Auxilary Instrunction Fault Status R */
40#define c6_DFAR 16 /* Data Fault Address Register */
41#define c6_IFAR 17 /* Instruction Fault Address Register */
42#define c7_PAR 18 /* Physical Address Register */
43#define c7_PAR_high 19 /* PAR top 32 bits */
44#define c9_L2CTLR 20 /* Cortex A15/A7 L2 Control Register */
45#define c10_PRRR 21 /* Primary Region Remap Register */
46#define c10_NMRR 22 /* Normal Memory Remap Register */
47#define c12_VBAR 23 /* Vector Base Address Register */
48#define c13_CID 24 /* Context ID Register */
49#define c13_TID_URW 25 /* Thread ID, User R/W */
50#define c13_TID_URO 26 /* Thread ID, User R/O */
51#define c13_TID_PRIV 27 /* Thread ID, Privileged */
52#define c14_CNTKCTL 28 /* Timer Control Register (PL1) */
53#define c10_AMAIR0 29 /* Auxilary Memory Attribute Indirection Reg0 */
54#define c10_AMAIR1 30 /* Auxilary Memory Attribute Indirection Reg1 */
55#define NR_CP15_REGS 31 /* Number of regs (incl. invalid) */
56
57#define ARM_EXCEPTION_RESET 0 24#define ARM_EXCEPTION_RESET 0
58#define ARM_EXCEPTION_UNDEFINED 1 25#define ARM_EXCEPTION_UNDEFINED 1
59#define ARM_EXCEPTION_SOFTWARE 2 26#define ARM_EXCEPTION_SOFTWARE 2
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h
index 0fe41aaf2171..daf6a71071da 100644
--- a/arch/arm/include/asm/kvm_host.h
+++ b/arch/arm/include/asm/kvm_host.h
@@ -88,6 +88,45 @@ struct kvm_vcpu_fault_info {
88 u32 hyp_pc; /* PC when exception was taken from Hyp mode */ 88 u32 hyp_pc; /* PC when exception was taken from Hyp mode */
89}; 89};
90 90
91/*
92 * 0 is reserved as an invalid value.
93 * Order should be kept in sync with the save/restore code.
94 */
95enum vcpu_sysreg {
96 __INVALID_SYSREG__,
97 c0_MPIDR, /* MultiProcessor ID Register */
98 c0_CSSELR, /* Cache Size Selection Register */
99 c1_SCTLR, /* System Control Register */
100 c1_ACTLR, /* Auxiliary Control Register */
101 c1_CPACR, /* Coprocessor Access Control */
102 c2_TTBR0, /* Translation Table Base Register 0 */
103 c2_TTBR0_high, /* TTBR0 top 32 bits */
104 c2_TTBR1, /* Translation Table Base Register 1 */
105 c2_TTBR1_high, /* TTBR1 top 32 bits */
106 c2_TTBCR, /* Translation Table Base Control R. */
107 c3_DACR, /* Domain Access Control Register */
108 c5_DFSR, /* Data Fault Status Register */
109 c5_IFSR, /* Instruction Fault Status Register */
110 c5_ADFSR, /* Auxilary Data Fault Status R */
111 c5_AIFSR, /* Auxilary Instrunction Fault Status R */
112 c6_DFAR, /* Data Fault Address Register */
113 c6_IFAR, /* Instruction Fault Address Register */
114 c7_PAR, /* Physical Address Register */
115 c7_PAR_high, /* PAR top 32 bits */
116 c9_L2CTLR, /* Cortex A15/A7 L2 Control Register */
117 c10_PRRR, /* Primary Region Remap Register */
118 c10_NMRR, /* Normal Memory Remap Register */
119 c12_VBAR, /* Vector Base Address Register */
120 c13_CID, /* Context ID Register */
121 c13_TID_URW, /* Thread ID, User R/W */
122 c13_TID_URO, /* Thread ID, User R/O */
123 c13_TID_PRIV, /* Thread ID, Privileged */
124 c14_CNTKCTL, /* Timer Control Register (PL1) */
125 c10_AMAIR0, /* Auxilary Memory Attribute Indirection Reg0 */
126 c10_AMAIR1, /* Auxilary Memory Attribute Indirection Reg1 */
127 NR_CP15_REGS /* Number of regs (incl. invalid) */
128};
129
91struct kvm_cpu_context { 130struct kvm_cpu_context {
92 struct kvm_regs gp_regs; 131 struct kvm_regs gp_regs;
93 struct vfp_hard_struct vfp; 132 struct vfp_hard_struct vfp;
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index 86e26fbd5ba3..12cbb6824443 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -25,7 +25,6 @@
25#include <asm/cputype.h> 25#include <asm/cputype.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/kvm.h> 27#include <asm/kvm.h>
28#include <asm/kvm_asm.h>
29#include <asm/kvm_emulate.h> 28#include <asm/kvm_emulate.h>
30#include <asm/kvm_coproc.h> 29#include <asm/kvm_coproc.h>
31 30