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

Merge tag 'powerpc-4.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
"Fixes for recently merged code:
- a fix for the _PAGE_DEVMAP support, which was breaking KVM on
Power9 radix
- avoid a (harmless) lockdep warning in the early SMP code
- return failure for some uses of dma_set_mask() rather than falling
back to 32-bits
- fix stack setup in watchdog soft_nmi_common() to use emergency
stack
- fix of_irq_to_resource() error check in of_fsl_spi_probe()

Two fixes going to stable:
- fix saving of Transactional Memory SPRs in core dump
- fix __check_irq_replay missing decrementer interrupt

And two misc:
- fix 64-bit boot wrapper build with non-biarch compiler
- work around a POWER9 PMU hang after state-loss idle

Thanks to: Alistair Popple, Aneesh Kumar K.V, Cyril Bur, Gustavo
Romero, Jose Ricardo Ziviani, Laurent Vivier, Nicholas Piggin, Oliver
O'Halloran, Sergei Shtylyov, Suraj Jitindar Singh, Thomas Gleixner"

* tag 'powerpc-4.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/64: Fix __check_irq_replay missing decrementer interrupt
powerpc/perf: POWER9 PMU stops after idle workaround
powerpc/83xx/mpc832x_rdb: fix of_irq_to_resource() error check
powerpc/64s: Fix stack setup in watchdog soft_nmi_common()
powerpc/powernv/pci: Return failure for some uses of dma_set_mask()
powerpc/boot: Fix 64-bit boot wrapper build with non-biarch compiler
powerpc/smp: Call smp_ops->setup_cpu() directly on the boot CPU
powerpc/tm: Fix saving of TM SPRs in core dump
powerpc/mm: Fix pmd/pte_devmap() on non-leaf entries

