All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmytro Bablinyuk <dmytro.bablinyuk@tait.co.nz>
To: linux-kernel@vger.kernel.org
Subject: Problem with remap_page_range
Date: Tue, 09 Sep 2003 21:13:49 -0400	[thread overview]
Message-ID: <3F5E7ACD.8040106@tait.co.nz> (raw)


We have a DSP shared memory which we should access (from PowerPC).
The problem is when I do ioremap I can see the memory correctly from the 
driver (see below) but when I do remap_page_range to the user space 
application then data appears to be wrong, I can recognize some values 
there, but they are in the wrong places and other values around from 
everywhere else (see below).

I tried mem_map_reserve - but still without luck.

Could somebody please give me a clue on this.

Thank you very much in advance for any help.

Below: the dsp_area prints correct values from DSP RAM but remap_page_range does not work properly.

  dsp_ptr=ioremap_nocache( DSP_ADDR, WINDOW_SIZE);
  dsp_area=(ushort *)(((unsigned long)dsp_ptr + PAGE_SIZE -1) &
PAGE_MASK);
/*   for (virt_addr=(unsigned long)dsp_area; virt_addr<(unsigned
long)dsp_area+WINDOW_SIZE; */
/*        virt_addr+=PAGE_SIZE) { */
/*       /\* reserve all pages to make them remapable *\/ */
/*     mem_map_reserve(virt_to_page(virt_addr)); */
/*   } */

  printk("dsp_area[0]=%04x\n", dsp_area[0]); //prints correct values
  ...
  vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO | VM_RESERVED);

  if (remap_page_range(vma->vm_start,
                       DSP_ADDR,
                       size,
                       vma->vm_page_prot
                       ))
    {
      printk("remap page range failed\n");
      return -ENXIO;
    }

Here is the ouput:
//correct from the driver
dsp_area[0]=0000
dsp_area[1]=bc00
dsp_area[2]=eb17
dsp_area[3]=2643
dsp_area[4]=54cd
dsp_area[5]=5405
dsp_area[6]=91ba
dsp_area[7]=49c2
dsp_area[8]=1f61
hpi_mmap: vma->vm_start=3006f000, vma->vm_end=30097000
vma->vm_flags=864fb

//wrong from the user space application
kadr=0x3006f000
kadr[0]=1c59
kadr[1]=49c2
kadr[2]=5405
kadr[3]=bc00
kadr[4]=49c2
kadr[5]=54cd
kadr[6]=bc00
kadr[7]=54cd




             reply	other threads:[~2003-09-09  9:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10  1:13 Dmytro Bablinyuk [this message]
2003-09-09  9:59 ` Problem with remap_page_range Jamie Lokier
2003-09-09 17:03   ` Matt Porter
2003-09-10  2:19   ` Dmytro Bablinyuk
2003-09-09 17:02 ` Matt Porter
2003-09-09 21:54   ` Dmytro Bablinyuk
2003-09-09 22:06     ` Matt Porter

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=3F5E7ACD.8040106@tait.co.nz \
    --to=dmytro.bablinyuk@tait.co.nz \
    --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.