Messages in this thread | | | Date | Wed, 01 Dec 2004 18:08:31 -0700 | From | Lance Spaulding <> | Subject | mmap() on 2.6 |
| |
I'm trying to port one of my drivers from 2.4 to 2.6 and am having problems getting mmap() to work. The driver works fine in 2.4 but hangs on 2.6 (using the same machine).
What I'm doing is setting aside 40 Meg of memory so I can use a 32 meg buffer for DMAs from a custom ASIC. I need to be able to acccess this memory both from kernel and user space.
To do this, I do the following steps:
- In grub.conf, I use "mem=472m"
- In my driver, I do an ioremap(0x1d800000, 0x02000000) to get a kernel pointer to the memory. This part works fine.
- In myapp, I call mmap(0, 0x02000000, (PROT_READ | PROT_WRITE), (MAP_SHARED | MAP_LOCKED), fd, (uint32)0x1d800000)
- In my driver's mmap() function, I do the following: vma->vm_flags|=(VM_RESERVED | VM_IO | VM_LOCKED | VM_SHM); remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start, vma->vm_page_prot) which ends up being: remap_page_range(0xDC3C7078, 0xB7257000, 0x1D800000, 0xC00000, 0x27)
This remap call works fine and my driver then tries to return 0 but at that point, the thread appears completely locked up. I'm never getting control back to the calling app. I can switch virtual consoles and run other commands just fine.
Can anyone tell me what I'm doing wrong and what I need to change for 2.6? This part of the driver has always worked fine on 2.4.
Thanks in advance, Lance - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |