Skip to content

Commit

Permalink
Merge tag 'powerpc-5.11-1' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/powerpc/linux

Pull powerpc updates from Michael Ellerman:

 - Switch to the generic C VDSO, as well as some cleanups of our VDSO
   setup/handling code.

 - Support for KUAP (Kernel User Access Prevention) on systems using the
   hashed page table MMU, using memory protection keys.

 - Better handling of PowerVM SMT8 systems where all threads of a core
   do not share an L2, allowing the scheduler to make better scheduling
   decisions.

 - Further improvements to our machine check handling.

 - Show registers when unwinding interrupt frames during stack traces.

 - Improvements to our pseries (PowerVM) partition migration code.

 - Several series from Christophe refactoring and cleaning up various
   parts of the 32-bit code.

 - Other smaller features, fixes & cleanups.

Thanks to: Alan Modra, Alexey Kardashevskiy, Andrew Donnellan, Aneesh
Kumar K.V, Ard Biesheuvel, Athira Rajeev, Balamuruhan S, Bill Wendling,
Cédric Le Goater, Christophe Leroy, Christophe Lombard, Colin Ian King,
Daniel Axtens, David Hildenbrand, Frederic Barrat, Ganesh Goudar,
Gautham R. Shenoy, Geert Uytterhoeven, Giuseppe Sacco, Greg Kurz,
Harish, Jan Kratochvil, Jordan Niethe, Kaixu Xia, Laurent Dufour,
Leonardo Bras, Madhavan Srinivasan, Mahesh Salgaonkar, Mathieu
Desnoyers, Nathan Lynch, Nicholas Piggin, Oleg Nesterov, Oliver
O'Halloran, Oscar Salvador, Po-Hsu Lin, Qian Cai, Qinglang Miao, Randy
Dunlap, Ravi Bangoria, Sachin Sant, Sandipan Das, Sebastian Andrzej
Siewior , Segher Boessenkool, Srikar Dronamraju, Tyrel Datwyler, Uwe
Kleine-König, Vincent Stehlé, Youling Tang, and Zhang Xiaoxu.

* tag 'powerpc-5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (304 commits)
  powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug
  powerpc: Add config fragment for disabling -Werror
  powerpc/configs: Add ppc64le_allnoconfig target
  powerpc/powernv: Rate limit opal-elog read failure message
  powerpc/pseries/memhotplug: Quieten some DLPAR operations
  powerpc/ps3: use dma_mapping_error()
  powerpc: force inlining of csum_partial() to avoid multiple csum_partial() with GCC10
  powerpc/perf: Fix Threshold Event Counter Multiplier width for P10
  powerpc/mm: Fix hugetlb_free_pmd_range() and hugetlb_free_pud_range()
  KVM: PPC: Book3S HV: Fix mask size for emulated msgsndp
  KVM: PPC: fix comparison to bool warning
  KVM: PPC: Book3S: Assign boolean values to a bool variable
  powerpc: Inline setup_kup()
  powerpc/64s: Mark the kuap/kuep functions non __init
  KVM: PPC: Book3S HV: XIVE: Add a comment regarding VP numbering
  powerpc/xive: Improve error reporting of OPAL calls
  powerpc/xive: Simplify xive_do_source_eoi()
  powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_EOI_FW
  powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_MASK_FW
  powerpc/xive: Remove P9 DD1 flag XIVE_IRQ_FLAG_SHIFT_BUG
  ...
  • Loading branch information
Linus Torvalds committed Dec 17, 2020
2 parents 09c0796 + c1bea0a commit 8a5be36
Show file tree
Hide file tree
Showing 258 changed files with 6,011 additions and 4,965 deletions.
26 changes: 19 additions & 7 deletions arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ config NEED_PER_CPU_PAGE_FIRST_CHUNK

config NR_IRQS
int "Number of virtual interrupt numbers"
range 32 32768
range 32 1048576
default "512"
help
This defines the number of virtual interrupt numbers the kernel
Expand All @@ -87,7 +87,7 @@ config PPC_WATCHDOG
help
This is a placeholder when the powerpc hardlockup detector
watchdog is selected (arch/powerpc/kernel/watchdog.c). It is
seleted via the generic lockup detector menu which is why we
selected via the generic lockup detector menu which is why we
have no standalone config option for it here.

