From: Ladislav Michl <ladis@psi.cz>
To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Cc: Guido Guenther <agx@sigxcpu.org>, linux-mips@linux-mips.org
Subject: Re: [patch] GIO bus support
Date: Sat, 28 Sep 2002 21:55:42 +0200 [thread overview]
Message-ID: <20020928195542.GA990@kopretinka> (raw)
In-Reply-To: <Pine.GSO.3.96.1020627140152.21496C-100000@delta.ds2.pg.gda.pl>
On Thu, Jun 27, 2002 at 02:21:30PM +0200, Maciej W. Rozycki wrote:
> On Wed, 26 Jun 2002, Ladislav Michl wrote:
>
> > +int be_ip22_handler(struct pt_regs *regs, int is_fixup)
> > +{
> > + save_and_clear_buserr();
> > + if (nofault) {
> > + nofault = 0;
> > + compute_return_epc(regs);
> > + return MIPS_BE_DISCARD;
> > + }
> > + return MIPS_BE_FIXUP;
> > +}
>
> I wouldn't use nofault -- it leads to reentrancy problems and I don't
> think you really need it. You probably need to code it like this:
>
> {
> save_and_clear_buserr();
>
> return is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL;
> }
>
> unless:
>
> 1. There is a condition when for is_fixup true you should ignore the fixup
> anyway (e.g. what the bus error logic reports is irrelevant to fixups).
> You should choose between MIPS_BE_FATAL and MIPS_BE_DISCARD then.
>
> 2. There is a condition when for is_fixup false, an error is not fatal and
> execution should get restarted. You should return MIPS_BE_DISCARD then.
There are no such conditions (or I'm missing something). I wrote it as
you suggested:
int be_ip22_handler(struct pt_regs *regs, int is_fixup)
{
DBG("BE exception (%s)\n", is_fixup ? "fixup" : "no fixup");
save_and_clear_buserr();
if (is_fixup)
return MIPS_BE_FIXUP;
print_buserr();
return MIPS_BE_FATAL;
}
try to read status register
addr = KSEG1ADDR(gio_slot_base_addr);
DBG("get_dbe\n");
if (!get_dbe(id, addr)) {
... ok
}
> > +int ip22_baddr(unsigned int *val, unsigned long addr)
> > +{
> > + nofault = 1;
> > + *val = *(volatile unsigned int *) addr;
> > + __asm__ __volatile__("nop;nop;nop;nop");
> > + if (nofault) {
> > + nofault = 0;
> > + return 0;
> > + }
> > + return -EFAULT;
> > +}
>
> Why not simply:
>
> {
> int err;
>
> err = get_dbe(*val, (volatile unsigned int *) addr);
>
> return err ? -EFAULT : 0;
> }
>
> It was designed exactly for this purpose. You may consider using "u32"
> instead of "unsigned int" for hardware accesses to assure the type will
> always be 32-bit.
This way gives following result:
get_dbe
BE exception (no fixup)
Dump of MC registers shows that timeout occurs when accessing nonexistant
memory. Of course it is posible return MIPS_BE_DISCARD than (and
regs->cp0_epc += 4), but how to force get_dbe fail then? Not mentioning
that in such case is better to avoid use of get_dbe... Suggestions are
welcome as always.
Thanks a lot,
Ladis
next prev parent reply other threads:[~2002-09-28 20:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-17 11:33 DBE/IBE handling incompatibility Ladislav Michl
2002-06-19 16:47 ` Maciej W. Rozycki
2002-06-25 0:36 ` Ladislav Michl
2002-06-25 11:55 ` Maciej W. Rozycki
2002-06-26 11:51 ` [patch] linux: DBE/IBE handling rewrite Maciej W. Rozycki
2002-06-26 12:05 ` Ralf Baechle
2002-06-26 13:07 ` Maciej W. Rozycki
2002-06-26 17:21 ` Jun Sun
2002-06-27 12:00 ` Maciej W. Rozycki
2002-06-27 17:12 ` Jun Sun
2002-06-27 18:29 ` Maciej W. Rozycki
2002-06-27 19:08 ` Jun Sun
2002-06-27 20:00 ` Maciej W. Rozycki
2002-06-26 20:59 ` [patch] GIO bus support Ladislav Michl
2002-06-26 23:46 ` Ralf Baechle
2002-06-27 10:14 ` FIR problem jeff
2002-06-27 10:14 ` jeff
2002-06-27 12:21 ` [patch] GIO bus support Maciej W. Rozycki
2002-08-04 22:03 ` Ladislav Michl
2002-09-28 19:55 ` Ladislav Michl [this message]
2002-06-26 17:17 ` [patch] linux: DBE/IBE handling rewrite Jun Sun
2002-06-27 11:51 ` Maciej W. Rozycki
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=20020928195542.GA990@kopretinka \
--to=ladis@psi.cz \
--cc=agx@sigxcpu.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@ds2.pg.gda.pl \
/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