Skip to content

Commit 218ea31

Browse files
committed
Merge branch 'fixes' into next
Merge our fixes branch, a few of them are tripping people up while working on top of next, and we also have a dependency between the CXL fixes and new CXL code we want to merge into next.
2 parents 5405c92 + d6bd819 commit 218ea31

35 files changed

+368
-172
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,15 @@
866866

867867
dscc4.setup= [NET]
868868

869+
dt_cpu_ftrs= [PPC]
870+
Format: {"off" | "known"}
871+
Control how the dt_cpu_ftrs device-tree binding is
872+
used for CPU feature discovery and setup (if it
873+
exists).
874+
off: Do not use it, fall back to legacy cpu table.
875+
known: Do not pass through unknown features to guests
876+
or userspace, only those that the kernel is aware of.
877+
869878
dump_apple_properties [X86]
870879
Dump name and content of EFI device properties on
871880
x86 Macs. Useful for driver authors to determine

arch/powerpc/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -374,22 +374,6 @@ source "arch/powerpc/platforms/Kconfig"
374374

375375
menu "Kernel options"
376376

377-
config PPC_DT_CPU_FTRS
378-
bool "Device-tree based CPU feature discovery & setup"
379-
depends on PPC_BOOK3S_64
380-
default n
381-
help
382-
This enables code to use a new device tree binding for describing CPU
383-
compatibility and features. Saying Y here will attempt to use the new
384-
binding if the firmware provides it. Currently only the skiboot
385-
firmware provides this binding.
386-
If you're not sure say Y.
387-
388-
config PPC_CPUFEATURES_ENABLE_UNKNOWN
389-
bool "cpufeatures pass through unknown features to guest/userspace"
390-
depends on PPC_DT_CPU_FTRS
391-
default y
392-
393377
config HIGHMEM
394378
bool "High memory support"
395379
depends on PPC32

arch/powerpc/include/asm/book3s/64/hash-4k.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define H_PTE_INDEX_SIZE 9
99
#define H_PMD_INDEX_SIZE 7
1010
#define H_PUD_INDEX_SIZE 9
11-
#define H_PGD_INDEX_SIZE 12
11+
#define H_PGD_INDEX_SIZE 9
1212

1313
#ifndef __ASSEMBLY__
1414
#define H_PTE_TABLE_SIZE (sizeof(pte_t) << H_PTE_INDEX_SIZE)

arch/powerpc/include/asm/bug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
"1: "PPC_TLNEI" %4,0\n" \
105105
_EMIT_BUG_ENTRY \
106106
: : "i" (__FILE__), "i" (__LINE__), \
107-
"i" (BUGFLAG_TAINT(TAINT_WARN)), \
107+
"i" (BUGFLAG_WARNING|BUGFLAG_TAINT(TAINT_WARN)),\
108108
"i" (sizeof(struct bug_entry)), \
109109
"r" (__ret_warn_on)); \
110110
} \

arch/powerpc/include/asm/cputable.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ enum {
214214
#define CPU_FTR_DAWR LONG_ASM_CONST(0x0400000000000000)
215215
#define CPU_FTR_DABRX LONG_ASM_CONST(0x0800000000000000)
216216
#define CPU_FTR_PMAO_BUG LONG_ASM_CONST(0x1000000000000000)
217-
#define CPU_FTR_SUBCORE LONG_ASM_CONST(0x2000000000000000)
218217
#define CPU_FTR_POWER9_DD1 LONG_ASM_CONST(0x4000000000000000)
219218

220219
#ifndef __ASSEMBLY__
@@ -463,7 +462,7 @@ enum {
463462
CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
464463
CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
465464
CPU_FTR_DBELL | CPU_FTR_HAS_PPR | CPU_FTR_DAWR | \
466-
CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP | CPU_FTR_SUBCORE)
465+
CPU_FTR_ARCH_207S | CPU_FTR_TM_COMP)
467466
#define CPU_FTRS_POWER8E (CPU_FTRS_POWER8 | CPU_FTR_PMAO_BUG)
468467
#define CPU_FTRS_POWER8_DD1 (CPU_FTRS_POWER8 & ~CPU_FTR_DBELL)
469468
#define CPU_FTRS_POWER9 (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \

