* [PATCH v13 07/22] riscv: mm: Add p?d_leaf() definitions [not found] <20191024093716.49420-1-steven.price@arm.com> @ 2019-10-24 9:37 ` Steven Price 2019-10-24 13:09 ` Zong Li 0 siblings, 1 reply; 2+ messages in thread From: Steven Price @ 2019-10-24 9:37 UTC (permalink / raw) To: linux-mm Cc: Mark Rutland, Peter Zijlstra, Catalin Marinas, Dave Hansen, H. Peter Anvin, linux-riscv, Will Deacon, Liang, Kan, Alexandre Ghiti, x86, Steven Price, Ingo Molnar, Palmer Dabbelt, Albert Ou, Arnd Bergmann, Jérôme Glisse, Borislav Petkov, Andy Lutomirski, Paul Walmsley, Thomas Gleixner, linux-arm-kernel, Ard Biesheuvel, linux-kernel, James Morse, Andrew Morton walk_page_range() is going to be allowed to walk page tables other than those of user space. For this it needs to know when it has reached a 'leaf' entry in the page tables. This information is provided by the p?d_leaf() functions/macros. For riscv a page is a leaf page when it has a read, write or execute bit set on it. CC: Palmer Dabbelt <palmer@sifive.com> CC: Albert Ou <aou@eecs.berkeley.edu> CC: linux-riscv@lists.infradead.org Reviewed-by: Alexandre Ghiti <alex@ghiti.fr> Acked-by: Paul Walmsley <paul.walmsley@sifive.com> # for arch/riscv Signed-off-by: Steven Price <steven.price@arm.com> --- arch/riscv/include/asm/pgtable-64.h | 7 +++++++ arch/riscv/include/asm/pgtable.h | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h index 74630989006d..4c4d2c65ba6c 100644 --- a/arch/riscv/include/asm/pgtable-64.h +++ b/arch/riscv/include/asm/pgtable-64.h @@ -43,6 +43,13 @@ static inline int pud_bad(pud_t pud) return !pud_present(pud); } +#define pud_leaf pud_leaf +static inline int pud_leaf(pud_t pud) +{ + return pud_present(pud) && + (pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); +} + static inline void set_pud(pud_t *pudp, pud_t pud) { *pudp = pud; diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 7255f2d8395b..3aa972dda75a 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -130,6 +130,13 @@ static inline int pmd_bad(pmd_t pmd) return !pmd_present(pmd); } +#define pmd_leaf pmd_leaf +static inline int pmd_leaf(pmd_t pmd) +{ + return pmd_present(pmd) && + (pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); +} + static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) { *pmdp = pmd; -- 2.20.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v13 07/22] riscv: mm: Add p?d_leaf() definitions 2019-10-24 9:37 ` [PATCH v13 07/22] riscv: mm: Add p?d_leaf() definitions Steven Price @ 2019-10-24 13:09 ` Zong Li 0 siblings, 0 replies; 2+ messages in thread From: Zong Li @ 2019-10-24 13:09 UTC (permalink / raw) To: Steven Price Cc: Mark Rutland, Peter Zijlstra, Catalin Marinas, Dave Hansen, linux-mm, Albert Ou, H. Peter Anvin, linux-riscv, Will Deacon, Liang, Kan, Alexandre Ghiti, x86, Ingo Molnar, Palmer Dabbelt, Arnd Bergmann, Jérôme Glisse, Borislav Petkov, Andy Lutomirski, Paul Walmsley, Thomas Gleixner, linux-arm-kernel, Ard Biesheuvel, Linux Kernel Mailing List, James Morse, Andrew Morton Steven Price <steven.price@arm.com> 於 2019年10月24日 週四 下午5:40寫道: > > walk_page_range() is going to be allowed to walk page tables other than > those of user space. For this it needs to know when it has reached a > 'leaf' entry in the page tables. This information is provided by the > p?d_leaf() functions/macros. > > For riscv a page is a leaf page when it has a read, write or execute bit > set on it. > > CC: Palmer Dabbelt <palmer@sifive.com> > CC: Albert Ou <aou@eecs.berkeley.edu> > CC: linux-riscv@lists.infradead.org > Reviewed-by: Alexandre Ghiti <alex@ghiti.fr> > Acked-by: Paul Walmsley <paul.walmsley@sifive.com> # for arch/riscv > Signed-off-by: Steven Price <steven.price@arm.com> > --- > arch/riscv/include/asm/pgtable-64.h | 7 +++++++ > arch/riscv/include/asm/pgtable.h | 7 +++++++ > 2 files changed, 14 insertions(+) > > diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h > index 74630989006d..4c4d2c65ba6c 100644 > --- a/arch/riscv/include/asm/pgtable-64.h > +++ b/arch/riscv/include/asm/pgtable-64.h > @@ -43,6 +43,13 @@ static inline int pud_bad(pud_t pud) > return !pud_present(pud); > } > > +#define pud_leaf pud_leaf > +static inline int pud_leaf(pud_t pud) > +{ > + return pud_present(pud) && > + (pud_val(pud) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); > +} > + > static inline void set_pud(pud_t *pudp, pud_t pud) > { > *pudp = pud; > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index 7255f2d8395b..3aa972dda75a 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -130,6 +130,13 @@ static inline int pmd_bad(pmd_t pmd) > return !pmd_present(pmd); > } > > +#define pmd_leaf pmd_leaf > +static inline int pmd_leaf(pmd_t pmd) > +{ > + return pmd_present(pmd) && > + (pmd_val(pmd) & (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC)); > +} > + > static inline void set_pmd(pmd_t *pmdp, pmd_t pmd) > { > *pmdp = pmd; > -- > 2.20.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv It's good to me. Reviewed-by: Zong Li <zong.li@sifive.com> _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-24 13:09 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20191024093716.49420-1-steven.price@arm.com> 2019-10-24 9:37 ` [PATCH v13 07/22] riscv: mm: Add p?d_leaf() definitions Steven Price 2019-10-24 13:09 ` Zong Li
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).