From: grundler@cup.hp.com (Grant Grundler)
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] mmap crashes system after mapping PCI device into user space and reading and writin
Date: Wed, 09 Apr 2003 06:20:46 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590723705446@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590723705441@msgid-missing>
On Wed, Apr 09, 2003 at 01:36:33AM -0400, Mike Fox wrote:
> /*
> * this maps the physical memory to the user
> */
> if (remap_page_range(vma->vm_start, offset, vma->vm_end-vma->vm_start,
> vma->vm_page_prot))
> {
> return -EAGAIN;
> }
The example code I posted (a) used physical addresses and (b)
assume the "user" was root (to access /dev/mem/).
XFree86 pokes around in PCI MMIO and IO space and does work.
Have you tried to dig through the source of XF86 4.2?
Have you checked the return address (to user space) is uncached?
If I understood details of VM it might be obvious from the code
you posted.
hth,
grant
>
> Thanks,
> Mike.
>
>
>
> -----Original Message-----
> From: linux-ia64-admin@linuxia64.org [mailto:linux-ia64-admin@linuxia64.org]
> On Behalf Of Grant Grundler
> Sent: Tuesday, April 08, 2003 8:43 PM
> To: Mike Fox
> Cc: linux-ia64@linuxia64.org
> Subject: Re: [Linux-ia64] mmap crashes system after mapping PCI device into
> user space and reading and writing.
>
> On Tue, Apr 08, 2003 at 05:59:56PM -0400, Mike Fox wrote:
> ...
> > Has anyone tried using mmap to remap PCI device memory into user space? I
> > have seen the following problem: If I do the mmap, it returns
> successfully,
> > and I can indeed access the device memory. Unfortunately, the system will
> > hang within about a minute after doing so.
> ...
>
> David Mosberger passed on a very short program who's essence is:
> mem = mmap (NULL, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
> offset);
> if (mem = MAP_FAILED)
> {
> perror ("memmap");
> exit (-1);
> }
>
> This works on the HP ZX1 platforms with 2.4.20+patches kernel.
>
> Be warned, it's *very* easy to crash a machine when using /dev/mem
> and scribbling in misc parts of IO space. The symptom will typically
> be an MCA (see "errdump MCA" output from EFI to get the xip).
>
> grant
>
> _______________________________________________
> Linux-IA64 mailing list
> Linux-IA64@linuxia64.org
> http://lists.linuxia64.org/lists/listinfo/linux-ia64
>
>
> _______________________________________________
> Linux-IA64 mailing list
> Linux-IA64@linuxia64.org
> http://lists.linuxia64.org/lists/listinfo/linux-ia64
--
Grant Grundler Linux Open Systems Lab/BCST
grundler@cup.hp.com +1.408.447.7253
next prev parent reply other threads:[~2003-04-09 6:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-08 21:59 [Linux-ia64] mmap crashes system after mapping PCI device into user space and reading and writing Mike Fox
2003-04-09 0:42 ` [Linux-ia64] mmap crashes system after mapping PCI device into user space and reading and writin Grant Grundler
2003-04-09 5:36 ` Mike Fox
2003-04-09 6:20 ` Grant Grundler [this message]
2003-04-09 8:57 ` [Linux-ia64] mmap crashes system after mapping PCI device into user Christian Hinkelbein
2003-04-09 17:33 ` [Linux-ia64] mmap crashes system after mapping PCI device into user space and reading and writin David Mosberger
2003-04-09 17:45 ` David Mosberger
2003-04-09 23:53 ` Mike Fox
2003-04-10 0:44 ` David Mosberger
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=marc-linux-ia64-105590723705446@msgid-missing \
--to=grundler@cup.hp.com \
--cc=linux-ia64@vger.kernel.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