Skip to content

Commit 4645453

Browse files
committed
Merge tag 'powerpc-4.20-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "One notable fix for our change to split pt_regs between user/kernel, we forgot to update BPF to use the user-visible type which was an ABI break for BPF programs. A slightly ugly but minimal fix to do_syscall_trace_enter() so that we use tracehook_report_syscall_entry() properly. We'll rework the code in next to avoid the empty if body. Seven commits fixing bugs in the new papr_scm (Storage Class Memory) driver. The driver was finally able to be tested on the other hypervisor which exposed several bugs. The fixes are all fairly minimal at least. Fix a crash in our MSI code if an MSI-capable device is plugged into a non-MSI capable PHB, only seen on older hardware (MPC8378). Fix our legacy serial code to look for "stdout-path" since the device trees were updated to use that instead of "linux,stdout-path". A change to the COFF zImage code to fix booting old powermacs. A couple of minor build fixes. Thanks to: Benjamin Herrenschmidt, Daniel Axtens, Dmitry V. Levin, Elvira Khabirova, Oliver O'Halloran, Paul Mackerras, Radu Rendec, Rob Herring, Sandipan Das" * tag 'powerpc-4.20-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/ptrace: replace ptrace_report_syscall() with a tracehook call powerpc/mm: Fallback to RAM if the altmap is unusable powerpc/papr_scm: Use ibm,unit-guid as the iset cookie powerpc/papr_scm: Fix DIMM device registration race powerpc/papr_scm: Remove endian conversions powerpc/papr_scm: Update DT properties powerpc/papr_scm: Fix resource end address powerpc/papr_scm: Use depend instead of select powerpc/bpf: Fix broken uapi for BPF_PROG_TYPE_PERF_EVENT powerpc/boot: Fix build failures with -j 1 powerpc: Look for "stdout-path" when setting up legacy consoles powerpc/msi: Fix NULL pointer access in teardown code powerpc/mm: Fix linux page tables build with some configs powerpc: Fix COFF zImage booting on old powermacs
2 parents c19bf74 + a225f15 commit 4645453

12 files changed

Lines changed: 80 additions & 20 deletions

File tree

