You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Martin Schwidefsky:
- New entropy generation for the pseudo random number generator.
- Early boot printk output via sclp to help debug crashes on boot. This
needs to be enabled with a kernel parameter.
- Add proper no-execute support with a bit in the page table entry.
- Bug fixes and cleanups.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (65 commits)
s390/syscall: fix single stepped system calls
s390/zcrypt: make ap_bus explicitly non-modular
s390/zcrypt: Removed unneeded debug feature directory creation.
s390: add missing "do {} while (0)" loop constructs to multiline macros
s390/mm: add cond_resched call to kernel page table dumper
s390: get rid of MACHINE_HAS_PFMF and MACHINE_HAS_HPAGE
s390/mm: make memory_block_size_bytes available for !MEMORY_HOTPLUG
s390: replace ACCESS_ONCE with READ_ONCE
s390: Audit and remove any remaining unnecessary uses of module.h
s390: mm: Audit and remove any unnecessary uses of module.h
s390: kernel: Audit and remove any unnecessary uses of module.h
s390/kdump: Use "LINUX" ELF note name instead of "CORE"
s390: add no-execute support
s390: report new vector facilities
s390: use correct input data address for setup_randomness
s390/sclp: get rid of common response code handling
s390/sclp: don't add new lines to each printed string
s390/sclp: make early sclp code readable
s390/sclp: disable early sclp code as soon as the base sclp driver is active
s390/sclp: move early printk code to drivers
...
This commit is contained in:
@@ -970,9 +970,10 @@
|
||||
address. The serial port must already be setup
|
||||
and configured. Options are not yet supported.
|
||||
|
||||
earlyprintk= [X86,SH,BLACKFIN,ARM,M68k]
|
||||
earlyprintk= [X86,SH,BLACKFIN,ARM,M68k,S390]
|
||||
earlyprintk=vga
|
||||
earlyprintk=efi
|
||||
earlyprintk=sclp
|
||||
earlyprintk=xen
|
||||
earlyprintk=serial[,ttySn[,baudrate]]
|
||||
earlyprintk=serial[,0x...[,baudrate]]
|
||||
@@ -1007,6 +1008,8 @@
|
||||
|
||||
The xen output can only be used by Xen PV guests.
|
||||
|
||||
The sclp output can only be used on s390.
|
||||
|
||||
edac_report= [HW,EDAC] Control how to report EDAC event
|
||||
Format: {"on" | "off" | "force"}
|
||||
on: enable EDAC to report H/W event. May be overridden
|
||||
|
||||
@@ -17,4 +17,7 @@ config S390_PTDUMP
|
||||
kernel.
|
||||
If in doubt, say "N"
|
||||
|
||||
config EARLY_PRINTK
|
||||
def_bool y
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -19,7 +19,8 @@ KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
|
||||
GCOV_PROFILE := n
|
||||
UBSAN_SANITIZE := n
|
||||
|
||||
OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o sclp.o ebcdic.o als.o)
|
||||
OBJECTS := $(addprefix $(objtree)/arch/s390/kernel/, head.o ebcdic.o als.o)
|
||||
OBJECTS += $(objtree)/drivers/s390/char/sclp_early_core.o
|
||||
OBJECTS += $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o
|
||||
|
||||
LDFLAGS_vmlinux := --oformat $(LD_BFD) -e startup -T
|
||||
|
||||
@@ -66,7 +66,7 @@ static unsigned long free_mem_end_ptr;
|
||||
|
||||
static int puts(const char *s)
|
||||
{
|
||||
_sclp_print_early(s);
|
||||
sclp_early_printk(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <linux/cpufeature.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/fips.h>
|
||||
#include <crypto/xts.h>
|
||||
#include <asm/cpacf.h>
|
||||
|
||||
@@ -501,6 +502,12 @@ static int xts_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* In fips mode only 128 bit or 256 bit keys are valid */
|
||||
if (fips_enabled && key_len != 32 && key_len != 64) {
|
||||
tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Pick the correct function code based on the key length */
|
||||
fc = (key_len == 32) ? CPACF_KM_XTS_128 :
|
||||
(key_len == 64) ? CPACF_KM_XTS_256 : 0;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/cpufeature.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/fips.h>
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/des.h>
|
||||
#include <asm/cpacf.h>
|
||||
@@ -221,6 +222,8 @@ static struct crypto_alg cbc_des_alg = {
|
||||
* same as DES. Implementers MUST reject keys that exhibit this
|
||||
* property.
|
||||
*
|
||||
* In fips mode additinally check for all 3 keys are unique.
|
||||
*
|
||||
*/
|
||||
static int des3_setkey(struct crypto_tfm *tfm, const u8 *key,
|
||||
unsigned int key_len)
|
||||
@@ -234,6 +237,17 @@ static int des3_setkey(struct crypto_tfm *tfm, const u8 *key,
|
||||
tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* in fips mode, ensure k1 != k2 and k2 != k3 and k1 != k3 */
|
||||
if (fips_enabled &&
|
||||
!(crypto_memneq(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
|
||||
crypto_memneq(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
|
||||
DES_KEY_SIZE) &&
|
||||
crypto_memneq(key, &key[DES_KEY_SIZE * 2], DES_KEY_SIZE))) {
|
||||
tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
memcpy(ctx->key, key, key_len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+24
-16
@@ -110,22 +110,30 @@ static const u8 initial_parm_block[32] __initconst = {
|
||||
|
||||
/*** helper functions ***/
|
||||
|
||||
/*
|
||||
* generate_entropy:
|
||||
* This algorithm produces 64 bytes of entropy data based on 1024
|
||||
* individual stckf() invocations assuming that each stckf() value
|
||||
* contributes 0.25 bits of entropy. So the caller gets 256 bit
|
||||
* entropy per 64 byte or 4 bits entropy per byte.
|
||||
*/
|
||||
static int generate_entropy(u8 *ebuf, size_t nbytes)
|
||||
{
|
||||
int n, ret = 0;
|
||||
u8 *pg, *h, hash[32];
|
||||
u8 *pg, *h, hash[64];
|
||||
|
||||
pg = (u8 *) __get_free_page(GFP_KERNEL);
|
||||
/* allocate 2 pages */
|
||||
pg = (u8 *) __get_free_pages(GFP_KERNEL, 1);
|
||||
if (!pg) {
|
||||
prng_errorflag = PRNG_GEN_ENTROPY_FAILED;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
while (nbytes) {
|
||||
/* fill page with urandom bytes */
|
||||
get_random_bytes(pg, PAGE_SIZE);
|
||||
/* exor page with stckf values */
|
||||
for (n = 0; n < PAGE_SIZE / sizeof(u64); n++) {
|
||||
/* fill pages with urandom bytes */
|
||||
get_random_bytes(pg, 2*PAGE_SIZE);
|
||||
/* exor pages with 1024 stckf values */
|
||||
for (n = 0; n < 2 * PAGE_SIZE / sizeof(u64); n++) {
|
||||
u64 *p = ((u64 *)pg) + n;
|
||||
*p ^= get_tod_clock_fast();
|
||||
}
|
||||
@@ -134,8 +142,8 @@ static int generate_entropy(u8 *ebuf, size_t nbytes)
|
||||
h = hash;
|
||||
else
|
||||
h = ebuf;
|
||||
/* generate sha256 from this page */
|
||||
cpacf_kimd(CPACF_KIMD_SHA_256, h, pg, PAGE_SIZE);
|
||||
/* hash over the filled pages */
|
||||
cpacf_kimd(CPACF_KIMD_SHA_512, h, pg, 2*PAGE_SIZE);
|
||||
if (n < sizeof(hash))
|
||||
memcpy(ebuf, hash, n);
|
||||
ret += n;
|
||||
@@ -143,7 +151,7 @@ static int generate_entropy(u8 *ebuf, size_t nbytes)
|
||||
nbytes -= n;
|
||||
}
|
||||
|
||||
free_page((unsigned long)pg);
|
||||
free_pages((unsigned long)pg, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -334,7 +342,7 @@ static int __init prng_sha512_selftest(void)
|
||||
static int __init prng_sha512_instantiate(void)
|
||||
{
|
||||
int ret, datalen;
|
||||
u8 seed[64];
|
||||
u8 seed[64 + 32 + 16];
|
||||
|
||||
pr_debug("prng runs in SHA-512 mode "
|
||||
"with chunksize=%d and reseed_limit=%u\n",
|
||||
@@ -357,12 +365,12 @@ static int __init prng_sha512_instantiate(void)
|
||||
if (ret)
|
||||
goto outfree;
|
||||
|
||||
/* generate initial seed bytestring, first 48 bytes of entropy */
|
||||
ret = generate_entropy(seed, 48);
|
||||
if (ret != 48)
|
||||
/* generate initial seed bytestring, with 256 + 128 bits entropy */
|
||||
ret = generate_entropy(seed, 64 + 32);
|
||||
if (ret != 64 + 32)
|
||||
goto outfree;
|
||||
/* followed by 16 bytes of unique nonce */
|
||||
get_tod_clock_ext(seed + 48);
|
||||
get_tod_clock_ext(seed + 64 + 32);
|
||||
|
||||
/* initial seed of the ppno drng */
|
||||
cpacf_ppno(CPACF_PPNO_SHA512_DRNG_SEED,
|
||||
@@ -395,9 +403,9 @@ static void prng_sha512_deinstantiate(void)
|
||||
static int prng_sha512_reseed(void)
|
||||
{
|
||||
int ret;
|
||||
u8 seed[32];
|
||||
u8 seed[64];
|
||||
|
||||
/* generate 32 bytes of fresh entropy */
|
||||
/* fetch 256 bits of fresh entropy */
|
||||
ret = generate_entropy(seed, sizeof(seed));
|
||||
if (ret != sizeof(seed))
|
||||
return ret;
|
||||
|
||||
@@ -4,9 +4,31 @@
|
||||
/* Caches aren't brain-dead on the s390. */
|
||||
#include <asm-generic/cacheflush.h>
|
||||
|
||||
int set_memory_ro(unsigned long addr, int numpages);
|
||||
int set_memory_rw(unsigned long addr, int numpages);
|
||||
int set_memory_nx(unsigned long addr, int numpages);
|
||||
int set_memory_x(unsigned long addr, int numpages);
|
||||
#define SET_MEMORY_RO 1UL
|
||||
#define SET_MEMORY_RW 2UL
|
||||
#define SET_MEMORY_NX 4UL
|
||||
#define SET_MEMORY_X 8UL
|
||||
|
||||
int __set_memory(unsigned long addr, int numpages, unsigned long flags);
|
||||
|
||||
static inline int set_memory_ro(unsigned long addr, int numpages)
|
||||
{
|
||||
return __set_memory(addr, numpages, SET_MEMORY_RO);
|
||||
}
|
||||
|
||||
static inline int set_memory_rw(unsigned long addr, int numpages)
|
||||
{
|
||||
return __set_memory(addr, numpages, SET_MEMORY_RW);
|
||||
}
|
||||
|
||||
static inline int set_memory_nx(unsigned long addr, int numpages)
|
||||
{
|
||||
return __set_memory(addr, numpages, SET_MEMORY_NX);
|
||||
}
|
||||
|
||||
static inline int set_memory_x(unsigned long addr, int numpages)
|
||||
{
|
||||
return __set_memory(addr, numpages, SET_MEMORY_X);
|
||||
}
|
||||
|
||||
#endif /* _S390_CACHEFLUSH_H */
|
||||
|
||||
@@ -199,14 +199,15 @@ static inline int ecctr(u64 ctr, u64 *val)
|
||||
/* Store CPU counter multiple for the MT utilization counter set */
|
||||
static inline int stcctm5(u64 num, u64 *val)
|
||||
{
|
||||
typedef struct { u64 _[num]; } addrtype;
|
||||
int cc;
|
||||
|
||||
asm volatile (
|
||||
" .insn rsy,0xeb0000000017,%2,5,%1\n"
|
||||
" ipm %0\n"
|
||||
" srl %0,28\n"
|
||||
: "=d" (cc), "=Q" (*(addrtype *) val) : "d" (num) : "cc");
|
||||
: "=d" (cc)
|
||||
: "Q" (*val), "d" (num)
|
||||
: "cc", "memory");
|
||||
return cc;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <linux/bug.h>
|
||||
|
||||
#define __ctl_load(array, low, high) { \
|
||||
#define __ctl_load(array, low, high) do { \
|
||||
typedef struct { char _[sizeof(array)]; } addrtype; \
|
||||
\
|
||||
BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
|
||||
@@ -18,9 +18,9 @@
|
||||
: \
|
||||
: "Q" (*(addrtype *)(&array)), "i" (low), "i" (high) \
|
||||
: "memory"); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define __ctl_store(array, low, high) { \
|
||||
#define __ctl_store(array, low, high) do { \
|
||||
typedef struct { char _[sizeof(array)]; } addrtype; \
|
||||
\
|
||||
BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
|
||||
@@ -28,7 +28,7 @@
|
||||
" stctg %1,%2,%0\n" \
|
||||
: "=Q" (*(addrtype *)(&array)) \
|
||||
: "i" (low), "i" (high)); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
|
||||
{
|
||||
@@ -62,7 +62,9 @@ union ctlreg0 {
|
||||
unsigned long : 4;
|
||||
unsigned long afp : 1; /* AFP-register control */
|
||||
unsigned long vx : 1; /* Vector enablement control */
|
||||
unsigned long : 17;
|
||||
unsigned long : 7;
|
||||
unsigned long sssm : 1; /* Service signal subclass mask */
|
||||
unsigned long : 9;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -103,6 +103,8 @@
|
||||
#define HWCAP_S390_HIGH_GPRS 512
|
||||
#define HWCAP_S390_TE 1024
|
||||
#define HWCAP_S390_VXRS 2048
|
||||
#define HWCAP_S390_VXRS_BCD 4096
|
||||
#define HWCAP_S390_VXRS_EXT 8192
|
||||
|
||||
/* Internal bits, not exposed via elf */
|
||||
#define HWCAP_INT_SIE 1UL
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
#define is_hugepage_only_range(mm, addr, len) 0
|
||||
#define hugetlb_free_pgd_range free_pgd_range
|
||||
#define hugepages_supported() (MACHINE_HAS_HPAGE)
|
||||
#define hugepages_supported() (MACHINE_HAS_EDAT1)
|
||||
|
||||
void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
|
||||
pte_t *ptep, pte_t pte);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#ifndef ASM_LIVEPATCH_H
|
||||
#define ASM_LIVEPATCH_H
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
static inline int klp_check_compiler_support(void)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ struct clp_rsp_query_pci {
|
||||
u32 fid; /* pci function id */
|
||||
u8 bar_size[PCI_BAR_COUNT];
|
||||
u16 pchid;
|
||||
u32 bar[PCI_BAR_COUNT];
|
||||
__le32 bar[PCI_BAR_COUNT];
|
||||
u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */
|
||||
u32 : 16;
|
||||
u8 fmb_len;
|
||||
|
||||
@@ -200,6 +200,7 @@ static inline int is_module_addr(void *addr)
|
||||
*/
|
||||
|
||||
/* Hardware bits in the page table entry */
|
||||
#define _PAGE_NOEXEC 0x100 /* HW no-execute bit */
|
||||
#define _PAGE_PROTECT 0x200 /* HW read-only bit */
|
||||
#define _PAGE_INVALID 0x400 /* HW invalid bit */
|
||||
#define _PAGE_LARGE 0x800 /* Bit to mark a large pte */
|
||||
@@ -277,6 +278,7 @@ static inline int is_module_addr(void *addr)
|
||||
/* Bits in the region table entry */
|
||||
#define _REGION_ENTRY_ORIGIN ~0xfffUL/* region/segment table origin */
|
||||
#define _REGION_ENTRY_PROTECT 0x200 /* region protection bit */
|
||||
#define _REGION_ENTRY_NOEXEC 0x100 /* region no-execute bit */
|
||||
#define _REGION_ENTRY_OFFSET 0xc0 /* region table offset */
|
||||
#define _REGION_ENTRY_INVALID 0x20 /* invalid region table entry */
|
||||
#define _REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mask */
|
||||
@@ -316,6 +318,7 @@ static inline int is_module_addr(void *addr)
|
||||
#define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address */
|
||||
#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
|
||||
#define _SEGMENT_ENTRY_PROTECT 0x200 /* page protection bit */
|
||||
#define _SEGMENT_ENTRY_NOEXEC 0x100 /* region no-execute bit */
|
||||
#define _SEGMENT_ENTRY_INVALID 0x20 /* invalid segment table entry */
|
||||
|
||||
#define _SEGMENT_ENTRY (0)
|
||||
@@ -385,17 +388,23 @@ static inline int is_module_addr(void *addr)
|
||||
* Page protection definitions.
|
||||
*/
|
||||
#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_INVALID | _PAGE_PROTECT)
|
||||
#define PAGE_READ __pgprot(_PAGE_PRESENT | _PAGE_READ | \
|
||||
#define PAGE_RO __pgprot(_PAGE_PRESENT | _PAGE_READ | \
|
||||
_PAGE_NOEXEC | _PAGE_INVALID | _PAGE_PROTECT)
|
||||
#define PAGE_RX __pgprot(_PAGE_PRESENT | _PAGE_READ | \
|
||||
_PAGE_INVALID | _PAGE_PROTECT)
|
||||
#define PAGE_WRITE __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
|
||||
#define PAGE_RW __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
|
||||
_PAGE_NOEXEC | _PAGE_INVALID | _PAGE_PROTECT)
|
||||
#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
|
||||
_PAGE_INVALID | _PAGE_PROTECT)
|
||||
|
||||
#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
|
||||
_PAGE_YOUNG | _PAGE_DIRTY)
|
||||
_PAGE_YOUNG | _PAGE_DIRTY | _PAGE_NOEXEC)
|
||||
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
|
||||
_PAGE_YOUNG | _PAGE_DIRTY)
|
||||
_PAGE_YOUNG | _PAGE_DIRTY | _PAGE_NOEXEC)
|
||||
#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_YOUNG | \
|
||||
_PAGE_PROTECT)
|
||||
_PAGE_PROTECT | _PAGE_NOEXEC)
|
||||
#define PAGE_KERNEL_EXEC __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
|
||||
_PAGE_YOUNG | _PAGE_DIRTY)
|
||||
|
||||
/*
|
||||
* On s390 the page table entry has an invalid bit and a read-only bit.
|
||||
@@ -404,43 +413,51 @@ static inline int is_module_addr(void *addr)
|
||||
*/
|
||||
/*xwr*/
|
||||
#define __P000 PAGE_NONE
|
||||
#define __P001 PAGE_READ
|
||||
#define __P010 PAGE_READ
|
||||
#define __P011 PAGE_READ
|
||||
#define __P100 PAGE_READ
|
||||
#define __P101 PAGE_READ
|
||||
#define __P110 PAGE_READ
|
||||
#define __P111 PAGE_READ
|
||||
#define __P001 PAGE_RO
|
||||
#define __P010 PAGE_RO
|
||||
#define __P011 PAGE_RO
|
||||
#define __P100 PAGE_RX
|
||||
#define __P101 PAGE_RX
|
||||
#define __P110 PAGE_RX
|
||||
#define __P111 PAGE_RX
|
||||
|
||||
#define __S000 PAGE_NONE
|
||||
#define __S001 PAGE_READ
|
||||
#define __S010 PAGE_WRITE
|
||||
#define __S011 PAGE_WRITE
|
||||
#define __S100 PAGE_READ
|
||||
#define __S101 PAGE_READ
|
||||
#define __S110 PAGE_WRITE
|
||||
#define __S111 PAGE_WRITE
|
||||
#define __S001 PAGE_RO
|
||||
#define __S010 PAGE_RW
|
||||
#define __S011 PAGE_RW
|
||||
#define __S100 PAGE_RX
|
||||
#define __S101 PAGE_RX
|
||||
#define __S110 PAGE_RWX
|
||||
#define __S111 PAGE_RWX
|
||||
|
||||
/*
|
||||
* Segment entry (large page) protection definitions.
|
||||
*/
|
||||
#define SEGMENT_NONE __pgprot(_SEGMENT_ENTRY_INVALID | \
|
||||
_SEGMENT_ENTRY_PROTECT)
|
||||
#define SEGMENT_READ __pgprot(_SEGMENT_ENTRY_PROTECT | \
|
||||
#define SEGMENT_RO __pgprot(_SEGMENT_ENTRY_PROTECT | \
|
||||
_SEGMENT_ENTRY_READ | \
|
||||
_SEGMENT_ENTRY_NOEXEC)
|
||||
#define SEGMENT_RX __pgprot(_SEGMENT_ENTRY_PROTECT | \
|
||||
_SEGMENT_ENTRY_READ)
|
||||
#define SEGMENT_WRITE __pgprot(_SEGMENT_ENTRY_READ | \
|
||||
#define SEGMENT_RW __pgprot(_SEGMENT_ENTRY_READ | \
|
||||
_SEGMENT_ENTRY_WRITE | \
|
||||
_SEGMENT_ENTRY_NOEXEC)
|
||||
#define SEGMENT_RWX __pgprot(_SEGMENT_ENTRY_READ | \
|
||||
_SEGMENT_ENTRY_WRITE)
|
||||
#define SEGMENT_KERNEL __pgprot(_SEGMENT_ENTRY | \
|
||||
_SEGMENT_ENTRY_LARGE | \
|
||||
_SEGMENT_ENTRY_READ | \
|
||||
_SEGMENT_ENTRY_WRITE | \
|
||||
_SEGMENT_ENTRY_YOUNG | \
|
||||
_SEGMENT_ENTRY_DIRTY)
|
||||
_SEGMENT_ENTRY_DIRTY | \
|
||||
_SEGMENT_ENTRY_NOEXEC)
|
||||
#define SEGMENT_KERNEL_RO __pgprot(_SEGMENT_ENTRY | \
|
||||
_SEGMENT_ENTRY_LARGE | \
|
||||
_SEGMENT_ENTRY_READ | \
|
||||
_SEGMENT_ENTRY_YOUNG | \
|
||||
_SEGMENT_ENTRY_PROTECT)
|
||||
_SEGMENT_ENTRY_PROTECT | \
|
||||
_SEGMENT_ENTRY_NOEXEC)
|
||||
|
||||
/*
|
||||
* Region3 entry (large page) protection definitions.
|
||||
@@ -451,12 +468,14 @@ static inline int is_module_addr(void *addr)
|
||||
_REGION3_ENTRY_READ | \
|
||||
_REGION3_ENTRY_WRITE | \
|
||||
_REGION3_ENTRY_YOUNG | \
|
||||
_REGION3_ENTRY_DIRTY)
|
||||
_REGION3_ENTRY_DIRTY | \
|
||||
_REGION_ENTRY_NOEXEC)
|
||||
#define REGION3_KERNEL_RO __pgprot(_REGION_ENTRY_TYPE_R3 | \
|
||||
_REGION3_ENTRY_LARGE | \
|
||||
_REGION3_ENTRY_READ | \
|
||||
_REGION3_ENTRY_YOUNG | \
|
||||
_REGION_ENTRY_PROTECT)
|
||||
_REGION_ENTRY_PROTECT | \
|
||||
_REGION_ENTRY_NOEXEC)
|
||||
|
||||
static inline int mm_has_pgste(struct mm_struct *mm)
|
||||
{
|
||||
@@ -801,14 +820,14 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
|
||||
pte_val(pte) &= _PAGE_CHG_MASK;
|
||||
pte_val(pte) |= pgprot_val(newprot);
|
||||
/*
|
||||
* newprot for PAGE_NONE, PAGE_READ and PAGE_WRITE has the
|
||||
* invalid bit set, clear it again for readable, young pages
|
||||
* newprot for PAGE_NONE, PAGE_RO, PAGE_RX, PAGE_RW and PAGE_RWX
|
||||
* has the invalid bit set, clear it again for readable, young pages
|
||||
*/
|
||||
if ((pte_val(pte) & _PAGE_YOUNG) && (pte_val(pte) & _PAGE_READ))
|
||||
pte_val(pte) &= ~_PAGE_INVALID;
|
||||
/*
|
||||
* newprot for PAGE_READ and PAGE_WRITE has the page protection
|
||||
* bit set, clear it again for writable, dirty pages
|
||||
* newprot for PAGE_RO, PAGE_RX, PAGE_RW and PAGE_RWX has the page
|
||||
* protection bit set, clear it again for writable, dirty pages
|
||||
*/
|
||||
if ((pte_val(pte) & _PAGE_DIRTY) && (pte_val(pte) & _PAGE_WRITE))
|
||||
pte_val(pte) &= ~_PAGE_PROTECT;
|
||||
@@ -1029,6 +1048,8 @@ int get_guest_storage_key(struct mm_struct *mm, unsigned long addr,
|
||||
static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
|
||||
pte_t *ptep, pte_t entry)
|
||||
{
|
||||
if (!MACHINE_HAS_NX)
|
||||
pte_val(entry) &= ~_PAGE_NOEXEC;
|
||||
if (mm_has_pgste(mm))
|
||||
ptep_set_pte_at(mm, addr, ptep, entry);
|
||||
else
|
||||
@@ -1173,14 +1194,18 @@ static inline pud_t pud_mkdirty(pud_t pud)
|
||||
static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
|
||||
{
|
||||
/*
|
||||
* pgprot is PAGE_NONE, PAGE_READ, or PAGE_WRITE (see __Pxxx / __Sxxx)
|
||||
* Convert to segment table entry format.
|
||||
* pgprot is PAGE_NONE, PAGE_RO, PAGE_RX, PAGE_RW or PAGE_RWX
|
||||
* (see __Pxxx / __Sxxx). Convert to segment table entry format.
|
||||
*/
|
||||
if (pgprot_val(pgprot) == pgprot_val(PAGE_NONE))
|
||||
return pgprot_val(SEGMENT_NONE);
|
||||
if (pgprot_val(pgprot) == pgprot_val(PAGE_READ))
|
||||
return pgprot_val(SEGMENT_READ);
|
||||
return pgprot_val(SEGMENT_WRITE);
|
||||
if (pgprot_val(pgprot) == pgprot_val(PAGE_RO))
|
||||
return pgprot_val(SEGMENT_RO);
|
||||
if (pgprot_val(pgprot) == pgprot_val(PAGE_RX))
|
||||
return pgprot_val(SEGMENT_RX);
|
||||
if (pgprot_val(pgprot) == pgprot_val(PAGE_RW))
|
||||
return pgprot_val(SEGMENT_RW);
|
||||
return pgprot_val(SEGMENT_RWX);
|
||||
}
|
||||
|
||||
static inline pmd_t pmd_mkyoung(pmd_t pmd)
|
||||
@@ -1315,6 +1340,8 @@ static inline int pmdp_clear_flush_young(struct vm_area_struct *vma,
|
||||
static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
|
||||
pmd_t *pmdp, pmd_t entry)
|
||||
{
|
||||
if (!MACHINE_HAS_NX)
|
||||
pmd_val(entry) &= ~_SEGMENT_ENTRY_NOEXEC;
|
||||
*pmdp = entry;
|
||||
}
|
||||
|
||||
@@ -1389,7 +1416,7 @@ static inline int pmd_trans_huge(pmd_t pmd)
|
||||
#define has_transparent_hugepage has_transparent_hugepage
|
||||
static inline int has_transparent_hugepage(void)
|
||||
{
|
||||
return MACHINE_HAS_HPAGE ? 1 : 0;
|
||||
return MACHINE_HAS_EDAT1 ? 1 : 0;
|
||||
}
|
||||
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
|
||||
|
||||
|
||||
@@ -361,12 +361,12 @@ extern void (*s390_base_ext_handler_fn)(void);
|
||||
extern int memcpy_real(void *, void *, size_t);
|
||||
extern void memcpy_absolute(void *, void *, size_t);
|
||||
|
||||
#define mem_assign_absolute(dest, val) { \
|
||||
#define mem_assign_absolute(dest, val) do { \
|
||||
__typeof__(dest) __tmp = (val); \
|
||||
\
|
||||
BUILD_BUG_ON(sizeof(__tmp) != sizeof(val)); \
|
||||
memcpy_absolute(&(dest), &__tmp, sizeof(__tmp)); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
|
||||
@@ -101,7 +101,12 @@ struct zpci_report_error_header {
|
||||
u8 data[0]; /* Subsequent Data passed verbatim to SCLP ET 24 */
|
||||
} __packed;
|
||||
|
||||
int _sclp_get_core_info_early(struct sclp_core_info *info);
|
||||
int sclp_early_get_core_info(struct sclp_core_info *info);
|
||||
void sclp_early_get_ipl_info(struct sclp_ipl_info *info);
|
||||
void sclp_early_detect(void);
|
||||
void sclp_early_printk(const char *s);
|
||||
void __sclp_early_printk(const char *s, unsigned int len);
|
||||
|
||||
int _sclp_get_core_info(struct sclp_core_info *info);
|
||||
int sclp_core_configure(u8 core);
|
||||
int sclp_core_deconfigure(u8 core);
|
||||
@@ -110,20 +115,17 @@ int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
|
||||
int sclp_chp_configure(struct chp_id chpid);
|
||||
int sclp_chp_deconfigure(struct chp_id chpid);
|
||||
int sclp_chp_read_info(struct sclp_chp_info *info);
|
||||
void sclp_get_ipl_info(struct sclp_ipl_info *info);
|
||||
int sclp_pci_configure(u32 fid);
|
||||
int sclp_pci_deconfigure(u32 fid);
|
||||
int sclp_pci_report(struct zpci_report_error_header *report, u32 fh, u32 fid);
|
||||
int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count);
|
||||
int memcpy_hsa_user(void __user *dest, unsigned long src, size_t count);
|
||||
void sclp_early_detect(void);
|
||||
void _sclp_print_early(const char *);
|
||||
void sclp_ocf_cpc_name_copy(char *dst);
|
||||
|
||||
static inline int sclp_get_core_info(struct sclp_core_info *info, int early)
|
||||
{
|
||||
if (early)
|
||||
return _sclp_get_core_info_early(info);
|
||||
return sclp_early_get_core_info(info);
|
||||
return _sclp_get_core_info(info);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#define MACHINE_FLAG_TLB_LC _BITUL(12)
|
||||
#define MACHINE_FLAG_VX _BITUL(13)
|
||||
#define MACHINE_FLAG_CAD _BITUL(14)
|
||||
#define MACHINE_FLAG_NX _BITUL(15)
|
||||
|
||||
#define LPP_MAGIC _BITUL(31)
|
||||
#define LPP_PFAULT_PID_MASK _AC(0xffffffff, UL)
|
||||
@@ -58,9 +59,6 @@ extern void detect_memory_memblock(void);
|
||||
|
||||
#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
|
||||
#define MACHINE_HAS_ESOP (S390_lowcore.machine_flags & MACHINE_FLAG_ESOP)
|
||||
#define MACHINE_HAS_PFMF MACHINE_HAS_EDAT1
|
||||
#define MACHINE_HAS_HPAGE MACHINE_HAS_EDAT1
|
||||
|
||||
#define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE)
|
||||
#define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44)
|
||||
#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1)
|
||||
@@ -71,6 +69,7 @@ extern void detect_memory_memblock(void);
|
||||
#define MACHINE_HAS_TLB_LC (S390_lowcore.machine_flags & MACHINE_FLAG_TLB_LC)
|
||||
#define MACHINE_HAS_VX (S390_lowcore.machine_flags & MACHINE_FLAG_VX)
|
||||
#define MACHINE_HAS_CAD (S390_lowcore.machine_flags & MACHINE_FLAG_CAD)
|
||||
#define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX)
|
||||
|
||||
/*
|
||||
* Console mode. Override with conmode=
|
||||
|
||||
@@ -63,7 +63,7 @@ static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
|
||||
|
||||
static inline int arch_spin_is_locked(arch_spinlock_t *lp)
|
||||
{
|
||||
return ACCESS_ONCE(lp->lock) != 0;
|
||||
return READ_ONCE(lp->lock) != 0;
|
||||
}
|
||||
|
||||
static inline int arch_spin_trylock_once(arch_spinlock_t *lp)
|
||||
|
||||
@@ -178,14 +178,6 @@ int get_phys_clock(unsigned long long *clock);
|
||||
void init_cpu_timer(void);
|
||||
unsigned long long monotonic_clock(void);
|
||||
|
||||
void tod_to_timeval(__u64 todval, struct timespec64 *xt);
|
||||
|
||||
static inline
|
||||
void stck_to_timespec64(unsigned long long stck, struct timespec64 *ts)
|
||||
{
|
||||
tod_to_timeval(stck - TOD_UNIX_EPOCH, ts);
|
||||
}
|
||||
|
||||
extern u64 sched_clock_base_cc;
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user