linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Matt Porter <mporter@kernel.crashing.org>
To: Niklaus Giger <niklaus.giger@member.fsf.org>
Cc: rtai@rtai.org, linuxppc-embedded@ozlabs.org
Subject: Re: Newbie question about accessing memory in kernel space
Date: Tue, 24 May 2005 13:31:23 -0700	[thread overview]
Message-ID: <20050524133123.A23084@cox.net> (raw)
In-Reply-To: <200505242119.29197.niklaus.giger@member.fsf.org>; from niklaus.giger@member.fsf.org on Tue, May 24, 2005 at 09:19:28PM +0200

On Tue, May 24, 2005 at 09:19:28PM +0200, Niklaus Giger wrote:
> Hi
> 
> I am working on a custom PPC405 board where I have a 2.6.10 kernel with RTAI 
> patches (fusion) running.
> 
> I am trying to access some custom CPLD chip hanging at 0x7D000000. In my 
> intial board (hcu3_map_io) I added a corresponding io_block_mapping.

Is a "corresponding" mapping a 1:1 mapping? Don't do that.  You cannot
map stuff that way since it is below TASK_SIZE i.e. it's in user address
space, not kernel address space.

> Now I compiled a module which tries to access the CPLD during the insmod phase
> and I get the following output.
> 
> Oops: kernel access of bad area, sig: 11 [#1]

<snip>

> What is wrong with my code? 

You mapped the device into user virtual address space.  The TLB
replacement code is unable to load a TLB entry for a page outside
of kernel space...so you crash.

Don't use io_block_map()...it allows you to shoot yourself in the
foot very easily (as you just witnessed). Use ioremap() to map
your device.

-Matt

  parent reply	other threads:[~2005-05-24 20:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-24 19:19 Newbie question about accessing memory in kernel space Niklaus Giger
2005-05-24 20:17 ` Wolfgang Grandegger
2005-05-24 20:31 ` Matt Porter [this message]
2005-05-25 11:31   ` Niklaus Giger
2005-05-24 23:58 ` Roger Larsson
2005-05-25 11:35   ` Niklaus Giger
     [not found] <20050525020004.CCA3A67A3F@ozlabs.org>
2005-05-25 13:17 ` David Bruce

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=20050524133123.A23084@cox.net \
    --to=mporter@kernel.crashing.org \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=niklaus.giger@member.fsf.org \
    --cc=rtai@rtai.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).