‎arch/powerpc/boot/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ $(obj)/empty.c:
197197
$(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds : $(obj)/%: $(srctree)/$(src)/%.S
198198
$(Q)cp $< $@
199199

200-
$(obj)/serial.c: $(obj)/autoconf.h
200+
$(srctree)/$(src)/serial.c: $(obj)/autoconf.h
201201

202202
$(obj)/autoconf.h: $(obj)/%: $(objtree)/include/generated/%
203203
$(Q)cp $< $@

‎arch/powerpc/boot/crt0.S‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@
1515
RELA = 7
1616
RELACOUNT = 0x6ffffff9
1717

18-
.text
18+
.data
1919
/* A procedure descriptor used when booting this as a COFF file.
2020
* When making COFF, this comes first in the link and we're
2121
* linked at 0x500000.
2222
*/
2323
.globl _zimage_start_opd
2424
_zimage_start_opd:
2525
.long 0x500000, 0, 0, 0
26+
.text
27+
b _zimage_start
2628

2729
#ifdef __powerpc64__
2830
.balign 8

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <asm/ptrace.h>
2727
#include <asm/reg.h>
2828

29+
#define perf_arch_bpf_user_pt_regs(regs) &regs->user_regs
30+
2931
/*
3032
* Overload regs->result to specify whether we should use the MSR (result
3133
* is zero) or the SIAR (result is non zero).

‎arch/powerpc/include/uapi/asm/Kbuild‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# UAPI Header export list
22
include include/uapi/asm-generic/Kbuild.asm
33

4-
generic-y += bpf_perf_event.h
54
generic-y += param.h
65
generic-y += poll.h
76
generic-y += resource.h
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
3+
#define _UAPI__ASM_BPF_PERF_EVENT_H__
4+
5+
#include <asm/ptrace.h>
6+
7+
typedef struct user_pt_regs bpf_user_pt_regs_t;
8+
9+
#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */

‎arch/powerpc/kernel/legacy_serial.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ void __init find_legacy_serial_ports(void)
372372

373373
/* Now find out if one of these is out firmware console */
374374
path = of_get_property(of_chosen, "linux,stdout-path", NULL);
375+
if (path == NULL)
376+
path = of_get_property(of_chosen, "stdout-path", NULL);
375377
if (path != NULL) {
376378
stdout = of_find_node_by_path(path);
377379
if (stdout)
@@ -595,8 +597,10 @@ static int __init check_legacy_serial_console(void)
595597
/* We are getting a weird phandle from OF ... */
596598
/* ... So use the full path instead */
597599
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
600+
if (name == NULL)
601+
name = of_get_property(of_chosen, "stdout-path", NULL);
598602
if (name == NULL) {
599-
DBG(" no linux,stdout-path !\n");
603+
DBG(" no stdout-path !\n");
600604
return -ENODEV;
601605
}
602606
prom_stdout = of_find_node_by_path(name);

‎arch/powerpc/kernel/msi.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@ void arch_teardown_msi_irqs(struct pci_dev *dev)
3434
{
3535
struct pci_controller *phb = pci_bus_to_host(dev->bus);
3636

37-
phb->controller_ops.teardown_msi_irqs(dev);
37+
/*
38+
* We can be called even when arch_setup_msi_irqs() returns -ENOSYS,
39+
* so check the pointer again.
40+
*/
41+
if (phb->controller_ops.teardown_msi_irqs)
42+
phb->controller_ops.teardown_msi_irqs(dev);
3843
}

‎arch/powerpc/kernel/ptrace.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3266,12 +3266,17 @@ long do_syscall_trace_enter(struct pt_regs *regs)
32663266
user_exit();
32673267

32683268
if (test_thread_flag(TIF_SYSCALL_EMU)) {
3269-
ptrace_report_syscall(regs);
32703269
/*
3270+
* A nonzero return code from tracehook_report_syscall_entry()
3271+
* tells us to prevent the syscall execution, but we are not
3272+
* going to execute it anyway.
3273+
*
32713274
* Returning -1 will skip the syscall execution. We want to
32723275
* avoid clobbering any register also, thus, not 'gotoing'
32733276
* skip label.
32743277
*/
3278+
if (tracehook_report_syscall_entry(regs))
3279+
;
32753280
return -1;
32763281
}
32773282

‎arch/powerpc/mm/dump_linuxpagetables.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/hugetlb.h>
2020
#include <linux/io.h>
2121
#include <linux/mm.h>
22+
#include <linux/highmem.h>
2223
#include <linux/sched.h>
2324
#include <linux/seq_file.h>
2425
#include <asm/fixmap.h>

‎arch/powerpc/mm/init_64.c‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,20 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
188188
pr_debug("vmemmap_populate %lx..%lx, node %d\n", start, end, node);
189189

190190
for (; start < end; start += page_size) {
191-
void *p;
191+
void *p = NULL;
192192
int rc;
193193

194194
if (vmemmap_populated(start, page_size))
195195
continue;
196196

197+
/*
198+
* Allocate from the altmap first if we have one. This may
199+
* fail due to alignment issues when using 16MB hugepages, so
200+
* fall back to system memory if the altmap allocation fail.
201+
*/
197202
if (altmap)
198203
p = altmap_alloc_block_buf(page_size, altmap);
199-
else
204+
if (!p)
200205
p = vmemmap_alloc_block_buf(page_size, node);
201206
if (!p)
202207
return -ENOMEM;
@@ -255,8 +260,15 @@ void __ref vmemmap_free(unsigned long start, unsigned long end,
255260
{
256261
unsigned long page_size = 1 << mmu_psize_defs[mmu_vmemmap_psize].shift;
257262
unsigned long page_order = get_order(page_size);
263+
unsigned long alt_start = ~0, alt_end = ~0;
264+
unsigned long base_pfn;
258265

259266
start = _ALIGN_DOWN(start, page_size);
267+
if (altmap) {
268+
alt_start = altmap->base_pfn;
269+
alt_end = altmap->base_pfn + altmap->reserve +
270+
altmap->free + altmap->alloc + altmap->align;
271+
}
260272

261273
pr_debug("vmemmap_free %lx...%lx\n", start, end);
262274

@@ -280,8 +292,9 @@ void __ref vmemmap_free(unsigned long start, unsigned long end,
280292
page = pfn_to_page(addr >> PAGE_SHIFT);
281293
section_base = pfn_to_page(vmemmap_section_start(start));
282294
nr_pages = 1 << page_order;
295+
base_pfn = PHYS_PFN(addr);
283296

284-
if (altmap) {
297+
if (base_pfn >= alt_start && base_pfn < alt_end) {
285298
vmem_altmap_free(altmap, nr_pages);
286299
} else if (PageReserved(page)) {
287300
/* allocated from bootmem */

0 commit comments

Comments
 (0)