config STACKTRACE_SUPPORT
Expand Down Expand Up @@ -177,6 +177,7 @@ config PPC
select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER
select GENERIC_TIME_VSYSCALL
select GENERIC_GETTIMEOFDAY
select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 && PPC_RADIX_MMU
select HAVE_ARCH_JUMP_LABEL
Expand Down Expand Up @@ -207,6 +208,7 @@ config PPC
select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_TRACER
select HAVE_GCC_PLUGINS if GCC_VERSION >= 50200 # plugin support on gcc <= 5.1 is buggy on PPC
select HAVE_GENERIC_VDSO
select HAVE_HW_BREAKPOINT if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
select HAVE_IDE
select HAVE_IOREMAP_PROT
Expand Down Expand Up @@ -312,6 +314,10 @@ config GENERIC_BUG
default y
depends on BUG

config GENERIC_BUG_RELATIVE_POINTERS
def_bool y
depends on GENERIC_BUG

config SYS_SUPPORTS_APM_EMULATION
default y if PMAC_APM_EMU
bool
Expand Down Expand Up @@ -418,6 +424,7 @@ config HUGETLB_PAGE_SIZE_VARIABLE
config MATH_EMULATION
bool "Math emulation"
depends on 4xx || PPC_8xx || PPC_MPC832x || BOOKE
select PPC_FPU_REGS
help
Some PowerPC chips designed for embedded applications do not have
a floating-point unit and therefore do not implement the
Expand Down Expand Up @@ -657,9 +664,15 @@ config IRQ_ALL_CPUS
reported with SMP Power Macintoshes with this option enabled.

config NUMA
bool "NUMA support"
depends on PPC64
default y if SMP && PPC_PSERIES
bool "NUMA Memory Allocation and Scheduler Support"
depends on PPC64 && SMP
default y if PPC_PSERIES || PPC_POWERNV
help
Enable NUMA (Non-Uniform Memory Access) support.

The kernel will try to allocate memory used by a CPU on the
local memory controller of the CPU and add some more
NUMA awareness to the kernel.

config NODES_SHIFT
int
Expand Down Expand Up @@ -793,8 +806,7 @@ config DATA_SHIFT_BOOL
bool "Set custom data alignment"
depends on ADVANCED_OPTIONS
depends on STRICT_KERNEL_RWX || DEBUG_PAGEALLOC
depends on PPC_BOOK3S_32 || (PPC_8xx && !PIN_TLB_DATA && \
(!PIN_TLB_TEXT || !STRICT_KERNEL_RWX))
depends on PPC_BOOK3S_32 || (PPC_8xx && !PIN_TLB_DATA && !STRICT_KERNEL_RWX)
help
This option allows you to set the kernel data alignment. When
RAM is mapped by blocks, the alignment needs to fit the size and
Expand Down
29 changes: 20 additions & 9 deletions arch/powerpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ ppc64le_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \
-f $(srctree)/Makefile allmodconfig

PHONY += ppc64le_allnoconfig
ppc64le_allnoconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/ppc64le.config \
-f $(srctree)/Makefile allnoconfig

PHONY += ppc64_book3e_allmodconfig
ppc64_book3e_allmodconfig:
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \
Expand Down Expand Up @@ -405,18 +410,24 @@ PHONY += install
install:
$(Q)$(MAKE) $(build)=$(boot) install

PHONY += vdso_install
vdso_install:
ifdef CONFIG_PPC64
$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
endif
ifdef CONFIG_VDSO32
$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
endif

archclean:
$(Q)$(MAKE) $(clean)=$(boot)

ifeq ($(KBUILD_EXTMOD),)
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
# In order to do that, we should use the archprepare target, but we can't since
# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
# Therefore we need to generate the header after prepare0 has been made, hence
# this hack.
prepare: vdso_prepare
vdso_prepare: prepare0
$(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
$(build)=arch/powerpc/kernel/vdso32 include/generated/vdso32-offsets.h)
$(if $(CONFIG_PPC64),$(Q)$(MAKE) \
$(build)=arch/powerpc/kernel/vdso64 include/generated/vdso64-offsets.h)
endif

archprepare: checkbin

archheaders:
Expand Down
4 changes: 4 additions & 0 deletions arch/powerpc/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
all: $(obj)/zImage

