Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@oss.sgi.com>
To: Jun Sun <jsun@mvista.com>
Cc: linux-fbdev@vuser.vu.union.edu, linux-mips@oss.sgi.com,
	linux-mips@fnet.fr
Subject: Re: mmap() frame buffer causes bus error on MIPS ...
Date: Thu, 7 Sep 2000 11:20:13 +0200	[thread overview]
Message-ID: <20000907112013.A6259@bacchus.dhis.org> (raw)
In-Reply-To: <39B6B75D.2501654E@mvista.com>; from jsun@mvista.com on Wed, Sep 06, 2000 at 02:30:05PM -0700

On Wed, Sep 06, 2000 at 02:30:05PM -0700, Jun Sun wrote:

> In MIPS, mk_pte_phys() is defined as follows :
> 
> extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
> {
> 	return __pte(((physpage & PAGE_MASK) - PAGE_OFFSET) |
> pgprot_val(pgprot));
> }
> 
> The problematic part is " - PAGE_OFFSET" (where PAGE_OFFSET is
> 0x80000000).  If "physpage" is a physical address, it should not be
> substracted by PAGE_OFFSET.  This is a bug.
> 
> On the other hand, I wonder why this bug is there without being caught
> before (it is so fundamental).  If this is not a bug in MIPS kernel,
> then the fix is in the fb_mmap(), where under __mips__ case, we should
> add PAGE_OFFSET to the start of buffer address.

The definition should be:

extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
{
	return __pte(physpage) | pgprot_val(pgprot);
}

Masking with PAGE_MASK also seemed to be useless.

It's really surprising why it never has been caught.  Probably people
feed it with the addresses that are tweaked such that sich just work.

I'll cook up a patch for this bug.

  Ralf

  reply	other threads:[~2000-09-08  1:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <39B5BD14.A8D2F467@mvista.com>
2000-09-06  5:48 ` mmap() frame buffer causes bus error on MIPS Jun Sun
2000-09-06 21:30   ` Jun Sun
2000-09-07  9:20     ` Ralf Baechle [this message]
2000-09-07  9:58       ` Ralf Baechle

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=20000907112013.A6259@bacchus.dhis.org \
    --to=ralf@oss.sgi.com \
    --cc=jsun@mvista.com \
    --cc=linux-fbdev@vuser.vu.union.edu \
    --cc=linux-mips@fnet.fr \
    --cc=linux-mips@oss.sgi.com \
    /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