Skip to content

Commit ab159ac

Browse files
committed
Merge tag 'powerpc-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates and fixes from Michael Ellerman: "A bit of a mixture of things, tying up some loose ends. There's the removal of the nvlink code, which dependend on a commit in the vfio tree. Then the enablement of huge vmalloc which was in next for a few weeks but got dropped due to conflicts. And there's also a few fixes. Summary: - Remove the nvlink support now that it's only user has been removed. - Enable huge vmalloc mappings for Radix MMU (P9). - Fix KVM conversion to gfn-based MMU notifier callbacks. - Fix a kexec/kdump crash with hot plugged CPUs. - Fix boot failure on 32-bit with CONFIG_STACKPROTECTOR. - Restore alphabetic order of the selects under CONFIG_PPC. Thanks to: Christophe Leroy, Christoph Hellwig, Nicholas Piggin, Sandipan Das, and Sourabh Jain" * tag 'powerpc-5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks powerpc/kconfig: Restore alphabetic order of the selects under CONFIG_PPC powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR powerpc/powernv/memtrace: Fix dcache flushing powerpc/kexec_file: Use current CPU info while setting up FDT powerpc/64s/radix: Enable huge vmalloc mappings powerpc/powernv: remove the nvlink support
2 parents fc858a5 + f96271c commit ab159ac

File tree

19 files changed

+175
-990
lines changed

19 files changed

+175
-990
lines changed

Documentation/admin-guide/kernel-parameters.txt

+2
Original file line numberDiff line numberDiff line change
@@ -3282,6 +3282,8 @@
32823282

32833283
nohugeiomap [KNL,X86,PPC,ARM64] Disable kernel huge I/O mappings.
32843284

3285+
nohugevmalloc [PPC] Disable kernel huge vmalloc mappings.
3286+
32853287
nosmt [KNL,S390] Disable symmetric multithreading (SMT).
32863288
Equivalent to smt=1.
32873289

arch/powerpc/Kconfig

+19-18
Original file line numberDiff line numberDiff line change
@@ -120,28 +120,29 @@ config PPC
120120
select ARCH_32BIT_OFF_T if PPC32
121121
select ARCH_ENABLE_MEMORY_HOTPLUG
122122
select ARCH_ENABLE_MEMORY_HOTREMOVE
123+
select ARCH_HAS_COPY_MC if PPC64
123124
select ARCH_HAS_DEBUG_VIRTUAL
124125
select ARCH_HAS_DEBUG_VM_PGTABLE
125126
select ARCH_HAS_DEVMEM_IS_ALLOWED
127+
select ARCH_HAS_DMA_MAP_DIRECT if PPC_PSERIES
126128
select ARCH_HAS_ELF_RANDOMIZE
127129
select ARCH_HAS_FORTIFY_SOURCE
128130
select ARCH_HAS_GCOV_PROFILE_ALL
129-
select ARCH_HAS_KCOV
130131
select ARCH_HAS_HUGEPD if HUGETLB_PAGE
132+
select ARCH_HAS_KCOV
133+
select ARCH_HAS_MEMBARRIER_CALLBACKS
134+
select ARCH_HAS_MEMBARRIER_SYNC_CORE
131135
select ARCH_HAS_MEMREMAP_COMPAT_ALIGN
132136
select ARCH_HAS_MMIOWB if PPC64
137+
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
133138
select ARCH_HAS_PHYS_TO_DMA
134139
select ARCH_HAS_PMEM_API
135-
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
136140
select ARCH_HAS_PTE_DEVMAP if PPC_BOOK3S_64
137141
select ARCH_HAS_PTE_SPECIAL
138-
select ARCH_HAS_MEMBARRIER_CALLBACKS
139-
select ARCH_HAS_MEMBARRIER_SYNC_CORE
140142
select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
141143
select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION)
142144
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
143145
select ARCH_HAS_UACCESS_FLUSHCACHE
144-
select ARCH_HAS_COPY_MC if PPC64
145146
select ARCH_HAS_UBSAN_SANITIZE_ALL
146147
select ARCH_HAVE_NMI_SAFE_CMPXCHG
147148
select ARCH_KEEP_MEMBLOCK
@@ -164,9 +165,8 @@ config PPC
164165
select BUILDTIME_TABLE_SORT
165166
select CLONE_BACKWARDS
166167
select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN
167-
select DMA_OPS if PPC64
168168
select DMA_OPS_BYPASS if PPC64
169-
select ARCH_HAS_DMA_MAP_DIRECT if PPC64 && PPC_PSERIES
169+
select DMA_OPS if PPC64
170170
select DYNAMIC_FTRACE if FUNCTION_TRACER
171171
select EDAC_ATOMIC_SCRUB
172172
select EDAC_SUPPORT
@@ -186,23 +186,22 @@ config PPC
186186
select GENERIC_TIME_VSYSCALL
187187
select GENERIC_VDSO_TIME_NS
188188
select HAVE_ARCH_AUDITSYSCALL
189+
select HAVE_ARCH_HUGE_VMALLOC if HAVE_ARCH_HUGE_VMAP
189190
select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU
190191
select HAVE_ARCH_JUMP_LABEL
191192
select HAVE_ARCH_JUMP_LABEL_RELATIVE
192193
select HAVE_ARCH_KASAN if PPC32 && PPC_PAGE_SHIFT <= 14
193194
select HAVE_ARCH_KASAN_VMALLOC if PPC32 && PPC_PAGE_SHIFT <= 14
194-
select HAVE_ARCH_KGDB
195195
select HAVE_ARCH_KFENCE if PPC32
196+
select HAVE_ARCH_KGDB
196197
select HAVE_ARCH_MMAP_RND_BITS
197198
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
198199
select HAVE_ARCH_NVRAM_OPS
199200
select HAVE_ARCH_SECCOMP_FILTER
200201
select HAVE_ARCH_TRACEHOOK
201202
select HAVE_ASM_MODVERSIONS
202-
select HAVE_C_RECORDMCOUNT
203-
select HAVE_STACKPROTECTOR if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
204-
select HAVE_STACKPROTECTOR if PPC32 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r2)
205203
select HAVE_CONTEXT_TRACKING if PPC64
204+
select HAVE_C_RECORDMCOUNT
206205
select HAVE_DEBUG_KMEMLEAK
207206
select HAVE_DEBUG_STACKOVERFLOW
208207
select HAVE_DYNAMIC_FTRACE
@@ -216,10 +215,13 @@ config PPC
216215
select HAVE_FUNCTION_TRACER
217216
select HAVE_GCC_PLUGINS if GCC_VERSION >= 50200 # plugin support on gcc <= 5.1 is buggy on PPC
218217
select HAVE_GENERIC_VDSO
218+
select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC_BOOK3S_64 && SMP
219+
select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH
219220
select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
220221
select HAVE_IDE
221222
select HAVE_IOREMAP_PROT
222223
select HAVE_IRQ_EXIT_ON_IRQ_STACK
224+
select HAVE_IRQ_TIME_ACCOUNTING
223225
select HAVE_KERNEL_GZIP
224226
select HAVE_KERNEL_LZMA if DEFAULT_UIMAGE
225227
select HAVE_KERNEL_LZO if DEFAULT_UIMAGE
@@ -231,26 +233,25 @@ config PPC
231233
select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
232234
select HAVE_MOD_ARCH_SPECIFIC
233235
select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
234-
select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC64 && PPC_BOOK3S && SMP
235236
select HAVE_OPTPROBES
236237
select HAVE_PERF_EVENTS
237238
select HAVE_PERF_EVENTS_NMI if PPC64
238-
select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH
239239
select HAVE_PERF_REGS
240240
select HAVE_PERF_USER_STACK_DUMP
241-
select HUGETLB_PAGE_SIZE_VARIABLE if PPC_BOOK3S_64 && HUGETLB_PAGE
242-
select MMU_GATHER_RCU_TABLE_FREE
243-
select MMU_GATHER_PAGE_SIZE
244241
select HAVE_REGS_AND_STACK_ACCESS_API
245242
select HAVE_RELIABLE_STACKTRACE
243+
select HAVE_RSEQ
246244
select HAVE_SOFTIRQ_ON_OWN_STACK
245+
select HAVE_STACKPROTECTOR if PPC32 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r2)
246+
select HAVE_STACKPROTECTOR if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13)
247247
select HAVE_SYSCALL_TRACEPOINTS
248248
select HAVE_VIRT_CPU_ACCOUNTING
249-
select HAVE_IRQ_TIME_ACCOUNTING
250-
select HAVE_RSEQ
249+
select HUGETLB_PAGE_SIZE_VARIABLE if PPC_BOOK3S_64 && HUGETLB_PAGE
251250
select IOMMU_HELPER if PPC64
252251
select IRQ_DOMAIN
253252
select IRQ_FORCED_THREADING
253+
select MMU_GATHER_PAGE_SIZE
254+
select MMU_GATHER_RCU_TABLE_FREE
254255
select MODULES_USE_ELF_RELA
255256
select NEED_DMA_MAP_STATE if PPC64 || NOT_COHERENT_CACHE
256257
select NEED_SG_DMA_LENGTH

