]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/powerpc/mm/pkeys.c
Merge tag 'powerpc-4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
[linux.git] / arch / powerpc / mm / pkeys.c
index ba71c5481f42152683ad8a38c714b4c703d88b11..0eafdf01edc7d4bdaf04a7c1021ab19a3b5e808d 100644 (file)
@@ -119,18 +119,15 @@ int pkey_initialize(void)
 #else
        os_reserved = 0;
 #endif
+       initial_allocation_mask = ~0x0;
+       pkey_amr_uamor_mask = ~0x0ul;
+       pkey_iamr_mask = ~0x0ul;
        /*
-        * Bits are in LE format. NOTE: 1, 0 are reserved.
+        * key 0, 1 are reserved.
         * key 0 is the default key, which allows read/write/execute.
         * key 1 is recommended not to be used. PowerISA(3.0) page 1015,
         * programming note.
         */
-       initial_allocation_mask = ~0x0;
-
-       /* register mask is in BE format */
-       pkey_amr_uamor_mask = ~0x0ul;
-       pkey_iamr_mask = ~0x0ul;
-
        for (i = 2; i < (pkeys_total - os_reserved); i++) {
                initial_allocation_mask &= ~(0x1 << i);
                pkey_amr_uamor_mask &= ~(0x3ul << pkeyshift(i));
@@ -308,9 +305,9 @@ void thread_pkey_regs_init(struct thread_struct *thread)
        if (static_branch_likely(&pkey_disabled))
                return;
 
-       write_amr(read_amr() & pkey_amr_uamor_mask);
-       write_iamr(read_iamr() & pkey_iamr_mask);
-       write_uamor(read_uamor() & pkey_amr_uamor_mask);
+       thread->amr = read_amr() & pkey_amr_uamor_mask;
+       thread->iamr = read_iamr() & pkey_iamr_mask;
+       thread->uamor = read_uamor() & pkey_amr_uamor_mask;
 }
 
 static inline bool pkey_allows_readwrite(int pkey)