diff options
author | Paul Mackerras <paulus@samba.org> | 2014-01-08 05:25:24 -0500 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-01-27 10:01:06 -0500 |
commit | 5557ae0ec77c2b4b5bbce2883c0603054ab66e68 (patch) | |
tree | f9b858e122722953e0b945772a6b2cd7035c981b | |
parent | bd3048b80caace9cf0ae9ad22b2fbb8333b44a97 (diff) |
KVM: PPC: Book3S HV: Implement architecture compatibility modes for POWER8
This allows us to select architecture 2.05 (POWER6) or 2.06 (POWER7)
compatibility modes on a POWER8 processor. (Note that transactional
memory is disabled for usermode if either or both of the PCR_TM_DIS
and PCR_ARCH_206 bits are set.)
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | arch/powerpc/include/asm/reg.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kvm/book3s_hv.c | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 2f41e6475648..5a9983147683 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -329,6 +329,8 @@ | |||
329 | #define SPRN_PCR 0x152 /* Processor compatibility register */ | 329 | #define SPRN_PCR 0x152 /* Processor compatibility register */ |
330 | #define PCR_VEC_DIS (1ul << (63-0)) /* Vec. disable (bit NA since POWER8) */ | 330 | #define PCR_VEC_DIS (1ul << (63-0)) /* Vec. disable (bit NA since POWER8) */ |
331 | #define PCR_VSX_DIS (1ul << (63-1)) /* VSX disable (bit NA since POWER8) */ | 331 | #define PCR_VSX_DIS (1ul << (63-1)) /* VSX disable (bit NA since POWER8) */ |
332 | #define PCR_TM_DIS (1ul << (63-2)) /* Trans. memory disable (POWER8) */ | ||
333 | #define PCR_ARCH_206 0x4 /* Architecture 2.06 */ | ||
332 | #define PCR_ARCH_205 0x2 /* Architecture 2.05 */ | 334 | #define PCR_ARCH_205 0x2 /* Architecture 2.05 */ |
333 | #define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */ | 335 | #define SPRN_HEIR 0x153 /* Hypervisor Emulated Instruction Register */ |
334 | #define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */ | 336 | #define SPRN_TLBINDEXR 0x154 /* P7 TLB control register */ |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 1bf681e8a05f..1e9f4b45432b 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -184,14 +184,28 @@ int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) | |||
184 | 184 | ||
185 | switch (arch_compat) { | 185 | switch (arch_compat) { |
186 | case PVR_ARCH_205: | 186 | case PVR_ARCH_205: |
187 | pcr = PCR_ARCH_205; | 187 | /* |
188 | * If an arch bit is set in PCR, all the defined | ||
189 | * higher-order arch bits also have to be set. | ||
190 | */ | ||
191 | pcr = PCR_ARCH_206 | PCR_ARCH_205; | ||
188 | break; | 192 | break; |
189 | case PVR_ARCH_206: | 193 | case PVR_ARCH_206: |
190 | case PVR_ARCH_206p: | 194 | case PVR_ARCH_206p: |
195 | pcr = PCR_ARCH_206; | ||
196 | break; | ||
197 | case PVR_ARCH_207: | ||
191 | break; | 198 | break; |
192 | default: | 199 | default: |
193 | return -EINVAL; | 200 | return -EINVAL; |
194 | } | 201 | } |
202 | |||
203 | if (!cpu_has_feature(CPU_FTR_ARCH_207S)) { | ||
204 | /* POWER7 can't emulate POWER8 */ | ||
205 | if (!(pcr & PCR_ARCH_206)) | ||
206 | return -EINVAL; | ||
207 | pcr &= ~PCR_ARCH_206; | ||
208 | } | ||
195 | } | 209 | } |
196 | 210 | ||
197 | spin_lock(&vc->lock); | 211 | spin_lock(&vc->lock); |