Skip to content

Commit c278253

Browse files
committed
Merge tag 'powerpc-6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: - Reinstate support for little endian ELFv1 binaries, which it turns out still exist in the wild. - Revert a change which used asm goto for WARN_ON/__WARN_FLAGS, as it lead to dead code generation and seemed to trigger compiler bugs in some edge cases. - Fix a deadlock in the pseries VAS code, between live migration and the driver's mmap handler. - Disable KCOV instrumentation in the powerpc KASAN code. Thanks to Andrew Donnellan, Benjamin Gray, Christophe Leroy, Haren Myneni, Russell Currey, and Uwe Kleine-König. * tag 'powerpc-6.5-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: Revert "powerpc/64s: Remove support for ELFv1 little endian userspace" powerpc/kasan: Disable KCOV in KASAN code powerpc/512x: lpbfifo: Convert to platform remove callback returning void powerpc/crypto: Add gitignore for generated P10 AES/GCM .S files Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto" powerpc/pseries/vas: Hold mmap_mutex after mmap lock during window close
2 parents 295e138 + 106ea7f commit c278253

File tree

8 files changed

+29
-80
lines changed

8 files changed

+29
-80
lines changed

arch/powerpc/crypto/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
aesp10-ppc.S
3+
ghashp10-ppc.S

arch/powerpc/include/asm/bug.h

Lines changed: 13 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
#ifdef __KERNEL__
55

66
#include <asm/asm-compat.h>
7-
#include <asm/extable.h>
87

98
#ifdef CONFIG_BUG
109

1110
#ifdef __ASSEMBLY__
1211
#include <asm/asm-offsets.h>
1312
#ifdef CONFIG_DEBUG_BUGVERBOSE
14-
.macro __EMIT_BUG_ENTRY addr,file,line,flags
13+
.macro EMIT_BUG_ENTRY addr,file,line,flags
1514
.section __bug_table,"aw"
1615
5001: .4byte \addr - .
1716
.4byte 5002f - .
@@ -23,7 +22,7 @@
2322
.previous
2423
.endm
2524
#else
26-
.macro __EMIT_BUG_ENTRY addr,file,line,flags
25+
.macro EMIT_BUG_ENTRY addr,file,line,flags
2726
.section __bug_table,"aw"
2827
5001: .4byte \addr - .
2928
.short \flags
@@ -32,18 +31,6 @@
3231
.endm
3332
#endif /* verbose */
3433

35-
.macro EMIT_WARN_ENTRY addr,file,line,flags
36-
EX_TABLE(\addr,\addr+4)
37-
__EMIT_BUG_ENTRY \addr,\file,\line,\flags
38-
.endm
39-
40-
.macro EMIT_BUG_ENTRY addr,file,line,flags
41-
.if \flags & 1 /* BUGFLAG_WARNING */
42-
.err /* Use EMIT_WARN_ENTRY for warnings */
43-
.endif
44-
__EMIT_BUG_ENTRY \addr,\file,\line,\flags
45-
.endm
46-
4734
#else /* !__ASSEMBLY__ */
4835
/* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and
4936
sizeof(struct bug_entry), respectively */
@@ -73,16 +60,6 @@
7360
"i" (sizeof(struct bug_entry)), \
7461
##__VA_ARGS__)
7562

76-
#define WARN_ENTRY(insn, flags, label, ...) \
77-
asm_volatile_goto( \
78-
"1: " insn "\n" \
79-
EX_TABLE(1b, %l[label]) \
80-
_EMIT_BUG_ENTRY \
81-
: : "i" (__FILE__), "i" (__LINE__), \
82-
"i" (flags), \
83-
"i" (sizeof(struct bug_entry)), \
84-
##__VA_ARGS__ : : label)
85-
8663
/*
8764
* BUG_ON() and WARN_ON() do their best to cooperate with compile-time
8865
* optimisations. However depending on the complexity of the condition
@@ -95,16 +72,7 @@
9572
} while (0)
9673
#define HAVE_ARCH_BUG
9774

98-
#define __WARN_FLAGS(flags) do { \
99-
__label__ __label_warn_on; \
100-
\
101-
WARN_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags), __label_warn_on); \
102-
barrier_before_unreachable(); \
103-
__builtin_unreachable(); \
104-
\
105-
__label_warn_on: \
106-
break; \
107-
} while (0)
75+
#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags))
10876

10977
#ifdef CONFIG_PPC64
11078
#define BUG_ON(x) do { \
@@ -117,25 +85,15 @@ __label_warn_on: \
11785
} while (0)
11886

11987
#define WARN_ON(x) ({ \
120-
bool __ret_warn_on = false; \
121-
do { \
122-
if (__builtin_constant_p((x))) { \
123-
if (!(x)) \
124-
break; \
88+
int __ret_warn_on = !!(x); \
89+
if (__builtin_constant_p(__ret_warn_on)) { \
90+
if (__ret_warn_on) \
12591
__WARN(); \
126-
__ret_warn_on = true; \
127-
} else { \
128-
__label__ __label_warn_on; \
129-
\
130-
WARN_ENTRY(PPC_TLNEI " %4, 0", \
131-
BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \
132-
__label_warn_on, \
133-
"r" ((__force long)(x))); \
134-
break; \
135-
__label_warn_on: \
136-
__ret_warn_on = true; \
137-
} \
138-
} while (0); \
92+
} else { \
93+
BUG_ENTRY(PPC_TLNEI " %4, 0", \
94+
BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \
95+
"r" (__ret_warn_on)); \
96+
} \
13997
unlikely(__ret_warn_on); \
14098
})
14199

@@ -148,14 +106,13 @@ __label_warn_on: \
148106
#ifdef __ASSEMBLY__
149107
.macro EMIT_BUG_ENTRY addr,file,line,flags
150108
.endm
151-
.macro EMIT_WARN_ENTRY addr,file,line,flags
152-
.endm
153109
#else /* !__ASSEMBLY__ */
154110
#define _EMIT_BUG_ENTRY
155-
#define _EMIT_WARN_ENTRY
156111
#endif
157112
#endif /* CONFIG_BUG */
158113

114+
#define EMIT_WARN_ENTRY EMIT_BUG_ENTRY
115+
159116
#include <asm-generic/bug.h>
160117

161118
#ifndef __ASSEMBLY__

arch/powerpc/include/asm/elf.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@
1212

1313
/*
1414
* This is used to ensure we don't load something for the wrong architecture.
15-
* 64le only supports ELFv2 64-bit binaries (64be supports v1 and v2).
1615
*/
17-
#if defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN)
18-
#define elf_check_arch(x) (((x)->e_machine == ELF_ARCH) && \
19-
(((x)->e_flags & 0x3) == 0x2))
20-
#else
2116
#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
22-
#endif
2317
#define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC)
2418

