Skip to content

Commit d8b0bd5

Browse files
committed
Merge tag 'powerpc-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: - Extend KCSAN support to 32-bit and BookE. Add some KCSAN annotations - Make ELFv2 ABI the default for 64-bit big-endian kernel builds, and use the -mprofile-kernel option (kernel specific ftrace ABI) for big endian ELFv2 kernels - Add initial Dynamic Execution Control Register (DEXCR) support, and allow the ROP protection instructions to be used on Power 10 - Various other small features and fixes Thanks to Aditya Gupta, Aneesh Kumar K.V, Benjamin Gray, Brian King, Christophe Leroy, Colin Ian King, Dmitry Torokhov, Gaurav Batra, Jean Delvare, Joel Stanley, Marco Elver, Masahiro Yamada, Nageswara R Sastry, Nathan Chancellor, Naveen N Rao, Nayna Jain, Nicholas Piggin, Paul Gortmaker, Randy Dunlap, Rob Herring, Rohan McLure, Russell Currey, Sachin Sant, Timothy Pearson, Tom Rix, and Uwe Kleine-König. * tag 'powerpc-6.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (76 commits) powerpc: remove checks for binutils older than 2.25 powerpc: Fail build if using recordmcount with binutils v2.37 powerpc/iommu: TCEs are incorrectly manipulated with DLPAR add/remove of memory powerpc/iommu: Only build sPAPR access functions on pSeries powerpc: powernv: Annotate data races in opal events powerpc: Mark writes registering ipi to host cpu through kvm and polling powerpc: Annotate accesses to ipi message flags powerpc: powernv: Fix KCSAN datarace warnings on idle_state contention powerpc: Mark [h]ssr_valid accesses in check_return_regs_valid powerpc: qspinlock: Enforce qnode writes prior to publishing to queue powerpc: qspinlock: Mark accesses to qnode lock checks powerpc/powernv/pci: Remove last IODA1 defines powerpc/powernv/pci: Remove MVE code powerpc/powernv/pci: Remove ioda1 support powerpc: 52xx: Make immr_id DT match tables static powerpc: mpc512x: Remove open coded "ranges" parsing powerpc: fsl_soc: Use of_range_to_resource() for "ranges" parsing powerpc: fsl: Use of_property_read_reg() to parse "reg" powerpc: fsl_rio: Use of_range_to_resource() for "ranges" parsing macintosh: Use of_property_read_reg() to parse "reg" ...
2 parents b69f0ae + 54a1165 commit d8b0bd5

File tree

116 files changed

+1353
-4425
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1353
-4425
lines changed

Documentation/powerpc/dexcr.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.. SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
==========================================
4+
DEXCR (Dynamic Execution Control Register)
5+
==========================================
6+
7+
Overview
8+
========
9+
10+
The DEXCR is a privileged special purpose register (SPR) introduced in
11+
PowerPC ISA 3.1B (Power10) that allows per-cpu control over several dynamic
12+
execution behaviours. These behaviours include speculation (e.g., indirect
13+
branch target prediction) and enabling return-oriented programming (ROP)
14+
protection instructions.
15+
16+
The execution control is exposed in hardware as up to 32 bits ('aspects') in
17+
the DEXCR. Each aspect controls a certain behaviour, and can be set or cleared
18+
to enable/disable the aspect. There are several variants of the DEXCR for
19+
different purposes:
20+
21+
DEXCR
22+
A privileged SPR that can control aspects for userspace and kernel space
23+
HDEXCR
24+
A hypervisor-privileged SPR that can control aspects for the hypervisor and
25+
enforce aspects for the kernel and userspace.
26+
UDEXCR
27+
An optional ultravisor-privileged SPR that can control aspects for the ultravisor.
28+
29+
Userspace can examine the current DEXCR state using a dedicated SPR that
30+
provides a non-privileged read-only view of the userspace DEXCR aspects.
31+
There is also an SPR that provides a read-only view of the hypervisor enforced
32+
aspects, which ORed with the userspace DEXCR view gives the effective DEXCR
33+
state for a process.
34+
35+
36+
Configuration
37+
=============
38+
39+
The DEXCR is currently unconfigurable. All threads are run with the
40+
NPHIE aspect enabled.
41+
42+
43+
coredump and ptrace
44+
===================
45+
46+
The userspace values of the DEXCR and HDEXCR (in this order) are exposed under
47+
``NT_PPC_DEXCR``. These are each 64 bits and readonly, and are intended to
48+
assist with core dumps. The DEXCR may be made writable in future. The top 32
49+
bits of both registers (corresponding to the non-userspace bits) are masked off.
50+
51+
If the kernel config ``CONFIG_CHECKPOINT_RESTORE`` is enabled, then
52+
``NT_PPC_HASHKEYR`` is available and exposes the HASHKEYR value of the process
53+
for reading and writing. This is a tradeoff between increased security and
54+
checkpoint/restore support: a process should normally have no need to know its
55+
secret key, but restoring a process requires setting its original key. The key
56+
therefore appears in core dumps, and an attacker may be able to retrieve it from
57+
a coredump and effectively bypass ROP protection on any threads that share this
58+
key (potentially all threads from the same parent that have not run ``exec()``).