ifdef CROSS32_COMPILE
ifdef CONFIG_CC_IS_CLANG
BOOTCC := $(CROSS32_COMPILE)clang
else
BOOTCC := $(CROSS32_COMPILE)gcc
endif
BOOTAR := $(CROSS32_COMPILE)ar
else
BOOTCC := $(CC)
Expand Down
7 changes: 0 additions & 7 deletions arch/powerpc/boot/ps3.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ extern int lv1_get_logical_ppe_id(u64 *out_1);
extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3,
u64 in_4, u64 in_5, u64 *out_1, u64 *out_2);

#ifdef DEBUG
#define DBG(fmt...) printf(fmt)
#else
static inline int __attribute__ ((format (printf, 1, 2))) DBG(
const char *fmt, ...) {return 0;}
#endif

BSS_STACK(4096);

/* A buffer that may be edited by tools operating on a zImage binary so as to
Expand Down
9 changes: 3 additions & 6 deletions arch/powerpc/boot/util.S
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ udelay:
* (nanoseconds + (timebase_period_ns - 1 )) / timebase_period_ns
* timebase_period_ns defaults to 60 (16.6MHz) */
mflr r5
bl 0f
bcl 20,31,0f
0: mflr r6
mtlr r5
lis r5,0b@ha
addi r5,r5,0b@l
subf r5,r5,r6 /* In case we're relocated */
addis r5,r5,timebase_period_ns@ha
lwz r5,timebase_period_ns@l(r5)
addis r5,r6,(timebase_period_ns-0b)@ha
lwz r5,(timebase_period_ns-0b)@l(r5)
add r4,r4,r5
addi r4,r4,-1
divw r4,r4,r5 /* BUS ticks */
Expand Down
6 changes: 5 additions & 1 deletion arch/powerpc/boot/wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ compression=.gz
uboot_comp=gzip
pie=
format=
notext=
rodynamic=

# cross-compilation prefix
CROSS=
Expand Down Expand Up @@ -353,6 +355,8 @@ epapr)
platformo="$object/pseries-head.o $object/epapr.o $object/epapr-wrapper.o"
link_address='0x20000000'
pie=-pie
notext='-z notext'
rodynamic=$(if ${CROSS}ld -V 2>&1 | grep -q LLD ; then echo "-z rodynamic"; fi)
;;
mvme5100)
platformo="$object/fixed-head.o $object/mvme5100.o"
Expand Down Expand Up @@ -493,7 +497,7 @@ if [ "$platform" != "miboot" ]; then
text_start="-Ttext $link_address"
fi
#link everything
${CROSS}ld -m $format -T $lds $text_start $pie $nodl -o "$ofile" $map \
${CROSS}ld -m $format -T $lds $text_start $pie $nodl $rodynamic $notext -o "$ofile" $map \
$platformo $tmp $object/wrapper.a
rm $tmp
fi
Expand Down
21 changes: 11 additions & 10 deletions arch/powerpc/boot/zImage.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ SECTIONS
__dynamic_start = .;
*(.dynamic)
}

#ifdef CONFIG_PPC64_BOOT_WRAPPER
. = ALIGN(256);
.got :
{
__toc_start = .;
*(.got)
*(.toc)
}
#endif

.hash : { *(.hash) }
.interp : { *(.interp) }
.rela.dyn :
Expand Down Expand Up @@ -76,16 +87,6 @@ SECTIONS
_esm_blob_end = .;
}

#ifdef CONFIG_PPC64_BOOT_WRAPPER
. = ALIGN(256);
.got :
{
__toc_start = .;
*(.got)
*(.toc)
}
#endif