2519
#define CORE_DUMP_USE_REGSET

arch/powerpc/include/asm/thread_info.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,9 @@ static inline bool test_thread_local_flags(unsigned int flags)
183183
#define clear_tsk_compat_task(tsk) do { } while (0)
184184
#endif
185185

186-
#ifdef CONFIG_PPC64
187-
#ifdef CONFIG_CPU_BIG_ENDIAN
186+
#if defined(CONFIG_PPC64)
188187
#define is_elf2_task() (test_thread_flag(TIF_ELF2ABI))
189188
#else
190-
#define is_elf2_task() (1)
191-
#endif
192-
#else
193189
#define is_elf2_task() (0)
194190
#endif
195191

arch/powerpc/kernel/traps.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,13 +1508,8 @@ static void do_program_check(struct pt_regs *regs)
15081508

15091509
if (!(regs->msr & MSR_PR) && /* not user-mode */
15101510
report_bug(bugaddr, regs) == BUG_TRAP_TYPE_WARN) {
1511-
const struct exception_table_entry *entry;
1512-
1513-
entry = search_exception_tables(bugaddr);
1514-
if (entry) {
1515-
regs_set_return_ip(regs, extable_fixup(entry) + regs->nip - bugaddr);
1516-
return;
1517-
}
1511+
regs_add_return_ip(regs, 4);
1512+
return;
15181513
}
15191514

15201515
if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE) && user_mode(regs)) {

arch/powerpc/mm/kasan/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22

33
KASAN_SANITIZE := n
4+
KCOV_INSTRUMENT := n
45

56
obj-$(CONFIG_PPC32) += init_32.o
67
obj-$(CONFIG_PPC_8xx) += 8xx.o

arch/powerpc/platforms/512x/mpc512x_lpbfifo.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static int mpc512x_lpbfifo_probe(struct platform_device *pdev)
477477
return ret;
478478
}
479479

480-
static int mpc512x_lpbfifo_remove(struct platform_device *pdev)
480+
static void mpc512x_lpbfifo_remove(struct platform_device *pdev)
481481
{
482482
unsigned long flags;
483483
struct dma_device *dma_dev = lpbfifo.chan->device;
@@ -494,8 +494,6 @@ static int mpc512x_lpbfifo_remove(struct platform_device *pdev)
494494
free_irq(lpbfifo.irq, &pdev->dev);
495495
irq_dispose_mapping(lpbfifo.irq);
496496
dma_release_channel(lpbfifo.chan);
497-
498-
return 0;
499497
}
500498

501499
static const struct of_device_id mpc512x_lpbfifo_match[] = {
@@ -506,7 +504,7 @@ MODULE_DEVICE_TABLE(of, mpc512x_lpbfifo_match);
506504

507505
static struct platform_driver mpc512x_lpbfifo_driver = {
508506
.probe = mpc512x_lpbfifo_probe,
509-
.remove = mpc512x_lpbfifo_remove,
507+
.remove_new = mpc512x_lpbfifo_remove,
510508
.driver = {
511509
.name = DRV_NAME,
512510
.of_match_table = mpc512x_lpbfifo_match,

arch/powerpc/platforms/pseries/vas.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,12 @@ static int reconfig_close_windows(struct vas_caps *vcap, int excess_creds,
744744
}
745745

746746
task_ref = &win->vas_win.task_ref;
747+
/*
748+
* VAS mmap (coproc_mmap()) and its fault handler
749+
* (vas_mmap_fault()) are called after holding mmap lock.
750+
* So hold mmap mutex after mmap_lock to avoid deadlock.
751+
*/
752+
mmap_write_lock(task_ref->mm);
747753
mutex_lock(&task_ref->mmap_mutex);
748754
vma = task_ref->vma;
749755
/*
@@ -752,7 +758,6 @@ static int reconfig_close_windows(struct vas_caps *vcap, int excess_creds,
752758
*/
753759
win->vas_win.status |= flag;
754760

755-
mmap_write_lock(task_ref->mm);
756761
/*
757762
* vma is set in the original mapping. But this mapping
758763
* is done with mmap() after the window is opened with ioctl.
@@ -762,8 +767,8 @@ static int reconfig_close_windows(struct vas_caps *vcap, int excess_creds,
762767
if (vma)
763768
zap_vma_pages(vma);
764769

765-
mmap_write_unlock(task_ref->mm);
766770
mutex_unlock(&task_ref->mmap_mutex);
771+
mmap_write_unlock(task_ref->mm);
767772
/*
768773
* Close VAS window in the hypervisor, but do not
769774
* free vas_window struct since it may be reused

0 commit comments

Comments
 (0)