| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
|
| 3 |
#ifndef _ASM_S390_ASCE_H |
| 4 |
#define _ASM_S390_ASCE_H |
| 5 |
|
| 6 |
#include <linux/thread_info.h> |
| 7 |
#include <linux/irqflags.h> |
| 8 |
#include <asm/lowcore.h> |
| 9 |
#include <asm/ctlreg.h> |
| 10 |
|
| 11 |
static inline bool enable_sacf_uaccess(void) |
| 12 |
{ |
| 13 |
unsigned long flags; |
| 14 |
|
| 15 |
if (test_thread_flag(TIF_ASCE_PRIMARY)) |
| 16 |
return true; |
| 17 |
local_irq_save(flags); |
| 18 |
local_ctl_load(1, &get_lowcore()->kernel_asce); |
| 19 |
set_thread_flag(TIF_ASCE_PRIMARY); |
| 20 |
local_irq_restore(flags); |
| 21 |
return false; |
| 22 |
} |
| 23 |
|
| 24 |
static inline void disable_sacf_uaccess(bool previous) |
| 25 |
{ |
| 26 |
unsigned long flags; |
| 27 |
|
| 28 |
if (previous) |
| 29 |
return; |
| 30 |
local_irq_save(flags); |
| 31 |
local_ctl_load(1, &get_lowcore()->user_asce); |
| 32 |
clear_thread_flag(TIF_ASCE_PRIMARY); |
| 33 |
local_irq_restore(flags); |
| 34 |
} |
| 35 |
|
| 36 |
#endif /* _ASM_S390_ASCE_H */ |