. = ALIGN(4096);
.bss :
{
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/configs/disable-werror.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_PPC_DISABLE_WERROR=y
2 changes: 2 additions & 0 deletions arch/powerpc/configs/ppc64le.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_PPC64=y
CONFIG_CPU_LITTLE_ENDIAN=y
15 changes: 15 additions & 0 deletions arch/powerpc/configs/security.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This is the equivalent of booting with lockdown=integrity
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_LOCKDOWN_LSM=y
CONFIG_SECURITY_LOCKDOWN_LSM_EARLY=y
CONFIG_LOCK_DOWN_KERNEL_FORCE_INTEGRITY=y

# These are some general, reasonably inexpensive hardening options
CONFIG_HARDENED_USERCOPY=y
CONFIG_FORTIFY_SOURCE=y
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y

# UBSAN bounds checking is very cheap and good for hardening
CONFIG_UBSAN=y
# CONFIG_UBSAN_MISC is not set
9 changes: 5 additions & 4 deletions arch/powerpc/include/asm/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/types.h>
#include <asm/cmpxchg.h>
#include <asm/barrier.h>
#include <asm/asm-const.h>

/*
* Since *_return_relaxed and {cmp}xchg_relaxed are implemented with
Expand All @@ -26,14 +27,14 @@ static __inline__ int atomic_read(const atomic_t *v)
{
int t;

__asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m"(v->counter));
__asm__ __volatile__("lwz%U1%X1 %0,%1" : "=r"(t) : "m"UPD_CONSTR(v->counter));

return t;
}

static __inline__ void atomic_set(atomic_t *v, int i)
{
__asm__ __volatile__("stw%U0%X0 %1,%0" : "=m"(v->counter) : "r"(i));
__asm__ __volatile__("stw%U0%X0 %1,%0" : "=m"UPD_CONSTR(v->counter) : "r"(i));
}

#define ATOMIC_OP(op, asm_op) \
Expand Down Expand Up @@ -316,14 +317,14 @@ static __inline__ s64 atomic64_read(const atomic64_t *v)
{
s64 t;

__asm__ __volatile__("ld%U1%X1 %0,%1" : "=r"(t) : "m"(v->counter));
__asm__ __volatile__("ld%U1%X1 %0,%1" : "=r"(t) : "m"UPD_CONSTR(v->counter));

return t;
}

static __inline__ void atomic64_set(atomic64_t *v, s64 i)
{
__asm__ __volatile__("std%U0%X0 %1,%0" : "=m"(v->counter) : "r"(i));
__asm__ __volatile__("std%U0%X0 %1,%0" : "=m"UPD_CONSTR(v->counter) : "r"(i));
}

#define ATOMIC64_OP(op, asm_op) \
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/include/asm/barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#define wmb() __asm__ __volatile__ ("sync" : : : "memory")

/* The sub-arch has lwsync */
#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC)
#if defined(CONFIG_PPC64) || defined(CONFIG_PPC_E500MC)
# define SMPWMB LWSYNC
#else
# define SMPWMB eieio
Expand Down
23 changes: 21 additions & 2 deletions arch/powerpc/include/asm/bitops.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,34 @@ static inline void arch___clear_bit_unlock(int nr, volatile unsigned long *addr)
*/
static inline int fls(unsigned int x)
{
return 32 - __builtin_clz(x);
int lz;

if (__builtin_constant_p(x))
return x ? 32 - __builtin_clz(x) : 0;
asm("cntlzw %0,%1" : "=r" (lz) : "r" (x));
return 32 - lz;
}

#include <asm-generic/bitops/builtin-__fls.h>

/*
* 64-bit can do this using one cntlzd (count leading zeroes doubleword)
* instruction; for 32-bit we use the generic version, which does two
* 32-bit fls calls.
*/
#ifdef CONFIG_PPC64
static inline int fls64(__u64 x)
{
return 64 - __builtin_clzll(x);
int lz;

if (__builtin_constant_p(x))
return x ? 64 - __builtin_clzll(x) : 0;
asm("cntlzd %0,%1" : "=r" (lz) : "r" (x));
return 64 - lz;
}
#else
#include <asm-generic/bitops/fls64.h>
#endif

#ifdef CONFIG_PPC64
unsigned int __arch_hweight8(unsigned int w);
Expand Down
6 changes: 1 addition & 5 deletions arch/powerpc/include/asm/book3s/32/kup.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ bad_kuap_fault(struct pt_regs *regs, unsigned long address, bool is_write)
unsigned long begin = regs->kuap & 0xf0000000;
unsigned long end = regs->kuap << 28;

if (!is_write)
return false;

return WARN(address < begin || address >= end,
"Bug: write fault blocked by segment registers !");
return is_write && (address < begin || address >= end);
}

#endif /* CONFIG_PPC_KUAP */
Expand Down
3 changes: 2 additions & 1 deletion arch/powerpc/include/asm/book3s/32/mmu-hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,11 @@ struct hash_pte {

typedef struct {
unsigned long id;
unsigned long vdso_base;
void __user *vdso;
} mm_context_t;

void update_bats(void);
static inline void cleanup_cpu_mmu_context(void) { };

/* patch sites */
extern s32 patch__hash_page_A0, patch__hash_page_A1, patch__hash_page_A2;
Expand Down
Loading

0 comments on commit 8a5be36

Please sign in to comment.