Skip to content

Commit d65e1a0

Browse files
committed
Merge tag 's390-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Alexander Gordeev: - Store AP Query Configuration Information in a static buffer - Rework the AP initialization and add missing cleanups to the error path - Swap IRQ and AP bus/device registration to avoid race conditions - Export prot_virt_guest symbol - Introduce AP configuration changes notifier interface to facilitate modularization of the AP bus - Add CONFIG_AP kernel configuration option to allow modularization of the AP bus - Rework CONFIG_ZCRYPT_DEBUG kernel configuration option description and dependency and rename it to CONFIG_AP_DEBUG - Convert sprintf() and snprintf() to sysfs_emit() in CIO code - Adjust indentation of RELOCS command build step - Make crypto performance counters upward compatible - Convert make_page_secure() and gmap_make_secure() to use folio - Rework channel-utilization-block (CUB) handling in preparation of introducing additional CUBs - Use attribute groups to simplify registration, removal and extension of measurement-related channel-path sysfs attributes - Add a per-channel-path binary "ext_measurement" sysfs attribute that provides access to extended channel-path measurement data - Export measurement data for all channel-measurement-groups (CMG), not only for a specific ones. This enables support of new CMG data formats in userspace without the need for kernel changes - Add a per-channel-path sysfs attribute "speed_bps" that provides the operating speed in bits per second or 0 if the operating speed is not available - The CIO tracepoint subchannel-type field "st" is incorrectly set to the value of subchannel-enabled SCHIB "ena" field. Fix that - Do not forcefully limit vmemmap starting address to MAX_PHYSMEM_BITS - Consider the maximum physical address available to a DCSS segment (512GB) when memory layout is set up - Simplify the virtual memory layout setup by reducing the size of identity mapping vs vmemmap overlap - Swap vmalloc and Lowcore/Real Memory Copy areas in virtual memory. This will allow to place the kernel image next to kernel modules - Move everyting KASLR related from <asm/setup.h> to <asm/page.h> - Put virtual memory layout information into a structure to improve code generation - Currently __kaslr_offset is the kernel offset in both physical and virtual memory spaces. Uncouple these offsets to allow uncoupling of the addresses spaces - Currently the identity mapping base address is implicit and is always set to zero. Make it explicit by putting into __identity_base persistent boot variable and use it in proper context - Introduce .amode31 section start and end macros AMODE31_START and AMODE31_END - Introduce OS_INFO entries that do not reference any data in memory, but rather provide only values - Store virtual memory layout in OS_INFO. It is read out by makedumpfile, crash and other tools - Store virtual memory layout in VMCORE_INFO. It is read out by crash and other tools when /proc/kcore device is used - Create additional PT_LOAD ELF program header that covers kernel image only, so that vmcore tools could locate kernel text and data when virtual and physical memory spaces are uncoupled - Uncouple physical and virtual address spaces - Map kernel at fixed location when KASLR mode is disabled. The location is defined by CONFIG_KERNEL_IMAGE_BASE kernel configuration value. - Rework deployment of kernel image for both compressed and uncompressed variants as defined by CONFIG_KERNEL_UNCOMPRESSED kernel configuration value - Move .vmlinux.relocs section in front of the compressed kernel. The interim section rescue step is avoided as result - Correct modules thunk offset calculation when branch target is more than 2GB away - Kernel modules contain their own set of expoline thunks. Now that the kernel modules area is less than 4GB away from kernel expoline thunks, make modules use kernel expolines. Also make EXPOLINE_EXTERN the default if the compiler supports it - userfaultfd can insert shared zeropages into processes running VMs, but that is not allowed for s390. Fallback to allocating a fresh zeroed anonymous folio and insert that instead - Re-enable shared zeropages for non-PV and non-skeys KVM guests - Rename hex2bitmap() to ap_hex2bitmap() and export it for external use - Add ap_config sysfs attribute to provide the means for setting or displaying adapters, domains and control domains assigned to a vfio-ap mediated device in a single operation - Make vfio_ap_mdev_link_queue() ignore duplicate link requests - Add write support to ap_config sysfs attribute to allow atomic update a vfio-ap mediated device state - Document ap_config sysfs attribute - Function os_info_old_init() is expected to be called only from a regular kdump kernel. Enable it to be called from a stand-alone dump kernel - Address gcc -Warray-bounds warning and fix array size in struct os_info - s390 does not support SMBIOS, so drop unneeded CONFIG_DMI checks - Use unwinder instead of __builtin_return_address() with ftrace to prevent returning of undefined values - Sections .hash and .gnu.hash are only created when CONFIG_PIE_BUILD kernel is enabled. Drop these for the case CONFIG_PIE_BUILD is disabled - Compile kernel with -fPIC and link with -no-pie to allow kpatch feature always succeed and drop the whole CONFIG_PIE_BUILD option-enabled code - Add missing virt_to_phys() converter for VSIE facility and crypto control blocks * tag 's390-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (54 commits) Revert "s390: Relocate vmlinux ELF data to virtual address space" KVM: s390: vsie: Use virt_to_phys for crypto control block s390: Relocate vmlinux ELF data to virtual address space s390: Compile kernel with -fPIC and link with -no-pie s390: vmlinux.lds.S: Drop .hash and .gnu.hash for !CONFIG_PIE_BUILD s390/ftrace: Use unwinder instead of __builtin_return_address() s390/pci: Drop unneeded reference to CONFIG_DMI s390/os_info: Fix array size in struct os_info s390/os_info: Initialize old os_info in standalone dump kernel docs: Update s390 vfio-ap doc for ap_config sysfs attribute s390/vfio-ap: Add write support to sysfs attr ap_config s390/vfio-ap: Ignore duplicate link requests in vfio_ap_mdev_link_queue s390/vfio-ap: Add sysfs attr, ap_config, to export mdev state s390/ap: Externalize AP bus specific bitmap reading function s390/mm: Re-enable the shared zeropage for !PV and !skeys KVM guests mm/userfaultfd: Do not place zeropages when zeropages are disallowed s390/expoline: Make modules use kernel expolines s390/nospec: Correct modules thunk offset calculation s390/boot: Do not rescue .vmlinux.relocs section s390/boot: Rework deployment of the kernel image ...
2 parents a38297e + 1812dc9 commit d65e1a0

