Balbir Singh [off-list ref] writes:
[ text/plain ]
On 27/03/16 19:23, Aneesh Kumar K.V wrote:
quoted
We have common declaration in pte-common.h Add book3s specific one
and switch to pte_user. In the later patch we will be switching
_PAGE_USER to _PAGE_PRIVILEGED
Signed-off-by: Aneesh Kumar K.V <redacted>
---
arch/powerpc/include/asm/book3s/64/pgtable.h | 5 +++++
arch/powerpc/perf/callchain.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h
index 77d3ce05798e..4ac6221802ad 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);
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val((pte)) & ~_PAGE_PTE })
#define __swp_entry_to_pte(x) __pte((x).val | _PAGE_PTE)
+static inline bool pte_user(pte_t pte)
+{
+ return (pte_val(pte) & _PAGE_USER);
+}
Ideally this should be
return !!(pte_val(pte) & _PAGE_USER)
for consistency with page_present() and the fact that it returns a bool
Fixed. I missed that because later patch convert this to
!(pte_val(pte) & _PAGE_PRIVILEGED).
-aneesh