Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - mmap can't map full size of DMA-safe region: (3 Items)
   
mmap can't map full size of DMA-safe region  
I need to use typed memory to define a DMA-safe region (See "Defining a DMA-Safe region" on http://www.qnx.com/
developers/docs/6.4.1/neutrino/sys_arch/ipc.html). Hardware contraints requires that this region be 128MB aligned.

I made the appropriate modifications to main.c and rebuilt the OS image to reserve 128MB on a 128MB boundary (starting 
at 0x08000000). I am using an x86 board with 2 GB of ram.

I found out that mmap doesn't let me map the full 128MB. I can only do about 120MB or so. If I cycle power, the maximum 
amount of memory that I can map changes, but I have not been able to get all the memory reserved.

Why is it that mmap doesn't allow me to use all the memory I defined? 

From the example in the documentation (see above documentation reference), it seems to imply that the value of the 
variable "size" would be the same in both code snippets.

Thanks
RE: mmap can't map full size of DMA-safe region  
Here is the reason. In x86 system, the startup maps the first 256M
physical memory as 1-1 map area for kernel usage. The kernel allocates
memory in 1-1 area from top area first after the kernel starts. So part
of the top memory of the first 256M physical memory is already allocated
by the kernel when you starts your application, you won't be able to
mmap that section. In your configuration, you start the "DMA-Safe"
region from 0x08000000, ends at 0x10000000(128M size), the top section
of your DMA region is exactly the top section of 1-1 area. If the kernel
uses about 8M from the top area for heap, which is quite reasonable, you
will only get about 120M.

Jerry Sui | Software Developer | jsui@qnx.com
O:613-591-0836 x 2904 C:613-240-9239 | www.qnx.com | QNX Software
Systems
Cisco Support Team email: cisco_support@qnx.com

-----Original Message-----
From: Willman Rojas [mailto:community-noreply@qnx.com] 
Sent: February 24, 2011 1:30 PM
To: ostech-core_os
Subject: mmap can't map full size of DMA-safe region

I need to use typed memory to define a DMA-safe region (See "Defining a
DMA-Safe region" on
http://www.qnx.com/developers/docs/6.4.1/neutrino/sys_arch/ipc.html).
Hardware contraints requires that this region be 128MB aligned.

I made the appropriate modifications to main.c and rebuilt the OS image
to reserve 128MB on a 128MB boundary (starting at 0x08000000). I am
using an x86 board with 2 GB of ram.

I found out that mmap doesn't let me map the full 128MB. I can only do
about 120MB or so. If I cycle power, the maximum amount of memory that I
can map changes, but I have not been able to get all the memory
reserved.

Why is it that mmap doesn't allow me to use all the memory I defined? 

From the example in the documentation (see above documentation
reference), it seems to imply that the value of the variable "size"
would be the same in both code snippets.

Thanks




_______________________________________________

OSTech
http://community.qnx.com/sf/go/post83473
Re: RE: mmap can't map full size of DMA-safe region  
You are right, moving the region to the 256MB or higher boundary fixed it.

Thanks