arch/powerpc/include/asm/kvm_book3s.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ extern void kvmppc_free_pgtable_radix(struct kvm *kvm, pgd_t *pgd,
210210
unsigned int lpid);
211211
extern int kvmppc_radix_init(void);
212212
extern void kvmppc_radix_exit(void);
213-
extern bool kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
213+
extern void kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
214214
unsigned long gfn);
215215
extern bool kvm_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
216216
unsigned long gfn);

arch/powerpc/include/asm/opal.h

-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ extern struct device_node *opal_node;
2828

2929
/* API functions */
3030
int64_t opal_invalid_call(void);
31-
int64_t opal_npu_destroy_context(uint64_t phb_id, uint64_t pid, uint64_t bdf);
32-
int64_t opal_npu_init_context(uint64_t phb_id, int pasid, uint64_t msr,
33-
uint64_t bdf);
3431
int64_t opal_npu_map_lpar(uint64_t phb_id, uint64_t bdf, uint64_t lparid,
3532
uint64_t lpcr);
3633
int64_t opal_npu_spa_setup(uint64_t phb_id, uint32_t bdfn,

arch/powerpc/include/asm/pci-bridge.h

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ struct pci_controller {
126126
#endif /* CONFIG_PPC64 */
127127

128128
void *private_data;
129-
struct npu *npu;
130129
};
131130

132131
/* These are used for config access before all the PCI probing

arch/powerpc/include/asm/pci.h

-7
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,4 @@ extern void pcibios_scan_phb(struct pci_controller *hose);
119119

120120
#endif /* __KERNEL__ */
121121

122-
extern struct pci_dev *pnv_pci_get_gpu_dev(struct pci_dev *npdev);
123-
extern struct pci_dev *pnv_pci_get_npu_dev(struct pci_dev *gpdev, int index);
124-
extern int pnv_npu2_init(struct pci_controller *hose);
125-
extern int pnv_npu2_map_lpar_dev(struct pci_dev *gpdev, unsigned int lparid,
126-
unsigned long msr);
127-
extern int pnv_npu2_unmap_lpar_dev(struct pci_dev *gpdev);
128-
129122
#endif /* __ASM_POWERPC_PCI_H */

arch/powerpc/kernel/module.c

+13-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/moduleloader.h>
99
#include <linux/err.h>
1010
#include <linux/vmalloc.h>
11+
#include <linux/mm.h>
1112
#include <linux/bug.h>
1213
#include <asm/module.h>
1314
#include <linux/uaccess.h>
@@ -88,17 +89,22 @@ int module_finalize(const Elf_Ehdr *hdr,
8889
return 0;
8990
}
9091

91-
#ifdef MODULES_VADDR
9292
static __always_inline void *
9393
__module_alloc(unsigned long size, unsigned long start, unsigned long end)
9494
{
95-
return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL,
96-
PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
97-
__builtin_return_address(0));
95+
/*
96+
* Don't do huge page allocations for modules yet until more testing
97+
* is done. STRICT_MODULE_RWX may require extra work to support this
98+
* too.
99+
*/
100+
return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL, PAGE_KERNEL_EXEC,
101+
VM_FLUSH_RESET_PERMS | VM_NO_HUGE_VMAP,
102+
NUMA_NO_NODE, __builtin_return_address(0));
98103
}
99104

100105
void *module_alloc(unsigned long size)
101106
{
107+
#ifdef MODULES_VADDR
102108
unsigned long limit = (unsigned long)_etext - SZ_32M;
103109
void *ptr = NULL;
104110

@@ -112,5 +118,7 @@ void *module_alloc(unsigned long size)
112118
ptr = __module_alloc(size, MODULES_VADDR, MODULES_END);
113119

114120
return ptr;
115-
}
121+
#else
122+
return __module_alloc(size, VMALLOC_START, VMALLOC_END);
116123
#endif
124+
}

arch/powerpc/kexec/file_load_64.c

+92
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,93 @@ unsigned int kexec_extra_fdt_size_ppc64(struct kimage *image)
950950
return (unsigned int)(usm_entries * sizeof(u64));
951951
}
952952

953+
/**
954+
* add_node_props - Reads node properties from device node structure and add
955+
* them to fdt.
956+
* @fdt: Flattened device tree of the kernel
957+
* @node_offset: offset of the node to add a property at
958+
* @dn: device node pointer
959+
*
960+
* Returns 0 on success, negative errno on error.
961+
*/
962+
static int add_node_props(void *fdt, int node_offset, const struct device_node *dn)
963+
{
964+
int ret = 0;
965+
struct property *pp;
966+
967+
if (!dn)
968+
return -EINVAL;
969+
970+
for_each_property_of_node(dn, pp) {
971+
ret = fdt_setprop(fdt, node_offset, pp->name, pp->value, pp->length);
972+
if (ret < 0) {
973+
pr_err("Unable to add %s property: %s\n", pp->name, fdt_strerror(ret));
974+
return ret;
975+
}
976+
}
977+
return ret;
978+
}
979+
980+
/**
981+
* update_cpus_node - Update cpus node of flattened device tree using of_root
982+
* device node.
983+
* @fdt: Flattened device tree of the kernel.
984+
*
985+
* Returns 0 on success, negative errno on error.
986+
*/
987+
static int update_cpus_node(void *fdt)
988+
{
989+
struct device_node *cpus_node, *dn;
990+
int cpus_offset, cpus_subnode_offset, ret = 0;
991+
992+
cpus_offset = fdt_path_offset(fdt, "/cpus");
993+
if (cpus_offset < 0 && cpus_offset != -FDT_ERR_NOTFOUND) {
994+
pr_err("Malformed device tree: error reading /cpus node: %s\n",
995+
fdt_strerror(cpus_offset));
996+
return cpus_offset;
997+
}
998+
999+
if (cpus_offset > 0) {
1000+
ret = fdt_del_node(fdt, cpus_offset);
1001+
if (ret < 0) {
1002+
pr_err("Error deleting /cpus node: %s\n", fdt_strerror(ret));
1003+
return -EINVAL;
1004+
}
1005+
}
1006+
1007+
/* Add cpus node to fdt */
1008+
cpus_offset = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"), "cpus");
1009+
if (cpus_offset < 0) {
1010+
pr_err("Error creating /cpus node: %s\n", fdt_strerror(cpus_offset));
1011+
return -EINVAL;
1012+
}
1013+
1014+
/* Add cpus node properties */
1015+
cpus_node = of_find_node_by_path("/cpus");
1016+
ret = add_node_props(fdt, cpus_offset, cpus_node);
1017+
of_node_put(cpus_node);
1018+
if (ret < 0)
1019+
return ret;
1020+
1021+
/* Loop through all subnodes of cpus and add them to fdt */
1022+
for_each_node_by_type(dn, "cpu") {
1023+
cpus_subnode_offset = fdt_add_subnode(fdt, cpus_offset, dn->full_name);
1024+
if (cpus_subnode_offset < 0) {
1025+
pr_err("Unable to add %s subnode: %s\n", dn->full_name,
1026+
fdt_strerror(cpus_subnode_offset));
1027+
ret = cpus_subnode_offset;
1028+
goto out;
1029+
}
1030+
1031+
ret = add_node_props(fdt, cpus_subnode_offset, dn);
1032+
if (ret < 0)
1033+
goto out;
1034+
}
1035+
out:
1036+
of_node_put(dn);
1037+
return ret;
1038+
}
1039+
9531040
/**
9541041
* setup_new_fdt_ppc64 - Update the flattend device-tree of the kernel
9551042
* being loaded.
@@ -1006,6 +1093,11 @@ int setup_new_fdt_ppc64(const struct kimage *image, void *fdt,
10061093
}
10071094
}
10081095

1096+
/* Update cpus nodes information to account hotplug CPUs. */
1097+
ret = update_cpus_node(fdt);
1098+
if (ret < 0)
1099+
goto out;
1100+
10091101
/* Update memory reserve map */
10101102
ret = get_reserved_memory_ranges(&rmem);
10111103
if (ret)

0 commit comments

Comments
 (0)