* [PATCH] boot parameters mem and max_addr
@ 2004-05-05 17:01 Robert Picco
2004-05-05 17:07 ` Jesse Barnes
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Robert Picco @ 2004-05-05 17:01 UTC (permalink / raw)
To: linux-ia64
The boot parameter "mem=" will behave like it does for other LINUX
architectures. The boot parameter "max_addr" can be used to limit the
maximum physical address like the old "mem=" feature.
--- linux-2.6.5-orig/arch/ia64/kernel/efi.c 2004-04-03 22:36:15.000000000 -0500
+++ linux-2.6.5-mem/arch/ia64/kernel/efi.c 2004-05-04 11:56:42.000000000 -0400
@@ -53,7 +53,7 @@
EXPORT_SYMBOL(efi_dir);
#endif
-static unsigned long mem_limit = ~0UL;
+static unsigned long mem_limit = ~0UL, max_addr = ~0UL;
#define efi_call_virt(f, args...) (*(f))(args)
@@ -304,6 +304,7 @@
void *efi_map_start, *efi_map_end, *p, *q;
efi_memory_desc_t *md, *check_md;
u64 efi_desc_size, start, end, granule_addr, last_granule_addr, first_non_wb_addr = 0;
+ unsigned long total_mem = 0;
efi_map_start = __va(ia64_boot_param->efi_memmap);
efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -345,12 +346,18 @@
trim_top(md, last_granule_addr);
if (is_available_memory(md)) {
- if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > mem_limit) {
- if (md->phys_addr > mem_limit)
+ if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > max_addr) {
+ if (md->phys_addr > max_addr)
continue;
- md->num_pages = (mem_limit - md->phys_addr) >> EFI_PAGE_SHIFT;
+ md->num_pages = (max_addr - md->phys_addr) >> EFI_PAGE_SHIFT;
}
+ if (total_mem >= mem_limit)
+ continue;
+ total_mem += (md->num_pages << EFI_PAGE_SHIFT);
+ if (total_mem > mem_limit)
+ md->num_pages -= ((total_mem - mem_limit) >> EFI_PAGE_SHIFT);
+
if (md->num_pages = 0)
continue;
@@ -484,7 +491,13 @@
for (cp = saved_command_line; *cp; ) {
if (memcmp(cp, "mem=", 4) = 0) {
cp += 4;
- mem_limit = memparse(cp, &end) - 1;
+ mem_limit = memparse(cp, &end) - 2;
+ if (end != cp)
+ break;
+ cp = end;
+ } else if (memcmp(cp, "max_addr=", 9) = 0) {
+ cp += 9;
+ max_addr = memparse(cp, &end) - 1;
if (end != cp)
break;
cp = end;
@@ -495,8 +508,8 @@
++cp;
}
}
- if (mem_limit != ~0UL)
- printk(KERN_INFO "Ignoring memory above %luMB\n", mem_limit >> 20);
+ if (max_addr != ~0UL)
+ printk(KERN_INFO "Ignoring memory above %luMB\n", max_addr >> 20);
efi.systab = __va(ia64_boot_param->efi_systab);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] boot parameters mem and max_addr
2004-05-05 17:01 [PATCH] boot parameters mem and max_addr Robert Picco
@ 2004-05-05 17:07 ` Jesse Barnes
2004-05-05 17:10 ` Randy.Dunlap
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jesse Barnes @ 2004-05-05 17:07 UTC (permalink / raw)
To: linux-ia64
I won't complain this time. :) Looks good to me.
Jesse
On Wednesday, May 5, 2004 10:01 am, Robert Picco wrote:
> The boot parameter "mem=" will behave like it does for other LINUX
> architectures. The boot parameter "max_addr" can be used to limit the
> maximum physical address like the old "mem=" feature.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] boot parameters mem and max_addr
2004-05-05 17:01 [PATCH] boot parameters mem and max_addr Robert Picco
2004-05-05 17:07 ` Jesse Barnes
@ 2004-05-05 17:10 ` Randy.Dunlap
2004-05-05 18:46 ` Robert Picco
2004-05-05 23:33 ` David Mosberger
3 siblings, 0 replies; 5+ messages in thread
From: Randy.Dunlap @ 2004-05-05 17:10 UTC (permalink / raw)
To: linux-ia64
On Wed, 05 May 2004 13:01:27 -0400 Robert Picco wrote:
| The boot parameter "mem=" will behave like it does for other LINUX
| architectures. The boot parameter "max_addr" can be used to limit the
| maximum physical address like the old "mem=" feature.
|
So max_addr needs to be documented in Documentation/kernel-parameters.txt.
--
~Randy
(Again. Sometimes I think ln -s /usr/src/linux/.config .signature) -- akpm
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] boot parameters mem and max_addr
2004-05-05 17:01 [PATCH] boot parameters mem and max_addr Robert Picco
2004-05-05 17:07 ` Jesse Barnes
2004-05-05 17:10 ` Randy.Dunlap
@ 2004-05-05 18:46 ` Robert Picco
2004-05-05 23:33 ` David Mosberger
3 siblings, 0 replies; 5+ messages in thread
From: Robert Picco @ 2004-05-05 18:46 UTC (permalink / raw)
To: linux-ia64
Whole patch again with documentation.
thanks,
Bob
diff -uNr -X /home/picco/losl/dontdiff linux-2.6.5-orig/arch/ia64/kernel/efi.c linux-2.6.5-mem/arch/ia64/kernel/efi.c
--- linux-2.6.5-orig/arch/ia64/kernel/efi.c 2004-04-03 22:36:15.000000000 -0500
+++ linux-2.6.5-mem/arch/ia64/kernel/efi.c 2004-05-04 11:56:42.000000000 -0400
@@ -53,7 +53,7 @@
EXPORT_SYMBOL(efi_dir);
#endif
-static unsigned long mem_limit = ~0UL;
+static unsigned long mem_limit = ~0UL, max_addr = ~0UL;
#define efi_call_virt(f, args...) (*(f))(args)
@@ -304,6 +304,7 @@
void *efi_map_start, *efi_map_end, *p, *q;
efi_memory_desc_t *md, *check_md;
u64 efi_desc_size, start, end, granule_addr, last_granule_addr, first_non_wb_addr = 0;
+ unsigned long total_mem = 0;
efi_map_start = __va(ia64_boot_param->efi_memmap);
efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -345,12 +346,18 @@
trim_top(md, last_granule_addr);
if (is_available_memory(md)) {
- if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > mem_limit) {
- if (md->phys_addr > mem_limit)
+ if (md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) > max_addr) {
+ if (md->phys_addr > max_addr)
continue;
- md->num_pages = (mem_limit - md->phys_addr) >> EFI_PAGE_SHIFT;
+ md->num_pages = (max_addr - md->phys_addr) >> EFI_PAGE_SHIFT;
}
+ if (total_mem >= mem_limit)
+ continue;
+ total_mem += (md->num_pages << EFI_PAGE_SHIFT);
+ if (total_mem > mem_limit)
+ md->num_pages -= ((total_mem - mem_limit) >> EFI_PAGE_SHIFT);
+
if (md->num_pages = 0)
continue;
@@ -484,7 +491,13 @@
for (cp = saved_command_line; *cp; ) {
if (memcmp(cp, "mem=", 4) = 0) {
cp += 4;
- mem_limit = memparse(cp, &end) - 1;
+ mem_limit = memparse(cp, &end) - 2;
+ if (end != cp)
+ break;
+ cp = end;
+ } else if (memcmp(cp, "max_addr=", 9) = 0) {
+ cp += 9;
+ max_addr = memparse(cp, &end) - 1;
if (end != cp)
break;
cp = end;
@@ -495,8 +508,8 @@
++cp;
}
}
- if (mem_limit != ~0UL)
- printk(KERN_INFO "Ignoring memory above %luMB\n", mem_limit >> 20);
+ if (max_addr != ~0UL)
+ printk(KERN_INFO "Ignoring memory above %luMB\n", max_addr >> 20);
efi.systab = __va(ia64_boot_param->efi_systab);
diff -uNr -X /home/picco/losl/dontdiff linux-2.6.5-orig/Documentation/kernel-parameters.txt linux-2.6.5-mem/Documentation/kernel-parameters.txt
--- linux-2.6.5-orig/Documentation/kernel-parameters.txt 2004-04-03 22:38:27.000000000 -0500
+++ linux-2.6.5-mem/Documentation/kernel-parameters.txt 2004-05-05 13:47:49.000000000 -0400
@@ -574,6 +574,9 @@
maui= [HW,OSS]
Format: <io>,<irq>
+
+ max_addr= [KNL,BOOT,IA64] Force the kernel to consider this the maximum physical
+ address.
max_loop= [LOOP] Maximum number of loopback devices that can
be mounted
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] boot parameters mem and max_addr
2004-05-05 17:01 [PATCH] boot parameters mem and max_addr Robert Picco
` (2 preceding siblings ...)
2004-05-05 18:46 ` Robert Picco
@ 2004-05-05 23:33 ` David Mosberger
3 siblings, 0 replies; 5+ messages in thread
From: David Mosberger @ 2004-05-05 23:33 UTC (permalink / raw)
To: linux-ia64
>>>>> On Wed, 05 May 2004 13:01:27 -0400, Robert Picco <Robert.Picco@hp.com> said:
Robert> The boot parameter "mem=" will behave like it does for other
Robert> LINUX architectures. The boot parameter "max_addr" can be
Robert> used to limit the maximum physical address like the old
Robert> "mem=" feature.
Great!
I applied the ia64-portion of the patch. There was a merge conflict,
but I fixed that by hand.
Thanks,
--david
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-05-05 23:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-05 17:01 [PATCH] boot parameters mem and max_addr Robert Picco
2004-05-05 17:07 ` Jesse Barnes
2004-05-05 17:10 ` Randy.Dunlap
2004-05-05 18:46 ` Robert Picco
2004-05-05 23:33 ` David Mosberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox