Message ID | 20190917004605.22471-1-alistair@popple.id.au (mailing list archive) |
---|---|
State | Accepted |
Commit | c6fadabb2868f817299ddb338ac15885e25d12d2 |
Headers | show |
Series | [1/2] powerpc: Fix definition of PCR bits to work with old binutils | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (31f571deea2bc840fbe52c6385d6723b4e69a15c) |
snowpatch_ozlabs/checkpatch | warning | total: 0 errors, 0 warnings, 3 checks, 12 lines checked |
On Tue, 2019-09-17 at 00:46:04 UTC, Alistair Popple wrote: > Commit 388cc6e133132 ("KVM: PPC: Book3S HV: Support POWER6 > compatibility mode on POWER7") introduced new macros defining the PCR > bits. When used from assembly files these definitions lead to build > errors using older versions of binutils that don't support the 'ul' > suffix. This fixes the build errors by updating the definitions to use > the __MASK() macro which selects the appropriate suffix. > > Signed-off-by: Alistair Popple <alistair@popple.id.au> Series applied to powerpc fixes, thanks. https://git.kernel.org/powerpc/c/c6fadabb2868f817299ddb338ac15885e25d12d2 cheers
On 25/09/2019 21:05, Michael Ellerman wrote: > On Tue, 2019-09-17 at 00:46:04 UTC, Alistair Popple wrote: >> Commit 388cc6e133132 ("KVM: PPC: Book3S HV: Support POWER6 >> compatibility mode on POWER7") introduced new macros defining the PCR >> bits. When used from assembly files these definitions lead to build >> errors using older versions of binutils that don't support the 'ul' >> suffix. This fixes the build errors by updating the definitions to use >> the __MASK() macro which selects the appropriate suffix. >> >> Signed-off-by: Alistair Popple <alistair@popple.id.au> > > Series applied to powerpc fixes, thanks. > > https://git.kernel.org/powerpc/c/c6fadabb2868f817299ddb338ac15885e25d12d2 It breaks KVM on POWER8's garrison: === KVM: CPU 1 seems to be stuck KVM: CPU 2 seems to be stuck KVM: CPU 3 seems to be stuck KVM: CPU 4 seems to be stuck KVM: CPU 5 seems to be stuck KVM: CPU 6 seems to be stuck KVM: CPU 7 seems to be stuck === in a loop. Run as: "taskset -c 0 qemu-system-ppc64 -smp 8,threads=8" The patch below fixes it and I have no idea why. 0x1ffffffffffffff1 is the PCR after the mask applied to it. diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 709cf1fd4cf4..9df9865b2e5b 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -406,6 +406,7 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) * Also set all reserved PCR bits */ vc->pcr = (host_pcr_bit - guest_pcr_bit) | PCR_MASK; + vc->pcr &= 0xffffffffffffff00UL; spin_unlock(&vc->lock); return 0; @@ -3413,7 +3414,7 @@ static int kvmhv_load_hv_regs_and_go(struct kvm_vcpu *vcpu, u64 time_limit, } if (vc->pcr) - mtspr(SPRN_PCR, vc->pcr | PCR_MASK); + mtspr(SPRN_PCR, vc->pcr); mtspr(SPRN_DPDES, vc->dpdes); mtspr(SPRN_VTB, vc->vtb);
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 10caa145f98b..a18c366aa0d7 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -472,9 +472,9 @@ #define HMER_DEBUG_TRIG (1ul << (63 - 17)) /* Debug trigger */ #define SPRN_HMEER 0x151 /* Hyp maintenance exception enable reg */ #define SPRN_PCR 0x152 /* Processor compatibility register */ -#define PCR_VEC_DIS (1ul << (63-0)) /* Vec. disable (bit NA since POWER8) */ -#define PCR_VSX_DIS (1ul << (63-1)) /* VSX disable (bit NA since POWER8) */ -#define PCR_TM_DIS (1ul << (63-2)) /* Trans. memory disable (POWER8) */ +#define PCR_VEC_DIS (__MASK(63-0)) /* Vec. disable (bit NA since POWER8) */ +#define PCR_VSX_DIS (__MASK(63-1)) /* VSX disable (bit NA since POWER8) */ +#define PCR_TM_DIS (__MASK(63-2)) /* Trans. memory disable (POWER8) */ /* * These bits are used in the function kvmppc_set_arch_compat() to specify and * determine both the compatibility level which we want to emulate and the
Commit 388cc6e133132 ("KVM: PPC: Book3S HV: Support POWER6 compatibility mode on POWER7") introduced new macros defining the PCR bits. When used from assembly files these definitions lead to build errors using older versions of binutils that don't support the 'ul' suffix. This fixes the build errors by updating the definitions to use the __MASK() macro which selects the appropriate suffix. Signed-off-by: Alistair Popple <alistair@popple.id.au> --- arch/powerpc/include/asm/reg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)