x86/fpu: Use pkru_write_default() in copy_init_fpstate_to_fpregs()
[linux-2.6-microblaze.git] / arch / x86 / mm / pkeys.c
index a2332ee..fb171a5 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <asm/cpufeature.h>             /* boot_cpu_has, ...            */
 #include <asm/mmu_context.h>            /* vma_pkey()                   */
-#include <asm/fpu/internal.h>          /* init_fpstate                 */
 
 int __execute_only_pkey(struct mm_struct *mm)
 {
@@ -125,22 +124,6 @@ u32 init_pkru_value = PKRU_AD_KEY( 1) | PKRU_AD_KEY( 2) | PKRU_AD_KEY( 3) |
                      PKRU_AD_KEY(10) | PKRU_AD_KEY(11) | PKRU_AD_KEY(12) |
                      PKRU_AD_KEY(13) | PKRU_AD_KEY(14) | PKRU_AD_KEY(15);
 
-/*
- * Called from the FPU code when creating a fresh set of FPU
- * registers.  This is called from a very specific context where
- * we know the FPU registers are safe for use and we can use PKRU
- * directly.
- */
-void copy_init_pkru_to_fpregs(void)
-{
-       u32 init_pkru_value_snapshot = READ_ONCE(init_pkru_value);
-       /*
-        * Override the PKRU state that came from 'init_fpstate'
-        * with the baseline from the process.
-        */
-       write_pkru(init_pkru_value_snapshot);
-}
-
 static ssize_t init_pkru_read_file(struct file *file, char __user *user_buf,
                             size_t count, loff_t *ppos)
 {
@@ -154,7 +137,6 @@ static ssize_t init_pkru_read_file(struct file *file, char __user *user_buf,
 static ssize_t init_pkru_write_file(struct file *file,
                 const char __user *user_buf, size_t count, loff_t *ppos)
 {
-       struct pkru_state *pk;
        char buf[32];
        ssize_t len;
        u32 new_init_pkru;
@@ -177,10 +159,6 @@ static ssize_t init_pkru_write_file(struct file *file,
                return -EINVAL;
 
        WRITE_ONCE(init_pkru_value, new_init_pkru);
-       pk = get_xsave_addr(&init_fpstate.xsave, XFEATURE_PKRU);
-       if (!pk)
-               return -EINVAL;
-       pk->pkru = new_init_pkru;
        return count;
 }