From: Matt Fleming <matt@console-pimps.org>
To: Dave Young <dyoung@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
x86@kernel.org, mjg59@srcf.ucam.org, hpa@zytor.com,
James.Bottomley@HansenPartnership.com, vgoyal@redhat.com,
ebiederm@xmission.com, horms@verge.net.au,
kexec@lists.infradead.org, bp@alien8.de, greg@kroah.com,
toshi.kani@hp.com, akpm@linux-foundation.org, mingo@kernel.org,
msalter@redhat.com, leif.lindholm@linaro.org
Subject: Re: [PATCH v7 09/12] efi: passing kexec necessary efi data via setup_data
Date: Sat, 21 Dec 2013 14:53:48 +0000 [thread overview]
Message-ID: <20131221145348.GC29501@console-pimps.org> (raw)
In-Reply-To: <1387533742-18018-10-git-send-email-dyoung@redhat.com>
On Fri, 20 Dec, at 06:02:19PM, Dave Young wrote:
> Add a new setup_data type SETUP_EFI for kexec use.
> Passing the saved fw_vendor, runtime, config tables and efi runtime mappings.
>
> When entering virtual mode, directly mapping the efi runtime ragions which
> we passed in previously. And skip the step to call SetVirtualAddressMap.
>
> Specially for HP z420 workstation we need save the smbios physical address.
> The kernel boot sequence proceeds in the following order. Step 2
> requires efi.smbios to be the physical address. However, I found that on
> HP z420 EFI system table has a virtual address of SMBIOS in step 1. Hence,
> we need set it back to the physical address with the smbios in
> efi_setup_data. (When it is still the physical address, it simply sets
> the same value.)
>
> 1. efi_init() - Set efi.smbios from EFI system table
> 2. dmi_scan_machine() - Temporary map efi.smbios to access SMBIOS table
> 3. efi_enter_virtual_mode() - Map EFI ranges
>
> Tested on ovmf+qemu, lenovo thinkpad, a dell laptop and an
> HP z420 workstation.
>
> v2: refresh based on previous patch changes, code cleanup.
> v3: use ioremap instead of phys_to_virt for efi_setup
> v5: improve some code structure per comments from Matt
> Boris: improve code structure, spell fix, etc.
> Improve changelog from Toshi.
> change the variable efi_setup to the physical address of efi setup_data
> instead of the ioremapped virt address
> v6: Boris: Documentation fixes
> move parse_efi_setup to efi_$(BITS).c
> simplify parse_efi_setup logic
> Matt: check return value of efi_reuse_config
> v7: cleanup efi_map_regions and efi_map_regions_fixed
> remove useless return at the end of efi_enter_virtual_mode
>
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
> arch/x86/include/asm/efi.h | 13 +++
> arch/x86/include/uapi/asm/bootparam.h | 1 +
> arch/x86/kernel/setup.c | 3 +
> arch/x86/platform/efi/efi.c | 159 ++++++++++++++++++++++++++++------
> arch/x86/platform/efi/efi_32.c | 1 +
> arch/x86/platform/efi/efi_64.c | 6 ++
> 6 files changed, 158 insertions(+), 25 deletions(-)
[...]
> efi_systab.hdr = systab64->hdr;
> - efi_systab.fw_vendor = systab64->fw_vendor;
> - tmp |= systab64->fw_vendor;
> +
> + efi_systab.fw_vendor = data ? (unsigned long)data->fw_vendor :
> + systab64->fw_vendor;
> + tmp |= efi_systab.fw_vendor;
[... snip ...]
> @@ -519,15 +530,20 @@ static int __init efi_systab_init(void *phys)
> tmp |= systab64->stderr_handle;
> efi_systab.stderr = systab64->stderr;
> tmp |= systab64->stderr;
> - efi_systab.runtime = (void *)(unsigned long)systab64->runtime;
> - tmp |= systab64->runtime;
> + efi_systab.runtime = data ?
> + (void *)(unsigned long)data->runtime :
> + (void *)(unsigned long)systab64->runtime;
> + tmp |= (unsigned long)efi_systab.runtime;
> efi_systab.boottime = (void *)(unsigned long)systab64->boottime;
> tmp |= systab64->boottime;
> efi_systab.nr_tables = systab64->nr_tables;
> - efi_systab.tables = systab64->tables;
> - tmp |= systab64->tables;
> + efi_systab.tables = data ? (unsigned long)data->tables :
> + systab64->tables;
> + tmp |= efi_systab.tables;
>
> early_memunmap(systab64, sizeof(*systab64));
> + if (data)
> + early_memunmap(data, sizeof(*data));
> #ifdef CONFIG_X86_32
> if (tmp >> 32) {
> pr_err("EFI data located above 4GB, disabling EFI.\n");
This isn't correct, and means we now won't trigger this pr_err() if
booting a CONFIG_X86_32 kernel with EFI_64BIT and where the ->fw_vendor,
->runtime or ->tables pointer is above 4GB - you've mixed up systab and
systab64. I've fixed this up like so when applying this patch,
---
@@ -494,18 +495,27 @@ static int __init efi_systab_init(void *phys)
{
if (efi_enabled(EFI_64BIT)) {
efi_system_table_64_t *systab64;
+ struct efi_setup_data *data = NULL;
u64 tmp = 0;
+ if (efi_setup) {
+ data = early_memremap(efi_setup, sizeof(*data));
+ if (!data)
+ return -ENOMEM;
+ }
systab64 = early_ioremap((unsigned long)phys,
sizeof(*systab64));
if (systab64 == NULL) {
pr_err("Couldn't map the system table!\n");
+ if (data)
+ early_iounmap(data, sizeof(*data));
return -ENOMEM;
}
efi_systab.hdr = systab64->hdr;
- efi_systab.fw_vendor = systab64->fw_vendor;
- tmp |= systab64->fw_vendor;
+ efi_systab.fw_vendor = data ? (unsigned long)data->fw_vendor :
+ systab64->fw_vendor;
+ tmp |= data ? data->fw_vendor : systab64->fw_vendor;
efi_systab.fw_revision = systab64->fw_revision;
efi_systab.con_in_handle = systab64->con_in_handle;
tmp |= systab64->con_in_handle;
@@ -519,15 +529,20 @@ static int __init efi_systab_init(void *phys)
tmp |= systab64->stderr_handle;
efi_systab.stderr = systab64->stderr;
tmp |= systab64->stderr;
- efi_systab.runtime = (void *)(unsigned long)systab64->runtime;
- tmp |= systab64->runtime;
+ efi_systab.runtime = data ?
+ (void *)(unsigned long)data->runtime :
+ (void *)(unsigned long)systab64->runtime;
+ tmp |= data ? data->runtime : systab64->runtime;
efi_systab.boottime = (void *)(unsigned long)systab64->boottime;
tmp |= systab64->boottime;
efi_systab.nr_tables = systab64->nr_tables;
- efi_systab.tables = systab64->tables;
- tmp |= systab64->tables;
+ efi_systab.tables = data ? (unsigned long)data->tables :
+ systab64->tables;
+ tmp |= data ? data->tables : systab64->tables;
early_iounmap(systab64, sizeof(*systab64));
+ if (data)
+ early_iounmap(data, sizeof(*data));
#ifdef CONFIG_X86_32
if (tmp >> 32) {
pr_err("EFI data located above 4GB, disabling EFI.\n");
--
Matt Fleming, Intel Open Source Technology Center
next prev parent reply other threads:[~2013-12-21 14:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 10:02 [PATCH v7 00/12] kexec kernel efi runtime support Dave Young
2013-12-20 10:02 ` [PATCH v7 01/12] x86/mm: sparse warning fix for early_memremap Dave Young
2013-12-20 10:02 ` [PATCH v7 02/12] efi: Use early_memremap and early_memunmap to fix sparse warnings Dave Young
2013-12-20 10:02 ` [PATCH v7 03/12] efi: remove unused variables in __map_region Dave Young
2013-12-20 10:02 ` [PATCH v7 04/12] efi: add a wrapper function efi_map_region_fixed Dave Young
2013-12-20 10:02 ` [PATCH v7 05/12] efi: reserve boot service fix Dave Young
2013-12-20 10:02 ` [PATCH v7 06/12] efi: cleanup efi_enter_virtual_mode function Dave Young
2013-12-20 10:02 ` [PATCH v7 07/12] efi: export more efi table variable to sysfs Dave Young
2013-12-20 10:02 ` [PATCH v7 08/12] efi: export efi runtime memory mapping " Dave Young
2013-12-20 10:02 ` [PATCH v7 09/12] efi: passing kexec necessary efi data via setup_data Dave Young
2013-12-21 14:53 ` Matt Fleming [this message]
2013-12-23 2:06 ` Dave Young
2013-12-21 16:06 ` Matt Fleming
2013-12-23 2:09 ` Dave Young
2013-12-23 6:09 ` Dave Young
2013-12-23 8:07 ` Matt Fleming
2013-12-25 3:12 ` Dave Young
2013-12-25 3:32 ` Dave Young
2013-12-29 13:05 ` Matt Fleming
2013-12-30 1:38 ` Dave Young
2013-12-20 10:02 ` [PATCH v7 10/12] x86: add xloadflags bit for efi runtime support on kexec Dave Young
2013-12-20 10:02 ` [PATCH v7 11/12] x86: export x86 boot_params to sysfs Dave Young
2013-12-20 10:02 ` [PATCH v7 12/12] x86: reserve setup_data ranges late after parsing memmap cmdline Dave Young
2013-12-20 18:01 ` [PATCH v7 00/12] kexec kernel efi runtime support Toshi Kani
2013-12-21 17:35 ` Matt Fleming
2013-12-22 21:27 ` Toshi Kani
2013-12-23 7:36 ` Matt Fleming
2013-12-24 20:31 ` Toshi Kani
2013-12-25 3:09 ` Dave Young
2013-12-23 2:32 ` Dave Young
2014-01-02 2:42 ` Dave Young
2014-01-02 10:35 ` Matt Fleming
2014-01-03 4:12 ` Dave Young
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=20131221145348.GC29501@console-pimps.org \
--to=matt@console-pimps.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=greg@kroah.com \
--cc=horms@verge.net.au \
--cc=hpa@zytor.com \
--cc=kexec@lists.infradead.org \
--cc=leif.lindholm@linaro.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=msalter@redhat.com \
--cc=toshi.kani@hp.com \
--cc=vgoyal@redhat.com \
--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