From: Russ Anderson <rja-sJ/iWh9BUns@public.gmane.org>
To: joeyli <jlee-IBi9RG/b67k@public.gmane.org>
Cc: Jiri Kosina <jkosina-AlSwsSmVLrQ@public.gmane.org>,
Matt Fleming
<matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>,
Matthew Garrett
<matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org>,
matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Ingo Molnar <mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
"H. Peter Anvin" <hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
Subject: Re: [regression, bisected] x86: efi: Pass boot services variable info to runtime code
Date: Thu, 30 May 2013 17:17:37 -0500 [thread overview]
Message-ID: <20130530221737.GA11105@sgi.com> (raw)
In-Reply-To: <1369880172.17397.11.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]
On Thu, May 30, 2013 at 10:16:12AM +0800, joeyli wrote:
> 於 四,2013-05-30 於 00:53 +0200,Jiri Kosina 提到:
> > On Wed, 29 May 2013, Russ Anderson wrote:
> >
> > > > Yes, but this call is clearly happening way before ExitBootServices() --
> > > > see the surrounding code, see for example this in efi_main():
> > > >
> > > > [ ... snip ... ]
> > > > setup_efi_vars(boot_params);
> > > >
> > > > setup_efi_pci(boot_params);
> > > >
> > > > status = efi_call_phys3(sys_table->boottime->allocate_pool,
> > > > EFI_LOADER_DATA, sizeof(*gdt),
> > > > (void **)&gdt);
> > > > if (status != EFI_SUCCESS) {
> > > > efi_printk("Failed to alloc mem for gdt structure\n");
> > > > goto fail;
> > > > }
> > > > [ ... snip ... ]
> > >
> > > Yes. Note the failing call is sys_table->runtime while all the
> > > other calls are sys_table->boottime and seem to work. Not sure
> > > why the sys_table->runtime call has a problem but it may be
> > > a clue. Could something in the runtime path not be set up???
> >
> > That was my original idea early today as well. My understanding of the
> > UEFI spec is admittedly limited, but afaics calling runtime method from
> > boot environment should be a valid thing to do ... ?
>
> QueryVariableInfo() is a runtime services, all runtime services should
> available bother on boot time and runtime:
>
> UEFI spec 2.3.1 P.109:
> Runtime Services
> Functions that are available before and after any call to
> ExitBootServices(). These functions are described in Section 7.
That's a great idea. This patch moves the QueryVariableInfo()
call from bootime to runtime, in efi_late_init(). The attached
patch is consistent with the UEFI spec and avoids the problem.
Thanks,
--
Russ Anderson, OS RAS/Partitioning Project Lead
SGI - Silicon Graphics Inc rja-sJ/iWh9BUns@public.gmane.org
[-- Attachment #2: efi_move_query_call.patch --]
[-- Type: text/x-patch, Size: 4185 bytes --]
Move query_variable_info call to runtime to avoid bios issues.
Signed-off-by: Russ Anderson <rja-sJ/iWh9BUns@public.gmane.org>
---
arch/x86/boot/compressed/eboot.c | 49 ---------------------------------------
arch/x86/platform/efi/efi.c | 35 ++++++++++++---------------
2 files changed, 16 insertions(+), 68 deletions(-)
Index: linux/arch/x86/boot/compressed/eboot.c
===================================================================
--- linux.orig/arch/x86/boot/compressed/eboot.c 2013-05-30 11:02:19.034914824 -0500
+++ linux/arch/x86/boot/compressed/eboot.c 2013-05-30 16:53:50.512636568 -0500
@@ -251,53 +251,6 @@ static void find_bits(unsigned long mask
*size = len;
}
-static efi_status_t setup_efi_vars(struct boot_params *params)
-{
- struct setup_data *data;
- struct efi_var_bootdata *efidata;
- u64 store_size, remaining_size, var_size;
- efi_status_t status;
-
- if (sys_table->runtime->hdr.revision < EFI_2_00_SYSTEM_TABLE_REVISION)
- return EFI_UNSUPPORTED;
-
- data = (struct setup_data *)(unsigned long)params->hdr.setup_data;
-
- while (data && data->next)
- data = (struct setup_data *)(unsigned long)data->next;
-
- status = efi_call_phys4((void *)sys_table->runtime->query_variable_info,
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS, &store_size,
- &remaining_size, &var_size);
-
- if (status != EFI_SUCCESS) { // RJA
- efi_printk("RJA: setup_efi_vars FAILED\n");
- return status;
- }
-
- status = efi_call_phys3(sys_table->boottime->allocate_pool,
- EFI_LOADER_DATA, sizeof(*efidata), &efidata);
-
- if (status != EFI_SUCCESS)
- return status;
-
- efidata->data.type = SETUP_EFI_VARS;
- efidata->data.len = sizeof(struct efi_var_bootdata) -
- sizeof(struct setup_data);
- efidata->data.next = 0;
- efidata->store_size = store_size;
- efidata->remaining_size = remaining_size;
- efidata->max_var_size = var_size;
-
- if (data)
- data->next = (unsigned long)efidata;
- else
- params->hdr.setup_data = (unsigned long)efidata;
-
-}
-
static efi_status_t setup_efi_pci(struct boot_params *params)
{
efi_pci_io_protocol *pci;
@@ -1204,8 +1157,6 @@ struct boot_params *efi_main(void *handl
setup_graphics(boot_params);
- setup_efi_vars(boot_params);
-
setup_efi_pci(boot_params);
status = efi_call_phys3(sys_table->boottime->allocate_pool,
Index: linux/arch/x86/platform/efi/efi.c
===================================================================
--- linux.orig/arch/x86/platform/efi/efi.c 2013-05-30 11:02:19.034914824 -0500
+++ linux/arch/x86/platform/efi/efi.c 2013-05-30 17:05:38.140039879 -0500
@@ -786,9 +786,6 @@ void __init efi_init(void)
char vendor[100] = "unknown";
int i = 0;
void *tmp;
- struct setup_data *data;
- struct efi_var_bootdata *efi_var_data;
- u64 pa_data;
#ifdef CONFIG_X86_32
if (boot_params.efi_info.efi_systab_hi ||
@@ -806,22 +803,6 @@ void __init efi_init(void)
if (efi_systab_init(efi_phys.systab))
return;
- pa_data = boot_params.hdr.setup_data;
- while (pa_data) {
- data = early_ioremap(pa_data, sizeof(*efi_var_data));
- if (data->type == SETUP_EFI_VARS) {
- efi_var_data = (struct efi_var_bootdata *)data;
-
- efi_var_store_size = efi_var_data->store_size;
- efi_var_remaining_size = efi_var_data->remaining_size;
- efi_var_max_var_size = efi_var_data->max_var_size;
- }
- pa_data = data->next;
- early_iounmap(data, sizeof(*efi_var_data));
- }
-
- boot_used_size = efi_var_store_size - efi_var_remaining_size;
-
set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility);
/*
@@ -877,7 +858,23 @@ void __init efi_init(void)
void __init efi_late_init(void)
{
+ efi_status_t status;
+
efi_bgrt_init();
+
+ if (efi.runtime_version < EFI_2_00_SYSTEM_TABLE_REVISION)
+ return;
+
+ status = efi_call_virt4(query_variable_info,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ &efi_var_max_var_size, &efi_var_remaining_size,
+ &efi_var_store_size);
+ if (status != EFI_SUCCESS)
+ return;
+
+ boot_used_size = efi_var_store_size - efi_var_remaining_size;
}
void __init efi_set_executable(efi_memory_desc_t *md, bool executable)
next prev parent reply other threads:[~2013-05-30 22:17 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-22 16:27 [regression, bisected] x86: efi: Pass boot services variable info to runtime code Russ Anderson
[not found] ` <20130522162747.GA20816-sJ/iWh9BUns@public.gmane.org>
2013-05-23 11:58 ` Matt Fleming
[not found] ` <20130523115801.GJ14575-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-05-23 20:32 ` Russ Anderson
[not found] ` <20130523203234.GD20913-sJ/iWh9BUns@public.gmane.org>
2013-05-24 7:43 ` Matt Fleming
[not found] ` <20130524074331.GL14575-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-05-24 11:09 ` Borislav Petkov
[not found] ` <20130524110911.GA32220-K5JNixvcfoxupOikMc4+xw@public.gmane.org>
2013-05-24 11:40 ` Matt Fleming
2013-05-24 16:11 ` Robin Holt
[not found] ` <20130524161111.GE3672-sJ/iWh9BUns@public.gmane.org>
2013-05-24 17:02 ` Russ Anderson
[not found] ` <20130524170214.GA30179-sJ/iWh9BUns@public.gmane.org>
2013-05-24 21:05 ` Dave Jones
[not found] ` <20130524210534.GA15466-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-27 4:27 ` joeyli
[not found] ` <1369628832.19026.22.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2013-05-27 4:32 ` joeyli
2013-05-28 2:43 ` Russ Anderson
2013-05-24 20:05 ` Russ Anderson
[not found] ` <20130524200539.GA3322-sJ/iWh9BUns@public.gmane.org>
2013-05-24 20:11 ` Matthew Garrett
2013-05-24 20:49 ` Russ Anderson
[not found] ` <20130524204937.GB3322-sJ/iWh9BUns@public.gmane.org>
2013-05-28 10:50 ` Matt Fleming
2013-05-28 10:53 ` Matt Fleming
2013-05-28 8:35 ` Ingo Molnar
2013-05-29 21:01 ` Russ Anderson
[not found] ` <20130529210115.GC28027-sJ/iWh9BUns@public.gmane.org>
2013-05-29 22:22 ` Jiri Kosina
[not found] ` <alpine.LRH.2.00.1305300018180.1111-1ReQVI26iDCaZKY3DrU6dA@public.gmane.org>
2013-05-29 22:46 ` Russ Anderson
[not found] ` <20130529224645.GA16582-sJ/iWh9BUns@public.gmane.org>
2013-05-29 22:53 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1305300048520.30576-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2013-05-30 2:16 ` joeyli
[not found] ` <1369880172.17397.11.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org>
2013-05-30 22:17 ` Russ Anderson [this message]
[not found] ` <20130530221737.GA11105-sJ/iWh9BUns@public.gmane.org>
2013-05-30 22:21 ` Matthew Garrett
2013-05-30 22:28 ` Russ Anderson
[not found] ` <20130530222836.GB11105-sJ/iWh9BUns@public.gmane.org>
2013-05-30 22:30 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1305310029560.30576-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2013-05-31 2:17 ` Russ Anderson
[not found] ` <20130531021749.GA24287-sJ/iWh9BUns@public.gmane.org>
2013-05-31 3:28 ` joeyli
2013-05-30 22:32 ` Matthew Garrett
2013-05-31 2:54 ` Russ Anderson
2013-05-31 10:06 ` Ingo Molnar
2013-05-30 22:25 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1305310023020.30576-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2013-05-31 10:12 ` Ingo Molnar
[not found] ` <20130531101250.GD30394-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-31 11:06 ` Jiri Kosina
[not found] ` <alpine.LNX.2.00.1305311259520.30576-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2013-05-31 11:40 ` Ingo Molnar
[not found] ` <20130531114037.GC7131-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-31 11:54 ` Josh Boyer
2013-05-31 12:30 ` Borislav Petkov
[not found] ` <20130531123015.GC17843-K5JNixvcfoxupOikMc4+xw@public.gmane.org>
2013-05-31 12:43 ` Ingo Molnar
[not found] ` <20130531124356.GA8212-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-31 14:34 ` Matthew Garrett
[not found] ` <20130531143425.GA5850-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-05-31 14:42 ` James Bottomley
[not found] ` <1370011357.1913.15.camel-sFMDBYUN5F8GjUHQrlYNx2Wm91YjaHnnhRte9Li2A+AAvxtiuMwx3w@public.gmane.org>
2013-05-31 14:45 ` H. Peter Anvin
2013-05-31 14:48 ` Matthew Garrett
2013-05-31 15:43 ` Russ Anderson
[not found] ` <20130531154348.GA17145-sJ/iWh9BUns@public.gmane.org>
2013-05-31 16:28 ` Matthew Garrett
[not found] ` <20130531162815.GA8082-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-05-31 17:35 ` James Bottomley
2013-05-31 22:57 ` Russ Anderson
[not found] ` <20130531225730.GB14752-sJ/iWh9BUns@public.gmane.org>
2013-05-31 22:59 ` H. Peter Anvin
2013-05-31 23:30 ` Jiri Kosina
2013-06-01 0:03 ` Matthew Garrett
[not found] ` <20130601000311.GA15126-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-06-01 4:20 ` Russ Anderson
[not found] ` <20130601042058.GB15199-sJ/iWh9BUns@public.gmane.org>
2013-06-01 4:41 ` Matthew Garrett
2013-06-01 11:01 ` Linus Torvalds
[not found] ` <alpine.LFD.2.03.1306011956350.9068-OR3hLWCBCApQetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
2013-06-01 14:40 ` Matthew Garrett
2013-05-30 2:38 ` joeyli
2013-05-23 22:23 ` Russ Anderson
[not found] ` <20130523222321.GB31880-sJ/iWh9BUns@public.gmane.org>
2013-05-24 7:45 ` Matt Fleming
[not found] ` <20130524074544.GM14575-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-05-29 20:16 ` Russ Anderson
[not found] ` <20130529201616.GB28027-sJ/iWh9BUns@public.gmane.org>
2013-05-31 14:41 ` 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=20130530221737.GA11105@sgi.com \
--to=rja-sj/iwh9buns@public.gmane.org \
--cc=bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org \
--cc=hpa-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=jkosina-AlSwsSmVLrQ@public.gmane.org \
--cc=jlee-IBi9RG/b67k@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
--cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA@public.gmane.org \
--cc=mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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