Skip to content

Commit ff2632d

Browse files
committed
Merge tag 'powerpc-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc updates from Michael Ellerman: - Enable BPF Kernel Functions (kfuncs) in the powerpc BPF JIT. - Allow per-process DEXCR (Dynamic Execution Control Register) settings via prctl, notably NPHIE which controls hashst/hashchk for ROP protection. - Install powerpc selftests in sub-directories. Note this changes the way run_kselftest.sh needs to be invoked for powerpc selftests. - Change fadump (Firmware Assisted Dump) to better handle memory add/remove. - Add support for passing additional parameters to the fadump kernel. - Add support for updating the kdump image on CPU/memory add/remove events. - Other small features, cleanups and fixes. Thanks to Andrew Donnellan, Andy Shevchenko, Aneesh Kumar K.V, Arnd Bergmann, Benjamin Gray, Bjorn Helgaas, Christian Zigotzky, Christophe Jaillet, Christophe Leroy, Colin Ian King, Cédric Le Goater, Dr. David Alan Gilbert, Erhard Furtner, Frank Li, GUO Zihua, Ganesh Goudar, Geoff Levand, Ghanshyam Agrawal, Greg Kurz, Hari Bathini, Joel Stanley, Justin Stitt, Kunwu Chan, Li Yang, Lidong Zhong, Madhavan Srinivasan, Mahesh Salgaonkar, Masahiro Yamada, Matthias Schiffer, Naresh Kamboju, Nathan Chancellor, Nathan Lynch, Naveen N Rao, Nicholas Miehlbradt, Ran Wang, Randy Dunlap, Ritesh Harjani, Sachin Sant, Shirisha Ganta, Shrikanth Hegde, Sourabh Jain, Stephen Rothwell, sundar, Thorsten Blum, Vaibhav Jain, Xiaowei Bao, Yang Li, and Zhao Chenhui. * tag 'powerpc-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (85 commits) powerpc/fadump: Fix section mismatch warning powerpc/85xx: fix compile error without CONFIG_CRASH_DUMP powerpc/fadump: update documentation about bootargs_append powerpc/fadump: pass additional parameters when fadump is active powerpc/fadump: setup additional parameters for dump capture kernel powerpc/pseries/fadump: add support for multiple boot memory regions selftests/powerpc/dexcr: Fix spelling mistake "predicition" -> "prediction" KVM: PPC: Book3S HV nestedv2: Fix an error handling path in gs_msg_ops_kvmhv_nestedv2_config_fill_info() KVM: PPC: Fix documentation for ppc mmu caps KVM: PPC: code cleanup for kvmppc_book3s_irqprio_deliver KVM: PPC: Book3S HV nestedv2: Cancel pending DEC exception powerpc/xmon: Check cpu id in commands "c#", "dp#" and "dx#" powerpc/code-patching: Use dedicated memory routines for patching powerpc/code-patching: Test patch_instructions() during boot powerpc64/kasan: Pass virtual addresses to kasan_init_phys_region() powerpc: rename SPRN_HID2 define to SPRN_HID2_750FX powerpc: Fix typos powerpc/eeh: Fix spelling of the word "auxillary" and update comment macintosh/ams: Fix unused variable warning powerpc/Makefile: Remove bits related to the previous use of -mcmodel=large ...
2 parents 4853f1f + 61700f8 commit ff2632d

File tree

199 files changed

+3053
-1271
lines changed

Some content is hidden

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

199 files changed

+3053
-1271
lines changed

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ What: /sys/devices/system/cpu/cpuX/cpufreq/throttle_stats
423423
/sys/devices/system/cpu/cpuX/cpufreq/throttle_stats/occ_reset
424424
Date: March 2016
425425
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
426-
Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
426+
Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
427427
Description: POWERNV CPUFreq driver's frequency throttle stats directory and
428428
attributes
429429

@@ -473,7 +473,7 @@ What: /sys/devices/system/cpu/cpufreq/policyX/throttle_stats
473473
/sys/devices/system/cpu/cpufreq/policyX/throttle_stats/occ_reset
474474
Date: March 2016
475475
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
476-
Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
476+
Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
477477
Description: POWERNV CPUFreq driver's frequency throttle stats directory and
478478
attributes
479479

