aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/include/asm')
-rw-r--r--arch/s390/include/asm/barrier.h9
-rw-r--r--arch/s390/include/asm/clp.h2
-rw-r--r--arch/s390/include/asm/cpu_mf.h4
-rw-r--r--arch/s390/include/asm/dma-mapping.h8
-rw-r--r--arch/s390/include/asm/elf.h5
-rw-r--r--arch/s390/include/asm/futex.h6
-rw-r--r--arch/s390/include/asm/irq.h1
-rw-r--r--arch/s390/include/asm/kvm_host.h15
-rw-r--r--arch/s390/include/asm/mman.h4
-rw-r--r--arch/s390/include/asm/page.h22
-rw-r--r--arch/s390/include/asm/pci.h11
-rw-r--r--arch/s390/include/asm/pgtable.h134
-rw-r--r--arch/s390/include/asm/sclp.h1
-rw-r--r--arch/s390/include/asm/setup.h22
-rw-r--r--arch/s390/include/asm/signal.h19
-rw-r--r--arch/s390/include/asm/timex.h18
-rw-r--r--arch/s390/include/asm/uaccess.h23
-rw-r--r--arch/s390/include/asm/unistd.h3
18 files changed, 154 insertions, 153 deletions
diff --git a/arch/s390/include/asm/barrier.h b/arch/s390/include/asm/barrier.h
index 10a508802940..16760eeb79b0 100644
--- a/arch/s390/include/asm/barrier.h
+++ b/arch/s390/include/asm/barrier.h
@@ -13,15 +13,12 @@
13 * to devices. 13 * to devices.
14 */ 14 */
15 15
16static inline void mb(void)
17{
18#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES 16#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
19 /* Fast-BCR without checkpoint synchronization */ 17/* Fast-BCR without checkpoint synchronization */
20 asm volatile("bcr 14,0" : : : "memory"); 18#define mb() do { asm volatile("bcr 14,0" : : : "memory"); } while (0)
21#else 19#else
22 asm volatile("bcr 15,0" : : : "memory"); 20#define mb() do { asm volatile("bcr 15,0" : : : "memory"); } while (0)
23#endif 21#endif
24}
25 22
26#define rmb() mb() 23#define rmb() mb()
27#define wmb() mb() 24#define wmb() mb()
diff --git a/arch/s390/include/asm/clp.h b/arch/s390/include/asm/clp.h
index 6c3aecc245ff..a0e71a501f7c 100644
--- a/arch/s390/include/asm/clp.h
+++ b/arch/s390/include/asm/clp.h
@@ -2,7 +2,7 @@
2#define _ASM_S390_CLP_H 2#define _ASM_S390_CLP_H
3 3
4/* CLP common request & response block size */ 4/* CLP common request & response block size */
5#define CLP_BLK_SIZE (PAGE_SIZE * 2) 5#define CLP_BLK_SIZE PAGE_SIZE
6 6
7struct clp_req_hdr { 7struct clp_req_hdr {
8 u16 len; 8 u16 len;
diff --git a/arch/s390/include/asm/cpu_mf.h b/arch/s390/include/asm/cpu_mf.h
index c7c9bf647c3e..c879fad404c8 100644
--- a/arch/s390/include/asm/cpu_mf.h
+++ b/arch/s390/include/asm/cpu_mf.h
@@ -35,12 +35,12 @@
35/* CPU measurement facility support */ 35/* CPU measurement facility support */
36static inline int cpum_cf_avail(void) 36static inline int cpum_cf_avail(void)
37{ 37{
38 return MACHINE_HAS_SPP && test_facility(67); 38 return MACHINE_HAS_LPP && test_facility(67);
39} 39}
40 40
41static inline int cpum_sf_avail(void) 41static inline int cpum_sf_avail(void)
42{ 42{
43 return MACHINE_HAS_SPP && test_facility(68); 43 return MACHINE_HAS_LPP && test_facility(68);
44} 44}
45 45
46 46
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h
index 8a32f7dfd3af..9411db653bac 100644
--- a/arch/s390/include/asm/dma-mapping.h
+++ b/arch/s390/include/asm/dma-mapping.h
@@ -19,9 +19,11 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
19} 19}
20 20
21extern int dma_set_mask(struct device *dev, u64 mask); 21extern int dma_set_mask(struct device *dev, u64 mask);
22extern int dma_is_consistent(struct device *dev, dma_addr_t dma_handle); 22
23extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 23static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
24 enum dma_data_direction direction); 24 enum dma_data_direction direction)
25{
26}
25 27
26#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 28#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
27#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 29#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 178ff966a8ba..1bfdf24b85a2 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -180,10 +180,7 @@ extern unsigned long elf_hwcap;
180extern char elf_platform[]; 180extern char elf_platform[];
181#define ELF_PLATFORM (elf_platform) 181#define ELF_PLATFORM (elf_platform)
182 182
183#ifndef CONFIG_64BIT 183#ifdef CONFIG_64BIT
184#define SET_PERSONALITY(ex) \
185 set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
186#else /* CONFIG_64BIT */
187#define SET_PERSONALITY(ex) \ 184#define SET_PERSONALITY(ex) \
188do { \ 185do { \
189 if (personality(current->personality) != PER_LINUX32) \ 186 if (personality(current->personality) != PER_LINUX32) \
diff --git a/arch/s390/include/asm/futex.h b/arch/s390/include/asm/futex.h
index 96bc83ea5c90..51bcaa0fdeef 100644
--- a/arch/s390/include/asm/futex.h
+++ b/arch/s390/include/asm/futex.h
@@ -16,9 +16,6 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
16 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 16 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
17 oparg = 1 << oparg; 17 oparg = 1 << oparg;
18 18
19 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32)))
20 return -EFAULT;
21
22 pagefault_disable(); 19 pagefault_disable();
23 ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval); 20 ret = uaccess.futex_atomic_op(op, uaddr, oparg, &oldval);
24 pagefault_enable(); 21 pagefault_enable();
@@ -40,9 +37,6 @@ static inline int futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
40static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, 37static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
41 u32 oldval, u32 newval) 38 u32 oldval, u32 newval)
42{ 39{
43 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(u32)))
44 return -EFAULT;
45
46 return uaccess.futex_atomic_cmpxchg(uval, uaddr, oldval, newval); 40 return uaccess.futex_atomic_cmpxchg(uval, uaddr, oldval, newval);
47} 41}
48 42
diff --git a/arch/s390/include/asm/irq.h b/arch/s390/include/asm/irq.h
index 7def77302d63..87c17bfb2968 100644
--- a/arch/s390/include/asm/irq.h
+++ b/arch/s390/include/asm/irq.h
@@ -41,6 +41,7 @@ enum interruption_class {
41 IRQIO_CSC, 41 IRQIO_CSC,
42 IRQIO_PCI, 42 IRQIO_PCI,
43 IRQIO_MSI, 43 IRQIO_MSI,
44 IRQIO_VIR,
44 NMI_NMI, 45 NMI_NMI,
45 CPU_RST, 46 CPU_RST,
46 NR_ARCH_IRQS 47 NR_ARCH_IRQS
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index b7841546991f..16bd5d169cdb 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -20,9 +20,7 @@
20#include <asm/cpu.h> 20#include <asm/cpu.h>
21 21
22#define KVM_MAX_VCPUS 64 22#define KVM_MAX_VCPUS 64
23#define KVM_MEMORY_SLOTS 32 23#define KVM_USER_MEM_SLOTS 32
24/* memory slots that does not exposed to userspace */
25#define KVM_PRIVATE_MEM_SLOTS 4
26 24
27struct sca_entry { 25struct sca_entry {
28 atomic_t scn; 26 atomic_t scn;
@@ -76,8 +74,11 @@ struct kvm_s390_sie_block {
76 __u64 epoch; /* 0x0038 */ 74 __u64 epoch; /* 0x0038 */
77 __u8 reserved40[4]; /* 0x0040 */ 75 __u8 reserved40[4]; /* 0x0040 */
78#define LCTL_CR0 0x8000 76#define LCTL_CR0 0x8000
77#define LCTL_CR6 0x0200
78#define LCTL_CR14 0x0002
79 __u16 lctl; /* 0x0044 */ 79 __u16 lctl; /* 0x0044 */
80 __s16 icpua; /* 0x0046 */ 80 __s16 icpua; /* 0x0046 */
81#define ICTL_LPSW 0x00400000
81 __u32 ictl; /* 0x0048 */ 82 __u32 ictl; /* 0x0048 */
82 __u32 eca; /* 0x004c */ 83 __u32 eca; /* 0x004c */
83 __u8 icptcode; /* 0x0050 */ 84 __u8 icptcode; /* 0x0050 */
@@ -127,6 +128,7 @@ struct kvm_vcpu_stat {
127 u32 deliver_prefix_signal; 128 u32 deliver_prefix_signal;
128 u32 deliver_restart_signal; 129 u32 deliver_restart_signal;
129 u32 deliver_program_int; 130 u32 deliver_program_int;
131 u32 deliver_io_int;
130 u32 exit_wait_state; 132 u32 exit_wait_state;
131 u32 instruction_stidp; 133 u32 instruction_stidp;
132 u32 instruction_spx; 134 u32 instruction_spx;
@@ -187,6 +189,11 @@ struct kvm_s390_emerg_info {
187 __u16 code; 189 __u16 code;
188}; 190};
189 191
192struct kvm_s390_mchk_info {
193 __u64 cr14;
194 __u64 mcic;
195};
196
190struct kvm_s390_interrupt_info { 197struct kvm_s390_interrupt_info {
191 struct list_head list; 198 struct list_head list;
192 u64 type; 199 u64 type;
@@ -197,6 +204,7 @@ struct kvm_s390_interrupt_info {
197 struct kvm_s390_emerg_info emerg; 204 struct kvm_s390_emerg_info emerg;
198 struct kvm_s390_extcall_info extcall; 205 struct kvm_s390_extcall_info extcall;
199 struct kvm_s390_prefix_info prefix; 206 struct kvm_s390_prefix_info prefix;
207 struct kvm_s390_mchk_info mchk;
200 }; 208 };
201}; 209};
202 210
@@ -254,6 +262,7 @@ struct kvm_arch{
254 debug_info_t *dbf; 262 debug_info_t *dbf;
255 struct kvm_s390_float_interrupt float_int; 263 struct kvm_s390_float_interrupt float_int;
256 struct gmap *gmap; 264 struct gmap *gmap;
265 int css_support;
257}; 266};
258 267
259extern int sie64a(struct kvm_s390_sie_block *, u64 *); 268extern int sie64a(struct kvm_s390_sie_block *, u64 *);
diff --git a/arch/s390/include/asm/mman.h b/arch/s390/include/asm/mman.h
index 0e47a576d666..9977e08df5bd 100644
--- a/arch/s390/include/asm/mman.h
+++ b/arch/s390/include/asm/mman.h
@@ -9,7 +9,7 @@
9#include <uapi/asm/mman.h> 9#include <uapi/asm/mman.h>
10 10
11#if !defined(__ASSEMBLY__) && defined(CONFIG_64BIT) 11#if !defined(__ASSEMBLY__) && defined(CONFIG_64BIT)
12int s390_mmap_check(unsigned long addr, unsigned long len); 12int s390_mmap_check(unsigned long addr, unsigned long len, unsigned long flags);
13#define arch_mmap_check(addr,len,flags) s390_mmap_check(addr,len) 13#define arch_mmap_check(addr, len, flags) s390_mmap_check(addr, len, flags)
14#endif 14#endif
15#endif /* __S390_MMAN_H__ */ 15#endif /* __S390_MMAN_H__ */
diff --git a/arch/s390/include/asm/page.h b/arch/s390/include/asm/page.h
index a86ad4084073..75ce9b065f9f 100644
--- a/arch/s390/include/asm/page.h
+++ b/arch/s390/include/asm/page.h
@@ -155,28 +155,6 @@ static inline int page_reset_referenced(unsigned long addr)
155#define _PAGE_ACC_BITS 0xf0 /* HW access control bits */ 155#define _PAGE_ACC_BITS 0xf0 /* HW access control bits */
156 156
157/* 157/*
158 * Test and clear dirty bit in storage key.
159 * We can't clear the changed bit atomically. This is a potential
160 * race against modification of the referenced bit. This function
161 * should therefore only be called if it is not mapped in any
162 * address space.
163 *
164 * Note that the bit gets set whenever page content is changed. That means
165 * also when the page is modified by DMA or from inside the kernel.
166 */
167#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
168static inline int page_test_and_clear_dirty(unsigned long pfn, int mapped)
169{
170 unsigned char skey;
171
172 skey = page_get_storage_key(pfn << PAGE_SHIFT);
173 if (!(skey & _PAGE_CHANGED))
174 return 0;
175 page_set_storage_key(pfn << PAGE_SHIFT, skey & ~_PAGE_CHANGED, mapped);
176 return 1;
177}
178
179/*
180 * Test and clear referenced bit in storage key. 158 * Test and clear referenced bit in storage key.
181 */ 159 */
182#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 160#define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index b1fa93c606ad..05333b7f0469 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -160,9 +160,14 @@ void zpci_teardown_msi_irq(struct zpci_dev *, struct msi_desc *);
160int zpci_msihash_init(void); 160int zpci_msihash_init(void);
161void zpci_msihash_exit(void); 161void zpci_msihash_exit(void);
162 162
163#ifdef CONFIG_PCI
163/* Error handling and recovery */ 164/* Error handling and recovery */
164void zpci_event_error(void *); 165void zpci_event_error(void *);
165void zpci_event_availability(void *); 166void zpci_event_availability(void *);
167#else /* CONFIG_PCI */
168static inline void zpci_event_error(void *e) {}
169static inline void zpci_event_availability(void *e) {}
170#endif /* CONFIG_PCI */
166 171
167/* Helpers */ 172/* Helpers */
168struct zpci_dev *get_zdev(struct pci_dev *); 173struct zpci_dev *get_zdev(struct pci_dev *);
@@ -180,8 +185,10 @@ void zpci_dma_exit(void);
180/* Hotplug */ 185/* Hotplug */
181extern struct mutex zpci_list_lock; 186extern struct mutex zpci_list_lock;
182extern struct list_head zpci_list; 187extern struct list_head zpci_list;
183extern struct pci_hp_callback_ops hotplug_ops; 188extern unsigned int s390_pci_probe;
184extern unsigned int pci_probe; 189
190void zpci_register_hp_ops(struct pci_hp_callback_ops *);
191void zpci_deregister_hp_ops(void);
185 192
186/* FMB */ 193/* FMB */
187int zpci_fmb_enable_device(struct zpci_dev *); 194int zpci_fmb_enable_device(struct zpci_dev *);
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 098adbb62660..4a2930844d43 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -29,6 +29,7 @@
29#ifndef __ASSEMBLY__ 29#ifndef __ASSEMBLY__
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/mm_types.h> 31#include <linux/mm_types.h>
32#include <linux/page-flags.h>
32#include <asm/bug.h> 33#include <asm/bug.h>
33#include <asm/page.h> 34#include <asm/page.h>
34 35
@@ -221,13 +222,15 @@ extern unsigned long MODULES_END;
221/* Software bits in the page table entry */ 222/* Software bits in the page table entry */
222#define _PAGE_SWT 0x001 /* SW pte type bit t */ 223#define _PAGE_SWT 0x001 /* SW pte type bit t */
223#define _PAGE_SWX 0x002 /* SW pte type bit x */ 224#define _PAGE_SWX 0x002 /* SW pte type bit x */
224#define _PAGE_SWC 0x004 /* SW pte changed bit (for KVM) */ 225#define _PAGE_SWC 0x004 /* SW pte changed bit */
225#define _PAGE_SWR 0x008 /* SW pte referenced bit (for KVM) */ 226#define _PAGE_SWR 0x008 /* SW pte referenced bit */
226#define _PAGE_SPECIAL 0x010 /* SW associated with special page */ 227#define _PAGE_SWW 0x010 /* SW pte write bit */
228#define _PAGE_SPECIAL 0x020 /* SW associated with special page */
227#define __HAVE_ARCH_PTE_SPECIAL 229#define __HAVE_ARCH_PTE_SPECIAL
228 230
229/* Set of bits not changed in pte_modify */ 231/* Set of bits not changed in pte_modify */
230#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_SPECIAL | _PAGE_SWC | _PAGE_SWR) 232#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_SPECIAL | _PAGE_CO | \
233 _PAGE_SWC | _PAGE_SWR)
231 234
232/* Six different types of pages. */ 235/* Six different types of pages. */
233#define _PAGE_TYPE_EMPTY 0x400 236#define _PAGE_TYPE_EMPTY 0x400
@@ -321,6 +324,7 @@ extern unsigned long MODULES_END;
321 324
322/* Bits in the region table entry */ 325/* Bits in the region table entry */
323#define _REGION_ENTRY_ORIGIN ~0xfffUL/* region/segment table origin */ 326#define _REGION_ENTRY_ORIGIN ~0xfffUL/* region/segment table origin */
327#define _REGION_ENTRY_RO 0x200 /* region protection bit */
324#define _REGION_ENTRY_INV 0x20 /* invalid region table entry */ 328#define _REGION_ENTRY_INV 0x20 /* invalid region table entry */
325#define _REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mask */ 329#define _REGION_ENTRY_TYPE_MASK 0x0c /* region/segment table type mask */
326#define _REGION_ENTRY_TYPE_R1 0x0c /* region first table type */ 330#define _REGION_ENTRY_TYPE_R1 0x0c /* region first table type */
@@ -336,6 +340,8 @@ extern unsigned long MODULES_END;
336#define _REGION3_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INV) 340#define _REGION3_ENTRY_EMPTY (_REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INV)
337 341
338#define _REGION3_ENTRY_LARGE 0x400 /* RTTE-format control, large page */ 342#define _REGION3_ENTRY_LARGE 0x400 /* RTTE-format control, large page */
343#define _REGION3_ENTRY_RO 0x200 /* page protection bit */
344#define _REGION3_ENTRY_CO 0x100 /* change-recording override */
339 345
340/* Bits in the segment table entry */ 346/* Bits in the segment table entry */
341#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */ 347#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
@@ -382,9 +388,11 @@ extern unsigned long MODULES_END;
382 */ 388 */
383#define PAGE_NONE __pgprot(_PAGE_TYPE_NONE) 389#define PAGE_NONE __pgprot(_PAGE_TYPE_NONE)
384#define PAGE_RO __pgprot(_PAGE_TYPE_RO) 390#define PAGE_RO __pgprot(_PAGE_TYPE_RO)
385#define PAGE_RW __pgprot(_PAGE_TYPE_RW) 391#define PAGE_RW __pgprot(_PAGE_TYPE_RO | _PAGE_SWW)
392#define PAGE_RWC __pgprot(_PAGE_TYPE_RW | _PAGE_SWW | _PAGE_SWC)
386 393
387#define PAGE_KERNEL PAGE_RW 394#define PAGE_KERNEL PAGE_RWC
395#define PAGE_SHARED PAGE_KERNEL
388#define PAGE_COPY PAGE_RO 396#define PAGE_COPY PAGE_RO
389 397
390/* 398/*
@@ -631,23 +639,23 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste)
631 bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); 639 bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED);
632 /* Clear page changed & referenced bit in the storage key */ 640 /* Clear page changed & referenced bit in the storage key */
633 if (bits & _PAGE_CHANGED) 641 if (bits & _PAGE_CHANGED)
634 page_set_storage_key(address, skey ^ bits, 1); 642 page_set_storage_key(address, skey ^ bits, 0);
635 else if (bits) 643 else if (bits)
636 page_reset_referenced(address); 644 page_reset_referenced(address);
637 /* Transfer page changed & referenced bit to guest bits in pgste */ 645 /* Transfer page changed & referenced bit to guest bits in pgste */
638 pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ 646 pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */
639 /* Get host changed & referenced bits from pgste */ 647 /* Get host changed & referenced bits from pgste */
640 bits |= (pgste_val(pgste) & (RCP_HR_BIT | RCP_HC_BIT)) >> 52; 648 bits |= (pgste_val(pgste) & (RCP_HR_BIT | RCP_HC_BIT)) >> 52;
641 /* Clear host bits in pgste. */ 649 /* Transfer page changed & referenced bit to kvm user bits */
650 pgste_val(pgste) |= bits << 45; /* KVM_UR_BIT & KVM_UC_BIT */
651 /* Clear relevant host bits in pgste. */
642 pgste_val(pgste) &= ~(RCP_HR_BIT | RCP_HC_BIT); 652 pgste_val(pgste) &= ~(RCP_HR_BIT | RCP_HC_BIT);
643 pgste_val(pgste) &= ~(RCP_ACC_BITS | RCP_FP_BIT); 653 pgste_val(pgste) &= ~(RCP_ACC_BITS | RCP_FP_BIT);
644 /* Copy page access key and fetch protection bit to pgste */ 654 /* Copy page access key and fetch protection bit to pgste */
645 pgste_val(pgste) |= 655 pgste_val(pgste) |=
646 (unsigned long) (skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56; 656 (unsigned long) (skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56;
647 /* Transfer changed and referenced to kvm user bits */ 657 /* Transfer referenced bit to pte */
648 pgste_val(pgste) |= bits << 45; /* KVM_UR_BIT & KVM_UC_BIT */ 658 pte_val(*ptep) |= (bits & _PAGE_REFERENCED) << 1;
649 /* Transfer changed & referenced to pte sofware bits */
650 pte_val(*ptep) |= bits << 1; /* _PAGE_SWR & _PAGE_SWC */
651#endif 659#endif
652 return pgste; 660 return pgste;
653 661
@@ -660,20 +668,25 @@ static inline pgste_t pgste_update_young(pte_t *ptep, pgste_t pgste)
660 668
661 if (!pte_present(*ptep)) 669 if (!pte_present(*ptep))
662 return pgste; 670 return pgste;
671 /* Get referenced bit from storage key */
663 young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK); 672 young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK);
664 /* Transfer page referenced bit to pte software bit (host view) */ 673 if (young)
665 if (young || (pgste_val(pgste) & RCP_HR_BIT)) 674 pgste_val(pgste) |= RCP_GR_BIT;
675 /* Get host referenced bit from pgste */
676 if (pgste_val(pgste) & RCP_HR_BIT) {
677 pgste_val(pgste) &= ~RCP_HR_BIT;
678 young = 1;
679 }
680 /* Transfer referenced bit to kvm user bits and pte */
681 if (young) {
682 pgste_val(pgste) |= KVM_UR_BIT;
666 pte_val(*ptep) |= _PAGE_SWR; 683 pte_val(*ptep) |= _PAGE_SWR;
667 /* Clear host referenced bit in pgste. */ 684 }
668 pgste_val(pgste) &= ~RCP_HR_BIT;
669 /* Transfer page referenced bit to guest bit in pgste */
670 pgste_val(pgste) |= (unsigned long) young << 50; /* set RCP_GR_BIT */
671#endif 685#endif
672 return pgste; 686 return pgste;
673
674} 687}
675 688
676static inline void pgste_set_pte(pte_t *ptep, pgste_t pgste, pte_t entry) 689static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry)
677{ 690{
678#ifdef CONFIG_PGSTE 691#ifdef CONFIG_PGSTE
679 unsigned long address; 692 unsigned long address;
@@ -687,10 +700,23 @@ static inline void pgste_set_pte(pte_t *ptep, pgste_t pgste, pte_t entry)
687 /* Set page access key and fetch protection bit from pgste */ 700 /* Set page access key and fetch protection bit from pgste */
688 nkey |= (pgste_val(pgste) & (RCP_ACC_BITS | RCP_FP_BIT)) >> 56; 701 nkey |= (pgste_val(pgste) & (RCP_ACC_BITS | RCP_FP_BIT)) >> 56;
689 if (okey != nkey) 702 if (okey != nkey)
690 page_set_storage_key(address, nkey, 1); 703 page_set_storage_key(address, nkey, 0);
691#endif 704#endif
692} 705}
693 706
707static inline void pgste_set_pte(pte_t *ptep, pte_t entry)
708{
709 if (!MACHINE_HAS_ESOP && (pte_val(entry) & _PAGE_SWW)) {
710 /*
711 * Without enhanced suppression-on-protection force
712 * the dirty bit on for all writable ptes.
713 */
714 pte_val(entry) |= _PAGE_SWC;
715 pte_val(entry) &= ~_PAGE_RO;
716 }
717 *ptep = entry;
718}
719
694/** 720/**
695 * struct gmap_struct - guest address space 721 * struct gmap_struct - guest address space
696 * @mm: pointer to the parent mm_struct 722 * @mm: pointer to the parent mm_struct
@@ -749,11 +775,14 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
749 775
750 if (mm_has_pgste(mm)) { 776 if (mm_has_pgste(mm)) {
751 pgste = pgste_get_lock(ptep); 777 pgste = pgste_get_lock(ptep);
752 pgste_set_pte(ptep, pgste, entry); 778 pgste_set_key(ptep, pgste, entry);
753 *ptep = entry; 779 pgste_set_pte(ptep, entry);
754 pgste_set_unlock(ptep, pgste); 780 pgste_set_unlock(ptep, pgste);
755 } else 781 } else {
782 if (!(pte_val(entry) & _PAGE_INVALID) && MACHINE_HAS_EDAT1)
783 pte_val(entry) |= _PAGE_CO;
756 *ptep = entry; 784 *ptep = entry;
785 }
757} 786}
758 787
759/* 788/*
@@ -762,16 +791,12 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
762 */ 791 */
763static inline int pte_write(pte_t pte) 792static inline int pte_write(pte_t pte)
764{ 793{
765 return (pte_val(pte) & _PAGE_RO) == 0; 794 return (pte_val(pte) & _PAGE_SWW) != 0;
766} 795}
767 796
768static inline int pte_dirty(pte_t pte) 797static inline int pte_dirty(pte_t pte)
769{ 798{
770#ifdef CONFIG_PGSTE 799 return (pte_val(pte) & _PAGE_SWC) != 0;
771 if (pte_val(pte) & _PAGE_SWC)
772 return 1;
773#endif
774 return 0;
775} 800}
776 801
777static inline int pte_young(pte_t pte) 802static inline int pte_young(pte_t pte)
@@ -821,11 +846,14 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
821{ 846{
822 pte_val(pte) &= _PAGE_CHG_MASK; 847 pte_val(pte) &= _PAGE_CHG_MASK;
823 pte_val(pte) |= pgprot_val(newprot); 848 pte_val(pte) |= pgprot_val(newprot);
849 if ((pte_val(pte) & _PAGE_SWC) && (pte_val(pte) & _PAGE_SWW))
850 pte_val(pte) &= ~_PAGE_RO;
824 return pte; 851 return pte;
825} 852}
826 853
827static inline pte_t pte_wrprotect(pte_t pte) 854static inline pte_t pte_wrprotect(pte_t pte)
828{ 855{
856 pte_val(pte) &= ~_PAGE_SWW;
829 /* Do not clobber _PAGE_TYPE_NONE pages! */ 857 /* Do not clobber _PAGE_TYPE_NONE pages! */
830 if (!(pte_val(pte) & _PAGE_INVALID)) 858 if (!(pte_val(pte) & _PAGE_INVALID))
831 pte_val(pte) |= _PAGE_RO; 859 pte_val(pte) |= _PAGE_RO;
@@ -834,20 +862,26 @@ static inline pte_t pte_wrprotect(pte_t pte)
834 862
835static inline pte_t pte_mkwrite(pte_t pte) 863static inline pte_t pte_mkwrite(pte_t pte)
836{ 864{
837 pte_val(pte) &= ~_PAGE_RO; 865 pte_val(pte) |= _PAGE_SWW;
866 if (pte_val(pte) & _PAGE_SWC)
867 pte_val(pte) &= ~_PAGE_RO;
838 return pte; 868 return pte;
839} 869}
840 870
841static inline pte_t pte_mkclean(pte_t pte) 871static inline pte_t pte_mkclean(pte_t pte)
842{ 872{
843#ifdef CONFIG_PGSTE
844 pte_val(pte) &= ~_PAGE_SWC; 873 pte_val(pte) &= ~_PAGE_SWC;
845#endif 874 /* Do not clobber _PAGE_TYPE_NONE pages! */
875 if (!(pte_val(pte) & _PAGE_INVALID))
876 pte_val(pte) |= _PAGE_RO;
846 return pte; 877 return pte;
847} 878}
848 879
849static inline pte_t pte_mkdirty(pte_t pte) 880static inline pte_t pte_mkdirty(pte_t pte)
850{ 881{
882 pte_val(pte) |= _PAGE_SWC;
883 if (pte_val(pte) & _PAGE_SWW)
884 pte_val(pte) &= ~_PAGE_RO;
851 return pte; 885 return pte;
852} 886}
853 887
@@ -885,10 +919,10 @@ static inline pte_t pte_mkhuge(pte_t pte)
885 pte_val(pte) |= _SEGMENT_ENTRY_INV; 919 pte_val(pte) |= _SEGMENT_ENTRY_INV;
886 } 920 }
887 /* 921 /*
888 * Clear SW pte bits SWT and SWX, there are no SW bits in a segment 922 * Clear SW pte bits, there are no SW bits in a segment table entry.
889 * table entry.
890 */ 923 */
891 pte_val(pte) &= ~(_PAGE_SWT | _PAGE_SWX); 924 pte_val(pte) &= ~(_PAGE_SWT | _PAGE_SWX | _PAGE_SWC |
925 _PAGE_SWR | _PAGE_SWW);
892 /* 926 /*
893 * Also set the change-override bit because we don't need dirty bit 927 * Also set the change-override bit because we don't need dirty bit
894 * tracking for hugetlbfs pages. 928 * tracking for hugetlbfs pages.
@@ -1040,9 +1074,11 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
1040 unsigned long address, 1074 unsigned long address,
1041 pte_t *ptep, pte_t pte) 1075 pte_t *ptep, pte_t pte)
1042{ 1076{
1043 *ptep = pte; 1077 if (mm_has_pgste(mm)) {
1044 if (mm_has_pgste(mm)) 1078 pgste_set_pte(ptep, pte);
1045 pgste_set_unlock(ptep, *(pgste_t *)(ptep + PTRS_PER_PTE)); 1079 pgste_set_unlock(ptep, *(pgste_t *)(ptep + PTRS_PER_PTE));
1080 } else
1081 *ptep = pte;
1046} 1082}
1047 1083
1048#define __HAVE_ARCH_PTEP_CLEAR_FLUSH 1084#define __HAVE_ARCH_PTEP_CLEAR_FLUSH
@@ -1110,10 +1146,13 @@ static inline pte_t ptep_set_wrprotect(struct mm_struct *mm,
1110 1146
1111 if (!mm_exclusive(mm)) 1147 if (!mm_exclusive(mm))
1112 __ptep_ipte(address, ptep); 1148 __ptep_ipte(address, ptep);
1113 *ptep = pte_wrprotect(pte); 1149 pte = pte_wrprotect(pte);
1114 1150
1115 if (mm_has_pgste(mm)) 1151 if (mm_has_pgste(mm)) {
1152 pgste_set_pte(ptep, pte);
1116 pgste_set_unlock(ptep, pgste); 1153 pgste_set_unlock(ptep, pgste);
1154 } else
1155 *ptep = pte;
1117 } 1156 }
1118 return pte; 1157 return pte;
1119} 1158}
@@ -1131,10 +1170,12 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
1131 pgste = pgste_get_lock(ptep); 1170 pgste = pgste_get_lock(ptep);
1132 1171
1133 __ptep_ipte(address, ptep); 1172 __ptep_ipte(address, ptep);
1134 *ptep = entry;
1135 1173
1136 if (mm_has_pgste(vma->vm_mm)) 1174 if (mm_has_pgste(vma->vm_mm)) {
1175 pgste_set_pte(ptep, entry);
1137 pgste_set_unlock(ptep, pgste); 1176 pgste_set_unlock(ptep, pgste);
1177 } else
1178 *ptep = entry;
1138 return 1; 1179 return 1;
1139} 1180}
1140 1181
@@ -1152,8 +1193,13 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
1152static inline pte_t mk_pte(struct page *page, pgprot_t pgprot) 1193static inline pte_t mk_pte(struct page *page, pgprot_t pgprot)
1153{ 1194{
1154 unsigned long physpage = page_to_phys(page); 1195 unsigned long physpage = page_to_phys(page);
1196 pte_t __pte = mk_pte_phys(physpage, pgprot);
1155 1197
1156 return mk_pte_phys(physpage, pgprot); 1198 if ((pte_val(__pte) & _PAGE_SWW) && PageDirty(page)) {
1199 pte_val(__pte) |= _PAGE_SWC;
1200 pte_val(__pte) &= ~_PAGE_RO;
1201 }
1202 return __pte;
1157} 1203}
1158 1204
1159#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 1205#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
@@ -1245,6 +1291,8 @@ static inline int pmd_trans_splitting(pmd_t pmd)
1245static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, 1291static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
1246 pmd_t *pmdp, pmd_t entry) 1292 pmd_t *pmdp, pmd_t entry)
1247{ 1293{
1294 if (!(pmd_val(entry) & _SEGMENT_ENTRY_INV) && MACHINE_HAS_EDAT1)
1295 pmd_val(entry) |= _SEGMENT_ENTRY_CO;
1248 *pmdp = entry; 1296 *pmdp = entry;
1249} 1297}
1250 1298
diff --git a/arch/s390/include/asm/sclp.h b/arch/s390/include/asm/sclp.h
index 833788693f09..06a136136047 100644
--- a/arch/s390/include/asm/sclp.h
+++ b/arch/s390/include/asm/sclp.h
@@ -46,7 +46,6 @@ int sclp_cpu_deconfigure(u8 cpu);
46void sclp_facilities_detect(void); 46void sclp_facilities_detect(void);
47unsigned long long sclp_get_rnmax(void); 47unsigned long long sclp_get_rnmax(void);
48unsigned long long sclp_get_rzm(void); 48unsigned long long sclp_get_rzm(void);
49u8 sclp_get_fac85(void);
50int sclp_sdias_blk_count(void); 49int sclp_sdias_blk_count(void);
51int sclp_sdias_copy(void *dest, int blk_num, int nr_blks); 50int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
52int sclp_chp_configure(struct chp_id chpid); 51int sclp_chp_configure(struct chp_id chpid);
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index f69f76b3447a..ff67d730c00c 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -64,17 +64,18 @@ extern unsigned int s390_user_mode;
64 64
65#define MACHINE_FLAG_VM (1UL << 0) 65#define MACHINE_FLAG_VM (1UL << 0)
66#define MACHINE_FLAG_IEEE (1UL << 1) 66#define MACHINE_FLAG_IEEE (1UL << 1)
67#define MACHINE_FLAG_CSP (1UL << 3) 67#define MACHINE_FLAG_CSP (1UL << 2)
68#define MACHINE_FLAG_MVPG (1UL << 4) 68#define MACHINE_FLAG_MVPG (1UL << 3)
69#define MACHINE_FLAG_DIAG44 (1UL << 5) 69#define MACHINE_FLAG_DIAG44 (1UL << 4)
70#define MACHINE_FLAG_IDTE (1UL << 6) 70#define MACHINE_FLAG_IDTE (1UL << 5)
71#define MACHINE_FLAG_DIAG9C (1UL << 7) 71#define MACHINE_FLAG_DIAG9C (1UL << 6)
72#define MACHINE_FLAG_MVCOS (1UL << 8) 72#define MACHINE_FLAG_MVCOS (1UL << 7)
73#define MACHINE_FLAG_KVM (1UL << 9) 73#define MACHINE_FLAG_KVM (1UL << 8)
74#define MACHINE_FLAG_ESOP (1UL << 9)
74#define MACHINE_FLAG_EDAT1 (1UL << 10) 75#define MACHINE_FLAG_EDAT1 (1UL << 10)
75#define MACHINE_FLAG_EDAT2 (1UL << 11) 76#define MACHINE_FLAG_EDAT2 (1UL << 11)
76#define MACHINE_FLAG_LPAR (1UL << 12) 77#define MACHINE_FLAG_LPAR (1UL << 12)
77#define MACHINE_FLAG_SPP (1UL << 13) 78#define MACHINE_FLAG_LPP (1UL << 13)
78#define MACHINE_FLAG_TOPOLOGY (1UL << 14) 79#define MACHINE_FLAG_TOPOLOGY (1UL << 14)
79#define MACHINE_FLAG_TE (1UL << 15) 80#define MACHINE_FLAG_TE (1UL << 15)
80#define MACHINE_FLAG_RRBM (1UL << 16) 81#define MACHINE_FLAG_RRBM (1UL << 16)
@@ -84,6 +85,7 @@ extern unsigned int s390_user_mode;
84#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR) 85#define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR)
85 86
86#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C) 87#define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C)
88#define MACHINE_HAS_ESOP (S390_lowcore.machine_flags & MACHINE_FLAG_ESOP)
87#define MACHINE_HAS_PFMF MACHINE_HAS_EDAT1 89#define MACHINE_HAS_PFMF MACHINE_HAS_EDAT1
88#define MACHINE_HAS_HPAGE MACHINE_HAS_EDAT1 90#define MACHINE_HAS_HPAGE MACHINE_HAS_EDAT1
89 91
@@ -96,7 +98,7 @@ extern unsigned int s390_user_mode;
96#define MACHINE_HAS_MVCOS (0) 98#define MACHINE_HAS_MVCOS (0)
97#define MACHINE_HAS_EDAT1 (0) 99#define MACHINE_HAS_EDAT1 (0)
98#define MACHINE_HAS_EDAT2 (0) 100#define MACHINE_HAS_EDAT2 (0)
99#define MACHINE_HAS_SPP (0) 101#define MACHINE_HAS_LPP (0)
100#define MACHINE_HAS_TOPOLOGY (0) 102#define MACHINE_HAS_TOPOLOGY (0)
101#define MACHINE_HAS_TE (0) 103#define MACHINE_HAS_TE (0)
102#define MACHINE_HAS_RRBM (0) 104#define MACHINE_HAS_RRBM (0)
@@ -109,7 +111,7 @@ extern unsigned int s390_user_mode;
109#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS) 111#define MACHINE_HAS_MVCOS (S390_lowcore.machine_flags & MACHINE_FLAG_MVCOS)
110#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1) 112#define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1)
111#define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2) 113#define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2)
112#define MACHINE_HAS_SPP (S390_lowcore.machine_flags & MACHINE_FLAG_SPP) 114#define MACHINE_HAS_LPP (S390_lowcore.machine_flags & MACHINE_FLAG_LPP)
113#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 115#define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY)
114#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE) 116#define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE)
115#define MACHINE_HAS_RRBM (S390_lowcore.machine_flags & MACHINE_FLAG_RRBM) 117#define MACHINE_HAS_RRBM (S390_lowcore.machine_flags & MACHINE_FLAG_RRBM)
diff --git a/arch/s390/include/asm/signal.h b/arch/s390/include/asm/signal.h
index db7ddfaf5b79..abf9e5735943 100644
--- a/arch/s390/include/asm/signal.h
+++ b/arch/s390/include/asm/signal.h
@@ -21,22 +21,5 @@ typedef struct {
21 unsigned long sig[_NSIG_WORDS]; 21 unsigned long sig[_NSIG_WORDS];
22} sigset_t; 22} sigset_t;
23 23
24struct old_sigaction { 24#define __ARCH_HAS_SA_RESTORER
25 __sighandler_t sa_handler;
26 old_sigset_t sa_mask;
27 unsigned long sa_flags;
28 void (*sa_restorer)(void);
29};
30
31struct sigaction {
32 __sighandler_t sa_handler;
33 unsigned long sa_flags;
34 void (*sa_restorer)(void);
35 sigset_t sa_mask; /* mask last for extensibility */
36};
37
38struct k_sigaction {
39 struct sigaction sa;
40};
41
42#endif 25#endif
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 4c060bb5b8ea..8ad8af915032 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -15,7 +15,7 @@
15#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL 15#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL
16 16
17/* Inline functions for clock register access. */ 17/* Inline functions for clock register access. */
18static inline int set_clock(__u64 time) 18static inline int set_tod_clock(__u64 time)
19{ 19{
20 int cc; 20 int cc;
21 21
@@ -27,7 +27,7 @@ static inline int set_clock(__u64 time)
27 return cc; 27 return cc;
28} 28}
29 29
30static inline int store_clock(__u64 *time) 30static inline int store_tod_clock(__u64 *time)
31{ 31{
32 int cc; 32 int cc;
33 33
@@ -71,7 +71,7 @@ static inline void local_tick_enable(unsigned long long comp)
71 71
72typedef unsigned long long cycles_t; 72typedef unsigned long long cycles_t;
73 73
74static inline unsigned long long get_clock(void) 74static inline unsigned long long get_tod_clock(void)
75{ 75{
76 unsigned long long clk; 76 unsigned long long clk;
77 77
@@ -83,21 +83,21 @@ static inline unsigned long long get_clock(void)
83 return clk; 83 return clk;
84} 84}
85 85
86static inline void get_clock_ext(char *clk) 86static inline void get_tod_clock_ext(char *clk)
87{ 87{
88 asm volatile("stcke %0" : "=Q" (*clk) : : "cc"); 88 asm volatile("stcke %0" : "=Q" (*clk) : : "cc");
89} 89}
90 90
91static inline unsigned long long get_clock_xt(void) 91static inline unsigned long long get_tod_clock_xt(void)
92{ 92{
93 unsigned char clk[16]; 93 unsigned char clk[16];
94 get_clock_ext(clk); 94 get_tod_clock_ext(clk);
95 return *((unsigned long long *)&clk[1]); 95 return *((unsigned long long *)&clk[1]);
96} 96}
97 97
98static inline cycles_t get_cycles(void) 98static inline cycles_t get_cycles(void)
99{ 99{
100 return (cycles_t) get_clock() >> 2; 100 return (cycles_t) get_tod_clock() >> 2;
101} 101}
102 102
103int get_sync_clock(unsigned long long *clock); 103int get_sync_clock(unsigned long long *clock);
@@ -123,9 +123,9 @@ extern u64 sched_clock_base_cc;
123 * function, otherwise the returned value is not guaranteed to 123 * function, otherwise the returned value is not guaranteed to
124 * be monotonic. 124 * be monotonic.
125 */ 125 */
126static inline unsigned long long get_clock_monotonic(void) 126static inline unsigned long long get_tod_clock_monotonic(void)
127{ 127{
128 return get_clock_xt() - sched_clock_base_cc; 128 return get_tod_clock_xt() - sched_clock_base_cc;
129} 129}
130 130
131/** 131/**
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index 34268df959a3..9c33ed4e666f 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -252,9 +252,7 @@ static inline unsigned long __must_check
252copy_to_user(void __user *to, const void *from, unsigned long n) 252copy_to_user(void __user *to, const void *from, unsigned long n)
253{ 253{
254 might_fault(); 254 might_fault();
255 if (access_ok(VERIFY_WRITE, to, n)) 255 return __copy_to_user(to, from, n);
256 n = __copy_to_user(to, from, n);
257 return n;
258} 256}
259 257
260/** 258/**
@@ -315,11 +313,7 @@ copy_from_user(void *to, const void __user *from, unsigned long n)
315 copy_from_user_overflow(); 313 copy_from_user_overflow();
316 return n; 314 return n;
317 } 315 }
318 if (access_ok(VERIFY_READ, from, n)) 316 return __copy_from_user(to, from, n);
319 n = __copy_from_user(to, from, n);
320 else
321 memset(to, 0, n);
322 return n;
323} 317}
324 318
325static inline unsigned long __must_check 319static inline unsigned long __must_check
@@ -332,9 +326,7 @@ static inline unsigned long __must_check
332copy_in_user(void __user *to, const void __user *from, unsigned long n) 326copy_in_user(void __user *to, const void __user *from, unsigned long n)
333{ 327{
334 might_fault(); 328 might_fault();
335 if (__access_ok(from,n) && __access_ok(to,n)) 329 return __copy_in_user(to, from, n);
336 n = __copy_in_user(to, from, n);
337 return n;
338} 330}
339 331
340/* 332/*
@@ -343,11 +335,8 @@ copy_in_user(void __user *to, const void __user *from, unsigned long n)
343static inline long __must_check 335static inline long __must_check
344strncpy_from_user(char *dst, const char __user *src, long count) 336strncpy_from_user(char *dst, const char __user *src, long count)
345{ 337{
346 long res = -EFAULT;
347 might_fault(); 338 might_fault();
348 if (access_ok(VERIFY_READ, src, 1)) 339 return uaccess.strncpy_from_user(count, src, dst);
349 res = uaccess.strncpy_from_user(count, src, dst);
350 return res;
351} 340}
352 341
353static inline unsigned long 342static inline unsigned long
@@ -387,9 +376,7 @@ static inline unsigned long __must_check
387clear_user(void __user *to, unsigned long n) 376clear_user(void __user *to, unsigned long n)
388{ 377{
389 might_fault(); 378 might_fault();
390 if (access_ok(VERIFY_WRITE, to, n)) 379 return uaccess.clear_user(n, to);
391 n = uaccess.clear_user(n, to);
392 return n;
393} 380}
394 381
395extern int copy_to_user_real(void __user *dest, void *src, size_t count); 382extern int copy_to_user_real(void __user *dest, void *src, size_t count);
diff --git a/arch/s390/include/asm/unistd.h b/arch/s390/include/asm/unistd.h
index 636530872516..a6667a952969 100644
--- a/arch/s390/include/asm/unistd.h
+++ b/arch/s390/include/asm/unistd.h
@@ -43,15 +43,12 @@
43#define __ARCH_WANT_SYS_OLDUMOUNT 43#define __ARCH_WANT_SYS_OLDUMOUNT
44#define __ARCH_WANT_SYS_SIGPENDING 44#define __ARCH_WANT_SYS_SIGPENDING
45#define __ARCH_WANT_SYS_SIGPROCMASK 45#define __ARCH_WANT_SYS_SIGPROCMASK
46#define __ARCH_WANT_SYS_RT_SIGACTION
47#define __ARCH_WANT_SYS_RT_SIGSUSPEND
48# ifndef CONFIG_64BIT 46# ifndef CONFIG_64BIT
49# define __ARCH_WANT_STAT64 47# define __ARCH_WANT_STAT64
50# define __ARCH_WANT_SYS_TIME 48# define __ARCH_WANT_SYS_TIME
51# endif 49# endif
52# ifdef CONFIG_COMPAT 50# ifdef CONFIG_COMPAT
53# define __ARCH_WANT_COMPAT_SYS_TIME 51# define __ARCH_WANT_COMPAT_SYS_TIME
54# define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
55# endif 52# endif
56#define __ARCH_WANT_SYS_FORK 53#define __ARCH_WANT_SYS_FORK
57#define __ARCH_WANT_SYS_VFORK 54#define __ARCH_WANT_SYS_VFORK