All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE
@ 2015-07-13 16:12 ` Paul Burton
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Burton @ 2015-07-13 16:12 UTC (permalink / raw)
  To: linux-mips
  Cc: Paul Burton, Steven J. Hill, Joshua Kinard, linux-kernel,
	Rafał Miłecki, James Hogan, Markos Chandras,
	Ralf Baechle

After writing the appropriate mask to the cop0 PageMask register, read
the register back & check it matches what we want. If it doesn't then
the MMU does not support the page size the kernel is configured for and
we're better off bailing than continuing to do odd things with TLB
exceptions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/mm/tlb-r4k.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 08318ec..4330315 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -19,6 +19,7 @@
 #include <asm/cpu.h>
 #include <asm/cpu-type.h>
 #include <asm/bootinfo.h>
+#include <asm/hazards.h>
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/tlb.h>
@@ -486,6 +487,10 @@ static void r4k_tlb_configure(void)
 	 *     be set to fixed-size pages.
 	 */
 	write_c0_pagemask(PM_DEFAULT_MASK);
+	back_to_back_c0_hazard();
+	if (read_c0_pagemask() != PM_DEFAULT_MASK)
+		panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE);
+
 	write_c0_wired(0);
 	if (current_cpu_type() == CPU_R10000 ||
 	    current_cpu_type() == CPU_R12000 ||
-- 
2.4.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE
@ 2015-07-13 16:12 ` Paul Burton
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Burton @ 2015-07-13 16:12 UTC (permalink / raw)
  To: linux-mips
  Cc: Paul Burton, Steven J. Hill, Joshua Kinard, linux-kernel,
	Rafał Miłecki, James Hogan, Markos Chandras,
	Ralf Baechle

After writing the appropriate mask to the cop0 PageMask register, read
the register back & check it matches what we want. If it doesn't then
the MMU does not support the page size the kernel is configured for and
we're better off bailing than continuing to do odd things with TLB
exceptions.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

 arch/mips/mm/tlb-r4k.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 08318ec..4330315 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -19,6 +19,7 @@
 #include <asm/cpu.h>
 #include <asm/cpu-type.h>
 #include <asm/bootinfo.h>
+#include <asm/hazards.h>
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/tlb.h>
@@ -486,6 +487,10 @@ static void r4k_tlb_configure(void)
 	 *     be set to fixed-size pages.
 	 */
 	write_c0_pagemask(PM_DEFAULT_MASK);
+	back_to_back_c0_hazard();
+	if (read_c0_pagemask() != PM_DEFAULT_MASK)
+		panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE);
+
 	write_c0_wired(0);
 	if (current_cpu_type() == CPU_R10000 ||
 	    current_cpu_type() == CPU_R12000 ||
-- 
2.4.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE
  2015-07-13 16:12 ` Paul Burton
  (?)
@ 2016-02-10 22:10 ` Paul Burton
  2016-02-11 19:37   ` Maciej W. Rozycki
  2016-02-12 16:34   ` Ralf Baechle
  -1 siblings, 2 replies; 6+ messages in thread
From: Paul Burton @ 2016-02-10 22:10 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: linux-mips, Steven J. Hill, Joshua Kinard, linux-kernel,
	Rafał Miłecki, James Hogan, Markos Chandras

On Mon, Jul 13, 2015 at 05:12:44PM +0100, Paul Burton wrote:
> After writing the appropriate mask to the cop0 PageMask register, read
> the register back & check it matches what we want. If it doesn't then
> the MMU does not support the page size the kernel is configured for and
> we're better off bailing than continuing to do odd things with TLB
> exceptions.
> 
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---

Hi Ralf,

This patch is marked as accepted in patchwork[1] but is not present in
upstream. Did you lose it somehow? Could you please merge it?

Thanks,
    Paul

[1] http://patchwork.linux-mips.org/patch/10691/

>  arch/mips/mm/tlb-r4k.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
> index 08318ec..4330315 100644
> --- a/arch/mips/mm/tlb-r4k.c
> +++ b/arch/mips/mm/tlb-r4k.c
> @@ -19,6 +19,7 @@
>  #include <asm/cpu.h>
>  #include <asm/cpu-type.h>
>  #include <asm/bootinfo.h>
> +#include <asm/hazards.h>
>  #include <asm/mmu_context.h>
>  #include <asm/pgtable.h>
>  #include <asm/tlb.h>
> @@ -486,6 +487,10 @@ static void r4k_tlb_configure(void)
>  	 *     be set to fixed-size pages.
>  	 */
>  	write_c0_pagemask(PM_DEFAULT_MASK);
> +	back_to_back_c0_hazard();
> +	if (read_c0_pagemask() != PM_DEFAULT_MASK)
> +		panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE);
> +
>  	write_c0_wired(0);
>  	if (current_cpu_type() == CPU_R10000 ||
>  	    current_cpu_type() == CPU_R12000 ||
> -- 
> 2.4.5
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE
  2016-02-10 22:10 ` Paul Burton
@ 2016-02-11 19:37   ` Maciej W. Rozycki
  2016-02-12 10:57     ` Ralf Baechle
  2016-02-12 16:34   ` Ralf Baechle
  1 sibling, 1 reply; 6+ messages in thread
From: Maciej W. Rozycki @ 2016-02-11 19:37 UTC (permalink / raw)
  To: Paul Burton
  Cc: Ralf Baechle, linux-mips, Steven J. Hill, Joshua Kinard,
	linux-kernel, Rafał Miłecki, James Hogan,
	Markos Chandras

On Wed, 10 Feb 2016, Paul Burton wrote:

> > diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
> > index 08318ec..4330315 100644
> > --- a/arch/mips/mm/tlb-r4k.c
> > +++ b/arch/mips/mm/tlb-r4k.c
> > @@ -486,6 +487,10 @@ static void r4k_tlb_configure(void)
> >  	 *     be set to fixed-size pages.
> >  	 */
> >  	write_c0_pagemask(PM_DEFAULT_MASK);
> > +	back_to_back_c0_hazard();
> > +	if (read_c0_pagemask() != PM_DEFAULT_MASK)
> > +		panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE);

 I think it would make sense to report here what the minimum/maximum page 
size actually supported is, so that the users know what there might be 
after.

  Maciej

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE
  2016-02-11 19:37   ` Maciej W. Rozycki
@ 2016-02-12 10:57     ` Ralf Baechle
  0 siblings, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2016-02-12 10:57 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Paul Burton, linux-mips, Steven J. Hill, Joshua Kinard,
	linux-kernel, Rafał Miłecki, James Hogan,
	Markos Chandras

On Thu, Feb 11, 2016 at 07:37:12PM +0000, Maciej W. Rozycki wrote:

> > > index 08318ec..4330315 100644
> > > --- a/arch/mips/mm/tlb-r4k.c
> > > +++ b/arch/mips/mm/tlb-r4k.c
> > > @@ -486,6 +487,10 @@ static void r4k_tlb_configure(void)
> > >  	 *     be set to fixed-size pages.
> > >  	 */
> > >  	write_c0_pagemask(PM_DEFAULT_MASK);
> > > +	back_to_back_c0_hazard();
> > > +	if (read_c0_pagemask() != PM_DEFAULT_MASK)
> > > +		panic("MMU doesn't support PAGE_SIZE=0x%lx", PAGE_SIZE);
> 
>  I think it would make sense to report here what the minimum/maximum page 
> size actually supported is, so that the users know what there might be 
> after.

This is a very unlikely error condition to be hit so I'd rather keep it
simple.  Even just BUG_ON() would suffice.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE
  2016-02-10 22:10 ` Paul Burton
  2016-02-11 19:37   ` Maciej W. Rozycki
@ 2016-02-12 16:34   ` Ralf Baechle
  1 sibling, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2016-02-12 16:34 UTC (permalink / raw)
  To: Paul Burton
  Cc: linux-mips, Steven J. Hill, Joshua Kinard, linux-kernel,
	Rafał Miłecki, James Hogan, Markos Chandras

On Wed, Feb 10, 2016 at 02:10:49PM -0800, Paul Burton wrote:

> On Mon, Jul 13, 2015 at 05:12:44PM +0100, Paul Burton wrote:
> > After writing the appropriate mask to the cop0 PageMask register, read
> > the register back & check it matches what we want. If it doesn't then
> > the MMU does not support the page size the kernel is configured for and
> > we're better off bailing than continuing to do odd things with TLB
> > exceptions.
> > 
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > ---
> 
> Hi Ralf,
> 
> This patch is marked as accepted in patchwork[1] but is not present in
> upstream. Did you lose it somehow? Could you please merge it?

No idea what went wrong but I (re-?)applied it.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-12 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-13 16:12 [PATCH] MIPS: tlb-r4k: panic if the MMU doesn't support PAGE_SIZE Paul Burton
2015-07-13 16:12 ` Paul Burton
2016-02-10 22:10 ` Paul Burton
2016-02-11 19:37   ` Maciej W. Rozycki
2016-02-12 10:57     ` Ralf Baechle
2016-02-12 16:34   ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.