Commit 0338cd9c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents 5591fd5e e200565d
Loading
Loading
Loading
Loading
+28 −7
Original line number Diff line number Diff line
@@ -35,20 +35,24 @@ DIAGNOSE function codes not specific to KVM, please refer to the
documentation for the s390 hypervisors defining them.


DIAGNOSE function code 'X'500' - KVM virtio functions
-----------------------------------------------------
DIAGNOSE function code 'X'500' - KVM functions
----------------------------------------------

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

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

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

If the specified subfunction is not supported, a SPECIFICATION exception
will be triggered.

Subcode 0 - s390-virtio notification and early console printk
    Handled by userspace.

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

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

Subcode 4 - storage-limit
    Handled by userspace.

    After completion of the DIAGNOSE call, general register 2 will
    contain the storage limit: the maximum physical address that might be
    used for storage throughout the lifetime of the VM.

    The storage limit does not indicate currently usable storage, it may
    include holes, standby storage and areas reserved for other means, such
    as memory hotplug or virtio-mem devices. Other interfaces for detecting
    actually usable storage, such as SCLP, must be used in conjunction with
    this subfunction.

    Note that the storage limit can be larger, but never smaller than the
    maximum storage address indicated by SCLP via the "maximum storage
    increment" and the "increment size".


DIAGNOSE function code 'X'501 - KVM breakpoint
----------------------------------------------
+25 −1
Original line number Diff line number Diff line
@@ -20224,6 +20224,16 @@ L: linux-s390@vger.kernel.org
S:	Supported
F:	drivers/s390/cio/
S390 CRYPTO MODULES, PRNG DRIVER, ARCH RANDOM
M:	Harald Freudenberger <freude@linux.ibm.com>
M:	Holger Dengler <dengler@linux.ibm.com>
L:	linux-crypto@vger.kernel.org
L:	linux-s390@vger.kernel.org
S:	Supported
F:	arch/s390/crypto/
F:	arch/s390/include/asm/archrandom.h
F:	arch/s390/include/asm/cpacf.h
S390 DASD DRIVER
M:	Stefan Haberland <sth@linux.ibm.com>
M:	Jan Hoeppner <hoeppner@linux.ibm.com>
@@ -20233,6 +20243,14 @@ F: block/partitions/ibm.c
F:	drivers/s390/block/dasd*
F:	include/linux/dasd_mod.h
S390 HWRANDOM TRNG DRIVER
M:	Harald Freudenberger <freude@linux.ibm.com>
M:	Holger Dengler <dengler@linux.ibm.com>
L:	linux-crypto@vger.kernel.org
L:	linux-s390@vger.kernel.org
S:	Supported
F:	drivers/char/hw_random/s390-trng.c
S390 IOMMU (PCI)
M:	Niklas Schnelle <schnelle@linux.ibm.com>
M:	Matthew Rosato <mjrosato@linux.ibm.com>
@@ -20314,10 +20332,16 @@ F: arch/s390/kvm/pci*
F:	drivers/vfio/pci/vfio_pci_zdev.c
F:	include/uapi/linux/vfio_zdev.h
S390 ZCRYPT DRIVER
S390 ZCRYPT AND PKEY DRIVER AND AP BUS
M:	Harald Freudenberger <freude@linux.ibm.com>
M:	Holger Dengler <dengler@linux.ibm.com>
L:	linux-s390@vger.kernel.org
S:	Supported
F:	arch/s390/include/asm/ap.h
F:	arch/s390/include/asm/pkey.h
F:	arch/s390/include/asm/trace/zcrypt.h
F:	arch/s390/include/uapi/asm/pkey.h
F:	arch/s390/include/uapi/asm/zcrypt.h
F:	drivers/s390/crypto/
S390 ZFCP DRIVER
+8 −0
Original line number Diff line number Diff line
@@ -52,6 +52,13 @@ config KASAN_SHADOW_OFFSET
	depends on KASAN
	default 0x1C000000000000

config GCC_ASM_FLAG_OUTPUT_BROKEN
	def_bool CC_IS_GCC && GCC_VERSION < 140200
	help
	  GCC versions before 14.2.0 may die with an internal
	  compiler error in some configurations if flag output
	  operands are used within inline assemblies.

