Skip to content

Commit 0338cd9

Browse files
committed
Merge tag 's390-6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Heiko Carstens: - Add firmware sysfs interface which allows user space to retrieve the dump area size of the machine - Add 'measurement_chars_full' CHPID sysfs attribute to make the complete associated Channel-Measurements Characteristics Block available - Add virtio-mem support - Move gmap aka KVM page fault handling from the main fault handler to KVM code. This is the first step to make s390 KVM page fault handling similar to other architectures. With this first step the main fault handler does not have any special handling anymore, and therefore convert it to support LOCK_MM_AND_FIND_VMA - With gcc 14 s390 support for flag output operand support for inline assemblies was added. This allows for several optimizations: - Provide a cmpxchg inline assembly which makes use of this, and provide all variants of arch_try_cmpxchg() so that the compiler can generate slightly better code - Convert a few cmpxchg() loops to try_cmpxchg() loops - Similar to x86 add a CC_OUT() helper macro (and other macros), and convert all inline assemblies to make use of them, so that depending on compiler version better code can be generated - List installed host-key hashes in sysfs if the machine supports the Query Ultravisor Keys UVC - Add 'Retrieve Secret' ioctl which allows user space in protected execution guests to retrieve previously stored secrets from the Ultravisor - Add pkey-uv module which supports the conversion of Ultravisor retrievable secrets to protected keys - Extend the existing paes cipher to exploit the full AES-XTS hardware acceleration introduced with message-security assist extension 10 - Convert hopefully all sysfs show functions to use sysfs_emit() so that the constant flow of such patches stop - For PCI devices make use of the newly added Topology ID attribute to enable whole card multi-function support despite the change to PCHID per port. Additionally improve the overall robustness and usability of the multifunction support - Various other small improvements, fixes, and cleanups * tag 's390-6.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (133 commits) s390/cio/ioasm: Convert to use flag output macros s390/cio/qdio: Convert to use flag output macros s390/sclp: Convert to use flag output macros s390/dasd: Convert to use flag output macros s390/boot/physmem: Convert to use flag output macros s390/pci: Convert to use flag output macros s390/kvm: Convert to use flag output macros s390/extmem: Convert to use flag output macros s390/string: Convert to use flag output macros s390/diag: Convert to use flag output macros s390/irq: Convert to use flag output macros s390/smp: Convert to use flag output macros s390/uv: Convert to use flag output macros s390/pai: Convert to use flag output macros s390/mm: Convert to use flag output macros s390/cpu_mf: Convert to use flag output macros s390/cpcmd: Convert to use flag output macros s390/topology: Convert to use flag output macros s390/time: Convert to use flag output macros s390/pageattr: Convert to use flag output macros ...
2 parents 5591fd5 + e200565 commit 0338cd9

Some content is hidden

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

121 files changed

+2948
-1665
lines changed

Documentation/virt/kvm/s390/s390-diag.rst

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,24 @@ DIAGNOSE function codes not specific to KVM, please refer to the
3535
documentation for the s390 hypervisors defining them.
3636

3737

38-
DIAGNOSE function code 'X'500' - KVM virtio functions
39-
-----------------------------------------------------
38+
DIAGNOSE function code 'X'500' - KVM functions
39+
----------------------------------------------
4040

41-
If the function code specifies 0x500, various virtio-related functions
42-
are performed.
41+
If the function code specifies 0x500, various KVM-specific functions
42+
are performed, including virtio functions.
4343

44-
General register 1 contains the virtio subfunction code. Supported
45-
virtio subfunctions depend on KVM's userspace. Generally, userspace
46-
provides either s390-virtio (subcodes 0-2) or virtio-ccw (subcode 3).
44+
General register 1 contains the subfunction code. Supported subfunctions
45+
depend on KVM's userspace. Regarding virtio subfunctions, generally
46+
userspace provides either s390-virtio (subcodes 0-2) or virtio-ccw
47+
(subcode 3).
4748

4849
Upon completion of the DIAGNOSE instruction, general register 2 contains
4950
the function's return code, which is either a return code or a subcode
5051
specific value.
5152

53+
If the specified subfunction is not supported, a SPECIFICATION exception
54+
will be triggered.
55+
5256
Subcode 0 - s390-virtio notification and early console printk
5357
Handled by userspace.
5458

@@ -76,6 +80,23 @@ Subcode 3 - virtio-ccw notification
7680

7781
See also the virtio standard for a discussion of this hypercall.
7882

83+
Subcode 4 - storage-limit
84+
Handled by userspace.
85+
86+
After completion of the DIAGNOSE call, general register 2 will
87+
contain the storage limit: the maximum physical address that might be
88+
used for storage throughout the lifetime of the VM.
89+
90+
The storage limit does not indicate currently usable storage, it may
91+
include holes, standby storage and areas reserved for other means, such
92+
as memory hotplug or virtio-mem devices. Other interfaces for detecting
93+
actually usable storage, such as SCLP, must be used in conjunction with
94+
this subfunction.
95+
96+
Note that the storage limit can be larger, but never smaller than the
97+
maximum storage address indicated by SCLP via the "maximum storage
98+
increment" and the "increment size".
99+
79100

80101
DIAGNOSE function code 'X'501 - KVM breakpoint
81102
----------------------------------------------

MAINTAINERS

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20224,6 +20224,16 @@ L: linux-s390@vger.kernel.org
2022420224
S: Supported
2022520225
F: drivers/s390/cio/
2022620226

20227+
S390 CRYPTO MODULES, PRNG DRIVER, ARCH RANDOM
20228+
M: Harald Freudenberger <freude@linux.ibm.com>
20229+
M: Holger Dengler <dengler@linux.ibm.com>
20230+
L: linux-crypto@vger.kernel.org
20231+
L: linux-s390@vger.kernel.org
20232+
S: Supported
20233+
F: arch/s390/crypto/
20234+
F: arch/s390/include/asm/archrandom.h
20235+
F: arch/s390/include/asm/cpacf.h
20236+
2022720237
S390 DASD DRIVER
2022820238
M: Stefan Haberland <sth@linux.ibm.com>
2022920239
M: Jan Hoeppner <hoeppner@linux.ibm.com>
@@ -20233,6 +20243,14 @@ F: block/partitions/ibm.c
2023320243
F: drivers/s390/block/dasd*
2023420244
F: include/linux/dasd_mod.h
2023520245

20246+
S390 HWRANDOM TRNG DRIVER
20247+
M: Harald Freudenberger <freude@linux.ibm.com>
20248+
M: Holger Dengler <dengler@linux.ibm.com>
20249+
L: linux-crypto@vger.kernel.org
20250+
L: linux-s390@vger.kernel.org
20251+
S: Supported
20252+
F: drivers/char/hw_random/s390-trng.c
20253+
2023620254
S390 IOMMU (PCI)
2023720255
M: Niklas Schnelle <schnelle@linux.ibm.com>
2023820256
M: Matthew Rosato <mjrosato@linux.ibm.com>
@@ -20314,10 +20332,16 @@ F: arch/s390/kvm/pci*
2031420332
F: drivers/vfio/pci/vfio_pci_zdev.c
2031520333
F: include/uapi/linux/vfio_zdev.h
2031620334

20317-
S390 ZCRYPT DRIVER
20335+
S390 ZCRYPT AND PKEY DRIVER AND AP BUS
2031820336
M: Harald Freudenberger <freude@linux.ibm.com>
20337+
M: Holger Dengler <dengler@linux.ibm.com>
2031920338
L: linux-s390@vger.kernel.org
2032020339
S: Supported
20340+
F: arch/s390/include/asm/ap.h
20341+
F: arch/s390/include/asm/pkey.h
20342+
F: arch/s390/include/asm/trace/zcrypt.h
20343+
F: arch/s390/include/uapi/asm/pkey.h
20344+
F: arch/s390/include/uapi/asm/zcrypt.h
2032120345
F: drivers/s390/crypto/
2032220346

2032320347
S390 ZFCP DRIVER

arch/s390/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ config KASAN_SHADOW_OFFSET
5252
depends on KASAN
5353
default 0x1C000000000000
5454

