Skip to content

Commit bed38c3

Browse files
committed
Merge tag 'powerpc-5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "An assortment of non-regression fixes that have accumulated since the start of the merge window. - A fix for a user triggerable oops on machines where transactional memory is disabled, eg. Power9 bare metal, Power8 with TM disabled on the command line, or all Power7 or earlier machines. - Three fixes for handling of PMU and power saving registers when running nested KVM on Power9. - Two fixes for bugs found while stress testing the XIVE interrupt controller code, also on Power9. - A fix to allow guests to boot under Qemu/KVM on Power9 using the the Hash MMU with >= 1TB of memory. - Two fixes for bugs in the recent DMA cleanup, one of which could lead to checkstops. - And finally three fixes for the PAPR SCM nvdimm driver. Thanks to: Alexey Kardashevskiy, Andrea Arcangeli, Cédric Le Goater, Christoph Hellwig, David Gibson, Gautham R. Shenoy, Michael Neuling, Oliver O'Halloran, Satheesh Rajendran, Shawn Anastasio, Suraj Jitindar Singh, Vaibhav Jain" * tag 'powerpc-5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/papr_scm: Force a scm-unbind if initial scm-bind fails powerpc/papr_scm: Update drc_pmem_unbind() to use H_SCM_UNBIND_ALL powerpc/pseries: Update SCM hcall op-codes in hvcall.h powerpc/tm: Fix oops on sigreturn on systems without TM powerpc/dma: Fix invalid DMA mmap behavior KVM: PPC: Book3S HV: XIVE: fix rollback when kvmppc_xive_create fails powerpc/xive: Fix loop exit-condition in xive_find_target_in_mask() powerpc: fix off by one in max_zone_pfn initialization for ZONE_DMA KVM: PPC: Book3S HV: Save and restore guest visible PSSCR bits on pseries powerpc/pmu: Set pmcregs_in_use in paca when running as LPAR KVM: PPC: Book3S HV: Always save guest pmu for guest capable of nesting powerpc/mm: Limit rma_size to 1TB when running without HV mode
2 parents 7626077 + 3a855b7 commit bed38c3

14 files changed

Lines changed: 103 additions & 25 deletions

File tree

‎arch/powerpc/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ config PPC
121121
select ARCH_32BIT_OFF_T if PPC32
122122
select ARCH_HAS_DEBUG_VIRTUAL
123123
select ARCH_HAS_DEVMEM_IS_ALLOWED
124+
select ARCH_HAS_DMA_MMAP_PGPROT
124125
select ARCH_HAS_ELF_RANDOMIZE
125126
select ARCH_HAS_FORTIFY_SOURCE
126127
select ARCH_HAS_GCOV_PROFILE_ALL

‎arch/powerpc/include/asm/hvcall.h‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,14 @@
302302
#define H_SCM_UNBIND_MEM 0x3F0
303303
#define H_SCM_QUERY_BLOCK_MEM_BINDING 0x3F4
304304
#define H_SCM_QUERY_LOGICAL_MEM_BINDING 0x3F8
305-
#define H_SCM_MEM_QUERY 0x3FC
306-
#define H_SCM_BLOCK_CLEAR 0x400
307-
#define MAX_HCALL_OPCODE H_SCM_BLOCK_CLEAR
305+
#define H_SCM_UNBIND_ALL 0x3FC
306+
#define H_SCM_HEALTH 0x400
307+
#define H_SCM_PERFORMANCE_STATS 0x418
308+
#define MAX_HCALL_OPCODE H_SCM_PERFORMANCE_STATS
309+
310+
/* Scope args for H_SCM_UNBIND_ALL */
311+
#define H_UNBIND_SCOPE_ALL (0x1)
312+
#define H_UNBIND_SCOPE_DRC (0x2)
308313

309314
/* H_VIOCTL functions */
310315
#define H_GET_VIOA_DUMP_SIZE 0x01

‎arch/powerpc/include/asm/pmc.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ static inline void ppc_set_pmu_inuse(int inuse)
2727
#ifdef CONFIG_PPC_PSERIES
2828
get_lppaca()->pmcregs_in_use = inuse;
2929
#endif
30-
} else {
30+
}
3131
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
32-
get_paca()->pmcregs_in_use = inuse;
32+
get_paca()->pmcregs_in_use = inuse;
3333
#endif
34-
}
3534
#endif
3635
}
3736

‎arch/powerpc/kernel/Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ obj-y := cputable.o ptrace.o syscalls.o \
4949
signal.o sysfs.o cacheinfo.o time.o \
5050
prom.o traps.o setup-common.o \
5151
udbg.o misc.o io.o misc_$(BITS).o \
52-
of_platform.o prom_parse.o
52+
of_platform.o prom_parse.o \
53+
dma-common.o
5354
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
5455
signal_64.o ptrace32.o \
5556
paca.o nvram_64.o firmware.o

