From: Wen Congyang <wency@cn.fujitsu.com>
To: rob@landley.net, tglx@linutronix.de,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
bhelgaas@google.com, "H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] x86: reimplement mem boot option
Date: Tue, 17 Jul 2012 13:22:05 +0800 [thread overview]
Message-ID: <5004F67D.7000809@cn.fujitsu.com> (raw)
In-Reply-To: <4FEBB377.2080309@cn.fujitsu.com>
At 06/28/2012 09:29 AM, Wen Congyang Wrote:
> Pin......
Ping again........
>
> At 06/14/2012 04:12 PM, Wen Congyang Wrote:
>> Current mem boot option only can work for non efi environment. If the user
>> specifies add_efi_memmap, it cannot work for efi environment. In
>> the efi environment, we call e820_add_region() to add the memory map. So
>> we can modify __e820_add_region() and the mem boot option can work for
>> efi environment.
>>
>> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
>> ---
>> arch/x86/kernel/e820.c | 29 +++++++++++++++++++++++++----
>> 1 files changed, 25 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
>> index 4185797..20bc467 100644
>> --- a/arch/x86/kernel/e820.c
>> +++ b/arch/x86/kernel/e820.c
>> @@ -47,6 +47,7 @@ unsigned long pci_mem_start = 0xaeedbabe;
>> #ifdef CONFIG_PCI
>> EXPORT_SYMBOL(pci_mem_start);
>> #endif
>> +static u64 mem_limit = ~0ULL;
>>
>> /*
>> * This function checks if any part of the range <start,end> is mapped
>> @@ -119,6 +120,20 @@ static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size,
>> return;
>> }
>>
>> + if (start >= mem_limit) {
>> + printk(KERN_ERR "e820: ignoring [mem %#010llx-%#010llx]\n",
>> + (unsigned long long)start,
>> + (unsigned long long)(start + size - 1));
>> + return;
>> + }
>> +
>> + if (mem_limit - start < size) {
>> + printk(KERN_ERR "e820: ingoring [mem %#010llx-%#010llx]\n",
>> + (unsigned long long)mem_limit,
>> + (unsigned long long)(start + size - 1));
>> + size = mem_limit - start;
>> + }
>> +
>> e820x->map[x].addr = start;
>> e820x->map[x].size = size;
>> e820x->map[x].type = type;
>> @@ -809,7 +824,7 @@ static int userdef __initdata;
>> /* "mem=nopentium" disables the 4MB page tables. */
>> static int __init parse_memopt(char *p)
>> {
>> - u64 mem_size;
>> + char *oldp;
>>
>> if (!p)
>> return -EINVAL;
>> @@ -825,11 +840,11 @@ static int __init parse_memopt(char *p)
>> }
>>
>> userdef = 1;
>> - mem_size = memparse(p, &p);
>> + oldp = p;
>> + mem_limit = memparse(p, &p);
>> /* don't remove all of memory when handling "mem={invalid}" param */
>> - if (mem_size == 0)
>> + if (mem_limit == 0 || p == oldp)
>> return -EINVAL;
>> - e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
>>
>> return 0;
>> }
>> @@ -881,6 +896,12 @@ early_param("memmap", parse_memmap_opt);
>>
>> void __init finish_e820_parsing(void)
>> {
>> + if (mem_limit != ~0ULL) {
>> + userdef = 1;
>> + e820_remove_range(mem_limit, ULLONG_MAX - mem_limit,
>> + E820_RAM, 1);
>> + }
>> +
>> if (userdef) {
>> u32 nr = e820.nr_map;
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
next prev parent reply other threads:[~2012-07-17 5:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-14 8:10 [PATCH 1/2] doc: update mem= option's spec Wen Congyang
2012-06-14 8:12 ` [PATCH 2/2] x86: reimplement mem boot option Wen Congyang
2012-06-28 1:29 ` Wen Congyang
2012-07-17 5:22 ` Wen Congyang [this message]
2012-07-18 9:16 ` Ingo Molnar
2012-08-21 8:11 ` [PATCH v2 " Wen Congyang
2012-09-05 9:28 ` Wen Congyang
2012-06-14 20:22 ` [PATCH 1/2] doc: update mem= option's spec Rob Landley
-- strict thread matches above, loose matches on Subject: below --
2012-05-22 7:02 [PATCH 1/2] x86: add max_addr boot option Wen Congyang
2012-05-22 7:05 ` [PATCH 2/2] x86: reimplement mem " Wen Congyang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5004F67D.7000809@cn.fujitsu.com \
--to=wency@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=bhelgaas@google.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rob@landley.net \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).