Some content is hidden

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

68 files changed

+1453
-703
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4785,7 +4785,9 @@
47854785

47864786
prot_virt= [S390] enable hosting protected virtual machines
47874787
isolated from the hypervisor (if hardware supports
4788-
that).
4788+
that). If enabled, the default kernel base address
4789+
might be overridden even when Kernel Address Space
4790+
Layout Randomization is disabled.
47894791
Format: <bool>
47904792

47914793
psi= [KNL] Enable or disable pressure stall information

Documentation/arch/s390/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ s390 Architecture
88
cds
99
3270
1010
driver-model
11+
mm
1112
monreader
1213
qeth
1314
s390dbf

Documentation/arch/s390/mm.rst

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
=================
4+
Memory Management
5+
=================
6+
7+
Virtual memory layout
8+
=====================
9+
10+
.. note::
11+
12+
- Some aspects of the virtual memory layout setup are not
13+
clarified (number of page levels, alignment, DMA memory).
14+
15+
- Unused gaps in the virtual memory layout could be present
16+
or not - depending on how partucular system is configured.
17+
No page tables are created for the unused gaps.
18+
19+
- The virtual memory regions are tracked or untracked by KASAN
20+
instrumentation, as well as the KASAN shadow memory itself is
21+
created only when CONFIG_KASAN configuration option is enabled.
22+
23+
::
24+
25+
=============================================================================
26+
| Physical | Virtual | VM area description
27+
=============================================================================
28+
+- 0 --------------+- 0 --------------+
29+
| | S390_lowcore | Low-address memory
30+
| +- 8 KB -----------+
31+
| | |
32+
| | |
33+
| | ... unused gap | KASAN untracked
34+
| | |
35+
+- AMODE31_START --+- AMODE31_START --+ .amode31 rand. phys/virt start
36+
|.amode31 text/data|.amode31 text/data| KASAN untracked
37+
+- AMODE31_END ----+- AMODE31_END ----+ .amode31 rand. phys/virt end (<2GB)
38+
| | |
39+
| | |
40+
+- __kaslr_offset_phys | kernel rand. phys start
41+
| | |
42+
| kernel text/data | |
43+
| | |
44+
+------------------+ | kernel phys end
45+
| | |
46+
| | |
47+
| | |
48+
| | |
49+
+- ident_map_size -+ |
50+
| |
51+
| ... unused gap | KASAN untracked
52+
| |
53+
+- __identity_base + identity mapping start (>= 2GB)
54+
| |
55+
| identity | phys == virt - __identity_base
56+
| mapping | virt == phys + __identity_base
57+
| |
58+
| | KASAN tracked
59+
| |
60+
| |
61+
| |
62+
| |
63+
| |
64+
| |
65+
| |
66+
| |
67+
| |
68+
| |
69+
| |
70+
| |
71+
| |
72+
| |
73+
| |
74+
+---- vmemmap -----+ 'struct page' array start
75+
| |
76+
| virtually mapped |
77+
| memory map | KASAN untracked
78+
| |
79+
+- __abs_lowcore --+
80+
| |
81+
| Absolute Lowcore | KASAN untracked
82+
| |
83+
+- __memcpy_real_area
84+
| |
85+
| Real Memory Copy| KASAN untracked
86+
| |
87+
+- VMALLOC_START --+ vmalloc area start
88+
| | KASAN untracked or
89+
| vmalloc area | KASAN shallowly populated in case
90+
| | CONFIG_KASAN_VMALLOC=y
91+
+- MODULES_VADDR --+ modules area start
92+
| | KASAN allocated per module or
93+
| modules area | KASAN shallowly populated in case
94+
| | CONFIG_KASAN_VMALLOC=y
95+
+- __kaslr_offset -+ kernel rand. virt start
96+
| | KASAN tracked
97+
| kernel text/data | phys == (kvirt - __kaslr_offset) +
98+
| | __kaslr_offset_phys
99+
+- kernel .bss end + kernel rand. virt end
100+
| |
101+
| ... unused gap | KASAN untracked
102+
| |
103+
+------------------+ UltraVisor Secure Storage limit
104+
| |
105+
| ... unused gap | KASAN untracked
106+
| |
107+
+KASAN_SHADOW_START+ KASAN shadow memory start
108+
| |
109+
| KASAN shadow | KASAN untracked
110+
| |
111+
+------------------+ ASCE limit

