Commit e392ea4d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull s390 updates from Vasily Gorbik:

 - Get rid of private VM_FAULT flags

 - Add word-at-a-time implementation

 - Add DCACHE_WORD_ACCESS support

 - Cleanup control register handling

 - Disallow CPU hotplug of CPU 0 to simplify its handling complexity,
   following a similar restriction in x86

 - Optimize pai crypto map allocation

 - Update the list of crypto express EP11 coprocessor operation modes

 - Fixes and improvements for secure guests AP pass-through

 - Several fixes to address incorrect page marking for address
   translation with the "cmma no-dat" feature, preventing potential
   incorrect guest TLB flushes

 - Fix early IPI handling

 - Several virtual vs physical address confusion fixes

 - Various small fixes and improvements all over the code

* tag 's390-6.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (74 commits)
  s390/cio: replace deprecated strncpy with strscpy
  s390/sclp: replace deprecated strncpy with strtomem
  s390/cio: fix virtual vs physical address confusion
  s390/cio: export CMG value as decimal
  s390: delete the unused store_prefix() function
  s390/cmma: fix handling of swapper_pg_dir and invalid_pg_dir
  s390/cmma: fix detection of DAT pages
  s390/sclp: handle default case in sclp memory notifier
  s390/pai_crypto: remove per-cpu variable assignement in event initialization
  s390/pai: initialize event count once at initialization
  s390/pai_crypto: use PERF_ATTACH_TASK define for per task detection
  s390/mm: add missing arch_set_page_dat() call to gmap allocations
  s390/mm: add missing arch_set_page_dat() call to vmem_crst_alloc()
  s390/cmma: fix initial kernel address space page table walk
  s390/diag: add missing virt_to_phys() translation to diag224()
  s390/mm,fault: move VM_FAULT_ERROR handling to do_exception()
  s390/mm,fault: remove VM_FAULT_BADMAP and VM_FAULT_BADACCESS
  s390/mm,fault: remove VM_FAULT_SIGNAL
  s390/mm,fault: remove VM_FAULT_BADCONTEXT
  s390/mm,fault: simplify kfence fault handling
  ...
parents 707df298 991a211a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ config S390
	select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
	select BUILDTIME_TABLE_SORT
	select CLONE_BACKWARDS2
	select DCACHE_WORD_ACCESS if !KMSAN
	select DMA_OPS if PCI
	select DYNAMIC_FTRACE if FUNCTION_TRACER
	select FUNCTION_ALIGNMENT_8B if CC_IS_GCC
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ static void detect_facilities(void)
{
	if (test_facility(8)) {
		machine.has_edat1 = 1;
		__ctl_set_bit(0, 23);
		local_ctl_set_bit(0, CR0_EDAT_BIT);
	}
	if (test_facility(78))
		machine.has_edat2 = 1;
+8 −9
Original line number Diff line number Diff line
@@ -5,13 +5,14 @@
#include <asm/pgalloc.h>
#include <asm/facility.h>
#include <asm/sections.h>
#include <asm/ctlreg.h>
#include <asm/physmem_info.h>
#include <asm/maccess.h>
#include <asm/abs_lowcore.h>
#include "decompressor.h"
#include "boot.h"

unsigned long __bootdata_preserved(s390_invalid_asce);
struct ctlreg __bootdata_preserved(s390_invalid_asce);

#ifdef CONFIG_PROC_FS
atomic_long_t __bootdata_preserved(direct_pages_count[PG_DIRECT_MAP_MAX]);
@@ -166,8 +167,6 @@ static bool kasan_pmd_populate_zero_shadow(pmd_t *pmd, unsigned long addr,

static bool kasan_pte_populate_zero_shadow(pte_t *pte, enum populate_mode mode)
{
	pte_t entry;

	if (mode == POPULATE_KASAN_ZERO_SHADOW) {
		set_pte(pte, pte_z);
		return true;
@@ -426,7 +425,7 @@ void setup_vmem(unsigned long asce_limit)
		asce_type = _REGION3_ENTRY_EMPTY;
		asce_bits = _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH;
	}
	s390_invalid_asce = invalid_pg_dir | _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH;
	s390_invalid_asce.val = invalid_pg_dir | _ASCE_TYPE_REGION3 | _ASCE_TABLE_LENGTH;

	crst_table_init((unsigned long *)swapper_pg_dir, asce_type);
	crst_table_init((unsigned long *)invalid_pg_dir, _REGION3_ENTRY_EMPTY);
@@ -447,12 +446,12 @@ void setup_vmem(unsigned long asce_limit)

	kasan_populate_shadow();

	S390_lowcore.kernel_asce = swapper_pg_dir | asce_bits;
	S390_lowcore.kernel_asce.val = swapper_pg_dir | asce_bits;
	S390_lowcore.user_asce = s390_invalid_asce;

	__ctl_load(S390_lowcore.kernel_asce, 1, 1);
	__ctl_load(S390_lowcore.user_asce, 7, 7);
	__ctl_load(S390_lowcore.kernel_asce, 13, 13);
	local_ctl_load(1, &S390_lowcore.kernel_asce);
	local_ctl_load(7, &S390_lowcore.user_asce);
	local_ctl_load(13, &S390_lowcore.kernel_asce);

	init_mm.context.asce = S390_lowcore.kernel_asce;
	init_mm.context.asce = S390_lowcore.kernel_asce.val;
}
+11 −16
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#define EX_TYPE_UA_LOAD_MEM	4
#define EX_TYPE_UA_LOAD_REG	5
#define EX_TYPE_UA_LOAD_REGPAIR	6
#define EX_TYPE_ZEROPAD		7

#define EX_DATA_REG_ERR_SHIFT	0
#define EX_DATA_REG_ERR		GENMASK(3, 0)
@@ -23,16 +24,7 @@
#define EX_DATA_LEN_SHIFT	8
#define EX_DATA_LEN		GENMASK(11, 8)

#define __EX_TABLE(_section, _fault, _target, _type)			\
	stringify_in_c(.section	_section,"a";)				\
	stringify_in_c(.balign	4;)					\
	stringify_in_c(.long	(_fault) - .;)				\
	stringify_in_c(.long	(_target) - .;)				\
	stringify_in_c(.short	(_type);)				\
	stringify_in_c(.short	0;)					\
	stringify_in_c(.previous)

#define __EX_TABLE_UA(_section, _fault, _target, _type, _regerr, _regaddr, _len)\
#define __EX_TABLE(_section, _fault, _target, _type, _regerr, _regaddr, _len)	\
	stringify_in_c(.section _section,"a";)					\
	stringify_in_c(.balign	4;)						\
	stringify_in_c(.long	(_fault) - .;)					\
@@ -72,21 +64,24 @@
	stringify_in_c(.previous)

#define EX_TABLE(_fault, _target)					\
	__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_FIXUP)
	__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_FIXUP, __stringify(%%r0), __stringify(%%r0), 0)

