diff options
author | Xiao Guangrong <guangrong.xiao@linux.intel.com> | 2016-03-22 11:51:17 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-22 18:21:05 +0300 |
commit | 9e90199c25aec31b4509213881511948f6c763c8 (patch) | |
tree | e2cf6063637ff350c97664d1f1fc4075584b67f4 /arch/x86/include/asm/pgtable.h | |
parent | 17a511f878505d31f298de443269b3070c134163 (diff) | |
download | linux-9e90199c25aec31b4509213881511948f6c763c8.tar.xz |
x86: pkey: introduce write_pkru() for KVM
KVM will use it to switch pkru between guest and host.
CC: Ingo Molnar <mingo@redhat.com>
CC: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Huaitong Han <huaitong.han@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/pgtable.h')
-rw-r--r-- | arch/x86/include/asm/pgtable.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 1ff49ec29ece..97f3242e133c 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -107,6 +107,12 @@ static inline u32 read_pkru(void) return 0; } +static inline void write_pkru(u32 pkru) +{ + if (boot_cpu_has(X86_FEATURE_OSPKE)) + __write_pkru(pkru); +} + static inline int pte_young(pte_t pte) { return pte_flags(pte) & _PAGE_ACCESSED; |