arch/powerpc/include/asm/kprobes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ extern int kprobe_exceptions_notify(struct notifier_block *self,
103103
extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
104104
extern int kprobe_handler(struct pt_regs *regs);
105105
extern int kprobe_post_handler(struct pt_regs *regs);
106+
extern int is_current_kprobe_addr(unsigned long addr);
106107
#ifdef CONFIG_KPROBES_ON_FTRACE
107108
extern int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
108109
struct kprobe_ctlblk *kcb);

arch/powerpc/include/asm/processor.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,18 @@ void release_thread(struct task_struct *);
110110
#define TASK_SIZE_128TB (0x0000800000000000UL)
111111
#define TASK_SIZE_512TB (0x0002000000000000UL)
112112

113-
#ifdef CONFIG_PPC_BOOK3S_64
113+
/*
114+
* For now 512TB is only supported with book3s and 64K linux page size.
115+
*/
116+
#if defined(CONFIG_PPC_BOOK3S_64) && defined(CONFIG_PPC_64K_PAGES)
114117
/*
115118
* Max value currently used:
116119
*/
117-
#define TASK_SIZE_USER64 TASK_SIZE_512TB
120+
#define TASK_SIZE_USER64 TASK_SIZE_512TB
121+
#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_128TB
118122
#else
119-
#define TASK_SIZE_USER64 TASK_SIZE_64TB
123+
#define TASK_SIZE_USER64 TASK_SIZE_64TB
124+
#define DEFAULT_MAP_WINDOW_USER64 TASK_SIZE_64TB
120125
#endif
121126

122127
/*
@@ -132,7 +137,7 @@ void release_thread(struct task_struct *);
132137
* space during mmap's.
133138
*/
134139
#define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))
135-
#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_128TB / 4))
140+
#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(DEFAULT_MAP_WINDOW_USER64 / 4))
136141

137142
#define TASK_UNMAPPED_BASE ((is_32bit_task()) ? \
138143
TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 )
@@ -143,21 +148,15 @@ void release_thread(struct task_struct *);
143148
* with 128TB and conditionally enable upto 512TB
144149
*/
145150
#ifdef CONFIG_PPC_BOOK3S_64
146-
#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \
147-
TASK_SIZE_USER32 : TASK_SIZE_128TB)
151+
#define DEFAULT_MAP_WINDOW ((is_32bit_task()) ? \
152+
TASK_SIZE_USER32 : DEFAULT_MAP_WINDOW_USER64)
148153
#else
149154
#define DEFAULT_MAP_WINDOW TASK_SIZE
150155
#endif
151156

152157
#ifdef __powerpc64__
153158

154-
#ifdef CONFIG_PPC_BOOK3S_64
155-
/* Limit stack to 128TB */
156-
#define STACK_TOP_USER64 TASK_SIZE_128TB
157-
#else
158-
#define STACK_TOP_USER64 TASK_SIZE_USER64
159-
#endif
160-
159+
#define STACK_TOP_USER64 DEFAULT_MAP_WINDOW_USER64
161160
#define STACK_TOP_USER32 TASK_SIZE_USER32
162161

163162
#define STACK_TOP (is_32bit_task() ? \

arch/powerpc/include/asm/topology.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,22 @@ extern void __init dump_numa_cpu_topology(void);
4444
extern int sysfs_add_device_to_node(struct device *dev, int nid);
4545
extern void sysfs_remove_device_from_node(struct device *dev, int nid);
4646

47+
static inline int early_cpu_to_node(int cpu)
48+
{
49+
int nid;
50+
51+
nid = numa_cpu_lookup_table[cpu];
52+
53+
/*
54+
* Fall back to node 0 if nid is unset (it should be, except bugs).
55+
* This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)).
56+
*/
57+
return (nid < 0) ? 0 : nid;
58+
}
4759
#else
4860

61+
static inline int early_cpu_to_node(int cpu) { return 0; }
62+
4963
static inline void dump_numa_cpu_topology(void) {}
5064

5165
static inline int sysfs_add_device_to_node(struct device *dev, int nid)