@@ -608,7 +608,7 @@ Description: Umwait control
608608
What: /sys/devices/system/cpu/svm
609609
Date: August 2019
610610
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
611-
Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
611+
Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
612612
Description: Secure Virtual Machine
613613

614614
If 1, it means the system is using the Protected Execution
@@ -617,7 +617,7 @@ Description: Secure Virtual Machine
617617

618618
What: /sys/devices/system/cpu/cpuX/purr
619619
Date: Apr 2005
620-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
620+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
621621
Description: PURR ticks for this CPU since the system boot.
622622

623623
The Processor Utilization Resources Register (PURR) is
@@ -628,7 +628,7 @@ Description: PURR ticks for this CPU since the system boot.
628628

629629
What: /sys/devices/system/cpu/cpuX/spurr
630630
Date: Dec 2006
631-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
631+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
632632
Description: SPURR ticks for this CPU since the system boot.
633633

634634
The Scaled Processor Utilization Resources Register
@@ -640,15 +640,15 @@ Description: SPURR ticks for this CPU since the system boot.
640640

641641
What: /sys/devices/system/cpu/cpuX/idle_purr
642642
Date: Apr 2020
643-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
643+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
644644
Description: PURR ticks for cpuX when it was idle.
645645

646646
This sysfs interface exposes the number of PURR ticks
647647
for cpuX when it was idle.
648648

649649
What: /sys/devices/system/cpu/cpuX/idle_spurr
650650
Date: Apr 2020
651-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
651+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
652652
Description: SPURR ticks for cpuX when it was idle.
653653

654654
This sysfs interface exposes the number of SPURR ticks

Documentation/ABI/testing/sysfs-firmware-opal-powercap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
What: /sys/firmware/opal/powercap
22
Date: August 2017
3-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
3+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
44
Description: Powercap directory for Powernv (P8, P9) servers
55

66
Each folder in this directory contains a
@@ -11,7 +11,7 @@ What: /sys/firmware/opal/powercap/system-powercap
1111
/sys/firmware/opal/powercap/system-powercap/powercap-max
1212
/sys/firmware/opal/powercap/system-powercap/powercap-current
1313
Date: August 2017
14-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
14+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
1515
Description: System powercap directory and attributes applicable for
1616
Powernv (P8, P9) servers
1717

Documentation/ABI/testing/sysfs-firmware-opal-psr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
What: /sys/firmware/opal/psr
22
Date: August 2017
3-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
3+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
44
Description: Power-Shift-Ratio directory for Powernv P9 servers
55

66
Power-Shift-Ratio allows to provide hints the firmware
@@ -10,7 +10,7 @@ Description: Power-Shift-Ratio directory for Powernv P9 servers
1010

1111
What: /sys/firmware/opal/psr/cpu_to_gpu_X
1212
Date: August 2017
13-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
13+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
1414
Description: PSR sysfs attributes for Powernv P9 servers
1515

1616
Power-Shift-Ratio between CPU and GPU for a given chip

Documentation/ABI/testing/sysfs-firmware-opal-sensor-groups

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
What: /sys/firmware/opal/sensor_groups
22
Date: August 2017
3-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
3+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
44
Description: Sensor groups directory for POWER9 powernv servers
55

66
Each folder in this directory contains a sensor group
@@ -11,7 +11,7 @@ Description: Sensor groups directory for POWER9 powernv servers
1111

1212
What: /sys/firmware/opal/sensor_groups/<sensor_group_name>/clear
1313
Date: August 2017
14-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
14+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
1515
Description: Sysfs file to clear the min-max of all the sensors
1616
belonging to the group.
1717

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
What: /sys/firmware/papr/energy_scale_info
22
Date: February 2022
3-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
3+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
44
Description: Directory hosting a set of platform attributes like
55
energy/frequency on Linux running as a PAPR guest.
66

@@ -10,20 +10,20 @@ Description: Directory hosting a set of platform attributes like
1010

