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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'powerpc-4.20-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:
"Two weeks worth of fixes since rc1.

- I broke 16-byte alignment of the stack when we moved PPR into
pt_regs. Despite being required by the ABI this broke almost
nothing, we eventually hit it in code where GCC does arithmetic on
the stack pointer assuming the bottom 4 bits are clear. Fix it by
padding the in-kernel pt_regs by 8 bytes.

- A couple of commits fixing minor bugs in the recent SLB rewrite.

- A build fix related to tracepoints in KVM in some configurations.

- Our old "IO workarounds" code written for Cell couldn't coexist in
a kernel that runs on Power9 with the Radix MMU, fix that.

- Remove the NPU DMA ops, these just printed a warning and should
never have been called.

- Suppress an overly chatty message triggered by CPU hotplug in some
configs.

- Two small selftest fixes.

Thanks to: Alistair Popple, Gustavo Romero, Nicholas Piggin, Satheesh
Rajendran, Scott Wood"

* tag 'powerpc-4.20-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
selftests/powerpc: Adjust wild_bctr to build with old binutils
powerpc/64: Fix kernel stack 16-byte alignment
powerpc/numa: Suppress "VPHN is not supported" messages
selftests/powerpc: Fix wild_bctr test to work on ppc64
powerpc/io: Fix the IO workarounds code to work with Radix
powerpc/mm/64s: Fix preempt warning in slb_allocate_kernel()
KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE
powerpc/mm/64s: Only use slbfee on CPUs that support it
powerpc/mm/64s: Use PPC_SLBFEE macro
powerpc/mm/64s: Consolidate SLB assertions
powerpc/powernv/npu: Remove NPU DMA ops

