public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 8/8] MIPS: clear TagLo select 2 during cache init
Date: Wed, 28 Jan 2015 21:13:18 +0000	[thread overview]
Message-ID: <20150128211318.GD6116@NP-P-BURTON> (raw)
In-Reply-To: <54C94D3A.8050809@gmail.com>

On Wed, Jan 28, 2015 at 09:57:30PM +0100, Daniel Schwierzeck wrote:
> Am 26.01.2015 um 16:03 schrieb Paul Burton:
> > Current MIPS cores from Imagination Technologies use TagLo select 2 for
> > the data cache. The architecture requires that it is safe for software
> > to write to this register even if it isn't present, so take the trivial
> > option of clearing both selects 0 & 2.
> > 
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> > ---
> >  arch/mips/lib/cache_init.S | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/mips/lib/cache_init.S b/arch/mips/lib/cache_init.S
> > index 04a36b2..137d728 100644
> > --- a/arch/mips/lib/cache_init.S
> > +++ b/arch/mips/lib/cache_init.S
> > @@ -139,6 +139,14 @@ LEAF(mips_cache_reset)
> >  #endif /* CONFIG_SYS_MIPS_CACHE_INIT_RAM_LOAD */
> >  
> >  	/*
> > +	 * The TagLo registers used depend upon the CPU implementation, but the
> > +	 * architecture requires that it is safe for software to write to both
> > +	 * TagLo selects 0 & 2 covering supported cases.
> > +	 */
> > +	mtc0		zero, CP0_TAGLO
> > +	mtc0		zero, CP0_TAGLO, 2
> 
> maybe we should add new definitions to asm/mipsregs.h. In an out-of-tree
> SoC port I have something like this
> 
>  #define CP0_ECC $26
>  #define CP0_CACHEERR $27
>  #define CP0_TAGLO $28
> +#define CP0_ITAGLO $28
> +#define CP0_IDATALO $28,1
> +#define CP0_DTAGLO $28,2
> +#define CP0_DDATALO $28,3
> +#define CP0_L23TAGLO $28,4
> +#define CP0_L23DATALO $28,5
>  #define CP0_TAGHI $29
> +#define CP0_IDATAHI $29,1
> +#define CP0_DTAGHI $29,2
> +#define CP0_L23TAGHI $29,4
> +#define CP0_L23DATAHI $29,5
>  #define CP0_ERROREPC $30
>  #define CP0_DESAVE $31
> 

The problem with that is that the architecture doesn't actually define
which caches the various {Tag,Data}{Lo,Hi} registers apply to. So as far
as I can tell it would be perfectly valid for some CPU to implement
$28,0 operating on the Dcache & $28,2 operating on the Icache rather
than vice-versa.

Thanks,
    Paul

> > +
> > +	/*
> >  	 * The caches are probably in an indeterminate state, so we force good
> >  	 * parity into them by doing an invalidate for each line. If
> >  	 * CONFIG_SYS_MIPS_CACHE_INIT_RAM_LOAD is set then we'll proceed to
> > @@ -151,7 +159,6 @@ LEAF(mips_cache_reset)
> >  	 * Initialize the I-cache first,
> >  	 */
> >  	blez		t2, 1f
> > -	mtc0		zero, CP0_TAGLO
> >  	PTR_LI		t0, INDEX_BASE
> >  	PTR_ADDU	t1, t0, t2
> >  	/* clear tag to invalidate */
> > @@ -169,7 +176,6 @@ LEAF(mips_cache_reset)
> >  	 * then initialize D-cache.
> >  	 */
> >  1:	blez		t3, 3f
> > -	mtc0		zero, CP0_TAGLO
> >  	PTR_LI		t0, INDEX_BASE
> >  	PTR_ADDU	t1, t0, t3
> >  	/* clear all tags */
> > 
> 
> -- 
> - Daniel

  reply	other threads:[~2015-01-28 21:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 15:02 [U-Boot] [PATCH 0/8] MIPS cache code cleanup Paul Burton
2015-01-26 15:02 ` [U-Boot] [PATCH 1/8] MIPS: avoid .set ISA for cache operations Paul Burton
2015-01-28 20:43   ` Daniel Schwierzeck
2015-01-28 21:08     ` Paul Burton
2015-01-28 21:18       ` Daniel Schwierzeck
2015-01-26 15:02 ` [U-Boot] [PATCH 2/8] MIPS: unify cache maintenance functions Paul Burton
2015-01-26 15:02 ` [U-Boot] [PATCH 3/8] MIPS: unify cache initialization code Paul Burton
2015-01-26 15:02 ` [U-Boot] [PATCH 4/8] MIPS: refactor L1 cache config reads to a macro Paul Burton
2015-01-26 15:02 ` [U-Boot] [PATCH 5/8] MIPS: refactor cache loops " Paul Burton
2015-01-26 15:02 ` [U-Boot] [PATCH 6/8] MIPS: inline mips_init_[id]cache functions Paul Burton
2015-01-26 15:02 ` [U-Boot] [PATCH 7/8] MIPS: allow systems to skip loads during cache init Paul Burton
2015-01-26 15:03 ` [U-Boot] [PATCH 8/8] MIPS: clear TagLo select 2 " Paul Burton
2015-01-28 20:57   ` Daniel Schwierzeck
2015-01-28 21:13     ` Paul Burton [this message]
2015-01-28 20:31 ` [U-Boot] [PATCH 0/8] MIPS cache code cleanup Daniel Schwierzeck
2015-01-28 21:05   ` Paul Burton
     [not found]     ` <54C95453.8010009@gmail.com>
2015-01-28 22:21       ` Paul Burton

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=20150128211318.GD6116@NP-P-BURTON \
    --to=paul.burton@imgtec.com \
    --cc=u-boot@lists.denx.de \
    /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