Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dff839f2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull s390 updates from Heiko Carstens:
 "The main thing in this merge is the defense for the Spectre
  vulnerabilities. But there are other updates as well, the changes in
  more detail:

   - An s390 specific implementation of the array_index_mask_nospec
     function to the defense against spectre v1

   - Two patches to utilize the new PPA-12/PPA-13 instructions to run
     the kernel and/or user space with reduced branch predicton.

   - The s390 variant of the 'retpoline' spectre v2 defense called
     'expoline'. There is no return instruction for s390, instead an
     indirect branch is used for function return

     The s390 defense mechanism for indirect branches works by using an
     execute-type instruction with the indirect branch as the target of
     the execute. In effect that turns off the prediction for the
     indirect branch.

   - Scrub registers in entry.S that contain user controlled values to
     prevent the speculative use of these values.

   - Re-add the second parameter for the s390 specific runtime
     instrumentation system call and move the header file to uapi. The
     second parameter will continue to do nothing but older kernel
     versions only accepted valid real-time signal numbers. The details
     will be documented in the man-page for the system call.

   - Corrections and improvements for the s390 specific documentation

   - Add a line to /proc/sysinfo to display the CPU model dependent
     license-internal-code identifier

   - A header file include fix for eadm.

   - An error message fix in the kprobes code.

   - The removal of an outdated ARCH_xxx select statement"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/kconfig: Remove ARCH_WANTS_PROT_NUMA_PROT_NONE select
  s390: introduce execute-trampolines for branches
  s390: run user space and KVM guests with modified branch prediction
  s390: add options to change branch prediction behaviour for the kernel
  s390/alternative: use a copy of the facility bit mask
  s390: add optimized array_index_mask_nospec
  s390: scrub registers on kernel entry and KVM exit
  s390/cio: fix kernel-doc usage
  s390/runtime_instrumentation: re-add signum system call parameter
  s390/cpum_cf: correct counter number of LAST_HOST_TRANSLATIONS
  s390/kprobes: Fix %p uses in error messages
  s390/runtime instrumentation: provide uapi header file
  s390/sysinfo: add and display licensed internal code identifier
  s390/docs: reword airq section
  s390/docs: mention subchannel types
  s390/cmf: fix kerneldoc
  s390/eadm: fix CONFIG_BLOCK include dependency
parents 54ce685c 48973df8
Loading
Loading
Loading
Loading
+28 −4
Original line number Original line Diff line number Diff line
@@ -22,9 +22,28 @@ While most I/O devices on a s390 system are typically driven through the
channel I/O mechanism described here, there are various other methods
channel I/O mechanism described here, there are various other methods
(like the diag interface). These are out of the scope of this document.
(like the diag interface). These are out of the scope of this document.


The s390 common I/O layer also provides access to some devices that are
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
Some additional information can also be found in the kernel source under
Documentation/s390/driver-model.txt.
Documentation/s390/driver-model.txt.


The css bus
===========

The css bus contains the subchannels available on the system. They fall
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.txt.
* Message subchannels. No Linux driver currently exists.
* CHSC subchannels (at most one). The chsc subchannel driver can be used
  to send asynchronous chsc commands.
* eADM subchannels. Used for talking to storage class memory.

The ccw bus
The ccw bus
===========
===========


@@ -102,10 +121,15 @@ ccw group devices
Generic interfaces
Generic interfaces
==================
==================


Some interfaces are available to other drivers that do not necessarily
The following section contains interfaces in use not only by drivers
have anything to do with the busses described above, but still are
dealing with ccw devices, but drivers for various other s390 hardware
indirectly using basic infrastructure in the common I/O layer. One
as well.
example is the support for adapter interrupts.

Adapter interrupts
------------------

The common I/O layer provides helper functions for dealing with adapter
interrupts and interrupt vectors.


.. kernel-doc:: drivers/s390/cio/airq.c
.. kernel-doc:: drivers/s390/cio/airq.c
   :export:
   :export:
+45 −1
Original line number Original line Diff line number Diff line
@@ -112,7 +112,6 @@ config S390
	select ARCH_USE_BUILTIN_BSWAP
	select ARCH_USE_BUILTIN_BSWAP
	select ARCH_USE_CMPXCHG_LOCKREF
	select ARCH_USE_CMPXCHG_LOCKREF
	select ARCH_WANTS_DYNAMIC_TASK_STRUCT
	select ARCH_WANTS_DYNAMIC_TASK_STRUCT
	select ARCH_WANTS_PROT_NUMA_PROT_NONE
	select ARCH_WANTS_UBSAN_NO_NULL
	select ARCH_WANTS_UBSAN_NO_NULL
	select ARCH_WANT_IPC_PARSE_VERSION
	select ARCH_WANT_IPC_PARSE_VERSION
	select BUILDTIME_EXTABLE_SORT
	select BUILDTIME_EXTABLE_SORT