#define EX_TABLE_AMODE31(_fault, _target)				\
	__EX_TABLE(.amode31.ex_table, _fault, _target, EX_TYPE_FIXUP)
	__EX_TABLE(.amode31.ex_table, _fault, _target, EX_TYPE_FIXUP, __stringify(%%r0), __stringify(%%r0), 0)

#define EX_TABLE_UA_STORE(_fault, _target, _regerr)			\
	__EX_TABLE_UA(__ex_table, _fault, _target, EX_TYPE_UA_STORE, _regerr, _regerr, 0)
	__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_STORE, _regerr, _regerr, 0)

#define EX_TABLE_UA_LOAD_MEM(_fault, _target, _regerr, _regmem, _len)	\
	__EX_TABLE_UA(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_MEM, _regerr, _regmem, _len)
	__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_MEM, _regerr, _regmem, _len)

#define EX_TABLE_UA_LOAD_REG(_fault, _target, _regerr, _regzero)	\
	__EX_TABLE_UA(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_REG, _regerr, _regzero, 0)
	__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_REG, _regerr, _regzero, 0)

#define EX_TABLE_UA_LOAD_REGPAIR(_fault, _target, _regerr, _regzero)	\
	__EX_TABLE_UA(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_REGPAIR, _regerr, _regzero, 0)
	__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_REGPAIR, _regerr, _regzero, 0)

#define EX_TABLE_ZEROPAD(_fault, _target, _regdata, _regaddr)		\
	__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_ZEROPAD, _regdata, _regaddr, 0)

#endif /* __ASM_EXTABLE_H */

arch/s390/include/asm/ctl_reg.h

deleted100644 → 0
+0 −146
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright IBM Corp. 1999, 2009
 *
 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
 */

#ifndef __ASM_CTL_REG_H
#define __ASM_CTL_REG_H

#include <linux/bits.h>