Documentation/powerpc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ powerpc
1515
cxl
1616
cxlflash
1717
dawr-power9
18+
dexcr
1819
dscr
1920
eeh-pci-error-recovery
2021
elf_hwcaps

MAINTAINERS

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11448,7 +11448,13 @@ F: arch/mips/include/uapi/asm/kvm*
1144811448
F: arch/mips/kvm/
1144911449

1145011450
KERNEL VIRTUAL MACHINE FOR POWERPC (KVM/powerpc)
11451+
M: Michael Ellerman <[email protected]>
11452+
R: Nicholas Piggin <[email protected]>
1145111453
11454+
11455+
S: Maintained (Book3S 64-bit HV)
11456+
S: Odd fixes (Book3S 64-bit PR)
11457+
S: Orphan (Book3E and 32-bit)
1145211458
T: git git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git topic/ppc-kvm
1145311459
F: arch/powerpc/include/asm/kvm*
1145411460
F: arch/powerpc/include/uapi/asm/kvm*
@@ -11981,11 +11987,12 @@ F: lib/linear_ranges.c
1198111987
F: lib/test_linear_ranges.c
1198211988

1198311989
LINUX FOR POWER MACINTOSH
11984-
M: Benjamin Herrenschmidt <[email protected]>
1198511990
11986-
S: Odd Fixes
11991+
S: Orphan
1198711992
F: arch/powerpc/platforms/powermac/
1198811993
F: drivers/macintosh/
11994+
X: drivers/macintosh/adb-iop.c
11995+
X: drivers/macintosh/via-macii.c
1198911996

1199011997
LINUX FOR POWERPC (32-BIT AND 64-BIT)
1199111998
M: Michael Ellerman <[email protected]>

arch/powerpc/Kconfig

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ config PPC
210210
select HAVE_ARCH_KASAN if PPC_RADIX_MMU
211211
select HAVE_ARCH_KASAN if PPC_BOOK3E_64
212212
select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
213-
select HAVE_ARCH_KCSAN if PPC_BOOK3S_64
213+
select HAVE_ARCH_KCSAN
214214
select HAVE_ARCH_KFENCE if ARCH_SUPPORTS_DEBUG_PAGEALLOC
215215
select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
216216
select HAVE_ARCH_WITHIN_STACK_FRAMES
@@ -235,7 +235,7 @@ config PPC
235235
select HAVE_FUNCTION_DESCRIPTORS if PPC64_ELF_ABI_V1
236236
select HAVE_FUNCTION_ERROR_INJECTION
237237
select HAVE_FUNCTION_GRAPH_TRACER
238-
select HAVE_FUNCTION_TRACER
238+
select HAVE_FUNCTION_TRACER if PPC64 || (PPC32 && CC_IS_GCC)
239239
select HAVE_GCC_PLUGINS if GCC_VERSION >= 50200 # plugin support on gcc <= 5.1 is buggy on PPC
240240
select HAVE_GENERIC_VDSO
241241
select HAVE_HARDLOCKUP_DETECTOR_ARCH if PPC_BOOK3S_64 && SMP
@@ -547,8 +547,9 @@ config LD_HEAD_STUB_CATCH
547547
If unsure, say "N".
548548