config S390
	def_bool y
	#
@@ -224,6 +231,7 @@ config S390
	select HAVE_VIRT_CPU_ACCOUNTING_IDLE
	select IOMMU_HELPER		if PCI
	select IOMMU_SUPPORT		if PCI
	select LOCK_MM_AND_FIND_VMA
	select MMU_GATHER_MERGE_VMAS
	select MMU_GATHER_NO_GATHER
	select MMU_GATHER_RCU_TABLE_FREE
+67 −16
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <asm/sections.h>
#include <asm/setup.h>
#include <asm/sclp.h>
#include <asm/asm.h>
#include <asm/uv.h>
#include "decompressor.h"
#include "boot.h"
@@ -59,13 +60,13 @@ static int __diag260(unsigned long rx1, unsigned long rx2)
{
	unsigned long reg1, reg2, ry;
	union register_pair rx;
	int cc, exception;
	psw_t old;
	int rc;

	rx.even = rx1;
	rx.odd	= rx2;
	ry = 0x10; /* storage configuration */
	rc = -1;   /* fail */
	exception = 1;
	asm volatile(
		"	mvc	0(16,%[psw_old]),0(%[psw_pgm])\n"
		"	epsw	%[reg1],%[reg2]\n"
@@ -74,20 +75,22 @@ static int __diag260(unsigned long rx1, unsigned long rx2)
		"	larl	%[reg1],1f\n"
		"	stg	%[reg1],8(%[psw_pgm])\n"
		"	diag	%[rx],%[ry],0x260\n"
		"	ipm	%[rc]\n"
		"	srl	%[rc],28\n"
		"	lhi	%[exc],0\n"
		"1:	mvc	0(16,%[psw_pgm]),0(%[psw_old])\n"
		: [reg1] "=&d" (reg1),
		CC_IPM(cc)
		: CC_OUT(cc, cc),
		  [exc] "+d" (exception),
		  [reg1] "=&d" (reg1),
		  [reg2] "=&a" (reg2),
		  [rc] "+&d" (rc),
		  [ry] "+&d" (ry),
		  "+Q" (get_lowcore()->program_new_psw),
		  "=Q" (old)
		: [rx] "d" (rx.pair),
		  [psw_old] "a" (&old),
		  [psw_pgm] "a" (&get_lowcore()->program_new_psw)
		: "cc", "memory");
	return rc == 0 ? ry : -1;
		: CC_CLOBBER_LIST("memory"));
	cc = exception ? -1 : CC_TRANSFORM(cc);
	return cc == 0 ? ry : -1;
}

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

#define DIAG500_SC_STOR_LIMIT 4

static int diag500_storage_limit(unsigned long *max_physmem_end)
{
	unsigned long storage_limit;
	unsigned long reg1, reg2;
	psw_t old;

	asm volatile(
		"	mvc	0(16,%[psw_old]),0(%[psw_pgm])\n"
		"	epsw	%[reg1],%[reg2]\n"
		"	st	%[reg1],0(%[psw_pgm])\n"
		"	st	%[reg2],4(%[psw_pgm])\n"
		"	larl	%[reg1],1f\n"
		"	stg	%[reg1],8(%[psw_pgm])\n"
		"	lghi	1,%[subcode]\n"
		"	lghi	2,0\n"
		"	diag	2,4,0x500\n"
		"1:	mvc	0(16,%[psw_pgm]),0(%[psw_old])\n"
		"	lgr	%[slimit],2\n"
		: [reg1] "=&d" (reg1),
		  [reg2] "=&a" (reg2),
		  [slimit] "=d" (storage_limit),
		  "=Q" (get_lowcore()->program_new_psw),
		  "=Q" (old)
		: [psw_old] "a" (&old),
		  [psw_pgm] "a" (&get_lowcore()->program_new_psw),
		  [subcode] "i" (DIAG500_SC_STOR_LIMIT)
		: "memory", "1", "2");
	if (!storage_limit)
		return -EINVAL;
	/* Convert inclusive end to exclusive end */
	*max_physmem_end = storage_limit + 1;
	return 0;
}