Documentation/arch/s390/vfio-ap.rst

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,36 @@ matrix device.
380380
control_domains:
381381
A read-only file for displaying the control domain numbers assigned to the
382382
vfio_ap mediated device.
383+
ap_config:
384+
A read/write file that, when written to, allows all three of the
385+
vfio_ap mediated device's ap matrix masks to be replaced in one shot.
386+
Three masks are given, one for adapters, one for domains, and one for
387+
control domains. If the given state cannot be set then no changes are
388+
made to the vfio-ap mediated device.
389+
390+
The format of the data written to ap_config is as follows:
391+
{amask},{dmask},{cmask}\n
392+
393+
\n is a newline character.
394+
395+
amask, dmask, and cmask are masks identifying which adapters, domains,
396+
and control domains should be assigned to the mediated device.
397+
398+
The format of a mask is as follows:
399+
0xNN..NN
400+
401+
Where NN..NN is 64 hexadecimal characters representing a 256-bit value.
402+
The leftmost (highest order) bit represents adapter/domain 0.
403+
404+
For an example set of masks that represent your mdev's current
405+
configuration, simply cat ap_config.
406+
407+
Setting an adapter or domain number greater than the maximum allowed for
408+
the system will result in an error.
409+
410+
This attribute is intended to be used by automation. End users would be
411+
better served using the respective assign/unassign attributes for
412+
adapters, domains, and control domains.
383413

384414
* functions:
385415

@@ -550,7 +580,7 @@ These are the steps:
550580
following Kconfig elements selected:
551581
* IOMMU_SUPPORT
552582
* S390
553-
* ZCRYPT
583+
* AP
554584
* VFIO
555585
* KVM
556586

arch/s390/Kconfig

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ config ARCH_HAS_ILOG2_U32
1717
config ARCH_HAS_ILOG2_U64
1818
def_bool n
1919