549549
config MPROFILE_KERNEL
550-
depends on PPC64 && CPU_LITTLE_ENDIAN && FUNCTION_TRACER
551-
def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__)
550+
depends on PPC64_ELF_ABI_V2 && FUNCTION_TRACER
551+
def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mlittle-endian) if CPU_LITTLE_ENDIAN
552+
def_bool $(success,$(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -mbig-endian) if CPU_BIG_ENDIAN
552553

553554
config HOTPLUG_CPU
554555
bool "Support for enabling/disabling CPUs"
@@ -624,10 +625,12 @@ config ARCH_HAS_KEXEC_PURGATORY
624625
def_bool KEXEC_FILE
625626

626627
config PPC64_BIG_ENDIAN_ELF_ABI_V2
627-
bool "Build big-endian kernel using ELF ABI V2 (EXPERIMENTAL)"
628+
# Option is available to BFD, but LLD does not support ELFv1 so this is
629+
# always true there.
630+
prompt "Build big-endian kernel using ELF ABI V2" if LD_IS_BFD && EXPERT
631+
def_bool y
628632
depends on PPC64 && CPU_BIG_ENDIAN
629633
depends on CC_HAS_ELFV2
630-
depends on LD_VERSION >= 22400 || LLD_VERSION >= 150000
631634
help
632635
This builds the kernel image using the "Power Architecture 64-Bit ELF
633636
V2 ABI Specification", which has a reduced stack overhead and faster
@@ -638,8 +641,6 @@ config PPC64_BIG_ENDIAN_ELF_ABI_V2
638641
it is less well tested by kernel and toolchain. However some distros
639642
build userspace this way, and it can produce a functioning kernel.
640643

641-
This requires GCC and binutils 2.24 or newer.
642-
643644
config RELOCATABLE
644645
bool "Build a relocatable kernel"
645646
depends on PPC64 || (FLATMEM && (44x || PPC_85xx))

arch/powerpc/Makefile

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,13 @@ machine-$(CONFIG_PPC64) += 64
4242
machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
4343
UTS_MACHINE := $(subst $(space),,$(machine-y))
4444

45-
# XXX This needs to be before we override LD below
46-
ifdef CONFIG_PPC32
47-
KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
48-
else
49-
ifeq ($(call ld-ifversion, -ge, 22500, y),y)
45+
ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy)
5046
# Have the linker provide sfpr if possible.
5147
# There is a corresponding test in arch/powerpc/lib/Makefile
5248
KBUILD_LDFLAGS_MODULE += --save-restore-funcs
5349
else
5450
KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
5551
endif
56-
endif
5752

5853
ifdef CONFIG_CPU_LITTLE_ENDIAN
5954
KBUILD_CFLAGS += -mlittle-endian
@@ -166,7 +161,7 @@ asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
166161
KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr)
167162
KBUILD_AFLAGS += $(AFLAGS-y)
168163
KBUILD_CFLAGS += $(call cc-option,-msoft-float)
169-
KBUILD_CFLAGS += -pipe $(CFLAGS-y)
164+
KBUILD_CFLAGS += $(CFLAGS-y)
170165
CPP = $(CC) -E $(KBUILD_CFLAGS)
171166

172167
CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
@@ -398,14 +393,12 @@ endif
398393
endif
399394

400395
PHONY += checkbin
401-
# Check toolchain versions:
402-
# - gcc-4.6 is the minimum kernel-wide version so nothing required.
403396
checkbin:
404-
@if test "x${CONFIG_LD_IS_LLD}" != "xy" -a \
405-
"x$(call ld-ifversion, -le, 22400, y)" = "xy" ; then \
406-
echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
407-
echo 'in some circumstances.' ; \
408-
echo '*** binutils 2.23 do not define the TOC symbol ' ; \
409-
echo -n '*** Please use a different binutils version.' ; \
397+
@if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \
398+
"x${CONFIG_LD_IS_BFD}" = "xy" -a \
399+
"${CONFIG_LD_VERSION}" = "23700" ; then \
400+
echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \
401+
echo 'is unable to handle.' ; \
402+
echo '*** Please use a different binutils version.' ; \
410403
false ; \
411404
fi

arch/powerpc/boot/Makefile

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,58 @@ else
3232
BOOTAR := $(AR)
3333
endif
3434

35-
BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
36-
-fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
37-
$(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \
38-
-pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
39-
$(LINUXINCLUDE)
40-
4135
ifdef CONFIG_PPC64_BOOT_WRAPPER
42-
BOOTCFLAGS += -m64
36+
BOOTTARGETFLAGS += -m64
37+
BOOTTARGETFLAGS += -mabi=elfv2
4338
ifdef CONFIG_PPC64_ELF_ABI_V2
44-
BOOTCFLAGS += $(call cc-option,-mabi=elfv2)
39+
BOOTTARGETFLAGS += $(call cc-option,-mabi=elfv2)
4540
endif
4641
else
47-
BOOTCFLAGS += -m32
42+
BOOTTARGETFLAGS := -m32
4843
endif
4944

5045
ifdef CONFIG_TARGET_CPU_BOOL
51-
BOOTCFLAGS += -mcpu=$(CONFIG_TARGET_CPU)
46+
BOOTTARGETFLAGS += -mcpu=$(CONFIG_TARGET_CPU)
5247
else ifdef CONFIG_PPC64_BOOT_WRAPPER
5348
ifdef CONFIG_CPU_LITTLE_ENDIAN
54-
BOOTCFLAGS += -mcpu=powerpc64le
49+
BOOTTARGETFLAGS += -mcpu=powerpc64le
5550
else
56-
BOOTCFLAGS += -mcpu=powerpc64
51+
BOOTTARGETFLAGS += -mcpu=powerpc64
5752
endif
5853
endif
5954

60-
BOOTCFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include)
55+
$(obj)/4xx.o: BOOTTARGETFLAGS += -mcpu=405
56+
$(obj)/ebony.o: BOOTTARGETFLAGS += -mcpu=440
57+
$(obj)/cuboot-hotfoot.o: BOOTTARGETFLAGS += -mcpu=405
58+
$(obj)/cuboot-taishan.o: BOOTTARGETFLAGS += -mcpu=440
59+
$(obj)/cuboot-katmai.o: BOOTTARGETFLAGS += -mcpu=440
60+
$(obj)/cuboot-acadia.o: BOOTTARGETFLAGS += -mcpu=405
61+
$(obj)/treeboot-iss4xx.o: BOOTTARGETFLAGS += -mcpu=405
62+
$(obj)/treeboot-currituck.o: BOOTTARGETFLAGS += -mcpu=405
63+
$(obj)/treeboot-akebono.o: BOOTTARGETFLAGS += -mcpu=405
6164