#define CR0_CLOCK_COMPARATOR_SIGN	BIT(63 - 10)
#define CR0_LOW_ADDRESS_PROTECTION	BIT(63 - 35)
#define CR0_FETCH_PROTECTION_OVERRIDE	BIT(63 - 38)
#define CR0_STORAGE_PROTECTION_OVERRIDE	BIT(63 - 39)
#define CR0_EMERGENCY_SIGNAL_SUBMASK	BIT(63 - 49)
#define CR0_EXTERNAL_CALL_SUBMASK	BIT(63 - 50)
#define CR0_CLOCK_COMPARATOR_SUBMASK	BIT(63 - 52)
#define CR0_CPU_TIMER_SUBMASK		BIT(63 - 53)
#define CR0_SERVICE_SIGNAL_SUBMASK	BIT(63 - 54)
#define CR0_UNUSED_56			BIT(63 - 56)
#define CR0_INTERRUPT_KEY_SUBMASK	BIT(63 - 57)
#define CR0_MEASUREMENT_ALERT_SUBMASK	BIT(63 - 58)

#define CR14_UNUSED_32			BIT(63 - 32)
#define CR14_UNUSED_33			BIT(63 - 33)
#define CR14_CHANNEL_REPORT_SUBMASK	BIT(63 - 35)
#define CR14_RECOVERY_SUBMASK		BIT(63 - 36)
#define CR14_DEGRADATION_SUBMASK	BIT(63 - 37)
#define CR14_EXTERNAL_DAMAGE_SUBMASK	BIT(63 - 38)
#define CR14_WARNING_SUBMASK		BIT(63 - 39)

#ifndef __ASSEMBLY__

#include <linux/bug.h>

#define __ctl_load(array, low, high) do {				\
	typedef struct { char _[sizeof(array)]; } addrtype;		\
									\
	BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
	asm volatile(							\
		"	lctlg	%1,%2,%0\n"				\
		:							\
		: "Q" (*(addrtype *)(&array)), "i" (low), "i" (high)	\
		: "memory");						\
} while (0)

#define __ctl_store(array, low, high) do {				\
	typedef struct { char _[sizeof(array)]; } addrtype;		\
									\
	BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
	asm volatile(							\
		"	stctg	%1,%2,%0\n"				\
		: "=Q" (*(addrtype *)(&array))				\
		: "i" (low), "i" (high));				\
} while (0)

static __always_inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
{
	unsigned long reg;

	__ctl_store(reg, cr, cr);
	reg |= 1UL << bit;
	__ctl_load(reg, cr, cr);
}

static __always_inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
{
	unsigned long reg;

	__ctl_store(reg, cr, cr);
	reg &= ~(1UL << bit);
	__ctl_load(reg, cr, cr);
}

void smp_ctl_set_clear_bit(int cr, int bit, bool set);

static inline void ctl_set_bit(int cr, int bit)
{
	smp_ctl_set_clear_bit(cr, bit, true);
}

static inline void ctl_clear_bit(int cr, int bit)
{
	smp_ctl_set_clear_bit(cr, bit, false);
}

union ctlreg0 {
	unsigned long val;
	struct {
		unsigned long	   : 8;
		unsigned long tcx  : 1;	/* Transactional-Execution control */
		unsigned long pifo : 1;	/* Transactional-Execution Program-
					   Interruption-Filtering Override */
		unsigned long	   : 3;
		unsigned long ccc  : 1; /* Cryptography counter control */
		unsigned long pec  : 1; /* PAI extension control */
		unsigned long	   : 17;
		unsigned long	   : 3;
		unsigned long lap  : 1; /* Low-address-protection control */
		unsigned long	   : 4;
		unsigned long edat : 1; /* Enhanced-DAT-enablement control */
		unsigned long	   : 2;
		unsigned long iep  : 1; /* Instruction-Execution-Protection */
		unsigned long	   : 1;
		unsigned long afp  : 1; /* AFP-register control */
		unsigned long vx   : 1; /* Vector enablement control */
		unsigned long	   : 7;
		unsigned long sssm : 1; /* Service signal subclass mask */
		unsigned long	   : 9;
	};
};

union ctlreg2 {
	unsigned long val;
	struct {
		unsigned long	    : 33;
		unsigned long ducto : 25;
		unsigned long	    : 1;
		unsigned long gse   : 1;
		unsigned long	    : 1;
		unsigned long tds   : 1;
		unsigned long tdc   : 2;
	};
};

union ctlreg5 {
	unsigned long val;
	struct {
		unsigned long	    : 33;
		unsigned long pasteo: 25;
		unsigned long	    : 6;
	};
};

union ctlreg15 {
	unsigned long val;
	struct {
		unsigned long lsea  : 61;
		unsigned long	    : 3;
	};
};

#endif /* __ASSEMBLY__ */
#endif /* __ASM_CTL_REG_H */
Loading