Skip to content

Commit

Permalink
Merge tag 's390-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/s390/linux

Pull s390 updates from Heiko Carstens:

 - Add vfio-ap support to pass-through crypto devices to secure
   execution guests

 - Add API ordinal 6 support to zcrypt_ep11misc device drive, which is
   required to handle key generate and key derive (e.g. secure key to
   protected key) correctly

 - Add missing secure/has_secure sysfs files for the case where it is
   not possible to figure where a system has been booted from. Existing
   user space relies on that these files are always present

 - Fix DCSS block device driver list corruption, caused by incorrect
   error handling

 - Convert virt_to_pfn() and pfn_to_virt() from defines to static inline
   functions to enforce type checking

 - Cleanups, improvements, and minor fixes to the kernel mapping setup

 - Fix various virtual vs physical address confusions

 - Move pfault code to separate file, since it has nothing to do with
   regular fault handling

 - Move s390 documentation to Documentation/arch/ like it has been done
   for other architectures already

 - Add HAVE_FUNCTION_GRAPH_RETVAL support

 - Factor out the s390_hypfs filesystem and add a new config option for
   it. The filesystem is deprecated and as soon as all users are gone it
   can be removed some time in the not so near future

 - Remove support for old CEX2 and CEX3 crypto cards from zcrypt device
   driver

 - Add support for user-defined certificates: receive user-defined
   certificates with a diagnose call and provide them via 'cert_store'
   keyring to user space

 - Couple of other small fixes and improvements all over the place

* tag 's390-6.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (66 commits)
  s390/pci: use builtin_misc_device macro to simplify the code
  s390/vfio-ap: make sure nib is shared
  KVM: s390: export kvm_s390_pv*_is_protected functions
  s390/uv: export uv_pin_shared for direct usage
  s390/vfio-ap: check for TAPQ response codes 0x35 and 0x36
  s390/vfio-ap: handle queue state change in progress on reset
  s390/vfio-ap: use work struct to verify queue reset
  s390/vfio-ap: store entire AP queue status word with the queue object
  s390/vfio-ap: remove upper limit on wait for queue reset to complete
  s390/vfio-ap: allow deconfigured queue to be passed through to a guest
  s390/vfio-ap: wait for response code 05 to clear on queue reset
  s390/vfio-ap: clean up irq resources if possible
  s390/vfio-ap: no need to check the 'E' and 'I' bits in APQSW after TAPQ
  s390/ipl: refactor deprecated strncpy
  s390/ipl: fix virtual vs physical address confusion
  s390/zcrypt_ep11misc: support API ordinal 6 with empty pin-blob
  s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs
  s390/pkey: fix PKEY_TYPE_EP11_AES handling for sysfs attributes
  s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_VERIFYKEY2 IOCTL
  s390/pkey: fix PKEY_TYPE_EP11_AES handling in PKEY_KBLOB2PROTK[23]
  ...
  • Loading branch information
torvalds committed Aug 29, 2023
2 parents 97efd28 + dedf98d commit e5b7ca0
Show file tree
Hide file tree
Showing 104 changed files with 2,576 additions and 2,153 deletions.
4 changes: 2 additions & 2 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@
others).

ccw_timeout_log [S390]
See Documentation/s390/common_io.rst for details.
See Documentation/arch/s390/common_io.rst for details.

cgroup_disable= [KNL] Disable a particular controller or optional feature
Format: {name of the controller(s) or feature(s) to disable}
Expand Down Expand Up @@ -598,7 +598,7 @@
Setting checkreqprot to 1 is deprecated.

cio_ignore= [S390]
See Documentation/s390/common_io.rst for details.
See Documentation/arch/s390/common_io.rst for details.

clearcpuid=X[,X...] [X86]
Disable CPUID feature X for the kernel. See
Expand Down
2 changes: 1 addition & 1 deletion Documentation/arch/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ implementation.
parisc/index
../powerpc/index
../riscv/index
../s390/index
s390/index
sh/index
sparc/index
x86/index
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Here are the installation steps in detail:
as a 3270, not a 3215.

