[RFC PATCH v2 07/21] riscv: mm: Reimplement page table entry get function
Xu Lu
luxu.kernel at bytedance.com
Thu Dec 5 02:37:15 PST 2024
This commit reimplements ptep_get/pmdp_get/... functions. As pte
structures now contains multiple mapping entries, we can not use
READ_ONCE to fetch its value. Instead, we use traditional dereference
way.
Signed-off-by: Xu Lu <luxu.kernel at bytedance.com>
---
arch/riscv/include/asm/pgtable.h | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index d3da8aee213c..ba4a083b7210 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -704,6 +704,36 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
WRITE_ONCE(*ptep, pteval);
}
+static inline pte_t ptep_get(pte_t *ptep)
+{
+ return *ptep;
+}
+#define ptep_get ptep_get
+
+static inline pmd_t pmdp_get(pmd_t *pmdp)
+{
+ return *pmdp;
+}
+#define pmdp_get pmdp_get
+
+static inline pud_t pudp_get(pud_t *pudp)
+{
+ return *pudp;
+}
+#define pudp_get pudp_get
+
+static inline p4d_t p4dp_get(p4d_t *p4dp)
+{
+ return *p4dp;
+}
+#define p4dp_get p4dp_get
+
+static inline pgd_t pgdp_get(pgd_t *pgdp)
+{
+ return *pgdp;
+}
+#define pgdp_get pgdp_get
+
void flush_icache_pte(struct mm_struct *mm, pte_t pte);
static inline void __set_pte_at(struct mm_struct *mm, pte_t *ptep, pte_t pteval)
--
2.20.1
More information about the linux-riscv
mailing list