1111
What: /sys/firmware/papr/energy_scale_info/<id>
1212
Date: February 2022
13-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
13+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
1414
Description: Energy, frequency attributes directory for POWERVM servers
1515

1616
What: /sys/firmware/papr/energy_scale_info/<id>/desc
1717
Date: February 2022
18-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
18+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
1919
Description: String description of the energy attribute of <id>
2020

2121
What: /sys/firmware/papr/energy_scale_info/<id>/value
2222
Date: February 2022
23-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
23+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
2424
Description: Numeric value of the energy attribute of <id>
2525

2626
What: /sys/firmware/papr/energy_scale_info/<id>/value_desc
2727
Date: February 2022
28-
Contact: Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
28+
Contact: Linux for PowerPC mailing list <linuxppc-dev@lists.ozlabs.org>
2929
Description: String value of the energy attribute of <id>

Documentation/ABI/testing/sysfs-kernel-fadump

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,21 @@ Contact: linuxppc-dev@lists.ozlabs.org
3838
Description: read only
3939
Provide information about the amount of memory reserved by
4040
FADump to save the crash dump in bytes.
41+
42+
What: /sys/kernel/fadump/hotplug_ready
43+
Date: Apr 2024
44+
Contact: linuxppc-dev@lists.ozlabs.org
45+
Description: read only
46+
Kdump udev rule re-registers fadump on memory add/remove events,
47+
primarily to update the elfcorehdr. This sysfs indicates the
48+
kdump udev rule that fadump re-registration is not required on
49+
memory add/remove events because elfcorehdr is now prepared in
50+
the second/fadump kernel.
51+
User: kexec-tools
52+
53+
What: /sys/kernel/fadump/bootargs_append
54+
Date: May 2024
55+
Contact: linuxppc-dev@lists.ozlabs.org
56+
Description: read/write
57+
This is a special sysfs file available to setup additional
58+
parameters to be passed to capture kernel.

Documentation/arch/powerpc/dexcr.rst

Lines changed: 139 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,145 @@ state for a process.
3636
Configuration
3737
=============
3838

