* [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU
@ 2020-07-14 10:00 Pekka Enberg
2020-07-14 10:00 ` [PATCH 2/2] riscv: Use generic pgprot_* macros from <linux/pgtable.h> Pekka Enberg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pekka Enberg @ 2020-07-14 10:00 UTC (permalink / raw)
To: linux-riscv, linux-mm
Cc: Pekka Enberg, Tom Lendacky, Palmer Dabbelt, Mike Rapoport
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>
---
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] riscv: Use generic pgprot_* macros from <linux/pgtable.h>
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 ` Pekka Enberg
2020-07-14 11:53 ` [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU Mike Rapoport
2020-07-14 20:42 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2020-07-14 10:00 UTC (permalink / raw)
To: linux-riscv, linux-mm; +Cc: Pekka Enberg, Palmer Dabbelt
From: Pekka Enberg <penberg@kernel.org>
The <linux/pgtable.h> header now defines generic pgprot_ macros also for
the no-MMU configuration, so let's use them.
Cc: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
arch/riscv/include/asm/mmio.h | 6 ------
1 file changed, 6 deletions(-)
diff --git a/arch/riscv/include/asm/mmio.h b/arch/riscv/include/asm/mmio.h
index 56053c9838b2..aff6c33ab0c0 100644
--- a/arch/riscv/include/asm/mmio.h
+++ b/arch/riscv/include/asm/mmio.h
@@ -14,12 +14,6 @@
#include <linux/types.h>
#include <asm/mmiowb.h>
-#ifndef CONFIG_MMU
-#define pgprot_noncached(x) (x)
-#define pgprot_writecombine(x) (x)
-#define pgprot_device(x) (x)
-#endif /* CONFIG_MMU */
-
/* Generic IO read/write. These perform native-endian accesses. */
#define __raw_writeb __raw_writeb
static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
--
2.26.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU
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
2020-07-14 20:42 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: Mike Rapoport @ 2020-07-14 11:53 UTC (permalink / raw)
To: Pekka Enberg
Cc: Pekka Enberg, linux-mm, linux-riscv, Palmer Dabbelt, Tom Lendacky
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.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU
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 ` [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU Mike Rapoport
@ 2020-07-14 20:42 ` kernel test robot
2 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2020-07-14 20:42 UTC (permalink / raw)
To: Pekka Enberg, linux-riscv, linux-mm
Cc: Pekka Enberg, Tom Lendacky, Palmer Dabbelt, kbuild-all, Mike Rapoport
[-- Attachment #1: Type: text/plain, Size: 2928 bytes --]
Hi Pekka,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.8-rc5 next-20200714]
[cannot apply to mmotm/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Pekka-Enberg/mm-pgtable-Make-generic-pgprot_-macros-available-for-no-MMU/20200714-180502
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 0dc589da873b58b70f4caf4b070fb0cf70fdd1dc
config: arm-randconfig-r033-20200714 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/mm.h:32,
from include/linux/scatterlist.h:8,
from include/linux/dma-mapping.h:11,
from drivers/gpu/drm/tilcdc/tilcdc_crtc.c:8:
include/linux/pgtable.h: In function 'pgprot_modify':
>> include/linux/pgtable.h:834:26: error: self-comparison always evaluates to true [-Werror=tautological-compare]
834 | if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot)))
| ^~
include/linux/pgtable.h:836:26: error: self-comparison always evaluates to true [-Werror=tautological-compare]
836 | if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot)))
| ^~
include/linux/pgtable.h:838:26: error: self-comparison always evaluates to true [-Werror=tautological-compare]
838 | if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot)))
| ^~
cc1: all warnings being treated as errors
vim +834 include/linux/pgtable.h
829
830 #ifndef pgprot_modify
831 #define pgprot_modify pgprot_modify
832 static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
833 {
> 834 if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot)))
835 newprot = pgprot_noncached(newprot);
836 if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot)))
837 newprot = pgprot_writecombine(newprot);
838 if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot)))
839 newprot = pgprot_device(newprot);
840 return newprot;
841 }
842 #endif
843
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27605 bytes --]
[-- Attachment #3: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-14 20:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/2] mm: pgtable: Make generic pgprot_* macros available for no-MMU Mike Rapoport
2020-07-14 20:42 ` kernel test robot
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).