5. Run the 3270 configuration script config3270. It is
distributed in this same directory, Documentation/s390, as
distributed in this same directory, Documentation/arch/s390, as
config3270.sh. Inspect the output script it produces,
/tmp/mkdev3270, and then run that script. This will create the
necessary character special device files and make the necessary
Expand All @@ -125,7 +125,7 @@ Here are the installation steps in detail:
Then notify /sbin/init that /etc/inittab has changed, by issuing
the telinit command with the q operand::

cd Documentation/s390
cd Documentation/arch/s390
sh config3270.sh
sh /tmp/mkdev3270
telinit q
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ some of them are ESA/390 platform specific.

Note:
In order to write a driver for S/390, you also need to look into the interface
described in Documentation/s390/driver-model.rst.
described in Documentation/arch/s390/driver-model.rst.

Note for porting drivers from 2.4:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,5 @@ debugfs entries

The level of logging can be changed to be more or less verbose by piping to
/sys/kernel/debug/s390dbf/cio_*/level a number between 0 and 6; see the
documentation on the S/390 debug feature (Documentation/s390/s390dbf.rst)
documentation on the S/390 debug feature (Documentation/arch/s390/s390dbf.rst)
for details.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For example:
Change the level of logging to be more or less verbose by piping
a number between 0 and 6 to /sys/kernel/debug/s390dbf/pci_*/level. For
details, see the documentation on the S/390 debug feature at
Documentation/s390/s390dbf.rst.
Documentation/arch/s390/s390dbf.rst.

Sysfs entries
=============
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,6 @@ Reference
1. ESA/s390 Principles of Operation manual (IBM Form. No. SA22-7832)
2. ESA/390 Common I/O Device Commands manual (IBM Form. No. SA22-7204)
3. https://en.wikipedia.org/wiki/Channel_I/O
4. Documentation/s390/cds.rst
4. Documentation/arch/s390/cds.rst
5. Documentation/driver-api/vfio.rst
6. Documentation/driver-api/vfio-mediated-device.rst
File renamed without changes.
4 changes: 2 additions & 2 deletions Documentation/driver-api/s390-drivers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ not strictly considered I/O devices. They are considered here as well,
although they are not the focus of this document.

Some additional information can also be found in the kernel source under
Documentation/s390/driver-model.rst.
Documentation/arch/s390/driver-model.rst.

The css bus
===========
Expand All @@ -38,7 +38,7 @@ into several categories:
* Standard I/O subchannels, for use by the system. They have a child
device on the ccw bus and are described below.
* I/O subchannels bound to the vfio-ccw driver. See
Documentation/s390/vfio-ccw.rst.
Documentation/arch/s390/vfio-ccw.rst.
* Message subchannels. No Linux driver currently exists.
* CHSC subchannels (at most one). The chsc subchannel driver can be used
to send asynchronous chsc commands.
Expand Down
8 changes: 4 additions & 4 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -18605,7 +18605,7 @@ L: [email protected]
S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git
F: Documentation/driver-api/s390-drivers.rst
F: Documentation/s390/
F: Documentation/arch/s390/
F: arch/s390/
F: drivers/s390/
F: drivers/watchdog/diag288_wdt.c
Expand Down Expand Up @@ -18666,7 +18666,7 @@ M: Niklas Schnelle <[email protected]>
M: Gerald Schaefer <[email protected]>
L: [email protected]
S: Supported
F: Documentation/s390/pci.rst
F: Documentation/arch/s390/pci.rst
F: arch/s390/pci/
F: drivers/pci/hotplug/s390_pci_hpc.c

Expand All @@ -18683,7 +18683,7 @@ M: Halil Pasic <[email protected]>
M: Jason Herne <[email protected]>
L: [email protected]
S: Supported
F: Documentation/s390/vfio-ap*
F: Documentation/arch/s390/vfio-ap*
F: drivers/s390/crypto/vfio_ap*

