All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjanv@redhat.com>
To: Martin Drab <drab@kepler.fjfi.cvut.cz>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: mmap(2)ping of pci_alloc_consistent() allocated buffers on 2.4 kernels question/help
Date: Fri, 16 Sep 2005 14:50:52 -0400	[thread overview]
Message-ID: <1126896652.3103.10.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.60.0509162009510.14084@kepler.fjfi.cvut.cz>

[-- Attachment #1: Type: text/plain, Size: 837 bytes --]

On Fri, 2005-09-16 at 20:33 +0200, Martin Drab wrote:
> Hi,
> 
> can anyone explain me why it is not possible to mmap(2) a buffer 
> allocated in kernel by pci_alloc_consistent() to userspace on a 2.4 
> kernel?
> 
> In kernel PCI device initialization function I do something like:
> 
> ...
> kladdr = pci_alloc_consistent (dev, BUFSIZE, &baddr);
> ...
> 
> Then I send the physical address (i.e. the value of phaddr = __pa(kladdr)) 
> to the userspace application, and then when in the userspace I do 
> something like
> 
> ...
> fd = fopen ("/dev/mem", O_RDWR);
> buf = mmap (NULL, BUFSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, phaddr);
> ...


yuch.
why don't you make your device have an mmap operation instead?
(the device node that you use to get your physical address to userspace
in the first place)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2005-09-16 18:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-16 18:33 mmap(2)ping of pci_alloc_consistent() allocated buffers on 2.4 kernels question/help Martin Drab
2005-09-16 18:50 ` Arjan van de Ven [this message]
2005-09-16 21:24   ` Martin Drab
2005-09-16 21:40     ` Martin Drab
2005-09-16 21:46     ` Arjan van de Ven
2005-09-16 21:49       ` Martin Drab

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=1126896652.3103.10.camel@localhost.localdomain \
    --to=arjanv@redhat.com \
    --cc=drab@kepler.fjfi.cvut.cz \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.