public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Nazarewicz <mina86@tlen.pl>
To: linux-newbie@vger.kernel.org
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Subject: remap_pfn_range() and mapping RAM
Date: Sun, 10 May 2009 18:46:16 +0200	[thread overview]
Message-ID: <87ab5koqhz.fsf@erwin.mina86.com> (raw)

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

Hello everyone,

While developing a method for mapping RAM memory into user space
I stumbled across Suresh Siddha's commit that "broke" my code:

  commit be03d9e8022030c16abf534e33e185bfc3d40eef
  x86, pat: fix warn_on_once() while mapping 0-1MB range with /dev/mem

I believe there were important reasons for the changes but how do I map
user RAM memory into user space?  Up to this point I've used something
along the lines of (error checking removed):

#v+
static int file_mmap(struct file *file, struct vm_area_struct *vma)
{
	const size_t start  = /* physical address of memory allocated
	                         using alloc_bootmem_low_pages() */;

	return remap_pfn_range(vma, vma->vm_start,
	                       (start >> PAGE_SHIFT) + vma->vm_pgoff
	                       vma->vm_end - vma->vm_start,
	                       vma->vm_page_prot);
}
#v-

Reverting the be03... commit makes it work again but I guess it's not
a good way to solve this problem.

Could anyone point me to proper function which may be used like
remap_pfn_range() but work on RAM addresses?  It is important, that the
function will work in similar fashion, ie. create raw PFN mappings
without associated struct page.

-- 
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86*tlen.pl>--<jid:mina86*jabber.org>--ooO--(_)--Ooo--

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2009-05-10 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-10 16:46 Michal Nazarewicz [this message]
2009-05-11 17:40 ` remap_pfn_range() and mapping RAM Suresh Siddha
2009-05-12 18:56   ` Michal Nazarewicz

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=87ab5koqhz.fsf@erwin.mina86.com \
    --to=mina86@tlen.pl \
    --cc=linux-newbie@vger.kernel.org \
    --cc=suresh.b.siddha@intel.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