55+
config GCC_ASM_FLAG_OUTPUT_BROKEN
56+
def_bool CC_IS_GCC && GCC_VERSION < 140200
57+
help
58+
GCC versions before 14.2.0 may die with an internal
59+
compiler error in some configurations if flag output
60+
operands are used within inline assemblies.
61+
5562
config S390
5663
def_bool y
5764
#
@@ -224,6 +231,7 @@ config S390
224231
select HAVE_VIRT_CPU_ACCOUNTING_IDLE
225232
select IOMMU_HELPER if PCI
226233
select IOMMU_SUPPORT if PCI
234+
select LOCK_MM_AND_FIND_VMA
227235
select MMU_GATHER_MERGE_VMAS
228236
select MMU_GATHER_NO_GATHER
229237
select MMU_GATHER_RCU_TABLE_FREE

arch/s390/boot/physmem_info.c

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <asm/sections.h>
1010
#include <asm/setup.h>
1111
#include <asm/sclp.h>
12+
#include <asm/asm.h>
1213
#include <asm/uv.h>
1314
#include "decompressor.h"
1415
#include "boot.h"
@@ -59,13 +60,13 @@ static int __diag260(unsigned long rx1, unsigned long rx2)
5960
{
6061
unsigned long reg1, reg2, ry;
6162
union register_pair rx;
63+
int cc, exception;
6264
psw_t old;
63-
int rc;
6465

6566
rx.even = rx1;
6667
rx.odd = rx2;
6768
ry = 0x10; /* storage configuration */
68-
rc = -1; /* fail */
69+
exception = 1;
6970
asm volatile(
7071
" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n"
7172
" epsw %[reg1],%[reg2]\n"
@@ -74,20 +75,22 @@ static int __diag260(unsigned long rx1, unsigned long rx2)
7475
" larl %[reg1],1f\n"
7576
" stg %[reg1],8(%[psw_pgm])\n"
7677
" diag %[rx],%[ry],0x260\n"
77-
" ipm %[rc]\n"
78-
" srl %[rc],28\n"
78+
" lhi %[exc],0\n"
7979
"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n"
80-
: [reg1] "=&d" (reg1),
80+
CC_IPM(cc)
81+
: CC_OUT(cc, cc),
82+
[exc] "+d" (exception),
83+
[reg1] "=&d" (reg1),
8184
[reg2] "=&a" (reg2),
82-
[rc] "+&d" (rc),
8385
[ry] "+&d" (ry),
8486
"+Q" (get_lowcore()->program_new_psw),
8587
"=Q" (old)
8688
: [rx] "d" (rx.pair),
8789
[psw_old] "a" (&old),
8890
[psw_pgm] "a" (&get_lowcore()->program_new_psw)
89-
: "cc", "memory");
90-
return rc == 0 ? ry : -1;
91+
: CC_CLOBBER_LIST("memory"));
92+
cc = exception ? -1 : CC_TRANSFORM(cc);
93+
return cc == 0 ? ry : -1;
9194
}
9295

9396
static int diag260(void)
@@ -109,12 +112,49 @@ static int diag260(void)
109112
return 0;
110113
}
111114

