Message ID | 20200602055325.6102-1-alistair@popple.id.au (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | powerpc/kvm: Enable support for ISA v3.1 guests | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (00ec79b0b767994422c43792d73ff1327714a73f) |
snowpatch_ozlabs/build-ppc64le | fail | Build failed! |
snowpatch_ozlabs/build-ppc64be | fail | Build failed! |
snowpatch_ozlabs/build-ppc64e | success | Build succeeded |
snowpatch_ozlabs/build-pmac32 | success | Build succeeded |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 42 lines checked |
snowpatch_ozlabs/needsstable | success | Patch has no Fixes tags |
On Tue, Jun 2, 2020 at 3:55 PM Alistair Popple <alistair@popple.id.au> wrote: > > Adds support for emulating ISAv3.1 guests by adding the appropriate PCR > and FSCR bits. > > Signed-off-by: Alistair Popple <alistair@popple.id.au> > --- > arch/powerpc/include/asm/reg.h | 1 + > arch/powerpc/kvm/book3s_hv.c | 11 ++++++++--- > 2 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h > index 773f76402392..d77040d0588a 100644 > --- a/arch/powerpc/include/asm/reg.h > +++ b/arch/powerpc/include/asm/reg.h > @@ -1348,6 +1348,7 @@ > #define PVR_ARCH_206p 0x0f100003 > #define PVR_ARCH_207 0x0f000004 > #define PVR_ARCH_300 0x0f000005 > +#define PVR_ARCH_31 0x0f000006 > > /* Macros for setting and retrieving special purpose registers */ > #ifndef __ASSEMBLY__ > diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c > index 93493f0cbfe8..359bb2ed43e1 100644 > --- a/arch/powerpc/kvm/book3s_hv.c > +++ b/arch/powerpc/kvm/book3s_hv.c > @@ -345,7 +345,7 @@ static void kvmppc_set_pvr_hv(struct kvm_vcpu *vcpu, u32 pvr) > } > > /* Dummy value used in computing PCR value below */ > -#define PCR_ARCH_300 (PCR_ARCH_207 << 1) > +#define PCR_ARCH_31 (PCR_ARCH_300 << 1) > > static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) > { > @@ -353,7 +353,9 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) > struct kvmppc_vcore *vc = vcpu->arch.vcore; > > /* We can (emulate) our own architecture version and anything older */ > - if (cpu_has_feature(CPU_FTR_ARCH_300)) > + if (cpu_has_feature(CPU_FTR_ARCH_31)) > + host_pcr_bit = PCR_ARCH_31; > + else if (cpu_has_feature(CPU_FTR_ARCH_300)) > host_pcr_bit = PCR_ARCH_300; > else if (cpu_has_feature(CPU_FTR_ARCH_207S)) > host_pcr_bit = PCR_ARCH_207; > @@ -379,6 +381,9 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) > case PVR_ARCH_300: > guest_pcr_bit = PCR_ARCH_300; > break; > + case PVR_ARCH_31: > + guest_pcr_bit = PCR_ARCH_31; > + break; > default: > return -EINVAL; > } > @@ -2318,7 +2323,7 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu) > * to trap and then we emulate them. > */ The comment above this: "... * Set the default HFSCR for the guest from the host value. * This value is only used on POWER9..." would need to be updated. > vcpu->arch.hfscr = HFSCR_TAR | HFSCR_EBB | HFSCR_PM | HFSCR_BHRB | > - HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP; > + HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP | HFSCR_PREFIX; > if (cpu_has_feature(CPU_FTR_HVMODE)) { > vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); > if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST)) > -- > 2.20.1 >
Hi Alistair, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on v5.7 next-20200529] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Alistair-Popple/powerpc-kvm-Enable-support-for-ISA-v3-1-guests/20200602-140435 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-defconfig (attached as .config) compiler: powerpc64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=powerpc If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@intel.com> All error/warnings (new ones prefixed by >>, old ones prefixed by <<): arch/powerpc/kvm/book3s_hv.c: In function 'kvmppc_set_arch_compat': << from arch/powerpc/kvm/book3s_hv.c:81: >> arch/powerpc/kvm/book3s_hv.c:356:22: error: 'CPU_FTR_ARCH_31' undeclared (first use in this function); did you mean 'CPU_FTR_ARCH_300'? 356 | if (cpu_has_feature(CPU_FTR_ARCH_31)) | ^~~~~~~~~~~~~~~ | CPU_FTR_ARCH_300 arch/powerpc/kvm/book3s_hv.c:356:22: note: each undeclared identifier is reported only once for each function it appears in << from arch/powerpc/kvm/book3s_hv.c:81: >> arch/powerpc/kvm/book3s_hv.c:348:25: error: 'PCR_ARCH_300' undeclared (first use in this function); did you mean 'PVR_ARCH_300'? 348 | #define PCR_ARCH_31 (PCR_ARCH_300 << 1) | ^~~~~~~~~~~~ << from arch/powerpc/kvm/book3s_hv.c:81: >> arch/powerpc/kvm/book3s_hv.c:357:18: note: in expansion of macro 'PCR_ARCH_31' 357 | host_pcr_bit = PCR_ARCH_31; | ^~~~~~~~~~~ arch/powerpc/kvm/book3s_hv.c: At top level: arch/powerpc/kvm/book3s_hv.c:3521:5: error: no previous prototype for 'kvmhv_p9_guest_entry' [-Werror=missing-prototypes] 3521 | int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit, | ^~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors vim +356 arch/powerpc/kvm/book3s_hv.c 346 347 /* Dummy value used in computing PCR value below */ > 348 #define PCR_ARCH_31 (PCR_ARCH_300 << 1) 349 350 static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) 351 { 352 unsigned long host_pcr_bit = 0, guest_pcr_bit = 0; 353 struct kvmppc_vcore *vc = vcpu->arch.vcore; 354 355 /* We can (emulate) our own architecture version and anything older */ > 356 if (cpu_has_feature(CPU_FTR_ARCH_31)) > 357 host_pcr_bit = PCR_ARCH_31; 358 else if (cpu_has_feature(CPU_FTR_ARCH_300)) 359 host_pcr_bit = PCR_ARCH_300; 360 else if (cpu_has_feature(CPU_FTR_ARCH_207S)) 361 host_pcr_bit = PCR_ARCH_207; 362 else if (cpu_has_feature(CPU_FTR_ARCH_206)) 363 host_pcr_bit = PCR_ARCH_206; 364 else 365 host_pcr_bit = PCR_ARCH_205; 366 367 /* Determine lowest PCR bit needed to run guest in given PVR level */ 368 guest_pcr_bit = host_pcr_bit; 369 if (arch_compat) { 370 switch (arch_compat) { 371 case PVR_ARCH_205: 372 guest_pcr_bit = PCR_ARCH_205; 373 break; 374 case PVR_ARCH_206: 375 case PVR_ARCH_206p: 376 guest_pcr_bit = PCR_ARCH_206; 377 break; 378 case PVR_ARCH_207: 379 guest_pcr_bit = PCR_ARCH_207; 380 break; 381 case PVR_ARCH_300: 382 guest_pcr_bit = PCR_ARCH_300; 383 break; 384 case PVR_ARCH_31: 385 guest_pcr_bit = PCR_ARCH_31; 386 break; 387 default: 388 return -EINVAL; 389 } 390 } 391 392 /* Check requested PCR bits don't exceed our capabilities */ 393 if (guest_pcr_bit > host_pcr_bit) 394 return -EINVAL; 395 396 spin_lock(&vc->lock); 397 vc->arch_compat = arch_compat; 398 /* 399 * Set all PCR bits for which guest_pcr_bit <= bit < host_pcr_bit 400 * Also set all reserved PCR bits 401 */ 402 vc->pcr = (host_pcr_bit - guest_pcr_bit) | PCR_MASK; 403 spin_unlock(&vc->lock); 404 405 return 0; 406 } 407 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
On Tue, Jun 02, 2020 at 03:53:25PM +1000, Alistair Popple wrote: > Adds support for emulating ISAv3.1 guests by adding the appropriate PCR > and FSCR bits. > > Signed-off-by: Alistair Popple <alistair@popple.id.au> Thanks, patch applied to my kvm-ppc-next branch. Paul.
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 773f76402392..d77040d0588a 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -1348,6 +1348,7 @@ #define PVR_ARCH_206p 0x0f100003 #define PVR_ARCH_207 0x0f000004 #define PVR_ARCH_300 0x0f000005 +#define PVR_ARCH_31 0x0f000006 /* Macros for setting and retrieving special purpose registers */ #ifndef __ASSEMBLY__ diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 93493f0cbfe8..359bb2ed43e1 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -345,7 +345,7 @@ static void kvmppc_set_pvr_hv(struct kvm_vcpu *vcpu, u32 pvr) } /* Dummy value used in computing PCR value below */ -#define PCR_ARCH_300 (PCR_ARCH_207 << 1) +#define PCR_ARCH_31 (PCR_ARCH_300 << 1) static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) { @@ -353,7 +353,9 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) struct kvmppc_vcore *vc = vcpu->arch.vcore; /* We can (emulate) our own architecture version and anything older */ - if (cpu_has_feature(CPU_FTR_ARCH_300)) + if (cpu_has_feature(CPU_FTR_ARCH_31)) + host_pcr_bit = PCR_ARCH_31; + else if (cpu_has_feature(CPU_FTR_ARCH_300)) host_pcr_bit = PCR_ARCH_300; else if (cpu_has_feature(CPU_FTR_ARCH_207S)) host_pcr_bit = PCR_ARCH_207; @@ -379,6 +381,9 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) case PVR_ARCH_300: guest_pcr_bit = PCR_ARCH_300; break; + case PVR_ARCH_31: + guest_pcr_bit = PCR_ARCH_31; + break; default: return -EINVAL; } @@ -2318,7 +2323,7 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu) * to trap and then we emulate them. */ vcpu->arch.hfscr = HFSCR_TAR | HFSCR_EBB | HFSCR_PM | HFSCR_BHRB | - HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP; + HFSCR_DSCR | HFSCR_VECVSX | HFSCR_FP | HFSCR_PREFIX; if (cpu_has_feature(CPU_FTR_HVMODE)) { vcpu->arch.hfscr &= mfspr(SPRN_HFSCR); if (cpu_has_feature(CPU_FTR_P9_TM_HV_ASSIST))
Adds support for emulating ISAv3.1 guests by adding the appropriate PCR and FSCR bits. Signed-off-by: Alistair Popple <alistair@popple.id.au> --- arch/powerpc/include/asm/reg.h | 1 + arch/powerpc/kvm/book3s_hv.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)