linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: joeyli <jlee@suse.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Russ Anderson <rja@sgi.com>,
	Matt Fleming <matt@console-pimps.org>,
	Matthew Garrett <matthew.garrett@nebula.com>,
	matt.fleming@intel.com, linux-efi@vger.kernel.org,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Borislav Petkov <bp@alien8.de>
Subject: Re: [regression, bisected] x86: efi: Pass boot services variable info to runtime code
Date: Thu, 30 May 2013 10:16:12 +0800	[thread overview]
Message-ID: <1369880172.17397.11.camel@linux-s257.site> (raw)
In-Reply-To: <alpine.LNX.2.00.1305300048520.30576@pobox.suse.cz>

於 四,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.

> 
> > > We are calling QueryVariableInfo() in setup_efi_vars(), and later on 
> > > AllocatePool is being called (through boot table).
> > 
> > On my system the QueryVariableInfo() call fails, so AllocatePool()
> > is not called in setup_efi_vars().
> 
> But it's being called later on coming back to efi_main(). That was just a 
> poor man's demonstration attempt why this code is running before 
> ExitBootServices() has been called.
> 

Yes, I agreed your point, the space information of
EFI_VARIABLE_BOOTSERVICE_ACCESS should still return by
QueryVariableInfo() because we call it before ExitBootServices():

arch/x86/boot/compressed/eboot.c
efi_main(void *handle, efi_system_table_t *_table, struct boot_params *boot_params)
	..
	sys_table = _table;
	/* Check if we were booted by the EFI firmware */
	if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
		goto fail;
	boot_params->secure_boot = get_secure_boot(sys_table)			/* check does BIOS in secure boot mode */
	setup_graphics(boot_params);
	setup_efi_vars(boot_params);						/* Pass boot services variable info to runtime code, call QueryVariableInfo() */
	...
	status = exit_boot(boot_params, handle);				/* call ExitBootServices() */
	...


Thanks a lot!
Joey Lee


  reply	other threads:[~2013-05-30  2: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
2013-05-23 11:58 ` Matt Fleming
2013-05-23 20:32   ` Russ Anderson
2013-05-24  7:43     ` Matt Fleming
2013-05-24 11:09       ` Borislav Petkov
2013-05-24 11:40         ` Matt Fleming
2013-05-24 16:11       ` Robin Holt
2013-05-24 17:02         ` Russ Anderson
2013-05-24 21:05           ` Dave Jones
2013-05-27  4:27             ` joeyli
2013-05-27  4:32               ` joeyli
2013-05-28  2:43               ` Russ Anderson
2013-05-24 20:05       ` Russ Anderson
2013-05-24 20:11         ` Matthew Garrett
2013-05-24 20:49           ` Russ Anderson
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
2013-05-29 22:22         ` Jiri Kosina
2013-05-29 22:46           ` Russ Anderson
2013-05-29 22:53             ` Jiri Kosina
2013-05-30  2:16               ` joeyli [this message]
2013-05-30 22:17                 ` Russ Anderson
2013-05-30 22:21                   ` Matthew Garrett
2013-05-30 22:28                     ` Russ Anderson
2013-05-30 22:30                       ` Jiri Kosina
2013-05-31  2:17                         ` Russ Anderson
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
2013-05-31 10:12                     ` Ingo Molnar
2013-05-31 11:06                       ` Jiri Kosina
2013-05-31 11:40                         ` Ingo Molnar
2013-05-31 11:54                           ` Josh Boyer
2013-05-31 12:30                         ` Borislav Petkov
2013-05-31 12:43                           ` Ingo Molnar
2013-05-31 14:34                             ` Matthew Garrett
2013-05-31 14:42                               ` James Bottomley
2013-05-31 14:45                                 ` H. Peter Anvin
2013-05-31 14:48                                 ` Matthew Garrett
2013-05-31 15:43                                   ` Russ Anderson
2013-05-31 16:28                                     ` Matthew Garrett
2013-05-31 17:35                                       ` James Bottomley
2013-05-31 22:57                                       ` Russ Anderson
2013-05-31 22:59                                         ` H. Peter Anvin
2013-05-31 23:30                                         ` Jiri Kosina
2013-06-01  0:03                                         ` Matthew Garrett
2013-06-01  4:20                                           ` Russ Anderson
2013-06-01  4:41                                             ` Matthew Garrett
2013-06-01 11:01                               ` Linus Torvalds
2013-06-01 14:40                                 ` Matthew Garrett
2013-05-30  2:38             ` joeyli
2013-05-23 22:23   ` Russ Anderson
2013-05-24  7:45     ` Matt Fleming
2013-05-29 20:16       ` Russ Anderson
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=1369880172.17397.11.camel@linux-s257.site \
    --to=jlee@suse.com \
    --cc=bp@alien8.de \
    --cc=hpa@linux.intel.com \
    --cc=jkosina@suse.cz \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=matt@console-pimps.org \
    --cc=matthew.garrett@nebula.com \
    --cc=mingo@kernel.org \
    --cc=rja@sgi.com \
    --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).