From: "H. Peter Anvin" <hpa@zytor.com>
To: huang ying <huang.ying.caritas@gmail.com>,
Takao Indoh <indou.takao@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
ebiederm@xmission.com, tglx@linutronix.de, mingo@redhat.com,
vgoyal@redhat.com, nhorman@tuxdriver.com
Subject: Re: [PATCH][EFI] Run EFI in physical mode
Date: Sun, 15 Aug 2010 20:27:49 -0700 [thread overview]
Message-ID: <faf83501-1e53-459d-88ed-2ac5963a37f2@email.android.com> (raw)
In-Reply-To: <AANLkTimM0H0ryre3pXsXQ6c0e3=v_36-h0TsXzriMWXe@mail.gmail.com>
No, it should not be dynamic; rather we should unify all the users who need a 1:1 map and just keep that page table set around.
"huang ying" <huang.ying.caritas@gmail.com> wrote:
>On Sat, Aug 14, 2010 at 3:18 AM, Takao Indoh <indou.takao@jp.fujitsu.com> wrote:
>> diff -Nurp linux-2.6.35.org/arch/x86/kernel/efi_64.c linux-2.6.35/arch/x86/kernel/efi_64.c
>> --- linux-2.6.35.org/arch/x86/kernel/efi_64.c 2010-08-01 18:11:14.000000000 -0400
>> +++ linux-2.6.35/arch/x86/kernel/efi_64.c 2010-08-13 14:39:25.819105004 -0400
>> @@ -39,7 +39,9 @@
>> #include <asm/fixmap.h>
>>
>> static pgd_t save_pgd __initdata;
>> -static unsigned long efi_flags __initdata;
>> +static unsigned long efi_flags;
>> +static pgd_t efi_pgd[PTRS_PER_PGD] __page_aligned_bss;
>> +static unsigned long save_cr3;
>>
>> static void __init early_mapping_set_exec(unsigned long start,
>> unsigned long end,
>> @@ -98,6 +100,19 @@ void __init efi_call_phys_epilog(void)
>> early_runtime_code_mapping_set_exec(0);
>> }
>>
>> +void efi_call_phys_prelog_in_physmode(void)
>> +{
>> + local_irq_save(efi_flags);
>> + save_cr3 = read_cr3();
>> + write_cr3(virt_to_phys(efi_pgd));
>> +}
>> +
>> +void efi_call_phys_epilog_in_physmode(void)
>> +{
>> + write_cr3(save_cr3);
>> + local_irq_restore(efi_flags);
>> +}
>
>efi_flags and save_cr3 should be per-CPU, because they now will be
>used after SMP is enabled.
>
>efi_pgd should be dynamically allocated instead of statically
>allocated, because EFI may be not enabled on some platform.
>
>And I think it is better to unify early physical mode with run-time
>physical mode. Just allocate the page table with early page allocator
>(lmb?).
>
>Best Regards,
>Huang Ying
>
--
Sent from my mobile phone. Please pardon any lack of formatting.
next prev parent reply other threads:[~2010-08-16 3:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-13 19:18 Takao Indoh
2010-08-13 22:19 ` Eric W. Biederman
2010-08-16 19:30 ` Takao Indoh
2010-08-13 22:24 ` H. Peter Anvin
2010-08-13 22:33 ` Luck, Tony
2010-08-13 23:11 ` Eric W. Biederman
2010-08-13 23:16 ` H. Peter Anvin
2010-08-13 23:36 ` Tony Luck
2010-08-16 1:31 ` Simon Horman
2010-08-13 22:28 ` H. Peter Anvin
2010-08-16 1:43 ` huang ying
2010-08-16 3:27 ` H. Peter Anvin [this message]
2010-08-16 4:58 ` huang ying
2010-08-16 5:08 ` H. Peter Anvin
2010-08-16 23:39 ` Eric W. Biederman
2010-08-16 23:54 ` H. Peter Anvin
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=faf83501-1e53-459d-88ed-2ac5963a37f2@email.android.com \
--to=hpa@zytor.com \
--cc=ebiederm@xmission.com \
--cc=huang.ying.caritas@gmail.com \
--cc=indou.takao@jp.fujitsu.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nhorman@tuxdriver.com \
--cc=tglx@linutronix.de \
--cc=vgoyal@redhat.com \
/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
Powered by JetHome