diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2016-04-29 09:25:33 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-05-01 04:32:25 -0400 |
commit | e7bfc462d32fc417d3fea8ad07b62b59f000e925 (patch) | |
tree | 0edee82e64f61f039995204b669dcf581341b178 | |
parent | 7e1e63c5e9d694c1198d410a6c7b2d0fa06da355 (diff) |
powerpc/mm: Use pte_user() instead of open coding
We have a common declaration in pte-common.h Add a book3s specific one
and switch to pte_user() in callchain.c. In a subsequent patch we will
switch _PAGE_USER to _PAGE_PRIVILEGED in the book3s version only.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/include/asm/book3s/64/pgtable.h | 5 | ||||
-rw-r--r-- | arch/powerpc/perf/callchain.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 77d3ce05798e..60e84260a07d 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h | |||
@@ -185,6 +185,11 @@ extern struct page *pgd_page(pgd_t pgd); | |||
185 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) & ~_PAGE_PTE }) | 185 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) & ~_PAGE_PTE }) |
186 | #define __swp_entry_to_pte(x) __pte((x).val | _PAGE_PTE) | 186 | #define __swp_entry_to_pte(x) __pte((x).val | _PAGE_PTE) |
187 | 187 | ||
188 | static inline bool pte_user(pte_t pte) | ||
189 | { | ||
190 | return !!(pte_val(pte) & _PAGE_USER); | ||
191 | } | ||
192 | |||
188 | #ifdef CONFIG_MEM_SOFT_DIRTY | 193 | #ifdef CONFIG_MEM_SOFT_DIRTY |
189 | #define _PAGE_SWP_SOFT_DIRTY (1UL << (SWP_TYPE_BITS + _PAGE_BIT_SWAP_TYPE)) | 194 | #define _PAGE_SWP_SOFT_DIRTY (1UL << (SWP_TYPE_BITS + _PAGE_BIT_SWAP_TYPE)) |
190 | #else | 195 | #else |
diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c index e04a6752b399..0071de76d776 100644 --- a/arch/powerpc/perf/callchain.c +++ b/arch/powerpc/perf/callchain.c | |||
@@ -137,7 +137,7 @@ static int read_user_stack_slow(void __user *ptr, void *buf, int nb) | |||
137 | offset = addr & ((1UL << shift) - 1); | 137 | offset = addr & ((1UL << shift) - 1); |
138 | 138 | ||
139 | pte = READ_ONCE(*ptep); | 139 | pte = READ_ONCE(*ptep); |
140 | if (!pte_present(pte) || !(pte_val(pte) & _PAGE_USER)) | 140 | if (!pte_present(pte) || !pte_user(pte)) |
141 | goto err_out; | 141 | goto err_out; |
142 | pfn = pte_pfn(pte); | 142 | pfn = pte_pfn(pte); |
143 | if (!page_is_ram(pfn)) | 143 | if (!page_is_ram(pfn)) |