|
@@ -1581,6 +1581,30 @@ out_exit:
|
|
|
local_irq_restore(flags);
|
|
local_irq_restore(flags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+#ifdef CONFIG_PPC_MEM_KEYS
|
|
|
|
|
+/*
|
|
|
|
|
+ * Return the protection key associated with the given address and the
|
|
|
|
|
+ * mm_struct.
|
|
|
|
|
+ */
|
|
|
|
|
+u16 get_mm_addr_key(struct mm_struct *mm, unsigned long address)
|
|
|
|
|
+{
|
|
|
|
|
+ pte_t *ptep;
|
|
|
|
|
+ u16 pkey = 0;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
+
|
|
|
|
|
+ if (!mm || !mm->pgd)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+
|
|
|
|
|
+ local_irq_save(flags);
|
|
|
|
|
+ ptep = find_linux_pte(mm->pgd, address, NULL, NULL);
|
|
|
|
|
+ if (ptep)
|
|
|
|
|
+ pkey = pte_to_pkey_bits(pte_val(READ_ONCE(*ptep)));
|
|
|
|
|
+ local_irq_restore(flags);
|
|
|
|
|
+
|
|
|
|
|
+ return pkey;
|
|
|
|
|
+}
|
|
|
|
|
+#endif /* CONFIG_PPC_MEM_KEYS */
|
|
|
|
|
+
|
|
|
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
|
|
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
|
|
|
static inline void tm_flush_hash_page(int local)
|
|
static inline void tm_flush_hash_page(int local)
|
|
|
{
|
|
{
|