Skip to content

Commit 5411de0

Browse files
committed
Merge tag 'powerpc-5.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Fix BPF uapi confusion about the correct type of bpf_user_pt_regs_t. - Fix virt_addr_valid() when memory is hotplugged above the boot-time high_memory value. - Fix a bug in 64-bit Book3E map_kernel_page() which would incorrectly allocate a PMD page at PUD level. - Fix a couple of minor issues found since we enabled KASAN for 64-bit Book3S. Thanks to Aneesh Kumar K.V, Cédric Le Goater, Christophe Leroy, Kefeng Wang, Liam Howlett, Nathan Lynch, and Naveen N. Rao. * tag 'powerpc-5.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/memhotplug: Add add_pages override for PPC powerpc/bpf: Fix use of user_pt_regs in uapi powerpc/prom_init: Fix kernel config grep powerpc/book3e: Fix PUD allocation size in map_kernel_page() powerpc/xive/spapr: correct bitmap allocation size
2 parents 0898660 + ac790d0 commit 5411de0

File tree

7 files changed

+52
-16
lines changed

7 files changed

+52
-16
lines changed

arch/powerpc/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ config ARCH_SUSPEND_NONZERO_CPU
358358
def_bool y
359359
depends on PPC_POWERNV || PPC_PSERIES
360360

361+
config ARCH_HAS_ADD_PAGES
362+
def_bool y
363+
depends on ARCH_ENABLE_MEMORY_HOTPLUG
364+
361365
config PPC_DCR_NATIVE
362366
bool
363367

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 _ASM_POWERPC_BPF_PERF_EVENT_H
3+
#define _ASM_POWERPC_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 /* _ASM_POWERPC_BPF_PERF_EVENT_H */

arch/powerpc/include/uapi/asm/bpf_perf_event.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

arch/powerpc/kernel/prom_init_check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# If you really need to reference something from prom_init.o add
1414
# it to the list below:
1515

16-
grep "^CONFIG_KASAN=y$" .config >/dev/null
16+
grep "^CONFIG_KASAN=y$" ${KCONFIG_CONFIG} >/dev/null
1717
if [ $? -eq 0 ]
1818
then
1919
MEM_FUNCS="__memcpy __memset"

arch/powerpc/mm/mem.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,37 @@ void __ref arch_remove_linear_mapping(u64 start, u64 size)
105105
vm_unmap_aliases();
106106
}
107107

108+
/*
109+
* After memory hotplug the variables max_pfn, max_low_pfn and high_memory need
110+
* updating.
111+
*/
112+
static void update_end_of_memory_vars(u64 start, u64 size)
113+
{
114+
unsigned long end_pfn = PFN_UP(start + size);
115+
116+
if (end_pfn > max_pfn) {
117+
max_pfn = end_pfn;
118+
max_low_pfn = end_pfn;
119+
high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
120+
}
121+
}
122+
123+
int __ref add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
124+
struct mhp_params *params)
125+
{
126+
int ret;
127+
128+
ret = __add_pages(nid, start_pfn, nr_pages, params);
129+
if (ret)
130+
return ret;
131+
132+
/* update max_pfn, max_low_pfn and high_memory */
133+
update_end_of_memory_vars(start_pfn << PAGE_SHIFT,
134+
nr_pages << PAGE_SHIFT);
135+
136+
return ret;
137+
}
138+
108139
int __ref arch_add_memory(int nid, u64 start, u64 size,
109140
struct mhp_params *params)
110141
{
@@ -115,7 +146,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
115146
rc = arch_create_linear_mapping(nid, start, size, params);
116147
if (rc)
117148
return rc;
118-
rc = __add_pages(nid, start_pfn, nr_pages, params);
149+
rc = add_pages(nid, start_pfn, nr_pages, params);
119150
if (rc)
120151
arch_remove_linear_mapping(start, size);
121152
return rc;

arch/powerpc/mm/nohash/book3e_pgtable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
9696
pgdp = pgd_offset_k(ea);
9797
p4dp = p4d_offset(pgdp, ea);
9898
if (p4d_none(*p4dp)) {
99-
pmdp = early_alloc_pgtable(PMD_TABLE_SIZE);
100-
p4d_populate(&init_mm, p4dp, pmdp);
99+
pudp = early_alloc_pgtable(PUD_TABLE_SIZE);
100+
p4d_populate(&init_mm, p4dp, pudp);
101101
}
102102
pudp = pud_offset(p4dp, ea);
103103
if (pud_none(*pudp)) {
@@ -106,7 +106,7 @@ int __ref map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot)
106106
}
107107
pmdp = pmd_offset(pudp, ea);
108108
if (!pmd_present(*pmdp)) {
109-
ptep = early_alloc_pgtable(PAGE_SIZE);
109+
ptep = early_alloc_pgtable(PTE_TABLE_SIZE);
110110
pmd_populate_kernel(&init_mm, pmdp, ptep);
111111
}
112112
ptep = pte_offset_kernel(pmdp, ea);

arch/powerpc/sysdev/xive/spapr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/of_fdt.h>
1616
#include <linux/slab.h>
1717
#include <linux/spinlock.h>
18+
#include <linux/bitmap.h>
1819
#include <linux/cpumask.h>
1920
#include <linux/mm.h>
2021
#include <linux/delay.h>
@@ -57,7 +58,7 @@ static int __init xive_irq_bitmap_add(int base, int count)
5758
spin_lock_init(&xibm->lock);
5859
xibm->base = base;
5960
xibm->count = count;
60-
xibm->bitmap = kzalloc(xibm->count, GFP_KERNEL);
61+
xibm->bitmap = bitmap_zalloc(xibm->count, GFP_KERNEL);
6162
if (!xibm->bitmap) {
6263
kfree(xibm);
6364
return -ENOMEM;
@@ -75,7 +76,7 @@ static void xive_irq_bitmap_remove_all(void)
7576

7677
list_for_each_entry_safe(xibm, tmp, &xive_irq_bitmaps, list) {
7778
list_del(&xibm->list);
78-
kfree(xibm->bitmap);
79+
bitmap_free(xibm->bitmap);
7980
kfree(xibm);
8081
}
8182
}

0 commit comments

Comments
 (0)