39-
The DEXCR is currently unconfigurable. All threads are run with the
40-
NPHIE aspect enabled.
39+
prctl
40+
-----
41+
42+
A process can control its own userspace DEXCR value using the
43+
``PR_PPC_GET_DEXCR`` and ``PR_PPC_SET_DEXCR`` pair of
44+
:manpage:`prctl(2)` commands. These calls have the form::
45+
46+
prctl(PR_PPC_GET_DEXCR, unsigned long which, 0, 0, 0);
47+
prctl(PR_PPC_SET_DEXCR, unsigned long which, unsigned long ctrl, 0, 0);
48+
49+
The possible 'which' and 'ctrl' values are as follows. Note there is no relation
50+
between the 'which' value and the DEXCR aspect's index.
51+
52+
.. flat-table::
53+
:header-rows: 1
54+
:widths: 2 7 1
55+
56+
* - ``prctl()`` which
57+
- Aspect name
58+
- Aspect index
59+
60+
* - ``PR_PPC_DEXCR_SBHE``
61+
- Speculative Branch Hint Enable (SBHE)
62+
- 0
63+
64+
* - ``PR_PPC_DEXCR_IBRTPD``
65+
- Indirect Branch Recurrent Target Prediction Disable (IBRTPD)
66+
- 3
67+
68+
* - ``PR_PPC_DEXCR_SRAPD``
69+
- Subroutine Return Address Prediction Disable (SRAPD)
70+
- 4
71+
72+
* - ``PR_PPC_DEXCR_NPHIE``
73+
- Non-Privileged Hash Instruction Enable (NPHIE)
74+
- 5
75+
76+
.. flat-table::
77+
:header-rows: 1
78+
:widths: 2 8
79+
80+
* - ``prctl()`` ctrl
81+
- Meaning
82+
83+
* - ``PR_PPC_DEXCR_CTRL_EDITABLE``
84+
- This aspect can be configured with PR_PPC_SET_DEXCR (get only)
85+
86+
* - ``PR_PPC_DEXCR_CTRL_SET``
87+
- This aspect is set / set this aspect
88+
89+
* - ``PR_PPC_DEXCR_CTRL_CLEAR``
90+
- This aspect is clear / clear this aspect
91+
92+
* - ``PR_PPC_DEXCR_CTRL_SET_ONEXEC``
93+
- This aspect will be set after exec / set this aspect after exec
94+
95+
* - ``PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC``
96+
- This aspect will be clear after exec / clear this aspect after exec
97+
98+
Note that
99+
100+
* which is a plain value, not a bitmask. Aspects must be worked with individually.
101+
102+
* ctrl is a bitmask. ``PR_PPC_GET_DEXCR`` returns both the current and onexec
103+
configuration. For example, ``PR_PPC_GET_DEXCR`` may return
104+
``PR_PPC_DEXCR_CTRL_EDITABLE | PR_PPC_DEXCR_CTRL_SET |
105+
PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC``. This would indicate the aspect is currently
106+
set, it will be cleared when you run exec, and you can change this with the
107+
``PR_PPC_SET_DEXCR`` prctl.
108+
109+
* The set/clear terminology refers to setting/clearing the bit in the DEXCR.
110+
For example::
111+
112+
prctl(PR_PPC_SET_DEXCR, PR_PPC_DEXCR_IBRTPD, PR_PPC_DEXCR_CTRL_SET, 0, 0);
113+
114+
will set the IBRTPD aspect bit in the DEXCR, causing indirect branch prediction
115+
to be disabled.
116+
117+
* The status returned by ``PR_PPC_GET_DEXCR`` represents what value the process
118+
would like applied. It does not include any alternative overrides, such as if
119+
the hypervisor is enforcing the aspect be set. To see the true DEXCR state
120+
software should read the appropriate SPRs directly.
121+
122+
* The aspect state when starting a process is copied from the parent's state on
123+
:manpage:`fork(2)`. The state is reset to a fixed value on
124+
:manpage:`execve(2)`. The PR_PPC_SET_DEXCR prctl() can control both of these
125+
values.
126+
127+
* The ``*_ONEXEC`` controls do not change the current process's DEXCR.
128+
129+
Use ``PR_PPC_SET_DEXCR`` with one of ``PR_PPC_DEXCR_CTRL_SET`` or
130+
``PR_PPC_DEXCR_CTRL_CLEAR`` to edit a given aspect.
131+
132+
Common error codes for both getting and setting the DEXCR are as follows:
133+
134+
.. flat-table::
135+
:header-rows: 1
136+
:widths: 2 8
137+
138+
* - Error
139+
- Meaning
140+
141+
* - ``EINVAL``
142+
- The DEXCR is not supported by the kernel.
143+
144+
* - ``ENODEV``
145+
- The aspect is not recognised by the kernel or not supported by the
146+
hardware.
147+
148+
``PR_PPC_SET_DEXCR`` may also report the following error codes:
149+
150+
.. flat-table::
151+
:header-rows: 1
152+
:widths: 2 8
153+
154+
* - Error
155+
- Meaning
156+
157+
* - ``EINVAL``
158+
- The ctrl value contains unrecognised flags.
159+
160+
* - ``EINVAL``
161+
- The ctrl value contains mutually conflicting flags (e.g.,
162+
``PR_PPC_DEXCR_CTRL_SET | PR_PPC_DEXCR_CTRL_CLEAR``)
163+
164+
* - ``EPERM``
165+
- This aspect cannot be modified with prctl() (check for the
166+
PR_PPC_DEXCR_CTRL_EDITABLE flag with PR_PPC_GET_DEXCR).
167+
168+
* - ``EPERM``
169+
- The process does not have sufficient privilege to perform the operation.
170+
For example, clearing NPHIE on exec is a privileged operation (a process
171+
can still clear its own NPHIE aspect without privileges).
172+
173+
This interface allows a process to control its own DEXCR aspects, and also set
174+
the initial DEXCR value for any children in its process tree (up to the next
175+
child to use an ``*_ONEXEC`` control). This allows fine-grained control over the
176+
default value of the DEXCR, for example allowing containers to run with different
177+
default values.
41178

42179

43180
coredump and ptrace

0 commit comments

Comments
 (0)