20+
config ARCH_PROC_KCORE_TEXT
21+
def_bool y
22+
2023
config GENERIC_HWEIGHT
2124
def_bool y
2225

@@ -552,7 +555,7 @@ config EXPOLINE
552555
If unsure, say N.
553556

554557
config EXPOLINE_EXTERN
555-
def_bool n
558+
def_bool y if EXPOLINE
556559
depends on EXPOLINE
557560
depends on CC_IS_GCC && GCC_VERSION >= 110200
558561
depends on $(success,$(srctree)/arch/s390/tools/gcc-thunk-extern.sh $(CC))
@@ -590,18 +593,6 @@ config RELOCATABLE
590593
Note: this option exists only for documentation purposes, please do
591594
not remove it.
592595

593-
config PIE_BUILD
594-
def_bool CC_IS_CLANG && !$(cc-option,-munaligned-symbols)
595-
help
596-
If the compiler is unable to generate code that can manage unaligned
597-
symbols, the kernel is linked as a position-independent executable
598-
(PIE) and includes dynamic relocations that are processed early
599-
during bootup.
600-
601-
For kpatch functionality, it is recommended to build the kernel
602-
without the PIE_BUILD option. PIE_BUILD is only enabled when the
603-
compiler lacks proper support for handling unaligned symbols.
604-
605596
config RANDOMIZE_BASE
606597
bool "Randomize the address of the kernel image (KASLR)"
607598
default y
@@ -611,6 +602,25 @@ config RANDOMIZE_BASE
611602
as a security feature that deters exploit attempts relying on
612603
knowledge of the location of kernel internals.
613604

605+
config KERNEL_IMAGE_BASE
606+
hex "Kernel image base address"
607+
range 0x100000 0x1FFFFFE0000000 if !KASAN
608+
range 0x100000 0x1BFFFFE0000000 if KASAN
609+
default 0x3FFE0000000 if !KASAN
610+
default 0x7FFFE0000000 if KASAN
611+
help
612+
This is the address at which the kernel image is loaded in case
613+
Kernel Address Space Layout Randomization (KASLR) is disabled.
614+
615+
In case the Protected virtualization guest support is enabled the
616+
Ultravisor imposes a virtual address limit. If the value of this
617+
option leads to the kernel image exceeding the Ultravisor limit,
618+
this option is ignored and the image is loaded below the limit.
619+
620+
If the value of this option leads to the kernel image overlapping
621+
the virtual memory where other data structures are located, this
622+
option is ignored and the image is loaded above the structures.
623+
614624
endmenu
615625

616626
menu "Memory setup"
@@ -724,6 +734,33 @@ config EADM_SCH
724734
To compile this driver as a module, choose M here: the
725735
module will be called eadm_sch.
726736

737+
config AP
738+
def_tristate y
739+
prompt "Support for Adjunct Processors (ap)"
740+
help
741+
This driver allows usage to Adjunct Processor (AP) devices via
742+
the ap bus, cards and queues. Supported Adjunct Processors are
743+
the CryptoExpress Cards (CEX).
744+
745+
To compile this driver as a module, choose M here: the
746+
module will be called ap.
747+
748+
If unsure, say Y (default).
749+
750+
config AP_DEBUG
751+
def_bool n
752+
prompt "Enable debug features for Adjunct Processor (ap) devices"
753+
depends on AP
754+
help
755+
Say 'Y' here to enable some additional debug features for Adjunct
756+
Processor (ap) devices.
757+
758+
There will be some more sysfs attributes displayed for ap queues.
759+
760+
Do not enable on production level kernel build.
761+
762+
If unsure, say N.
763+
727764
config VFIO_CCW
728765
def_tristate n
729766
prompt "Support for VFIO-CCW subchannels"
@@ -740,7 +777,7 @@ config VFIO_AP
740777
prompt "VFIO support for AP devices"
741778
depends on KVM
742779
depends on VFIO
743-
depends on ZCRYPT
780+
depends on AP
744781
select VFIO_MDEV
745782
help
746783
This driver grants access to Adjunct Processor (AP) devices