115+
#define DIAG500_SC_STOR_LIMIT 4
116+
117+
static int diag500_storage_limit(unsigned long *max_physmem_end)
118+
{
119+
unsigned long storage_limit;
120+
unsigned long reg1, reg2;
121+
psw_t old;
122+
123+
asm volatile(
124+
" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n"
125+
" epsw %[reg1],%[reg2]\n"
126+
" st %[reg1],0(%[psw_pgm])\n"
127+
" st %[reg2],4(%[psw_pgm])\n"
128+
" larl %[reg1],1f\n"
129+
" stg %[reg1],8(%[psw_pgm])\n"
130+
" lghi 1,%[subcode]\n"
131+
" lghi 2,0\n"
132+
" diag 2,4,0x500\n"
133+
"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n"
134+
" lgr %[slimit],2\n"
135+
: [reg1] "=&d" (reg1),
136+
[reg2] "=&a" (reg2),
137+
[slimit] "=d" (storage_limit),
138+
"=Q" (get_lowcore()->program_new_psw),
139+
"=Q" (old)
140+
: [psw_old] "a" (&old),
141+
[psw_pgm] "a" (&get_lowcore()->program_new_psw),
142+
[subcode] "i" (DIAG500_SC_STOR_LIMIT)
143+
: "memory", "1", "2");
144+
if (!storage_limit)
145+
return -EINVAL;
146+
/* Convert inclusive end to exclusive end */
147+
*max_physmem_end = storage_limit + 1;
148+
return 0;
149+
}
150+
112151
static int tprot(unsigned long addr)
113152
{
114153
unsigned long reg1, reg2;
115-
int rc = -EFAULT;
154+
int cc, exception;
116155
psw_t old;
117156

157+
exception = 1;
118158
asm volatile(
119159
" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n"
120160
" epsw %[reg1],%[reg2]\n"
@@ -123,19 +163,21 @@ static int tprot(unsigned long addr)
123163
" larl %[reg1],1f\n"
124164
" stg %[reg1],8(%[psw_pgm])\n"
125165
" tprot 0(%[addr]),0\n"
126-
" ipm %[rc]\n"
127-
" srl %[rc],28\n"
166+
" lhi %[exc],0\n"
128167
"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n"
129-
: [reg1] "=&d" (reg1),
168+
CC_IPM(cc)
169+
: CC_OUT(cc, cc),
170+
[exc] "+d" (exception),
171+
[reg1] "=&d" (reg1),
130172
[reg2] "=&a" (reg2),
131-
[rc] "+&d" (rc),
132173
"=Q" (get_lowcore()->program_new_psw.addr),
133174
"=Q" (old)
134175
: [psw_old] "a" (&old),
135176
[psw_pgm] "a" (&get_lowcore()->program_new_psw),
136177
[addr] "a" (addr)
137-
: "cc", "memory");
138-
return rc;
178+
: CC_CLOBBER_LIST("memory"));
179+
cc = exception ? -EFAULT : CC_TRANSFORM(cc);
180+
return cc;
139181
}
140182

