From: Mike Rapoport <rppt@linux.ibm.com>
To: Pekka Enberg <penberg@gmail.com>
Cc: linux-riscv@lists.infradead.org, linux-mm@kvack.org,
Pekka Enberg <penberg@kernel.org>,
Palmer Dabbelt <palmerdabbelt@google.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU
Date: Tue, 14 Jul 2020 14:53:57 +0300 [thread overview]
Message-ID: <20200714115357.GB1166045@linux.ibm.com> (raw)
In-Reply-To: <20200714100051.345018-1-penberg@gmail.com>
On Tue, Jul 14, 2020 at 01:00:50PM +0300, Pekka Enberg wrote:
> From: Pekka Enberg <penberg@kernel.org>
>
> The <linux/pgtable.h> header defines some generic pgprot_*
> implementations, but they are only available when CONFIG_MMU is enabled.
> The RISC-V architecture, for example, therefore defines some of these
> pgprot_* macros for !NOMMU.
>
> Let's make the pgprot_* generic available even for !NOMMU so we can
> remove the RISC-V specific definitions.
>
> Compile-tested with x86 defconfig, and riscv defconfig and !MMU defconfig.
>
> Suggested-by: Palmer Dabbelt <palmerdabbelt@google.com>
> Cc: Mike Rapoport <rppt@linux.ibm.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> include/linux/pgtable.h | 69 +++++++++++++++++++++--------------------
> 1 file changed, 35 insertions(+), 34 deletions(-)
>
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index 56c1e8eb7bb0..ed9026ad7c31 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -647,40 +647,6 @@ static inline int arch_unmap_one(struct mm_struct *mm,
> #define flush_tlb_fix_spurious_fault(vma, address) flush_tlb_page(vma, address)
> #endif
>
> -#ifndef pgprot_nx
> -#define pgprot_nx(prot) (prot)
> -#endif
> -
> -#ifndef pgprot_noncached
> -#define pgprot_noncached(prot) (prot)
> -#endif
> -
> -#ifndef pgprot_writecombine
> -#define pgprot_writecombine pgprot_noncached
> -#endif
> -
> -#ifndef pgprot_writethrough
> -#define pgprot_writethrough pgprot_noncached
> -#endif
> -
> -#ifndef pgprot_device
> -#define pgprot_device pgprot_noncached
> -#endif
> -
> -#ifndef pgprot_modify
> -#define pgprot_modify pgprot_modify
> -static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
> -{
> - if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot)))
> - newprot = pgprot_noncached(newprot);
> - if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot)))
> - newprot = pgprot_writecombine(newprot);
> - if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot)))
> - newprot = pgprot_device(newprot);
> - return newprot;
> -}
> -#endif
> -
> /*
> * When walking page tables, get the address of the next boundary,
> * or the end address of the range if that comes earlier. Although no
> @@ -840,6 +806,41 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
> * No-op macros that just return the current protection value. Defined here
> * because these macros can be used used even if CONFIG_MMU is not defined.
> */
> +
> +#ifndef pgprot_nx
> +#define pgprot_nx(prot) (prot)
> +#endif
> +
> +#ifndef pgprot_noncached
> +#define pgprot_noncached(prot) (prot)
> +#endif
> +
> +#ifndef pgprot_writecombine
> +#define pgprot_writecombine pgprot_noncached
> +#endif
> +
> +#ifndef pgprot_writethrough
> +#define pgprot_writethrough pgprot_noncached
> +#endif
> +
> +#ifndef pgprot_device
> +#define pgprot_device pgprot_noncached
> +#endif
> +
> +#ifndef pgprot_modify
> +#define pgprot_modify pgprot_modify
> +static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
> +{
> + if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot)))
> + newprot = pgprot_noncached(newprot);
> + if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot)))
> + newprot = pgprot_writecombine(newprot);
> + if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot)))
> + newprot = pgprot_device(newprot);
> + return newprot;
> +}
> +#endif
> +
> #ifndef pgprot_encrypted
> #define pgprot_encrypted(prot) (prot)
> #endif
> --
> 2.26.2
>
--
Sincerely yours,
Mike.
next prev parent reply other threads:[~2020-07-14 11:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 10:00 [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU Pekka Enberg
2020-07-14 10:00 ` [PATCH 2/2] riscv: Use generic pgprot_* macros from <linux/pgtable.h> Pekka Enberg
2020-07-14 11:53 ` Mike Rapoport [this message]
2020-07-14 20:42 ` [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200714115357.GB1166045@linux.ibm.com \
--to=rppt@linux.ibm.com \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmerdabbelt@google.com \
--cc=penberg@gmail.com \
--cc=penberg@kernel.org \
--cc=thomas.lendacky@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).