Reserving a fixed physical address page of RAM.
Quoted 10 lines · Fawad Lateef
Quoted 2 lines · Jon Ringle
Quoted 1 line · Fawad Lateef
Yes, this can be used if required physical-memory exists
in the last
Quoted 2 lines
Quoted 2 lines
part of RAM as if you use mem=<xxxM> then kernel will only use memory less than or equal-to <xxxM> and above can be used
by drivers
Quoted 3 lines
Quoted 2 lines
(or any kernel module) might be through ioremap which takes physical-address.
Quoted 7 lines
Quoted 1 line
Seems that using mem= has to be in 1MB increments, where I
only need 4K.
Quoted 1 line
No AFAIK you can specify it in KBs (see
http://sosdg.org/~coywolf/lxr/source/Documentation/kernel-para
meters.txt#L869)
Yes, you can specify the mem= using K notation, but there is a test in arch/arm/mm/mm-armv.c:create_mapping() that prevents the mapping from being created if the boundaries are not MB aligned:
if (mem_types[md->type].prot_l1 == 0 &&
(virt & 0xfffff || (virt + off) & 0xfffff || (virt + length)
& 0xfffff)) {
printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can
not "
"be mapped using pages, ignoring.\n",
__pfn_to_phys(md->pfn), md->virtual);
return;
}This is in linux-2.6.16.29.
Quoted 29 lines
Quoted 3 lines
Quoted 3 lines
But if lets say we need only 1MB portion of specific
physical-memory
Quoted 1 line
Quoted 1 line
region then AFAIK it must be done by hacking in kernel
code during
Quoted 6 lines
Quoted 6 lines
memory-initialization (
mem_init
function) where it is marking/checking pages as/are reserved; you can simply mark you required pages as reserved too and set their count to some-value if you want to know later which pages are reserved by you. (can do this reservation work
here:http://lxr.free-electrons.com/source/arch/i386/mm/init.c#605).
Quoted 9 lines
Do you think that the following would work to properly reserve the memory. If it does, then I think I can just do a
ioremap(0x0ffff000, 0x1000)to obtain a virtual address. (Ofcourse I would actually use symbolic names rather than the hardcoded addesses shown here).Index:
linux/arch/arm/mm/init.c
===================================================================
---linux.orig/arch/arm/mm/init.c2006-11-3011:03:00.000000000
Quoted 6 lines
-0500
+++linux/arch/arm/mm/init.c2006-11-30 11:09:09.000000000 -0500(quoted diff) +0
-0@@ -429,6 +429,10 @@ unsigned long addr; void *vectors;
Quoted 13 lines
Review line 437
Quoted 8 lines
(quoted diff) +3
-0+#ifdef CONFIG_MACH_VERTICAL_RSC4 + reserve_bootmem (0x0ffff000, 0x1000); #endif + /* * Allocate the vector page early. */I think you can do like this but can't say accurately because I havn't worked on arm architecture and also you havn't mentioned your kernel-version or function (in file
arch/arm/mm/init.c) which you are going to do callreserve_bootmem!
Kernel version is 2.6.16.29 and the reserve_bootmem() call above is at the top of the function devicemaps_init().
Jon
Quoted 33 lines · Jon Ringle
Quoted 10 lines · Fawad Lateef
Quoted 2 lines · Jon Ringle
Quoted 1 line · Fawad Lateef
Yes, this can be used if required physical-memory exists
in the last
Quoted 2 lines
Quoted 2 lines
part of RAM as if you use mem=<xxxM> then kernel will only use memory less than or equal-to <xxxM> and above can be used
by drivers
Quoted 3 lines
Quoted 2 lines
(or any kernel module) might be through ioremap which takes physical-address.
Quoted 7 lines
Quoted 1 line
Seems that using mem= has to be in 1MB increments, where I
only need 4K.
Quoted 1 line
No AFAIK you can specify it in KBs (see
http://sosdg.org/~coywolf/lxr/source/Documentation/kernel-para
meters.txt#L869)Yes, you can specify the mem= using K notation, but there is a test in arch/arm/mm/mm-armv.c:create_mapping() that prevents the mapping from being created if the boundaries are not MB aligned:
if (mem_types[md->type].prot_l1 == 0 && (virt & 0xfffff || (virt + off) & 0xfffff || (virt + length) & 0xfffff)) { printk(KERN_WARNING "BUG: map for 0x%08lx at 0x%08lx can not " "be mapped using pages, ignoring.\n", __pfn_to_phys(md->pfn), md->virtual); return; }
Quoted 2 lines
This is in linux-2.6.16.29.
Ohh ok, I don't know about this architecture related information.
Quoted 43 lines
Quoted 29 lines
Quoted 3 lines
Quoted 3 lines
But if lets say we need only 1MB portion of specific
physical-memory
Quoted 1 line
Quoted 1 line
region then AFAIK it must be done by hacking in kernel
code during
Quoted 6 lines
Quoted 6 lines
memory-initialization (
mem_init
function) where it is marking/checking pages as/are reserved; you can simply mark you required pages as reserved too and set their count to some-value if you want to know later which pages are reserved by you. (can do this reservation work
here:http://lxr.free-electrons.com/source/arch/i386/mm/init.c#605).
Quoted 9 lines
Do you think that the following would work to properly reserve the memory. If it does, then I think I can just do a
ioremap(0x0ffff000, 0x1000)to obtain a virtual address. (Ofcourse I would actually use symbolic names rather than the hardcoded addesses shown here).Index:
linux/arch/arm/mm/init.c
===================================================================
---linux.orig/arch/arm/mm/init.c2006-11-3011:03:00.000000000
Quoted 6 lines
-0500
+++linux/arch/arm/mm/init.c2006-11-30 11:09:09.000000000 -0500(quoted diff) +0
-0@@ -429,6 +429,10 @@ unsigned long addr; void *vectors;Quoted 13 lines
Review line 437
Quoted 8 lines
(quoted diff) +3
-0+#ifdef CONFIG_MACH_VERTICAL_RSC4 + reserve_bootmem (0x0ffff000, 0x1000); #endif + /* * Allocate the vector page early. */I think you can do like this but can't say accurately because I havn't worked on arm architecture and also you havn't mentioned your kernel-version or function (in file
arch/arm/mm/init.c) which you are going to do callreserve_bootmem!
Quoted 3 lines
Kernel version is 2.6.16.29 and the
reserve_bootmem()call above is at the top of the functiondevicemaps_init().
reserving_bootmem in devicemaps_init will work but I think it will be better if you do this in mem_init function (here:
http://sosdg.org/~coywolf/lxr/source/arch/arm/mm/init.c?v=2.6.16;a=arm#L620),
so that all the paging and other map related stuff completes. (CMIIW)
Signature · 1 line
Fawad Lateef