141183
static unsigned long search_mem_end(void)
@@ -157,7 +199,9 @@ unsigned long detect_max_physmem_end(void)
157199
{
158200
unsigned long max_physmem_end = 0;
159201

160-
if (!sclp_early_get_memsize(&max_physmem_end)) {
202+
if (!diag500_storage_limit(&max_physmem_end)) {
203+
physmem_info.info_source = MEM_DETECT_DIAG500_STOR_LIMIT;
204+
} else if (!sclp_early_get_memsize(&max_physmem_end)) {
161205
physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO;
162206
} else {
163207
max_physmem_end = search_mem_end();
@@ -170,6 +214,13 @@ void detect_physmem_online_ranges(unsigned long max_physmem_end)
170214
{
171215
if (!sclp_early_read_storage_info()) {
172216
physmem_info.info_source = MEM_DETECT_SCLP_STOR_INFO;
217+
} else if (physmem_info.info_source == MEM_DETECT_DIAG500_STOR_LIMIT) {
218+
unsigned long online_end;
219+
220+
if (!sclp_early_get_memsize(&online_end)) {
221+
physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO;
222+
add_physmem_online_range(0, online_end);
223+
}
173224
} else if (!diag260()) {
174225
physmem_info.info_source = MEM_DETECT_DIAG260;
175226
} else if (max_physmem_end) {

arch/s390/boot/startup.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,15 @@ static void kaslr_adjust_got(unsigned long offset)
182182
* Merge information from several sources into a single ident_map_size value.
183183
* "ident_map_size" represents the upper limit of physical memory we may ever
184184
* reach. It might not be all online memory, but also include standby (offline)
185-
* memory. "ident_map_size" could be lower then actual standby or even online
185+
* memory or memory areas reserved for other means (e.g., memory devices such as
186+
* virtio-mem).
187+
*
188+
* "ident_map_size" could be lower then actual standby/reserved or even online
186189
* memory present, due to limiting factors. We should never go above this limit.
187190
* It is the size of our identity mapping.
188191
*
189192
* Consider the following factors:
190-
* 1. max_physmem_end - end of physical memory online or standby.
193+
* 1. max_physmem_end - end of physical memory online, standby or reserved.
191194
* Always >= end of the last online memory range (get_physmem_online_end()).
192195
* 2. CONFIG_MAX_PHYSMEM_BITS - the maximum size of physical memory the
193196
* kernel is able to support.
@@ -480,7 +483,7 @@ void startup_kernel(void)
480483
* __vmlinux_relocs_64_end as the lower range address. However,
481484
* .amode31 section is written to by the decompressed kernel - at
482485
* that time the contents of .vmlinux.relocs is not needed anymore.
483-
* Conversly, .vmlinux.relocs is read only by the decompressor, even
486+
* Conversely, .vmlinux.relocs is read only by the decompressor, even
484487
* before the kernel started. Therefore, in case the two sections
485488
* overlap there is no risk of corrupting any data.
486489
*/

arch/s390/boot/uv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ void uv_query_info(void)
2222
if (!test_facility(158))
2323
return;
2424

25-
/* rc==0x100 means that there is additional data we do not process */
26-
if (uv_call(0, (uint64_t)&uvcb) && uvcb.header.rc != 0x100)
25+
/* Ignore that there might be more data we do not process */
26+
if (uv_call(0, (uint64_t)&uvcb) && uvcb.header.rc != UVC_RC_MORE_DATA)
2727
return;
2828

2929
if (IS_ENABLED(CONFIG_KVM)) {
@@ -46,7 +46,8 @@ void uv_query_info(void)
4646
uv_info.supp_add_secret_req_ver = uvcb.supp_add_secret_req_ver;
4747
uv_info.supp_add_secret_pcf = uvcb.supp_add_secret_pcf;
4848
uv_info.supp_secret_types = uvcb.supp_secret_types;
49-
uv_info.max_secrets = uvcb.max_secrets;
49+
uv_info.max_assoc_secrets = uvcb.max_assoc_secrets;
50+
uv_info.max_retr_secrets = uvcb.max_retr_secrets;
5051
}
5152

5253
if (test_bit_inv(BIT_UVC_CMD_SET_SHARED_ACCESS, (unsigned long *)uvcb.inst_calls_list) &&

arch/s390/configs/debug_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ CONFIG_VFIO_PCI=m
625625
CONFIG_MLX5_VFIO_PCI=m
626626
CONFIG_VIRTIO_PCI=m
627627
CONFIG_VIRTIO_BALLOON=m
628+
CONFIG_VIRTIO_MEM=m
628629
CONFIG_VIRTIO_INPUT=y
629630
CONFIG_VHOST_NET=m
630631
CONFIG_VHOST_VSOCK=m
@@ -810,6 +811,7 @@ CONFIG_PKEY=m
810811
CONFIG_PKEY_CCA=m
811812
CONFIG_PKEY_EP11=m
812813
CONFIG_PKEY_PCKMO=m
814+
CONFIG_PKEY_UV=m
813815
CONFIG_CRYPTO_PAES_S390=m
814816
CONFIG_CRYPTO_DEV_VIRTIO=m
815817
CONFIG_SYSTEM_BLACKLIST_KEYRING=y

arch/s390/configs/defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ CONFIG_VFIO_PCI=m
615615
CONFIG_MLX5_VFIO_PCI=m
616616
CONFIG_VIRTIO_PCI=m
617617
CONFIG_VIRTIO_BALLOON=m
618+
CONFIG_VIRTIO_MEM=m
618619
CONFIG_VIRTIO_INPUT=y
619620
CONFIG_VHOST_NET=m
620621
CONFIG_VHOST_VSOCK=m
@@ -797,6 +798,7 @@ CONFIG_PKEY=m
797798
CONFIG_PKEY_CCA=m
798799
CONFIG_PKEY_EP11=m
799800
CONFIG_PKEY_PCKMO=m
801+
CONFIG_PKEY_UV=m
800802
CONFIG_CRYPTO_PAES_S390=m
801803
CONFIG_CRYPTO_DEV_VIRTIO=m
802804
CONFIG_SYSTEM_BLACKLIST_KEYRING=y

0 commit comments

Comments
 (0)