@@ -540,6 +539,51 @@ config ARCH_RANDOM


	  If unsure, say Y.
	  If unsure, say Y.


config KERNEL_NOBP
	def_bool n
	prompt "Enable modified branch prediction for the kernel by default"
	help
	  If this option is selected the kernel will switch to a modified
	  branch prediction mode if the firmware interface is available.
	  The modified branch prediction mode improves the behaviour in
	  regard to speculative execution.

	  With the option enabled the kernel parameter "nobp=0" or "nospec"
	  can be used to run the kernel in the normal branch prediction mode.

	  With the option disabled the modified branch prediction mode is
	  enabled with the "nobp=1" kernel parameter.

	  If unsure, say N.

config EXPOLINE
	def_bool n
	prompt "Avoid speculative indirect branches in the kernel"
	help
	  Compile the kernel with the expoline compiler options to guard
	  against kernel-to-user data leaks by avoiding speculative indirect
	  branches.
	  Requires a compiler with -mindirect-branch=thunk support for full
	  protection. The kernel may run slower.

	  If unsure, say N.

choice
	prompt "Expoline default"
	depends on EXPOLINE
	default EXPOLINE_FULL

config EXPOLINE_OFF
	bool "spectre_v2=off"

config EXPOLINE_MEDIUM
	bool "spectre_v2=auto"

config EXPOLINE_FULL
	bool "spectre_v2=on"

endchoice

endmenu
endmenu


menu "Memory setup"
menu "Memory setup"
+10 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,16 @@ ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y)
cflags-$(CONFIG_WARN_DYNAMIC_STACK) += -mwarn-dynamicstack
cflags-$(CONFIG_WARN_DYNAMIC_STACK) += -mwarn-dynamicstack
endif
endif


ifdef CONFIG_EXPOLINE
  ifeq ($(call cc-option-yn,$(CC_FLAGS_MARCH) -mindirect-branch=thunk),y)
    CC_FLAGS_EXPOLINE := -mindirect-branch=thunk
    CC_FLAGS_EXPOLINE += -mfunction-return=thunk
    CC_FLAGS_EXPOLINE += -mindirect-branch-table
    export CC_FLAGS_EXPOLINE
    cflags-y += $(CC_FLAGS_EXPOLINE)
  endif
endif

ifdef CONFIG_FUNCTION_TRACER
ifdef CONFIG_FUNCTION_TRACER
# make use of hotpatch feature if the compiler supports it
# make use of hotpatch feature if the compiler supports it
cc_hotpatch	:= -mhotpatch=0,3
cc_hotpatch	:= -mhotpatch=0,3
+24 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,30 @@ do { \
#define __smp_mb__before_atomic()	barrier()
#define __smp_mb__before_atomic()	barrier()
#define __smp_mb__after_atomic()	barrier()
#define __smp_mb__after_atomic()	barrier()


/**
 * array_index_mask_nospec - generate a mask for array_idx() that is
 * ~0UL when the bounds check succeeds and 0 otherwise
 * @index: array element index
 * @size: number of elements in array
 */
#define array_index_mask_nospec array_index_mask_nospec
static inline unsigned long array_index_mask_nospec(unsigned long index,
						    unsigned long size)
{
	unsigned long mask;

	if (__builtin_constant_p(size) && size > 0) {
		asm("	clgr	%2,%1\n"
		    "	slbgr	%0,%0\n"
		    :"=d" (mask) : "d" (size-1), "d" (index) :"cc");
		return mask;
	}
	asm("	clgr	%1,%2\n"
	    "	slbgr	%0,%0\n"
	    :"=d" (mask) : "d" (size), "d" (index) :"cc");
	return ~mask;
}

#include <asm-generic/barrier.h>
#include <asm-generic/barrier.h>


#endif /* __ASM_BARRIER_H */
#endif /* __ASM_BARRIER_H */
+1 −1
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@


#include <linux/types.h>
#include <linux/types.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/blkdev.h>
#include <linux/blk_types.h>


struct arqb {
struct arqb {
	u64 data;
	u64 data;
Loading