6265
ifdef CONFIG_CPU_BIG_ENDIAN
63-
BOOTCFLAGS += -mbig-endian
66+
BOOTTARGETFLAGS += -mbig-endian
6467
else
65-
BOOTCFLAGS += -mlittle-endian
68+
BOOTTARGETFLAGS += -mlittle-endian
6669
endif
6770

68-
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
69-
70-
BOOTARFLAGS := -crD
71+
BOOTCPPFLAGS := -nostdinc $(LINUXINCLUDE)
72+
BOOTCPPFLAGS += -isystem $(shell $(BOOTCC) -print-file-name=include)
7173

72-
BOOTCFLAGS += $(call cc-option,-mno-prefixed) \
74+
BOOTCFLAGS := $(BOOTTARGETFLAGS) \
75+
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
76+
-fno-strict-aliasing -O2 \
77+
-msoft-float -mno-altivec -mno-vsx \
78+
$(call cc-option,-mno-prefixed) \
7379
$(call cc-option,-mno-pcrel) \
74-
$(call cc-option,-mno-mma)
80+
$(call cc-option,-mno-mma) \
81+
$(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \
82+
-fomit-frame-pointer -fno-builtin -fPIC
83+
84+
BOOTAFLAGS := $(BOOTTARGETFLAGS) -D__ASSEMBLY__
85+
86+
BOOTARFLAGS := -crD
7587

7688
ifdef CONFIG_CC_IS_CLANG
7789
BOOTCFLAGS += $(CLANG_FLAGS)
@@ -91,16 +103,6 @@ BOOTCFLAGS += -I$(objtree)/$(obj) -I$(srctree)/$(obj)
91103

92104
DTC_FLAGS ?= -p 1024
93105

94-
$(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
95-
$(obj)/ebony.o: BOOTCFLAGS += -mcpu=440
96-
$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
97-
$(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440
98-
$(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
99-
$(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
100-
$(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
101-
$(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
102-
$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
103-
104106
# The pre-boot decompressors pull in a lot of kernel headers and other source
105107
# files. This creates a bit of a dependency headache since we need to copy
106108
# these files into the build dir, fix up any includes and ensure that dependent
@@ -224,10 +226,10 @@ clean-files := $(zlib-) $(zlibheader-) $(zliblinuxheader-) \
224226
empty.c zImage.coff.lds zImage.ps3.lds zImage.lds
225227

226228
quiet_cmd_bootcc = BOOTCC $@
227-
cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
229+
cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTCFLAGS) -c -o $@ $<
228230

229231
quiet_cmd_bootas = BOOTAS $@
230-
cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
232+
cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCPPFLAGS) $(BOOTAFLAGS) -c -o $@ $<
231233

232234
quiet_cmd_bootar = BOOTAR $@
233235
cmd_bootar = $(BOOTAR) $(BOOTARFLAGS) $@.$$$$ $(real-prereqs); mv $@.$$$$ $@
@@ -340,11 +342,6 @@ image-$(CONFIG_MPC834x_ITX) += cuImage.mpc8349emitx \
340342
image-$(CONFIG_ASP834x) += dtbImage.asp834x-redboot
341343

342344
# Board ports in arch/powerpc/platform/85xx/Kconfig
343-
image-$(CONFIG_MPC8540_ADS) += cuImage.mpc8540ads
344-
image-$(CONFIG_MPC8560_ADS) += cuImage.mpc8560ads
345-
image-$(CONFIG_MPC85xx_CDS) += cuImage.mpc8541cds \
346-
cuImage.mpc8548cds_32b \
347-
cuImage.mpc8555cds
348345
image-$(CONFIG_MPC85xx_MDS) += cuImage.mpc8568mds
349346
image-$(CONFIG_MPC85xx_DS) += cuImage.mpc8544ds \
350347
cuImage.mpc8572ds

0 commit comments

Comments
 (0)