+71 -21
+11 -3
arch/powerpc/boot/Makefile
··· 25 25 BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 26 26 -fno-strict-aliasing -Os -msoft-float -pipe \ 27 27 -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ 28 - -isystem $(shell $(CROSS32CC) -print-file-name=include) \ 29 28 -D$(compress-y) 30 29 30 + BOOTCC := $(CC) 31 31 ifdef CONFIG_PPC64_BOOT_WRAPPER 32 32 BOOTCFLAGS += -m64 33 + else 34 + BOOTCFLAGS += -m32 35 + ifdef CROSS32_COMPILE 36 + BOOTCC := $(CROSS32_COMPILE)gcc 33 37 endif 38 + endif 39 + 40 + BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include) 41 + 34 42 ifdef CONFIG_CPU_BIG_ENDIAN 35 43 BOOTCFLAGS += -mbig-endian 36 44 else ··· 191 183 empty.c zImage.coff.lds zImage.ps3.lds zImage.lds 192 184 193 185 quiet_cmd_bootcc = BOOTCC $@ 194 - cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 186 + cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $< 195 187 196 188 quiet_cmd_bootas = BOOTAS $@ 197 - cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 189 + cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 198 190 199 191 quiet_cmd_bootar = BOOTAR $@ 200 192 cmd_bootar = $(CROSS32AR) -cr$(KBUILD_ARFLAGS) $@.$$$$ $(filter-out FORCE,$^); mv $@.$$$$ $@
+9 -1
arch/powerpc/include/asm/book3s/64/pgtable.h
··· 608 608 return __pte(pte_val(pte) | _PAGE_SPECIAL|_PAGE_DEVMAP); 609 609 } 610 610 611 + /* 612 + * This is potentially called with a pmd as the argument, in which case it's not 613 + * safe to check _PAGE_DEVMAP unless we also confirm that _PAGE_PTE is set. 614 + * That's because the bit we use for _PAGE_DEVMAP is not reserved for software 615 + * use in page directory entries (ie. non-ptes). 616 + */ 611 617 static inline int pte_devmap(pte_t pte) 612 618 { 613 - return !!(pte_raw(pte) & cpu_to_be64(_PAGE_DEVMAP)); 619 + u64 mask = cpu_to_be64(_PAGE_DEVMAP | _PAGE_PTE); 620 + 621 + return (pte_raw(pte) & mask) == mask; 614 622 } 615 623 616 624 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
+9 -1
arch/powerpc/kernel/exceptions-64s.S
··· 1325 1325 std r10,PACA_EXGEN+EX_R13(r13); \ 1326 1326 EXCEPTION_PROLOG_PSERIES_1(soft_nmi_common, _H) 1327 1327 1328 + /* 1329 + * Branch to soft_nmi_interrupt using the emergency stack. The emergency 1330 + * stack is one that is usable by maskable interrupts so long as MSR_EE 1331 + * remains off. It is used for recovery when something has corrupted the 1332 + * normal kernel stack, for example. The "soft NMI" must not use the process 1333 + * stack because we want irq disabled sections to avoid touching the stack 1334 + * at all (other than PMU interrupts), so use the emergency stack for this, 1335 + * and run it entirely with interrupts hard disabled. 1336 + */ 1328 1337 EXC_COMMON_BEGIN(soft_nmi_common) 1329 1338 mr r10,r1 1330 1339 ld r1,PACAEMERGSP(r13) 1331 - ld r1,PACA_NMI_EMERG_SP(r13) 1332 1340 subi r1,r1,INT_FRAME_SIZE 1333 1341 EXCEPTION_COMMON_NORET_STACK(PACA_EXGEN, 0x900, 1334 1342 system_reset, soft_nmi_interrupt,
+7 -1
arch/powerpc/kernel/idle_book3s.S
··· 460 460 /* 461 461 * Workaround for POWER9, if we lost resources, the ERAT 462 462 * might have been mixed up and needs flushing. We also need 463 - * to reload MMCR0 (see comment above). 463 + * to reload MMCR0 (see comment above). We also need to set 464 + * then clear bit 60 in MMCRA to ensure the PMU starts running. 464 465 */ 465 466 blt cr3,1f 466 467 PPC_INVALIDATE_ERAT 467 468 ld r1,PACAR1(r13) 469 + mfspr r4,SPRN_MMCRA 470 + ori r4,r4,(1 << (63-60)) 471 + mtspr SPRN_MMCRA,r4 472 + xori r4,r4,(1 << (63-60)) 473 + mtspr SPRN_MMCRA,r4 468 474 ld r4,_MMCR0(r1) 469 475 mtspr SPRN_MMCR0,r4 470 476 1:
+14 -1
arch/powerpc/kernel/irq.c
··· 145 145 146 146 /* Clear bit 0 which we wouldn't clear otherwise */ 147 147 local_paca->irq_happened &= ~PACA_IRQ_HARD_DIS; 148 + if (happened & PACA_IRQ_HARD_DIS) { 149 + /* 150 + * We may have missed a decrementer interrupt if hard disabled. 151 + * Check the decrementer register in case we had a rollover 152 + * while hard disabled. 153 + */ 154 + if (!(happened & PACA_IRQ_DEC)) { 155 + if (decrementer_check_overflow()) { 156 + local_paca->irq_happened |= PACA_IRQ_DEC; 157 + happened |= PACA_IRQ_DEC; 158 + } 159 + } 160 + } 148 161 149 162 /* 150 163 * Force the delivery of pending soft-disabled interrupts on PS3. ··· 183 170 * in case we also had a rollover while hard disabled 184 171 */ 185 172 local_paca->irq_happened &= ~PACA_IRQ_DEC; 186 - if ((happened & PACA_IRQ_DEC) || decrementer_check_overflow()) 173 + if (happened & PACA_IRQ_DEC) 187 174 return 0x900; 188 175 189 176 /* Finally check if an external interrupt happened */
+10 -3
arch/powerpc/kernel/ptrace.c
··· 127 127 * If task is not current, it will have been flushed already to 128 128 * it's thread_struct during __switch_to(). 129 129 * 130 - * A reclaim flushes ALL the state. 130 + * A reclaim flushes ALL the state or if not in TM save TM SPRs 131 + * in the appropriate thread structures from live. 131 132 */ 132 133 133 - if (tsk == current && MSR_TM_SUSPENDED(mfmsr())) 134 - tm_reclaim_current(TM_CAUSE_SIGNAL); 134 + if (tsk != current) 135 + return; 135 136 137 + if (MSR_TM_SUSPENDED(mfmsr())) { 138 + tm_reclaim_current(TM_CAUSE_SIGNAL); 139 + } else { 140 + tm_enable(); 141 + tm_save_sprs(&(tsk->thread)); 142 + } 136 143 } 137 144 #else 138 145 static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }
+2 -10
arch/powerpc/kernel/smp.c
··· 1003 1003 { NULL, }, 1004 1004 }; 1005 1005 1006 - static __init long smp_setup_cpu_workfn(void *data __always_unused) 1007 - { 1008 - smp_ops->setup_cpu(boot_cpuid); 1009 - return 0; 1010 - } 1011 - 1012 1006 void __init smp_cpus_done(unsigned int max_cpus) 1013 1007 { 1014 1008 /* 1015 - * We want the setup_cpu() here to be called on the boot CPU, but 1016 - * init might run on any CPU, so make sure it's invoked on the boot 1017 - * CPU. 1009 + * We are running pinned to the boot CPU, see rest_init(). 1018 1010 */ 1019 1011 if (smp_ops && smp_ops->setup_cpu) 1020 - work_on_cpu_safe(boot_cpuid, smp_setup_cpu_workfn, NULL); 1012 + smp_ops->setup_cpu(boot_cpuid); 1021 1013 1022 1014 if (smp_ops && smp_ops->bringup_done) 1023 1015 smp_ops->bringup_done();
+1 -1
arch/powerpc/platforms/83xx/mpc832x_rdb.c
··· 89 89 goto err; 90 90 91 91 ret = of_irq_to_resource(np, 0, &res[1]); 92 - if (!ret) 92 + if (ret <= 0) 93 93 goto err; 94 94 95 95 pdev = platform_device_alloc("mpc83xx_spi", i);
+8
arch/powerpc/platforms/powernv/pci-ioda.c
··· 1852 1852 /* 4GB offset bypasses 32-bit space */ 1853 1853 set_dma_offset(&pdev->dev, (1ULL << 32)); 1854 1854 set_dma_ops(&pdev->dev, &dma_direct_ops); 1855 + } else if (dma_mask >> 32 && dma_mask != DMA_BIT_MASK(64)) { 1856 + /* 1857 + * Fail the request if a DMA mask between 32 and 64 bits 1858 + * was requested but couldn't be fulfilled. Ideally we 1859 + * would do this for 64-bits but historically we have 1860 + * always fallen back to 32-bits. 1861 + */ 1862 + return -ENOMEM; 1855 1863 } else { 1856 1864 dev_info(&pdev->dev, "Using 32-bit DMA via iommu\n"); 1857 1865 set_dma_ops(&pdev->dev, &dma_iommu_ops);