arch/powerpc/include/asm/uaccess.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,7 @@ do { \
267267
extern unsigned long __copy_tofrom_user(void __user *to,
268268
const void __user *from, unsigned long size);
269269

270-
#ifndef __powerpc64__
271-
272-
#define INLINE_COPY_FROM_USER
273-
#define INLINE_COPY_TO_USER
274-
275-
#else /* __powerpc64__ */
276-
270+
#ifdef __powerpc64__
277271
static inline unsigned long
278272
raw_copy_in_user(void __user *to, const void __user *from, unsigned long n)
279273
{

arch/powerpc/include/asm/xive.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ struct xive_q {
9494
* store at 0 and some ESBs support doing a trigger via a
9595
* separate trigger page.
9696
*/
97-
#define XIVE_ESB_GET 0x800
98-
#define XIVE_ESB_SET_PQ_00 0xc00
99-
#define XIVE_ESB_SET_PQ_01 0xd00
100-
#define XIVE_ESB_SET_PQ_10 0xe00
101-
#define XIVE_ESB_SET_PQ_11 0xf00
97+
#define XIVE_ESB_STORE_EOI 0x400 /* Store */
98+
#define XIVE_ESB_LOAD_EOI 0x000 /* Load */
99+
#define XIVE_ESB_GET 0x800 /* Load */
100+
#define XIVE_ESB_SET_PQ_00 0xc00 /* Load */
101+
#define XIVE_ESB_SET_PQ_01 0xd00 /* Load */
102+
#define XIVE_ESB_SET_PQ_10 0xe00 /* Load */
103+
#define XIVE_ESB_SET_PQ_11 0xf00 /* Load */
102104

103105
#define XIVE_ESB_VAL_P 0x2
104106
#define XIVE_ESB_VAL_Q 0x1

arch/powerpc/kernel/dt_cpu_ftrs.c

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/export.h>
99
#include <linux/init.h>
1010
#include <linux/jump_label.h>
11+
#include <linux/libfdt.h>
1112
#include <linux/memblock.h>
1213
#include <linux/printk.h>
1314
#include <linux/sched.h>
@@ -642,7 +643,6 @@ static struct dt_cpu_feature_match __initdata
642643
{"processor-control-facility", feat_enable_dbell, CPU_FTR_DBELL},
643644
{"processor-control-facility-v3", feat_enable_dbell, CPU_FTR_DBELL},
644645
{"processor-utilization-of-resources-register", feat_enable_purr, 0},
645-
{"subcore", feat_enable, CPU_FTR_SUBCORE},
646646
{"no-execute", feat_enable, 0},
647647
{"strong-access-ordering", feat_enable, CPU_FTR_SAO},
648648
{"cache-inhibited-large-page", feat_enable_large_ci, 0},
@@ -671,12 +671,24 @@ static struct dt_cpu_feature_match __initdata
671671
{"wait-v3", feat_enable, 0},
672672
};
673673

674-
/* XXX: how to configure this? Default + boot time? */
675-
#ifdef CONFIG_PPC_CPUFEATURES_ENABLE_UNKNOWN
676-
#define CPU_FEATURE_ENABLE_UNKNOWN 1
677-
#else
678-
#define CPU_FEATURE_ENABLE_UNKNOWN 0
679-
#endif
674+
static bool __initdata using_dt_cpu_ftrs;
675+
static bool __initdata enable_unknown = true;
676+
677+
static int __init dt_cpu_ftrs_parse(char *str)
678+
{
679+
if (!str)
680+
return 0;
681+
682+
if (!strcmp(str, "off"))
683+
using_dt_cpu_ftrs = false;
684+
else if (!strcmp(str, "known"))
685+
enable_unknown = false;
686+
else
687+
return 1;
688+
689+
return 0;
690+
}
691+
early_param("dt_cpu_ftrs", dt_cpu_ftrs_parse);
680692

681693
static void __init cpufeatures_setup_start(u32 isa)
682694
{
@@ -707,7 +719,7 @@ static bool __init cpufeatures_process_feature(struct dt_cpu_feature *f)
707719
}
708720
}
709721

710-
if (!known && CPU_FEATURE_ENABLE_UNKNOWN) {
722+
if (!known && enable_unknown) {
711723
if (!feat_try_enable_unknown(f)) {
712724
pr_info("not enabling: %s (unknown and unsupported by kernel)\n",
713725
f->name);
@@ -756,6 +768,26 @@ static void __init cpufeatures_setup_finished(void)
756768
cur_cpu_spec->cpu_features, cur_cpu_spec->mmu_features);
757769
}
758770

771+
static int __init disabled_on_cmdline(void)
772+
{
773+
unsigned long root, chosen;
774+
const char *p;
775+
776+
root = of_get_flat_dt_root();
777+
chosen = of_get_flat_dt_subnode_by_name(root, "chosen");
778+
if (chosen == -FDT_ERR_NOTFOUND)
779+
return false;
780+
781+
p = of_get_flat_dt_prop(chosen, "bootargs", NULL);
782+
if (!p)
783+
return false;
784+
785+
if (strstr(p, "dt_cpu_ftrs=off"))
786+
return true;
787+
788+
return false;
789+
}
790+
759791
static int __init fdt_find_cpu_features(unsigned long node, const char *uname,
760792
int depth, void *data)
761793
{
@@ -766,22 +798,25 @@ static int __init fdt_find_cpu_features(unsigned long node, const char *uname,
766798
return 0;
767799
}
768800

769-
static bool __initdata using_dt_cpu_ftrs = false;
770-
771801
bool __init dt_cpu_ftrs_in_use(void)
772802
{
773803
return using_dt_cpu_ftrs;
774804
}
775805

776806
bool __init dt_cpu_ftrs_init(void *fdt)
777807
{
808+
using_dt_cpu_ftrs = false;
809+
778810
/* Setup and verify the FDT, if it fails we just bail */
779811
if (!early_init_dt_verify(fdt))
780812
return false;
781813

782814
if (!of_scan_flat_dt(fdt_find_cpu_features, NULL))
783815
return false;
784816

817+
if (disabled_on_cmdline())
818+
return false;
819+
785820
cpufeatures_setup_cpu();
786821

787822
using_dt_cpu_ftrs = true;
@@ -1027,5 +1062,8 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char
10271062

10281063
void __init dt_cpu_ftrs_scan(void)
10291064
{
1065+
if (!using_dt_cpu_ftrs)
1066+
return;
1067+
10301068
of_scan_flat_dt(dt_cpu_ftrs_scan_callback, NULL);
10311069
}

arch/powerpc/kernel/exceptions-64s.S

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,10 +1452,8 @@ USE_TEXT_SECTION()
14521452
.balign IFETCH_ALIGN_BYTES
14531453
do_hash_page:
14541454
#ifdef CONFIG_PPC_STD_MMU_64
1455-
andis. r0,r4,0xa410 /* weird error? */
1455+
andis. r0,r4,0xa450 /* weird error? */
14561456
bne- handle_page_fault /* if not, try to insert a HPTE */
1457-
andis. r0,r4,DSISR_DABRMATCH@h
1458-
bne- handle_dabr_fault
14591457
CURRENT_THREAD_INFO(r11, r1)
14601458
lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
14611459
andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
@@ -1479,11 +1477,16 @@ do_hash_page:
14791477

14801478
/* Error */
14811479
blt- 13f
1480+
1481+
/* Reload DSISR into r4 for the DABR check below */
1482+
ld r4,_DSISR(r1)
14821483
#endif /* CONFIG_PPC_STD_MMU_64 */
14831484

14841485
/* Here we have a page fault that hash_page can't handle. */
14851486
handle_page_fault:
1486-
11: ld r4,_DAR(r1)
1487+
11: andis. r0,r4,DSISR_DABRMATCH@h
1488+
bne- handle_dabr_fault
1489+
ld r4,_DAR(r1)
14871490
ld r5,_DSISR(r1)
14881491
addi r3,r1,STACK_FRAME_OVERHEAD
14891492
bl do_page_fault

arch/powerpc/kernel/kprobes.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
4343

4444
struct kretprobe_blackpoint kretprobe_blacklist[] = {{NULL, NULL}};
4545

46+
int is_current_kprobe_addr(unsigned long addr)
47+
{
48+
struct kprobe *p = kprobe_running();
49+
return (p && (unsigned long)p->addr == addr) ? 1 : 0;
50+
}
51+
4652
bool arch_within_kprobe_blacklist(unsigned long addr)
4753
{
4854
return (addr >= (unsigned long)__kprobes_text_start &&
@@ -617,6 +623,15 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
617623
regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);
618624
#endif
619625

626+
/*
627+
* jprobes use jprobe_return() which skips the normal return
628+
* path of the function, and this messes up the accounting of the
629+
* function graph tracer.
630+
*
631+
* Pause function graph tracing while performing the jprobe function.
632+
*/
633+
pause_graph_tracing();
634+
620635
return 1;
621636
}
622637
NOKPROBE_SYMBOL(setjmp_pre_handler);
@@ -642,6 +657,8 @@ int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
642657
* saved regs...
643658
*/
644659
memcpy(regs, &kcb->jprobe_saved_regs, sizeof(struct pt_regs));
660+
/* It's OK to start function graph tracing again */
661+
unpause_graph_tracing();
645662
preempt_enable_no_resched();
646663
return 1;
647664
}

0 commit comments

Comments
 (0)