System spare memory, ioremap ()?

Is it wrong to call ioremap()

on system DRAM. I would like to reserve space in the system DRAM that will not be used by any other process. Will this be the way to do it? I know DRAM isn't actually IO memory, so I wasn't sure if this was considered bad practice.

0


source to share


2 answers


Is it wrong to call ioremap () on system DRAM.

System memory managed by the kernel should also not be reassigned using ioremap () . These multiple mappings can lead to data corruption on some architectures / processors. Refer to this article on this issue for ARM.

You can try to enforce a single mapping (using ioremap () ) by excluding the memory region in question at boot time from kernel control.
On ARM, specify the reduced physical memory using ATAG (tag ATAG_MEM

) or Device tree (property memory

).
Otherwise, use the kernel parameter memmap = on the kernel command line:



1835         memmap=nn[KMG]$ss[KMG]
1836                         [KNL,ACPI] Mark specific memory as reserved.
1837                         Region of memory to be reserved is from ss to ss+nn.
1838                         Example: Exclude memory from 0x18690000-0x1869ffff
1839                                  memmap=64K$0x18690000
1840                                  or
1841                                  memmap=0x10000$0x18690000

      

The memory region must also be declared with request_mem_region () to prevent multiple requests and / proc / iomem completeness / precision .

+2


source


Memory can be reserved at boot time using "mem" in the kernel command line argument.

LDD3 Ch-15 Pg 443

For example, if you have 256 MB, the mem = 255M argument keeps the kernel from using the top megabyte. Later, your module can use the following code to access such memory:



dmabuf = ioremap (0xFF00000 / * 255M /, 0x100000 / 1M * /);

However, this is not an efficient way to do it, since the kernel cannot use this reserved memory. The SoC I'm currently working on has memory reserved using the Allicator Allicator (CMA), which allows memory to be reused by other processes when the SoC drivers are not using that memory.

+1


source







All Articles