arch/s390/Makefile

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@ KBUILD_AFLAGS_MODULE += -fPIC
1414
KBUILD_CFLAGS_MODULE += -fPIC
1515
KBUILD_AFLAGS += -m64
1616
KBUILD_CFLAGS += -m64
17-
ifdef CONFIG_PIE_BUILD
18-
KBUILD_CFLAGS += -fPIE
19-
LDFLAGS_vmlinux := -pie -z notext
20-
else
21-
KBUILD_CFLAGS += $(call cc-option,-munaligned-symbols,)
22-
LDFLAGS_vmlinux := --emit-relocs --discard-none
17+
KBUILD_CFLAGS += -fPIC
18+
LDFLAGS_vmlinux := -no-pie --emit-relocs --discard-none
2319
extra_tools := relocs
24-
endif
2520
aflags_dwarf := -Wa,-gdwarf-2
2621
KBUILD_AFLAGS_DECOMPRESSOR := $(CLANG_FLAGS) -m64 -D__ASSEMBLY__
2722
ifndef CONFIG_AS_IS_LLVM
@@ -88,7 +83,6 @@ endif
8883

8984
ifdef CONFIG_EXPOLINE
9085
ifdef CONFIG_EXPOLINE_EXTERN
91-
KBUILD_LDFLAGS_MODULE += arch/s390/lib/expoline/expoline.o
9286
CC_FLAGS_EXPOLINE := -mindirect-branch=thunk-extern
9387
CC_FLAGS_EXPOLINE += -mfunction-return=thunk-extern
9488
else
@@ -167,11 +161,6 @@ vdso_prepare: prepare0
167161
vdso-install-y += arch/s390/kernel/vdso64/vdso64.so.dbg
168162
vdso-install-$(CONFIG_COMPAT) += arch/s390/kernel/vdso32/vdso32.so.dbg
169163

170-
ifdef CONFIG_EXPOLINE_EXTERN
171-
modules_prepare: expoline_prepare
172-
expoline_prepare: scripts
173-
$(Q)$(MAKE) $(build)=arch/s390/lib/expoline arch/s390/lib/expoline/expoline.o
174-
endif
175164
endif
176165

177166
# Don't use tabs in echo arguments

arch/s390/boot/Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
3737

3838
obj-y := head.o als.o startup.o physmem_info.o ipl_parm.o ipl_report.o vmem.o
3939
obj-y += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
40-
obj-y += version.o pgm_check_info.o ctype.o ipl_data.o
41-
obj-y += $(if $(CONFIG_PIE_BUILD),machine_kexec_reloc.o,relocs.o)
40+
obj-y += version.o pgm_check_info.o ctype.o ipl_data.o relocs.o
4241
obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) += uv.o
4342
obj-$(CONFIG_RANDOMIZE_BASE) += kaslr.o
4443
obj-y += $(if $(CONFIG_KERNEL_UNCOMPRESSED),,decompressor.o) info.o
@@ -49,9 +48,7 @@ targets := bzImage section_cmp.boot.data section_cmp.boot.preserved.data $(obj-y
4948
targets += vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2
5049
targets += vmlinux.bin.xz vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.lz4
5150
targets += vmlinux.bin.zst info.bin syms.bin vmlinux.syms $(obj-all)
52-
ifndef CONFIG_PIE_BUILD
5351
targets += relocs.S
54-
endif
5552

5653
OBJECTS := $(addprefix $(obj)/,$(obj-y))
5754
OBJECTS_ALL := $(addprefix $(obj)/,$(obj-all))
@@ -110,13 +107,11 @@ OBJCOPYFLAGS_vmlinux.bin := -O binary --remove-section=.comment --remove-section
110107
$(obj)/vmlinux.bin: vmlinux FORCE
111108
$(call if_changed,objcopy)
112109

113-
ifndef CONFIG_PIE_BUILD
114110
CMD_RELOCS=arch/s390/tools/relocs
115-
quiet_cmd_relocs = RELOCS $@
111+
quiet_cmd_relocs = RELOCS $@
116112
cmd_relocs = $(CMD_RELOCS) $< > $@
117113
$(obj)/relocs.S: vmlinux FORCE
118114
$(call if_changed,relocs)
119-
endif
120115

121116
suffix-$(CONFIG_KERNEL_GZIP) := .gz
122117
suffix-$(CONFIG_KERNEL_BZIP2) := .bz2

0 commit comments

Comments
 (0)