static int tprot(unsigned long addr)
{
	unsigned long reg1, reg2;
	int rc = -EFAULT;
	int cc, exception;
	psw_t old;

	exception = 1;
	asm volatile(
		"	mvc	0(16,%[psw_old]),0(%[psw_pgm])\n"
		"	epsw	%[reg1],%[reg2]\n"
@@ -123,19 +163,21 @@ static int tprot(unsigned long addr)
		"	larl	%[reg1],1f\n"
		"	stg	%[reg1],8(%[psw_pgm])\n"
		"	tprot	0(%[addr]),0\n"
		"	ipm	%[rc]\n"
		"	srl	%[rc],28\n"
		"	lhi	%[exc],0\n"
		"1:	mvc	0(16,%[psw_pgm]),0(%[psw_old])\n"
		: [reg1] "=&d" (reg1),
		CC_IPM(cc)
		: CC_OUT(cc, cc),
		  [exc] "+d" (exception),
		  [reg1] "=&d" (reg1),
		  [reg2] "=&a" (reg2),
		  [rc] "+&d" (rc),
		  "=Q" (get_lowcore()->program_new_psw.addr),
		  "=Q" (old)
		: [psw_old] "a" (&old),
		  [psw_pgm] "a" (&get_lowcore()->program_new_psw),
		  [addr] "a" (addr)
		: "cc", "memory");
	return rc;
		: CC_CLOBBER_LIST("memory"));
	cc = exception ? -EFAULT : CC_TRANSFORM(cc);
	return cc;
}

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

	if (!sclp_early_get_memsize(&max_physmem_end)) {
	if (!diag500_storage_limit(&max_physmem_end)) {
		physmem_info.info_source = MEM_DETECT_DIAG500_STOR_LIMIT;
	} else if (!sclp_early_get_memsize(&max_physmem_end)) {
		physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO;
	} else {
		max_physmem_end = search_mem_end();
@@ -170,6 +214,13 @@ void detect_physmem_online_ranges(unsigned long max_physmem_end)
{
	if (!sclp_early_read_storage_info()) {
		physmem_info.info_source = MEM_DETECT_SCLP_STOR_INFO;
	} else if (physmem_info.info_source == MEM_DETECT_DIAG500_STOR_LIMIT) {
		unsigned long online_end;

		if (!sclp_early_get_memsize(&online_end)) {
			physmem_info.info_source = MEM_DETECT_SCLP_READ_INFO;
			add_physmem_online_range(0, online_end);
		}
	} else if (!diag260()) {
		physmem_info.info_source = MEM_DETECT_DIAG260;
	} else if (max_physmem_end) {
+6 −3
Original line number Diff line number Diff line
@@ -182,12 +182,15 @@ static void kaslr_adjust_got(unsigned long offset)
 * Merge information from several sources into a single ident_map_size value.
 * "ident_map_size" represents the upper limit of physical memory we may ever
 * reach. It might not be all online memory, but also include standby (offline)
 * memory. "ident_map_size" could be lower then actual standby or even online
 * memory or memory areas reserved for other means (e.g., memory devices such as
 * virtio-mem).
 *
 * "ident_map_size" could be lower then actual standby/reserved or even online
 * memory present, due to limiting factors. We should never go above this limit.
 * It is the size of our identity mapping.
 *
 * Consider the following factors:
 * 1. max_physmem_end - end of physical memory online or standby.
 * 1. max_physmem_end - end of physical memory online, standby or reserved.
 *    Always >= end of the last online memory range (get_physmem_online_end()).
 * 2. CONFIG_MAX_PHYSMEM_BITS - the maximum size of physical memory the
 *    kernel is able to support.
@@ -480,7 +483,7 @@ void startup_kernel(void)
	 * __vmlinux_relocs_64_end as the lower range address. However,
	 * .amode31 section is written to by the decompressed kernel - at
	 * that time the contents of .vmlinux.relocs is not needed anymore.
	 * Conversly, .vmlinux.relocs is read only by the decompressor, even
	 * Conversely, .vmlinux.relocs is read only by the decompressor, even
	 * before the kernel started. Therefore, in case the two sections
	 * overlap there is no risk of corrupting any data.
	 */
Loading