Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: PPC: Book3SHV: Enable support for ISA v3.1 guests

Adds support for emulating ISAv3.1 guests by adding the appropriate PCR
and FSCR bits.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

authored by

Alistair Popple and committed by
Paul Mackerras
4cb4ade1 b3a9e3b9

+11 -2
+1
arch/powerpc/include/asm/reg.h
··· 1354 1354 #define PVR_ARCH_206p 0x0f100003 1355 1355 #define PVR_ARCH_207 0x0f000004 1356 1356 #define PVR_ARCH_300 0x0f000005 1357 + #define PVR_ARCH_31 0x0f000006 1357 1358 1358 1359 /* Macros for setting and retrieving special purpose registers */ 1359 1360 #ifndef __ASSEMBLY__
+10 -2
arch/powerpc/kvm/book3s_hv.c
··· 342 342 vcpu->arch.pvr = pvr; 343 343 } 344 344 345 + /* Dummy value used in computing PCR value below */ 346 + #define PCR_ARCH_31 (PCR_ARCH_300 << 1) 347 + 345 348 static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) 346 349 { 347 350 unsigned long host_pcr_bit = 0, guest_pcr_bit = 0; 348 351 struct kvmppc_vcore *vc = vcpu->arch.vcore; 349 352 350 353 /* We can (emulate) our own architecture version and anything older */ 351 - if (cpu_has_feature(CPU_FTR_ARCH_300)) 354 + if (cpu_has_feature(CPU_FTR_ARCH_31)) 355 + host_pcr_bit = PCR_ARCH_31; 356 + else if (cpu_has_feature(CPU_FTR_ARCH_300)) 352 357 host_pcr_bit = PCR_ARCH_300; 353 358 else if (cpu_has_feature(CPU_FTR_ARCH_207S)) 354 359 host_pcr_bit = PCR_ARCH_207; ··· 378 373 break; 379 374 case PVR_ARCH_300: 380 375 guest_pcr_bit = PCR_ARCH_300; 376 + break; 377 + case PVR_ARCH_31: 378 + guest_pcr_bit = PCR_ARCH_31; 381 379 break; 382 380 default: 383 381 return -EINVAL; ··· 2326 2318 * to trap and then we emulate them. 2327 2319 */ 2328 2320 vcpu->arch.hfscr = HFSCR_TAR | HFSCR_EBB | HFSCR_PM | HFSCR_BHRB | 2329 - HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP; 2321 + HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP | HFSCR_PREFIX; 2330 2322 if (cpu_has_feature(CPU_FTR_HVMODE)) { 2331 2323 vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); 2332 2324 if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST))