linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Till Straumann <strauman@SLAC.Stanford.EDU>
To: Dan Malek <dan@embeddededge.com>, joakim.tjernlund@lumentis.se
Cc: Tom Rini <trini@kernel.crashing.org>,
	"Linuxppc-Embedded@Lists. Linuxppc. Org"
	<linuxppc-embedded@lists.linuxppc.org>
Subject: Re: mpc8xx DCBZ (&friends) hw bug. Tests, analysis + conclusions.
Date: Wed, 26 Mar 2003 17:25:27 -0800	[thread overview]
Message-ID: <3E825307.8000404@slac.stanford.edu> (raw)
In-Reply-To: 3E81FA3A.9010306@embeddededge.com


My earlier message was not completely
correct. The TLBError exception raised
by any of the cache instructions
(dcbf, dcbst, dcbi, dcbz) does actually
leave the EPN bits in MD_EPN unmodified,
clears the reserved bits and sets CASID.

Here are the (corrected) results of some tests I ran
on my mpc860t (XPC860TZP50B5 / 3J21M).

I use mpc8bug on a FADS board to load motorola's
'init860.S' example. The example was slightly
modified to include (1-4 use differend EAs, of
course).

   1) a 1:1 TLB to DRAM, R/W access (already present
      in the vanilla code)

   2) a TLB to map DRAM r/w, caching inhibited

   3) a TLB to map DRAM r/o (behavior is the same
      if for a 'real RO' mapping and for a RW
      mapping with the 'CHANGE' bit cleared).

   4) a TLB to map DRAM r/w but with the VALID
      bit clear.

   5) a 'main' routine which executes the
      instructions under test through one
      of the aforementioned TLB mappings.

Here's what I found (I generally load bogus
values into MD_EPN/DAR prior to executing any
of the cache instructions under test)

A) All of dcbf, dcbi, dcbst, dcbz (dcbt and dcbtst
     should not and do not) raise a TLBMiss exception
     with MD_EPN set correctly but failing to set DAR
     (i.e. DAR is left unmodified) when trying to
     access an address not in any of the TLBs.

B) All of dcbf, dcbi, dcbst, dcbz raise a TLBError
     exception when accessing mapping 4) [as they should].

     Unlike regular loads/stores (non-cache instructions),
     NEITHER DAR not MD_EPN are set, however. DAR is left
     unmodified MD_EPN has the CASID and reserved bits set/reset
     but leaves the EPN bits unmodified.

C) dcbi and dcbz behave like B) when accessing
     through 3) [RO mapping]. Note that dcbf and
     dcbst are treated like 'loads' and hence do
     not raise a TLBError due to protection violation
     (in accordance with the docs).

D) dcbz through a cache inhibited mapping (2)) does
     not generate an alignment exception but
     transparently clears the memory (either is allowed
     according to the PPC specs).

Note: dcbt/dcbtst were included in all of the
tests but they never raise an exception which is
the correct behavior.

CONCLUSION:

   - the only correct workaround for TLBError
     is the one I suggested earlier: TLBError
     handler has to inspect the faulting opcode
     and fixup DAR and MD_EPN based on the GPR
     values if the faulting instruction is any
     of dcbf, dcbi, dcbst or dcbz.
     Performance of this solution could be
     improved (eliminate opcode-check in the
     vast majority of the cases) by storing
     a 'tag' value in DAR.

   - the aforementioned workaround also could handle
     TLBMiss - although performance is more of an issue
     there.
     Alternatives are
        a) Jocke's workaround: copy MD_EPN -> DAR
           (disadvantage: DAR truncated to page
           boundary).
        b) like a) but do this only if the faulting
           instruction is any dcbxx (disadvantage:
           performance loss).
        c) merge significant bits of MD_EPN into
           DAR. Thus, only cache instructions suffer
           from an incorrect page offset in DAR.
           At the same time, it's cheap.

Based on the analysis, I'd suggest to implement
the 'fixup' workaround for TLBError and alternative
c) for TLBMiss

-- Till

PS. due to unclear re-distribution terms of init860.S,
I refrain from appending it to this message. Send me
email for details about the test software.


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

  parent reply	other threads:[~2003-03-27  1:25 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-24 10:19 dcbz works on 862 everywhere! Joakim Tjernlund
2003-03-24 11:01 ` Joakim Tjernlund
2003-03-24 12:25 ` Joakim Tjernlund
2003-03-24 14:20   ` Joakim Tjernlund
2003-03-24 17:09     ` Till Straumann
2003-03-24 17:42       ` Joakim Tjernlund
2003-03-24 20:15 ` Tom Rini
2003-03-24 20:57   ` Joakim Tjernlund
2003-03-24 21:07     ` Tom Rini
2003-03-24 21:54       ` Joakim Tjernlund
2003-03-24 22:59         ` Dan Malek
2003-03-25  0:33           ` Joakim Tjernlund
2003-03-24 21:42     ` Dan Malek
2003-03-24 21:51       ` Joakim Tjernlund
2003-03-24 22:44   ` Joakim Tjernlund
2003-03-24 23:09     ` Dan Malek
2003-03-24 23:57       ` Joakim Tjernlund
2003-03-25  0:48         ` Dan Malek
2003-03-25  1:22           ` Dan Malek
2003-03-25 14:02             ` Joakim Tjernlund
2003-03-26  2:17               ` Till Straumann
2003-03-26  7:57                 ` Joakim Tjernlund
2003-03-26 15:18                 ` Dan Malek
2003-03-26 17:04                   ` Joakim Tjernlund
2003-03-26 18:52                     ` Dan Malek
2003-03-27 21:49                       ` Joakim Tjernlund
2003-03-26 18:11                   ` Till Straumann
2003-03-26 19:06                     ` Dan Malek
2003-03-26 22:42                       ` mpc8xx DCBZ (&friends) hw bug. Tests, analysis + conclusions Till Straumann
2003-03-27  1:25                       ` Till Straumann [this message]
2003-03-27 14:01                         ` Joakim Tjernlund
2003-04-03 12:50                         ` Joakim Tjernlund
2003-04-08 10:47                           ` Joakim Tjernlund
2003-04-08 16:25                             ` Till Straumann
2003-04-08 16:42                               ` Joakim Tjernlund
2003-04-08 16:52                               ` Joakim Tjernlund
2003-04-08 21:01                               ` Dan Malek
2003-04-08 17:25                             ` Joakim Tjernlund
2003-04-08 18:14                               ` Tom Rini
2003-04-08 21:07                                 ` Joakim Tjernlund
2003-05-09 12:37                             ` Joakim Tjernlund
2003-04-01  9:37                       ` dcbz works on 862 everywhere! Joakim Tjernlund
2003-04-04 15:09                         ` Joakim Tjernlund
2003-04-04 15:43                           ` Dan Malek
2003-04-04 16:37                             ` Joakim Tjernlund
2003-04-09 14:32                             ` Joakim Tjernlund
2003-03-26 18:52                   ` Till Straumann
2003-03-25  1:57           ` Joakim Tjernlund
2003-03-25 17:37             ` Joakim Tjernlund
2003-03-26 15:22               ` Dan Malek
2003-03-26 17:09                 ` Joakim Tjernlund

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=3E825307.8000404@slac.stanford.edu \
    --to=strauman@slac.stanford.edu \
    --cc=dan@embeddededge.com \
    --cc=joakim.tjernlund@lumentis.se \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    --cc=trini@kernel.crashing.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;
as well as URLs for NNTP newsgroup(s).