Jay D
Jay D

Reputation: 3307

Do we need to ioremap for memmap reserved memory chunk ?

I reserve the memory chunk using a memmap=8G$4G linux kernel boot parameter.

Is it needed to ioremap this memory ?

ioremap man pages say :

ioremap performs a platform specific sequence of operations to make bus memory CPU accessible via the readb/readw/readl/writeb/ writew/writel functions and the other mmio helpers. The returned address is not guaranteed to be usable directly as a virtual address.

So if i can't use the returned address of ioremap as a virtual address for directly addressing the memory, then a broader question is when should we ioremap the memory ?

Upvotes: 0

Views: 3386

Answers (2)

Kanishka
Kanishka

Reputation: 19

As per my experience with reserving ( or blocking) the memory is as followed.

if you are trying to reserve a particular volume of memory you may have to remap the already existing memory map provided by BIOS.

If your system doesnt enable you to do so then you will have to identify which area is free in the BIOS provided memory map and only that can be reserved.

Upvotes: 0

Serge
Serge

Reputation: 6095

Yes, you have to ioremap this region to access it. The kernel does not set up the Page Directory Entries for this memory region as you instructed the kernel to ignore this region.

The addresses returned by ioremap may not be used directly if you remapped the addresses of io-port address space. When you remap the addresses from the memory address space then it is OK to use them directly.

However, please take look at https://unix.stackexchange.com/questions/37729/how-can-i-reserve-a-block-of-memory-from-the-linux-kernel

Upvotes: 1

Related Questions