Skip to content

Commit d08de37

Browse files
committed
Merge tag 'powerpc-4.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Fix an off-by-one bug in our alternative asm patching which leads to incorrectly patched code. This bug lay dormant for nearly 10 years but we finally hit it due to a recent change. - Fix lockups when running KVM guests on Power8 due to a missing check when a thread that's running KVM comes out of idle. - Fix an out-of-spec behaviour in the XIVE code (P9 interrupt controller). - Fix EEH handling of bridge MMIO windows. - Prevent crashes in our RFI fallback flush handler if firmware didn't tell us the size of the L1 cache (only seen on simulators). Thanks to: Benjamin Herrenschmidt, Madhavan Srinivasan, Michael Neuling. * tag 'powerpc-4.17-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/kvm: Fix lockups when running KVM guests on Power8 powerpc/eeh: Fix enabling bridge MMIO windows powerpc/xive: Fix trying to "push" an already active pool VP powerpc/64s: Default l1d_size to 64K in RFI fallback flush powerpc/lib: Fix off-by-one in alternate feature patching
2 parents c2d94c5 + 56376c5 commit d08de37

File tree

5 files changed

+20
-4
lines changed

5 files changed

+20
-4
lines changed

arch/powerpc/kernel/eeh_pe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,8 @@ static void eeh_restore_bridge_bars(struct eeh_dev *edev)
807807
eeh_ops->write_config(pdn, 15*4, 4, edev->config_space[15]);
808808

809809
/* PCI Command: 0x4 */
810-
eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1]);
810+
eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1] |
811+
PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
811812

812813
/* Check the PCIe link is ready */
813814
eeh_bridge_check_link(edev);

arch/powerpc/kernel/idle_book3s.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,12 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300)
553553
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
554554
lbz r0,HSTATE_HWTHREAD_STATE(r13)
555555
cmpwi r0,KVM_HWTHREAD_IN_KERNEL
556-
beq 1f
556+
beq 0f
557557
li r0,KVM_HWTHREAD_IN_KERNEL
558558
stb r0,HSTATE_HWTHREAD_STATE(r13)
559559
/* Order setting hwthread_state vs. testing hwthread_req */
560560
sync
561-
lbz r0,HSTATE_HWTHREAD_REQ(r13)
561+
0: lbz r0,HSTATE_HWTHREAD_REQ(r13)
562562
cmpwi r0,0
563563
beq 1f
564564
b kvm_start_guest

arch/powerpc/kernel/setup_64.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,17 @@ static void __ref init_fallback_flush(void)
890890
return;
891891

892892
l1d_size = ppc64_caches.l1d.size;
893+
894+
/*
895+
* If there is no d-cache-size property in the device tree, l1d_size
896+
* could be zero. That leads to the loop in the asm wrapping around to
897+
* 2^64-1, and then walking off the end of the fallback area and
898+
* eventually causing a page fault which is fatal. Just default to
899+
* something vaguely sane.
900+
*/
901+
if (!l1d_size)
902+
l1d_size = (64 * 1024);
903+
893904
limit = min(ppc64_bolted_size(), ppc64_rma_size);
894905

895906
/*

arch/powerpc/lib/feature-fixups.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static int patch_alt_instruction(unsigned int *src, unsigned int *dest,
5555
unsigned int *target = (unsigned int *)branch_target(src);
5656

5757
/* Branch within the section doesn't need translating */
58-
if (target < alt_start || target >= alt_end) {
58+
if (target < alt_start || target > alt_end) {
5959
instr = translate_branch(dest, src);
6060
if (!instr)
6161
return 1;

arch/powerpc/sysdev/xive/native.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ static void xive_native_setup_cpu(unsigned int cpu, struct xive_cpu *xc)
389389
if (xive_pool_vps == XIVE_INVALID_VP)
390390
return;
391391

392+
/* Check if pool VP already active, if it is, pull it */
393+
if (in_be32(xive_tima + TM_QW2_HV_POOL + TM_WORD2) & TM_QW2W2_VP)
394+
in_be64(xive_tima + TM_SPC_PULL_POOL_CTX);
395+
392396
/* Enable the pool VP */
393397
vp = xive_pool_vps + cpu;
394398
pr_debug("CPU %d setting up pool VP 0x%x\n", cpu, vp);

0 commit comments

Comments
 (0)