‎arch/powerpc/kernel/dma-common.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Contains common dma routines for all powerpc platforms.
4+
*
5+
* Copyright (C) 2019 Shawn Anastasio.
6+
*/
7+
8+
#include <linux/mm.h>
9+
#include <linux/dma-noncoherent.h>
10+
11+
pgprot_t arch_dma_mmap_pgprot(struct device *dev, pgprot_t prot,
12+
unsigned long attrs)
13+
{
14+
if (!dev_is_dma_coherent(dev))
15+
return pgprot_noncached(prot);
16+
return prot;
17+
}

‎arch/powerpc/kernel/signal_32.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,9 @@ SYSCALL_DEFINE0(rt_sigreturn)
11981198
goto bad;
11991199

12001200
if (MSR_TM_ACTIVE(msr_hi<<32)) {
1201+
/* Trying to start TM on non TM system */
1202+
if (!cpu_has_feature(CPU_FTR_TM))
1203+
goto bad;
12011204
/* We only recheckpoint on return if we're
12021205
* transaction.
12031206
*/

‎arch/powerpc/kernel/signal_64.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,11 @@ SYSCALL_DEFINE0(rt_sigreturn)
771771
if (MSR_TM_ACTIVE(msr)) {
772772
/* We recheckpoint on return. */
773773
struct ucontext __user *uc_transact;
774+
775+
/* Trying to start TM on non TM system */
776+
if (!cpu_has_feature(CPU_FTR_TM))
777+
goto badframe;
778+
774779
if (__get_user(uc_transact, &uc->uc_link))
775780
goto badframe;
776781
if (restore_tm_sigcontexts(current, &uc->uc_mcontext,

‎arch/powerpc/kvm/book3s_hv.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3569,9 +3569,18 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
35693569
mtspr(SPRN_DEC, vcpu->arch.dec_expires - mftb());
35703570

35713571
if (kvmhv_on_pseries()) {
3572+
/*
3573+
* We need to save and restore the guest visible part of the
3574+
* psscr (i.e. using SPRN_PSSCR_PR) since the hypervisor
3575+
* doesn't do this for us. Note only required if pseries since
3576+
* this is done in kvmhv_load_hv_regs_and_go() below otherwise.
3577+
*/
3578+
unsigned long host_psscr;
35723579
/* call our hypervisor to load up HV regs and go */
35733580
struct hv_guest_state hvregs;
35743581

3582+
host_psscr = mfspr(SPRN_PSSCR_PR);
3583+
mtspr(SPRN_PSSCR_PR, vcpu->arch.psscr);
35753584
kvmhv_save_hv_regs(vcpu, &hvregs);
35763585
hvregs.lpcr = lpcr;
35773586
vcpu->arch.regs.msr = vcpu->arch.shregs.msr;
@@ -3590,6 +3599,8 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
35903599
vcpu->arch.shregs.msr = vcpu->arch.regs.msr;
35913600
vcpu->arch.shregs.dar = mfspr(SPRN_DAR);
35923601
vcpu->arch.shregs.dsisr = mfspr(SPRN_DSISR);
3602+
vcpu->arch.psscr = mfspr(SPRN_PSSCR_PR);
3603+
mtspr(SPRN_PSSCR_PR, host_psscr);
35933604

35943605
/* H_CEDE has to be handled now, not later */
35953606
if (trap == BOOK3S_INTERRUPT_SYSCALL && !vcpu->arch.nested &&
@@ -3654,6 +3665,8 @@ int kvmhv_p9_guest_entry(struct kvm_vcpu *vcpu, u64 time_limit,
36543665
vcpu->arch.vpa.dirty = 1;
36553666
save_pmu = lp->pmcregs_in_use;
36563667
}
3668+
/* Must save pmu if this guest is capable of running nested guests */
3669+
save_pmu |= nesting_enabled(vcpu->kvm);
36573670

36583671
kvmhv_save_guest_pmu(vcpu, save_pmu);
36593672

‎arch/powerpc/kvm/book3s_xive.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,10 +1986,8 @@ static int kvmppc_xive_create(struct kvm_device *dev, u32 type)
19861986

19871987
xive->single_escalation = xive_native_has_single_escalation();
19881988

1989-
if (ret) {
1990-
kfree(xive);
1989+
if (ret)
19911990
return ret;
1992-
}
19931991

19941992
return 0;
19951993
}

‎arch/powerpc/kvm/book3s_xive_native.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,9 +1090,9 @@ static int kvmppc_xive_native_create(struct kvm_device *dev, u32 type)
10901090
xive->ops = &kvmppc_xive_native_ops;
10911091

10921092
if (ret)
1093-
kfree(xive);
1093+
return ret;
10941094

1095-
return ret;
1095+
return 0;
10961096
}
10971097

10981098
/*

0 commit comments

Comments
 (0)