diff mbox

mm: provide a fallback for PAGE_KERNEL_RO for architectures

Message ID 20180428001526.22475-1-mcgrof@kernel.org
State New, archived
Headers show

Commit Message

Luis Chamberlain April 28, 2018, 12:15 a.m. UTC
Some architectures do not define PAGE_KERNEL_RO, best we can do
for them is to provide a fallback onto PAGE_KERNEL. Remove the
hack from the firmware loader and move it onto the asm-generic
header, and document while at it the affected architectures
which do not have a PAGE_KERNEL_RO:

  o alpha
  o ia64
  o m68k
  o mips
  o sparc64
  o sparc

Blessed-by: 0-day
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 drivers/base/firmware_loader/fallback.c |  5 -----
 include/asm-generic/pgtable.h           | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

Comments

Greg Kroah-Hartman April 28, 2018, 5:04 a.m. UTC | #1
On Fri, Apr 27, 2018 at 05:15:26PM -0700, Luis R. Rodriguez wrote:
> Some architectures do not define PAGE_KERNEL_RO, best we can do
> for them is to provide a fallback onto PAGE_KERNEL. Remove the
> hack from the firmware loader and move it onto the asm-generic
> header, and document while at it the affected architectures
> which do not have a PAGE_KERNEL_RO:
> 
>   o alpha
>   o ia64
>   o m68k
>   o mips
>   o sparc64
>   o sparc
> 
> Blessed-by: 0-day

New tag?  :)
Geert Uytterhoeven May 2, 2018, 10:08 a.m. UTC | #2
Hi Luis,

On Sat, Apr 28, 2018 at 2:15 AM, Luis R. Rodriguez <mcgrof@kernel.org> wrote:
> Some architectures do not define PAGE_KERNEL_RO, best we can do
> for them is to provide a fallback onto PAGE_KERNEL. Remove the
> hack from the firmware loader and move it onto the asm-generic
> header, and document while at it the affected architectures
> which do not have a PAGE_KERNEL_RO:
>
>   o alpha
>   o ia64
>   o m68k
>   o mips
>   o sparc64
>   o sparc
>
> Blessed-by: 0-day
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>

I believe the "best we can do" is to add the missing definitions for the
architectures where the hardware does support it?

Gr{oetje,eeting}s,

                        Geert
Luis Chamberlain May 2, 2018, 3:11 p.m. UTC | #3
On Wed, May 02, 2018 at 12:08:57PM +0200, Geert Uytterhoeven wrote:
> Hi Luis,
> 
> On Sat, Apr 28, 2018 at 2:15 AM, Luis R. Rodriguez <mcgrof@kernel.org> wrote:
> > Some architectures do not define PAGE_KERNEL_RO, best we can do
> > for them is to provide a fallback onto PAGE_KERNEL. Remove the
> > hack from the firmware loader and move it onto the asm-generic
> > header, and document while at it the affected architectures
> > which do not have a PAGE_KERNEL_RO:
> >
> >   o alpha
> >   o ia64
> >   o m68k
> >   o mips
> >   o sparc64
> >   o sparc
> >
> > Blessed-by: 0-day
> > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> 
> I believe the "best we can do" is to add the missing definitions for the
> architectures where the hardware does support it?

True, but we cannot wait for every architecture to implement a feature to then
such generics upstream, specially when we have common places which use that.
Matthew did send a patch to add ia64 support for PAGE_KERNEL_RO, so I'll
respin the patch to add that and also move the other define he suggested.

At least we'd now have a list of documented archs which need further work too.

  Luis
Luis Chamberlain May 10, 2018, 1:24 a.m. UTC | #4
On Wed, May 02, 2018 at 03:11:13PM +0000, Luis R. Rodriguez wrote:
> On Wed, May 02, 2018 at 12:08:57PM +0200, Geert Uytterhoeven wrote:
> > Hi Luis,
> > 
> > On Sat, Apr 28, 2018 at 2:15 AM, Luis R. Rodriguez <mcgrof@kernel.org> wrote:
> > > Some architectures do not define PAGE_KERNEL_RO, best we can do
> > > for them is to provide a fallback onto PAGE_KERNEL. Remove the
> > > hack from the firmware loader and move it onto the asm-generic
> > > header, and document while at it the affected architectures
> > > which do not have a PAGE_KERNEL_RO:
> > >
> > >   o alpha
> > >   o ia64
> > >   o m68k
> > >   o mips
> > >   o sparc64
> > >   o sparc
> > >
> > > Blessed-by: 0-day
> > > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> > 
> > I believe the "best we can do" is to add the missing definitions for the
> > architectures where the hardware does support it?
> 
> True, but we cannot wait for every architecture to implement a feature to then
> such generics upstream, 

Come to think of it your point was the wording. I changed it to not be as misleading.

  Luis
diff mbox

Patch

diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
index 31b5015b59fe..90f36be9e5ca 100644
--- a/drivers/base/firmware_loader/fallback.c
+++ b/drivers/base/firmware_loader/fallback.c
@@ -219,11 +219,6 @@  static ssize_t firmware_loading_show(struct device *dev,
 	return sprintf(buf, "%d\n", loading);
 }
 
-/* Some architectures don't have PAGE_KERNEL_RO */
-#ifndef PAGE_KERNEL_RO
-#define PAGE_KERNEL_RO PAGE_KERNEL
-#endif
-
 /* one pages buffer should be mapped/unmapped only once */
 static int map_fw_priv_pages(struct fw_priv *fw_priv)
 {
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index f59639afaa39..da47fe81df51 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -1083,6 +1083,21 @@  int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
 static inline void init_espfix_bsp(void) { }
 #endif
 
+/*
+ * Some architectures don't have PAGE_KERNEL_RO. This is the best
+ * we can do for them buggers for now. Currently known to not have it:
+ *
+ *  o alpha
+ *  o ia64
+ *  o m68k
+ *  o mips
+ *  o sparc64
+ *  o sparc
+ */
+#ifndef PAGE_KERNEL_RO
+#define PAGE_KERNEL_RO PAGE_KERNEL
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #ifndef io_remap_pfn_range