S390 VFIO-CCW DRIVER
Expand All @@ -18693,7 +18693,7 @@ R: Halil Pasic <[email protected]>
L: [email protected]
L: [email protected]
S: Supported
F: Documentation/s390/vfio-ccw.rst
F: Documentation/arch/s390/vfio-ccw.rst
F: drivers/s390/cio/vfio_ccw*
F: include/uapi/linux/vfio_ccw.h

Expand Down
2 changes: 1 addition & 1 deletion arch/s390/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ obj-y += kernel/
obj-y += mm/
obj-$(CONFIG_KVM) += kvm/
obj-y += crypto/
obj-$(CONFIG_S390_HYPFS_FS) += hypfs/
obj-$(CONFIG_S390_HYPFS) += hypfs/
obj-$(CONFIG_APPLDATA_BASE) += appldata/
obj-y += net/
obj-$(CONFIG_PCI) += pci/
Expand Down
31 changes: 27 additions & 4 deletions arch/s390/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ config S390
select HAVE_FTRACE_MCOUNT_RECORD
select HAVE_FUNCTION_ARG_ACCESS_API
select HAVE_FUNCTION_ERROR_INJECTION
select HAVE_FUNCTION_GRAPH_RETVAL
select HAVE_FUNCTION_GRAPH_TRACER
select HAVE_FUNCTION_TRACER
select HAVE_GCC_PLUGINS
Expand Down Expand Up @@ -512,6 +513,17 @@ config KEXEC_SIG
verification for the corresponding kernel image type being
loaded in order for this to work.

config CERT_STORE
bool "Get user certificates via DIAG320"
depends on KEYS
select CRYPTO_LIB_SHA256
help
Enable this option if you want to access user-provided secure boot
certificates via DIAG 0x320.

These certificates will be made available via the keyring named
'cert_store'.

config KERNEL_NOBP
def_bool n
prompt "Enable modified branch prediction for the kernel by default"
Expand Down Expand Up @@ -743,9 +755,9 @@ config CRASH_DUMP
Crash dump kernels are loaded in the main kernel with kexec-tools
into a specially reserved region and then later executed after
a crash by kdump/kexec.
Refer to <file:Documentation/s390/zfcpdump.rst> for more details on this.
Refer to <file:Documentation/arch/s390/zfcpdump.rst> for more details on this.
This option also enables s390 zfcpdump.
See also <file:Documentation/s390/zfcpdump.rst>
See also <file:Documentation/arch/s390/zfcpdump.rst>

endmenu

Expand Down Expand Up @@ -867,13 +879,24 @@ config APPLDATA_NET_SUM
This can also be compiled as a module, which will be called
appldata_net_sum.o.

config S390_HYPFS_FS
config S390_HYPFS
def_bool y
prompt "s390 hypervisor information"
help
This provides several binary files at (debugfs)/s390_hypfs/ to
provide accounting information in an s390 hypervisor environment.

config S390_HYPFS_FS
def_bool n
prompt "s390 hypervisor file system support"
select SYS_HYPERVISOR
depends on S390_HYPFS
help
This is a virtual file system intended to provide accounting
information in an s390 hypervisor environment.
information in an s390 hypervisor environment. This file system
is deprecated and should not be used.

Say N if you are unsure.

source "arch/s390/kvm/Kconfig"

Expand Down
1 change: 0 additions & 1 deletion arch/s390/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export KBUILD_CFLAGS_DECOMPRESSOR
OBJCOPYFLAGS := -O binary

libs-y += arch/s390/lib/
drivers-y += drivers/s390/

boot := arch/s390/boot
syscalls := arch/s390/kernel/syscalls
Expand Down
22 changes: 13 additions & 9 deletions arch/s390/boot/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct page *__bootdata_preserved(vmemmap);
unsigned long __bootdata_preserved(vmemmap_size);
unsigned long __bootdata_preserved(MODULES_VADDR);
unsigned long __bootdata_preserved(MODULES_END);
unsigned long __bootdata_preserved(max_mappable);
unsigned long __bootdata(ident_map_size);