+76 -106
+7 -13
arch/powerpc/include/asm/io.h
··· 268 268 * their hooks, a bitfield is reserved for use by the platform near the 269 269 * top of MMIO addresses (not PIO, those have to cope the hard way). 270 270 * 271 - * This bit field is 12 bits and is at the top of the IO virtual 272 - * addresses PCI_IO_INDIRECT_TOKEN_MASK. 271 + * The highest address in the kernel virtual space are: 273 272 * 274 - * The kernel virtual space is thus: 273 + * d0003fffffffffff # with Hash MMU 274 + * c00fffffffffffff # with Radix MMU 275 275 * 276 - * 0xD000000000000000 : vmalloc 277 - * 0xD000080000000000 : PCI PHB IO space 278 - * 0xD000080080000000 : ioremap 279 - * 0xD0000fffffffffff : end of ioremap region 280 - * 281 - * Since the top 4 bits are reserved as the region ID, we use thus 282 - * the next 12 bits and keep 4 bits available for the future if the 283 - * virtual address space is ever to be extended. 276 + * The top 4 bits are reserved as the region ID on hash, leaving us 8 bits 277 + * that can be used for the field. 284 278 * 285 279 * The direct IO mapping operations will then mask off those bits 286 280 * before doing the actual access, though that only happen when ··· 286 292 */ 287 293 288 294 #ifdef CONFIG_PPC_INDIRECT_MMIO 289 - #define PCI_IO_IND_TOKEN_MASK 0x0fff000000000000ul 290 - #define PCI_IO_IND_TOKEN_SHIFT 48 295 + #define PCI_IO_IND_TOKEN_SHIFT 52 296 + #define PCI_IO_IND_TOKEN_MASK (0xfful << PCI_IO_IND_TOKEN_SHIFT) 291 297 #define PCI_FIX_ADDR(addr) \ 292 298 ((PCI_IO_ADDR)(((unsigned long)(addr)) & ~PCI_IO_IND_TOKEN_MASK)) 293 299 #define PCI_GET_ADDR_TOKEN(addr) \
+2
arch/powerpc/include/asm/ppc-opcode.h
··· 493 493 __PPC_RS(t) | __PPC_RA0(a) | __PPC_RB(b)) 494 494 #define PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \ 495 495 __PPC_RT(t) | __PPC_RB(b)) 496 + #define __PPC_SLBFEE_DOT(t, b) stringify_in_c(.long PPC_INST_SLBFEE | \ 497 + ___PPC_RT(t) | ___PPC_RB(b)) 496 498 #define PPC_ICBT(c,a,b) stringify_in_c(.long PPC_INST_ICBT | \ 497 499 __PPC_CT(c) | __PPC_RA0(a) | __PPC_RB(b)) 498 500 /* PASemi instructions */
+1
arch/powerpc/include/asm/ptrace.h
··· 54 54 55 55 #ifdef CONFIG_PPC64 56 56 unsigned long ppr; 57 + unsigned long __pad; /* Maintain 16 byte interrupt stack alignment */ 57 58 #endif 58 59 }; 59 60 #endif
+2
arch/powerpc/kernel/setup_64.c
··· 636 636 { 637 637 unsigned long pa; 638 638 639 + BUILD_BUG_ON(STACK_INT_FRAME_SIZE % 16); 640 + 639 641 pa = memblock_alloc_base_nid(THREAD_SIZE, THREAD_SIZE, limit, 640 642 early_cpu_to_node(cpu), MEMBLOCK_NONE); 641 643 if (!pa) {
+6 -2
arch/powerpc/kvm/trace.h
··· 6 6 7 7 #undef TRACE_SYSTEM 8 8 #define TRACE_SYSTEM kvm 9 - #define TRACE_INCLUDE_PATH . 10 - #define TRACE_INCLUDE_FILE trace 11 9 12 10 /* 13 11 * Tracepoint for guest mode entry. ··· 118 120 #endif /* _TRACE_KVM_H */ 119 121 120 122 /* This part must be outside protection */ 123 + #undef TRACE_INCLUDE_PATH 124 + #undef TRACE_INCLUDE_FILE 125 + 126 + #define TRACE_INCLUDE_PATH . 127 + #define TRACE_INCLUDE_FILE trace 128 + 121 129 #include <trace/define_trace.h>
+7 -2
arch/powerpc/kvm/trace_booke.h
··· 6 6 7 7 #undef TRACE_SYSTEM 8 8 #define TRACE_SYSTEM kvm_booke 9 - #define TRACE_INCLUDE_PATH . 10 - #define TRACE_INCLUDE_FILE trace_booke 11 9 12 10 #define kvm_trace_symbol_exit \ 13 11 {0, "CRITICAL"}, \ ··· 216 218 #endif 217 219 218 220 /* This part must be outside protection */ 221 + 222 + #undef TRACE_INCLUDE_PATH 223 + #undef TRACE_INCLUDE_FILE 224 + 225 + #define TRACE_INCLUDE_PATH . 226 + #define TRACE_INCLUDE_FILE trace_booke 227 + 219 228 #include <trace/define_trace.h>
+7 -2
arch/powerpc/kvm/trace_hv.h
··· 9 9 10 10 #undef TRACE_SYSTEM 11 11 #define TRACE_SYSTEM kvm_hv 12 - #define TRACE_INCLUDE_PATH . 13 - #define TRACE_INCLUDE_FILE trace_hv 14 12 15 13 #define kvm_trace_symbol_hcall \ 16 14 {H_REMOVE, "H_REMOVE"}, \ ··· 495 497 #endif /* _TRACE_KVM_HV_H */ 496 498 497 499 /* This part must be outside protection */ 500 + 501 + #undef TRACE_INCLUDE_PATH 502 + #undef TRACE_INCLUDE_FILE 503 + 504 + #define TRACE_INCLUDE_PATH . 505 + #define TRACE_INCLUDE_FILE trace_hv 506 + 498 507 #include <trace/define_trace.h>
+7 -2
arch/powerpc/kvm/trace_pr.h
··· 8 8 9 9 #undef TRACE_SYSTEM 10 10 #define TRACE_SYSTEM kvm_pr 11 - #define TRACE_INCLUDE_PATH . 12 - #define TRACE_INCLUDE_FILE trace_pr 13 11 14 12 TRACE_EVENT(kvm_book3s_reenter, 15 13 TP_PROTO(int r, struct kvm_vcpu *vcpu), ··· 255 257 #endif /* _TRACE_KVM_H */ 256 258 257 259 /* This part must be outside protection */ 260 + 261 + #undef TRACE_INCLUDE_PATH 262 + #undef TRACE_INCLUDE_FILE 263 + 264 + #define TRACE_INCLUDE_PATH . 265 + #define TRACE_INCLUDE_FILE trace_pr 266 + 258 267 #include <trace/define_trace.h>
+1 -1
arch/powerpc/mm/numa.c
··· 1178 1178 1179 1179 switch (rc) { 1180 1180 case H_FUNCTION: 1181 - printk(KERN_INFO 1181 + printk_once(KERN_INFO 1182 1182 "VPHN is not supported. Disabling polling...\n"); 1183 1183 stop_topology_update(); 1184 1184 break;
+14 -21
arch/powerpc/mm/slb.c
··· 19 19 #include <asm/mmu.h> 20 20 #include <asm/mmu_context.h> 21 21 #include <asm/paca.h> 22 + #include <asm/ppc-opcode.h> 22 23 #include <asm/cputable.h> 23 24 #include <asm/cacheflush.h> 24 25 #include <asm/smp.h> ··· 59 58 return __mk_vsid_data(get_kernel_vsid(ea, ssize), ssize, flags); 60 59 } 61 60 62 - static void assert_slb_exists(unsigned long ea) 61 + static void assert_slb_presence(bool present, unsigned long ea) 63 62 { 64 63 #ifdef CONFIG_DEBUG_VM 65 64 unsigned long tmp; 66 65 67 66 WARN_ON_ONCE(mfmsr() & MSR_EE); 68 67 69 - asm volatile("slbfee. %0, %1" : "=r"(tmp) : "r"(ea) : "cr0"); 70 - WARN_ON(tmp == 0); 71 - #endif 72 - } 68 + if (!cpu_has_feature(CPU_FTR_ARCH_206)) 69 + return; 73 70 74 - static void assert_slb_notexists(unsigned long ea) 75 - { 76 - #ifdef CONFIG_DEBUG_VM 77 - unsigned long tmp; 71 + asm volatile(__PPC_SLBFEE_DOT(%0, %1) : "=r"(tmp) : "r"(ea) : "cr0"); 78 72 79 - WARN_ON_ONCE(mfmsr() & MSR_EE); 80 - 81 - asm volatile("slbfee. %0, %1" : "=r"(tmp) : "r"(ea) : "cr0"); 82 - WARN_ON(tmp != 0); 73 + WARN_ON(present == (tmp == 0)); 83 74 #endif 84 75 } 85 76 ··· 107 114 */ 108 115 slb_shadow_update(ea, ssize, flags, index); 109 116 110 - assert_slb_notexists(ea); 117 + assert_slb_presence(false, ea); 111 118 asm volatile("slbmte %0,%1" : 112 119 : "r" (mk_vsid_data(ea, ssize, flags)), 113 120 "r" (mk_esid_data(ea, ssize, index)) ··· 130 137 "r" (be64_to_cpu(p->save_area[index].esid))); 131 138 } 132 139 133 - assert_slb_exists(local_paca->kstack); 140 + assert_slb_presence(true, local_paca->kstack); 134 141 } 135 142 136 143 /* ··· 178 185 :: "r" (be64_to_cpu(p->save_area[KSTACK_INDEX].vsid)), 179 186 "r" (be64_to_cpu(p->save_area[KSTACK_INDEX].esid)) 180 187 : "memory"); 181 - assert_slb_exists(get_paca()->kstack); 188 + assert_slb_presence(true, get_paca()->kstack); 182 189 183 190 get_paca()->slb_cache_ptr = 0; 184 191 ··· 436 443 ea = (unsigned long) 437 444 get_paca()->slb_cache[i] << SID_SHIFT; 438 445 /* 439 - * Could assert_slb_exists here, but hypervisor 440 - * or machine check could have come in and 441 - * removed the entry at this point. 446 + * Could assert_slb_presence(true) here, but 447 + * hypervisor or machine check could have come 448 + * in and removed the entry at this point. 442 449 */ 443 450 444 451 slbie_data = ea; ··· 669 676 * User preloads should add isync afterwards in case the kernel 670 677 * accesses user memory before it returns to userspace with rfid. 671 678 */ 672 - assert_slb_notexists(ea); 679 + assert_slb_presence(false, ea); 673 680 asm volatile("slbmte %0, %1" : : "r" (vsid_data), "r" (esid_data)); 674 681 675 682 barrier(); ··· 708 715 return -EFAULT; 709 716 710 717 if (ea < H_VMALLOC_END) 711 - flags = get_paca()->vmalloc_sllp; 718 + flags = local_paca->vmalloc_sllp; 712 719 else 713 720 flags = SLB_VSID_KERNEL | mmu_psize_defs[mmu_io_psize].sllp; 714 721 } else {
+4 -60
arch/powerpc/platforms/powernv/npu-dma.c
··· 102 102 } 103 103 EXPORT_SYMBOL(pnv_pci_get_npu_dev); 104 104 105 - #define NPU_DMA_OP_UNSUPPORTED() \ 106 - dev_err_once(dev, "%s operation unsupported for NVLink devices\n", \ 107 - __func__) 108 - 109 - static void *dma_npu_alloc(struct device *dev, size_t size, 110 - dma_addr_t *dma_handle, gfp_t flag, 111 - unsigned long attrs) 112 - { 113 - NPU_DMA_OP_UNSUPPORTED(); 114 - return NULL; 115 - } 116 - 117 - static void dma_npu_free(struct device *dev, size_t size, 118 - void *vaddr, dma_addr_t dma_handle, 119 - unsigned long attrs) 120 - { 121 - NPU_DMA_OP_UNSUPPORTED(); 122 - } 123 - 124 - static dma_addr_t dma_npu_map_page(struct device *dev, struct page *page, 125 - unsigned long offset, size_t size, 126 - enum dma_data_direction direction, 127 - unsigned long attrs) 128 - { 129 - NPU_DMA_OP_UNSUPPORTED(); 130 - return 0; 131 - } 132 - 133 - static int dma_npu_map_sg(struct device *dev, struct scatterlist *sglist, 134 - int nelems, enum dma_data_direction direction, 135 - unsigned long attrs) 136 - { 137 - NPU_DMA_OP_UNSUPPORTED(); 138 - return 0; 139 - } 140 - 141 - static int dma_npu_dma_supported(struct device *dev, u64 mask) 142 - { 143 - NPU_DMA_OP_UNSUPPORTED(); 144 - return 0; 145 - } 146 - 147 - static u64 dma_npu_get_required_mask(struct device *dev) 148 - { 149 - NPU_DMA_OP_UNSUPPORTED(); 150 - return 0; 151 - } 152 - 153 - static const struct dma_map_ops dma_npu_ops = { 154 - .map_page = dma_npu_map_page, 155 - .map_sg = dma_npu_map_sg, 156 - .alloc = dma_npu_alloc, 157 - .free = dma_npu_free, 158 - .dma_supported = dma_npu_dma_supported, 159 - .get_required_mask = dma_npu_get_required_mask, 160 - }; 161 - 162 105 /* 163 106 * Returns the PE assoicated with the PCI device of the given 164 107 * NPU. Returns the linked pci device if pci_dev != NULL. ··· 213 270 rc = pnv_npu_set_window(npe, 0, gpe->table_group.tables[0]); 214 271 215 272 /* 216 - * We don't initialise npu_pe->tce32_table as we always use 217 - * dma_npu_ops which are nops. 273 + * NVLink devices use the same TCE table configuration as 274 + * their parent device so drivers shouldn't be doing DMA 275 + * operations directly on these devices. 218 276 */ 219 - set_dma_ops(&npe->pdev->dev, &dma_npu_ops); 277 + set_dma_ops(&npe->pdev->dev, NULL); 220 278 } 221 279 222 280 /*
+18 -3
tools/testing/selftests/powerpc/mm/wild_bctr.c
··· 47 47 return 0; 48 48 } 49 49 50 - #define REG_POISON 0x5a5aUL 51 - #define POISONED_REG(n) ((REG_POISON << 48) | ((n) << 32) | (REG_POISON << 16) | (n)) 50 + #define REG_POISON 0x5a5a 51 + #define POISONED_REG(n) ((((unsigned long)REG_POISON) << 48) | ((n) << 32) | \ 52 + (((unsigned long)REG_POISON) << 16) | (n)) 52 53 53 54 static inline void poison_regs(void) 54 55 { ··· 106 105 } 107 106 } 108 107 108 + #ifdef _CALL_AIXDESC 109 + struct opd { 110 + unsigned long ip; 111 + unsigned long toc; 112 + unsigned long env; 113 + }; 114 + static struct opd bad_opd = { 115 + .ip = BAD_NIP, 116 + }; 117 + #define BAD_FUNC (&bad_opd) 118 + #else 119 + #define BAD_FUNC BAD_NIP 120 + #endif 121 + 109 122 int test_wild_bctr(void) 110 123 { 111 124 int (*func_ptr)(void); ··· 148 133 149 134 poison_regs(); 150 135 151 - func_ptr = (int (*)(void))BAD_NIP; 136 + func_ptr = (int (*)(void))BAD_FUNC; 152 137 func_ptr(); 153 138 154 139 FAIL_IF(1); /* we didn't segv? */