linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tom Roberts <tjroberts@lucent.com>
To: Hua Ji <hji@netscreen.com>
Cc: linuxppc-embedded@lists.linuxppc.org, linux-mm@kvack.org
Subject: Re: mtsr and mfsr?
Date: Fri, 08 Jun 2001 11:39:23 -0500	[thread overview]
Message-ID: <3B20FFBB.5E29CE37@lucent.com> (raw)
In-Reply-To: <A33AEFDC2EC0D411851900D0B73EBEF766E100@NAPA>

Hua Ji wrote:
> I was trying to clear and write some values into those 15 sr registers by
> using **mtsr**.
> But looks like it doesn't work. The testing I did looks like follows:
> #define RESET 0
> li %r3, RESET;
> 
> sync
> isync
> mtsr sr0, %r3
> isync
> sync
> 
> mfsr %r3, sr0
> bl uart_print

While the general registers are scoreboarded, the SR registers are not.
Synchronization is especially tricky between the CPU and the MMU. I suspect
that if you interchange that second "isync;sync" pair to be the usual
"sync; isync" this will work -- the "sync" ensures that the memory system
is synchronized, and the "isync" ensures that the following mfsr does not
execute until the "sync" is _complete_. But I am not certain; I do remember
this is finicky, and there may well be errors of omission in the manuals....

While "isync" says the following instructions execute in the context 
established by the preceeding instructions, I suspect that in the case of
MMU registers that really only applies to their being _used_ by the MMU, and 
not necessarily to being _read_ by the CPU.

My (non-Linux) context-switching code simply loads all SR-s and does a single
isync. It then loads all the registers (via BAT memory addressing), does a 
little bit of housekeeping (again via BAT addressing), and then does an rfi. 
At that point the SRs are all valid.

So if the above interchange does not get it to work, try inserting a
few hundred NOP-s between setting and reading sr0 (:-)).


Tom Roberts	tjroberts@Lucent.com
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

      reply	other threads:[~2001-06-08 16:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-07 17:16 Hua Ji
2001-06-08 16:39 ` Tom Roberts [this message]

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=3B20FFBB.5E29CE37@lucent.com \
    --to=tjroberts@lucent.com \
    --cc=hji@netscreen.com \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /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