u64 __bootdata_preserved(stfle_fac_list[16]);
Expand Down Expand Up @@ -176,26 +177,27 @@ static unsigned long setup_kernel_memory_layout(void)
unsigned long asce_limit;
unsigned long rte_size;
unsigned long pages;
unsigned long vsize;
unsigned long vmax;

pages = ident_map_size / PAGE_SIZE;
/* vmemmap contains a multiple of PAGES_PER_SECTION struct pages */
vmemmap_size = SECTION_ALIGN_UP(pages) * sizeof(struct page);

/* choose kernel address space layout: 4 or 3 levels. */
vmemmap_start = round_up(ident_map_size, _REGION3_SIZE);
if (IS_ENABLED(CONFIG_KASAN) ||
vmalloc_size > _REGION2_SIZE ||
vmemmap_start + vmemmap_size + vmalloc_size + MODULES_LEN >
_REGION2_SIZE) {
vsize = round_up(ident_map_size, _REGION3_SIZE) + vmemmap_size +
MODULES_LEN + MEMCPY_REAL_SIZE + ABS_LOWCORE_MAP_SIZE;
vsize = size_add(vsize, vmalloc_size);
if (IS_ENABLED(CONFIG_KASAN) || (vsize > _REGION2_SIZE)) {
asce_limit = _REGION1_SIZE;
rte_size = _REGION2_SIZE;
} else {
asce_limit = _REGION2_SIZE;
rte_size = _REGION3_SIZE;
}

/*
* forcing modules and vmalloc area under the ultravisor
* Forcing modules and vmalloc area under the ultravisor
* secure storage limit, so that any vmalloc allocation
* we do could be used to back secure guest storage.
*/
Expand All @@ -204,7 +206,7 @@ static unsigned long setup_kernel_memory_layout(void)
/* force vmalloc and modules below kasan shadow */
vmax = min(vmax, KASAN_SHADOW_START);
#endif
__memcpy_real_area = round_down(vmax - PAGE_SIZE, PAGE_SIZE);
__memcpy_real_area = round_down(vmax - MEMCPY_REAL_SIZE, PAGE_SIZE);
__abs_lowcore = round_down(__memcpy_real_area - ABS_LOWCORE_MAP_SIZE,
sizeof(struct lowcore));
MODULES_END = round_down(__abs_lowcore, _SEGMENT_SIZE);
Expand All @@ -220,8 +222,9 @@ static unsigned long setup_kernel_memory_layout(void)
pages = SECTION_ALIGN_UP(pages);
/* keep vmemmap_start aligned to a top level region table entry */
vmemmap_start = round_down(VMALLOC_START - pages * sizeof(struct page), rte_size);
/* vmemmap_start is the future VMEM_MAX_PHYS, make sure it is within MAX_PHYSMEM */
vmemmap_start = min(vmemmap_start, 1UL << MAX_PHYSMEM_BITS);
/* maximum mappable address as seen by arch_get_mappable_range() */
max_mappable = vmemmap_start;
/* make sure identity map doesn't overlay with vmemmap */
ident_map_size = min(ident_map_size, vmemmap_start);
vmemmap_size = SECTION_ALIGN_UP(ident_map_size / PAGE_SIZE) * sizeof(struct page);
Expand Down Expand Up @@ -286,8 +289,9 @@ void startup_kernel(void)

setup_lpp();
safe_addr = mem_safe_offset();

/*
* reserve decompressor memory together with decompression heap, buffer and
* Reserve decompressor memory together with decompression heap, buffer and
* memory which might be occupied by uncompressed kernel at default 1Mb
* position (if KASLR is off or failed).
*/
Expand Down
1 change: 1 addition & 0 deletions arch/s390/configs/debug_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ CONFIG_RCU_CPU_STALL_TIMEOUT=300
# CONFIG_RCU_TRACE is not set
CONFIG_LATENCYTOP=y
CONFIG_BOOTTIME_TRACING=y
CONFIG_FUNCTION_GRAPH_RETVAL=y
CONFIG_FPROBE=y
CONFIG_FUNCTION_PROFILER=y
CONFIG_STACK_TRACER=y
Expand Down
1 change: 1 addition & 0 deletions arch/s390/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ CONFIG_RCU_REF_SCALE_TEST=m
CONFIG_RCU_CPU_STALL_TIMEOUT=60
CONFIG_LATENCYTOP=y
CONFIG_BOOTTIME_TRACING=y
CONFIG_FUNCTION_GRAPH_RETVAL=y
CONFIG_FPROBE=y
CONFIG_FUNCTION_PROFILER=y
CONFIG_STACK_TRACER=y
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/crypto/paes_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* and padding is also possible, the limits need to be generous.
*/
#define PAES_MIN_KEYSIZE 16
#define PAES_MAX_KEYSIZE 320
#define PAES_MAX_KEYSIZE MAXEP11AESKEYBLOBSIZE

static u8 *ctrblk;
static DEFINE_MUTEX(ctrblk_lock);
Expand Down
11 changes: 8 additions & 3 deletions arch/s390/hypfs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# Makefile for the linux hypfs filesystem routines.
#

obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o
obj-$(CONFIG_S390_HYPFS) += hypfs_dbfs.o
obj-$(CONFIG_S390_HYPFS) += hypfs_diag.o
obj-$(CONFIG_S390_HYPFS) += hypfs_diag0c.o
obj-$(CONFIG_S390_HYPFS) += hypfs_sprp.o
obj-$(CONFIG_S390_HYPFS) += hypfs_vm.o

s390_hypfs-objs := inode.o hypfs_diag.o hypfs_vm.o hypfs_dbfs.o hypfs_sprp.o
s390_hypfs-objs += hypfs_diag0c.o
obj-$(CONFIG_S390_HYPFS_FS) += hypfs_diag_fs.o
obj-$(CONFIG_S390_HYPFS_FS) += hypfs_vm_fs.o
obj-$(CONFIG_S390_HYPFS_FS) += inode.o
10 changes: 9 additions & 1 deletion arch/s390/hypfs/hypfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ void hypfs_diag0c_exit(void);
void hypfs_sprp_init(void);
void hypfs_sprp_exit(void);

int __hypfs_fs_init(void);

static inline int hypfs_fs_init(void)
{
if (IS_ENABLED(CONFIG_S390_HYPFS_FS))
return __hypfs_fs_init();
return 0;
}

/* debugfs interface */
struct hypfs_dbfs_file;

Expand All @@ -69,7 +78,6 @@ struct hypfs_dbfs_file {
struct dentry *dentry;
};

extern void hypfs_dbfs_init(void);
extern void hypfs_dbfs_exit(void);
extern void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df);
extern void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df);
Expand Down
31 changes: 26 additions & 5 deletions arch/s390/hypfs/hypfs_dbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,33 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df)
debugfs_remove(df->dentry);
}

void hypfs_dbfs_init(void)
static int __init hypfs_dbfs_init(void)
{
dbfs_dir = debugfs_create_dir("s390_hypfs", NULL);
}
int rc = -ENODATA;

void hypfs_dbfs_exit(void)
{
dbfs_dir = debugfs_create_dir("s390_hypfs", NULL);
if (hypfs_diag_init())
goto fail_dbfs_exit;
if (hypfs_vm_init())
goto fail_hypfs_diag_exit;
hypfs_sprp_init();
if (hypfs_diag0c_init())
goto fail_hypfs_sprp_exit;
rc = hypfs_fs_init();
if (rc)
goto fail_hypfs_diag0c_exit;
return 0;

fail_hypfs_diag0c_exit:
hypfs_diag0c_exit();
fail_hypfs_sprp_exit:
hypfs_sprp_exit();
hypfs_vm_exit();
fail_hypfs_diag_exit:
hypfs_diag_exit();
pr_err("Initialization of hypfs failed with rc=%i\n", rc);
fail_dbfs_exit:
debugfs_remove(dbfs_dir);
return rc;
}
device_initcall(hypfs_dbfs_init)
Loading

0 comments on commit e5b7ca0

Please sign in to comment.