mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <linux-os@analogic.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Linux-2.6.12 memory mapping broken
Date: Mon, 20 Jun 2005 17:03:17 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.61.0506201650400.5656@chaos.analogic.com> (raw)
In-Reply-To: <20050620.134302.85685273.davem@davemloft.net>

On Mon, 20 Jun 2005, David S. Miller wrote:

> From: "Richard B. Johnson" <linux-os@analogic.com>
> Date: Mon, 20 Jun 2005 15:53:34 -0400 (EDT)
>
>> I can test any patches.
>
> You have to let remap_pfn_range() fill in the PTEs for you,
> you can't fill them in yourself.  Just supply the correct
> "pfn" argument and you should be all set.
>

So I just supply the pointer now?

Right now my code does:

This is version-dependent, therefore a MACRO:
#define REMAP(a,b,c,d,e) remap_pfn_range((a), (b), (c) >> PAGE_SHIFT, (d), (e))

SHOW is a MACRO to write debugging info if enabled.

static int mmap(struct file *fp, struct vm_area_struct *vma)
{
     int minor, ret = 0;
     size_t len;
     SHOW(mmap);
     minor = MINOR(fp->f_dentry->d_inode->i_rdev);	// Extended open
     DEB(printk("UNIQUE.dma.len = %08x\n", UNIQUE.dma.len));
     DEB(printk("vma->vm_end-vma->vm_start=%08lx\n",vma->vm_end-vma->vm_start));
     len = MIN(UNIQUE.dma.len, (vma->vm_end - vma->vm_start));
     down(&UNIQUE.pci_sem);				// Acquire resource
     vma->vm_flags |= (VM_IO | VM_SHM | VM_LOCKED);	// Set required flags
     vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
     DEB(printk("About to execute remap_pfn_range\n"));
     DEB(printk("    vma->vm_start = %08lx\n", vma->vm_start));
     DEB(printk("     base address = %08x\n", UNIQUE.dma.base));
     DEB(printk("           length = %08x\n", len));
     DEB(printk("vma->vm_page_prot = %08x\n", *((size_t *)&vma->vm_page_prot)));
     ret = REMAP(vma, vma->vm_start, UNIQUE.dma.base, len, vma->vm_page_prot);
     DEB(printk("   returned value = %d\n", ret));
     up(&UNIQUE.pci_sem);				// Release resource
     return ret;
}

If I just give it the pointer, what do I put in the other
passed parameters?


Cheers,
Dick Johnson
Penguin : Linux version 2.6.11.9 on an i686 machine (5537.79 BogoMips).
  Notice : All mail here is now cached for review by Dictator Bush.
                  98.36% of all statistics are fiction.

  reply	other threads:[~2005-06-20 21:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20 19:53 Richard B. Johnson
2005-06-20 20:43 ` David S. Miller
2005-06-20 21:03   ` Richard B. Johnson [this message]
2005-06-21  0:46 ` Dave Jones
2005-06-21 19:57 ` Hugh Dickins
2005-06-21 20:35   ` Richard B. Johnson

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=Pine.LNX.4.61.0506201650400.5656@chaos.analogic.com \
    --to=linux-os@analogic.com \
    --cc=davem@davemloft.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®