[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+ZOyajoTagPdMA=WaQVLZ+aPzKmdX=j+apRVUsvpbVF_HtnQw@mail.gmail.com>
Date: Thu, 24 Oct 2019 21:09:03 +0800
From: Zong Li <zongbox@...il.com>
To: Steven Price <steven.price@....com>
Cc: linux-mm@...ck.org, Mark Rutland <Mark.Rutland@....com>,
Peter Zijlstra <peterz@...radead.org>,
Catalin Marinas <catalin.marinas@....com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>, linux-riscv@...ts.infradead.org,
Will Deacon <will@...nel.org>,
"Liang, Kan" <kan.liang@...ux.intel.com>,
Alexandre Ghiti <alex@...ti.fr>, x86@...nel.org,
Ingo Molnar <mingo@...hat.com>,
Palmer Dabbelt <palmer@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>,
Arnd Bergmann <arnd@...db.de>,
Jérôme Glisse <jglisse@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-arm-kernel@...ts.infradead.org,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
James Morse <james.morse@....com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v13 07/22] riscv: mm: Add p?d_leaf() definitions
Steven Price <steven.price@....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@...ive.com>
> CC: Albert Ou <aou@...s.berkeley.edu>
> CC: linux-riscv@...ts.infradead.org
> Reviewed-by: Alexandre Ghiti <alex@...ti.fr>
> Acked-by: Paul Walmsley <paul.walmsley@...ive.com> # for arch/riscv
> Signed-off-by: Steven Price <steven.price@....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@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
It's good to me.
Reviewed-by: Zong Li <zong.li@...ive.com>
Powered by blists - more mailing lists