Skip to contentSkip to conversation

EFI: Ignore EFI commandline, skip console setup when booted from GRUB

PATCH Superseded Roy Franz 3 participants 8 messages Nov 3, 2014 – Nov 5, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Roy Franz

author
#0 lore raw

PATCH 1/1 EFI: Ignore EFI commandline, skip console setup when booted from GRUB

Update EFI code to completely ignore the EFI comnandline when booted from GRUB. Previusly it was parsed of EFI boot specific options, but these aren't used when booted from GRUB.

Don't do EFI console or video configuration when booted by GRUB. The EFI boot code does some console and video initialization to support native EFI boot from the EFI boot manager or EFI shell. This initlization should not be done when booted using GRUB.

Update EFI documentation to indicate that it describes EFI native boot, and does not apply at all when Xen is booted using GRUB.

---
This patch implements what I understand to be the desired behavior when booting an EFI Xen image via GRUB based on the thread last week. The EFI command line is not used, and the Xen commandline comes via the multiboot protocol (and in the ARM case the multiboot FDT bindings). This brings the x86 and arm64 GRUB EFI boot cases into alignment in not using the EFI commandline.

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options. If unexpected options are passed in the EFI commandline, it will generate "unrecognized option" ouput for all unexpected options.

I think this should be considered for 4.5.

 docs/misc/efi.markdown |   5 ++
 xen/common/efi/boot.c  | 237 +++++++++++++++++++++++++------------------------
 2 files changed, 125 insertions(+), 117 deletions(-)
docs/misc/efi.markdown +5 -0
index 5e48aa3..f435ec7 100644
@@ -29,6 +29,11 @@ separators will be tried) to be present in the same directory as the binary.
 (To illustrate the name handling, a binary named `xen-4.2-unstable.efi` would
 try `xen-4.2-unstable.cfg`, `xen-4.2.cfg`, `xen-4.cfg`, and `xen.cfg` in
 order.) One can override this with a command line option (`-cfg=<filename>`).
+This configuration file and EFI commandline are only used for booting directly
+from EFI firmware, or when using an EFI loader that does not support
+the multiboot2 protocol.  When booting using GRUB or another multiboot aware
+loader the EFI commandline is ignored and all information is passed from
+the loader to Xen using the multiboot protocol.
 
 The configuration file consists of one or more sections headed by a section
 name enclosed in square brackets, with individual values specified in each
xen/common/efi/boot.c +120 -117

285 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 07:13, <[email protected]> wrote:

This patch implements what I understand to be the desired behavior when booting
an EFI Xen image via GRUB based on the thread last week. The EFI command line
is not used, and the Xen commandline comes via the multiboot protocol (and in the ARM case the multiboot FDT bindings). This brings the x86 and arm64 GRUB EFI boot cases into alignment in not using the EFI commandline.

Right, but ...

Quoted 4 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options. If unexpected options are passed in the EFI commandline, it will generate "unrecognized option" ouput for all unexpected options.

... why is this?

xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 804

Quoted 4 lines
xen/common/efi/boot.c +2 -0
+    if ( use_cfg_file )
     {
         EFI_FILE_HANDLE dir_handle;
+        size = 0;

Coding style (missing blank line between declaration(s) and statement(s). Plus - did you check whether some of the so far function wide variables (e.g. gop) could be moved into this more narrow scope?

Quoted 7 lines
             }
         }
     }
-
     efi_arch_edd();
 
     /* XXX Collect EDID info. */

Please don't.

Jan

author
#2 lore raw
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 07:13, <[email protected]> wrote:

This patch implements what I understand to be the desired behavior when booting
an EFI Xen image via GRUB based on the thread last week. The EFI command line
is not used, and the Xen commandline comes via the multiboot protocol (and in the ARM case the multiboot FDT bindings). This brings the x86 and arm64 GRUB EFI boot cases into alignment in not using the EFI commandline.

Quoted 8 lines

Right, but ...

Quoted 4 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options. If unexpected options are passed in the EFI commandline, it will generate "unrecognized option" ouput for all unexpected options.

... why is this?

The EFI boot code did this before any of the arm64 changes, and that behavior is unchanged.
The actual message is "WARNING: Unknown command line option"

I was simply trying to explain the current behavior regarding the EFI commandline.

Quoted 10 lines

xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 804

Quoted 5 lines
xen/common/efi/boot.c +2 -0
+    if ( use_cfg_file )
     {
         EFI_FILE_HANDLE dir_handle;
+        size = 0;

Coding style (missing blank line between declaration(s) and statement(s). Plus - did you check whether some of the so far function wide variables (e.g. gop) could be moved into this more narrow scope?

I'll fix the style. I had not reviewed scope, but now have. There are only a few
variables I can reduce in scope, which I have done in V2 of the patch which I will post shortly.
The gop variable and a few others cannot be moved without further code reorganization. The graphics
mode is set later in efi_start() if gop is !null (line 1035)
I don't see any reason this code couldn't be moved to be in the if ( use_cfg_file ) block, but given that
this patch is very late in the release cycle, I'm opting to try to keep this patch minimal. If you would prefer
me to move this code and variables, I am happy to do a v3 with these changes.

Quoted 10 lines
Quoted 8 lines
             }
         }
     }
-
     efi_arch_edd();

     /* XXX Collect EDID info. */

Please don't.

removed.

Quoted 3 lines

Jan

#3 lore raw
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 04.11.14 at 05:31, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 07:13, <[email protected]> wrote:

This patch implements what I understand to be the desired behavior when booting
an EFI Xen image via GRUB based on the thread last week. The EFI command line
is not used, and the Xen commandline comes via the multiboot protocol (and in the ARM case the multiboot FDT bindings). This brings the x86 and arm64 GRUB EFI boot cases into alignment in not using the EFI commandline.

Right, but ...

Quoted 4 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options. If unexpected options are passed in the EFI commandline, it will generate "unrecognized option" ouput for all unexpected options.

Quoted 8 lines
Quoted 1 line

... why is this?

The EFI boot code did this before any of the arm64 changes, and that behavior is unchanged.
The actual message is "WARNING: Unknown command line option"

I was simply trying to explain the current behavior regarding the EFI commandline.

Argh, I should have stripped that second sentence from the quoted context, as the question was regarding the apparently special ARM64 behavior you describe.

Quoted 10 lines
Quoted 9 lines

xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 804

Quoted 4 lines
xen/common/efi/boot.c +2 -0
+    if ( use_cfg_file )
     {
         EFI_FILE_HANDLE dir_handle;
+        size = 0;

Coding style (missing blank line between declaration(s) and statement(s). Plus - did you check whether some of the so far function wide variables (e.g. gop) could be moved into this more narrow scope?

Quoted 13 lines

I'll fix the style. I had not reviewed scope, but now have. There are only a few
variables I can reduce in scope, which I have done in V2 of the patch which I will post shortly.
The gop variable and a few others cannot be moved without further code reorganization. The graphics
mode is set later in efi_start() if gop is !null (line 1035) I don't see any reason this code couldn't be moved to be in the if ( use_cfg_file ) block, but given that
this patch is very late in the release cycle, I'm opting to try to keep this patch minimal. If you would prefer
me to move this code and variables, I am happy to do a v3 with these changes.

No, I'm perfectly fine with your decision not to do a larger re-org.

Jan

author
#4 lore raw
Quoted 24 lines · Jan Beulich
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 04.11.14 at 05:31, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 07:13, <[email protected]> wrote:

This patch implements what I understand to be the desired behavior when booting
an EFI Xen image via GRUB based on the thread last week. The EFI command line
is not used, and the Xen commandline comes via the multiboot protocol (and in the ARM case the multiboot FDT bindings). This brings the x86 and arm64 GRUB EFI boot cases into alignment in not using the EFI commandline.

Quoted 8 lines

Right, but ...

Quoted 4 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options. If unexpected options are passed in the EFI commandline, it will generate "unrecognized option" ouput for all unexpected options.

... why is this?

The EFI boot code did this before any of the arm64 changes, and that behavior is unchanged.
The actual message is "WARNING: Unknown command line option"

Quoted 9 lines
Quoted 2 lines

I was simply trying to explain the current behavior regarding the EFI commandline.

Argh, I should have stripped that second sentence from the quoted context, as the question was regarding the apparently special ARM64 behavior you describe.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options.

OK, I'll try address the above. This behavior is the "no config file case", which only
exists on arm64 - x86 always uses a config file when booted as an EFI application, since
for x86 GRUB does execute Xen as en EFI application when using multiboot2. The case of being executed as an EFI application, loaded by GRUB and provided module information via the multiboot2 (in FDT) protocol is unique to arm64. All the code
is common code, but since efi_arch_use_config_file() is always true for x86 the case
described only applies to arm64.

When I added the support for arm64 GRUB boot and the no config file case, I limited
the no config file case to not having a config file, but left console mode setting, and the
"-basevideo" option that goes with that. Those changes were narrowly focused on removing
the need for the config file. I think that the result of this patch, which is to have the EFI boot
code only do essential boot setup that doesn't need options (and hence no EFI command line at all)
is a better way to go.

Quoted 29 lines
Quoted 11 lines
Quoted 10 lines

xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 804

Quoted 5 lines
xen/common/efi/boot.c +2 -0
+    if ( use_cfg_file )
     {
         EFI_FILE_HANDLE dir_handle;
+        size = 0;

Coding style (missing blank line between declaration(s) and statement(s). Plus - did you check whether some of the so far function wide variables (e.g. gop) could be moved into this more narrow scope?

Quoted 13 lines

I'll fix the style. I had not reviewed scope, but now have. There are only a few
variables I can reduce in scope, which I have done in V2 of the patch which I will post shortly.
The gop variable and a few others cannot be moved without further code reorganization. The graphics
mode is set later in efi_start() if gop is !null (line 1035) I don't see any reason this code couldn't be moved to be in the if ( use_cfg_file ) block, but given that
this patch is very late in the release cycle, I'm opting to try to keep this patch minimal. If you would prefer
me to move this code and variables, I am happy to do a v3 with these changes.

No, I'm perfectly fine with your decision not to do a larger re-org.

Jan

#5 lore raw
Quoted 32 lines · Roy Franz
Quoted 30 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 04.11.14 at 05:31, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 07:13, <[email protected]> wrote:

This patch implements what I understand to be the desired behavior when booting
an EFI Xen image via GRUB based on the thread last week. The EFI command line
is not used, and the Xen commandline comes via the multiboot protocol (and in the ARM case the multiboot FDT bindings). This brings the x86 and arm64 GRUB EFI boot cases into alignment in not using the EFI commandline.

Right, but ...

Quoted 4 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options. If unexpected options are passed in the EFI commandline, it will generate "unrecognized option" ouput for all unexpected options.

Quoted 8 lines
Quoted 1 line

... why is this?

The EFI boot code did this before any of the arm64 changes, and that behavior is unchanged.
The actual message is "WARNING: Unknown command line option"

I was simply trying to explain the current behavior regarding the EFI commandline.

Argh, I should have stripped that second sentence from the quoted context, as the question was regarding the apparently special ARM64 behavior you describe.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options.

OK, I'll try address the above. This behavior is the "no config file case", which only
exists on arm64 - x86 always uses a config file when booted as an EFI application, since
for x86 GRUB does execute Xen as en EFI application when using multiboot2.

I have a feeling that you wrote that by mistake. As I said in my earlier emails multiboot2 on x86 EFI platform will not load EFI application as an EFI application.

Quoted 6 lines

The case of being executed as an EFI application, loaded by GRUB and provided module information via the multiboot2 (in FDT) protocol is unique to arm64. All the code
is common code, but since efi_arch_use_config_file() is always true for x86 the case
described only applies to arm64.

Right now it is true. Probably it will change after introducing multiboot2 protocol on x86.

Daniel

author
#6 lore raw
Quoted 35 lines · Daniel Kiper
Quoted 34 lines · Roy Franz
Quoted 33 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 04.11.14 at 05:31, <[email protected]> wrote:
Quoted 16 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 03.11.14 at 07:13, <[email protected]> wrote:

This patch implements what I understand to be the desired behavior when booting
an EFI Xen image via GRUB based on the thread last week. The EFI command line
is not used, and the Xen commandline comes via the multiboot protocol (and in the ARM case the multiboot FDT bindings). This brings the x86 and arm64 GRUB EFI boot cases into alignment in not using the EFI commandline.

Right, but ...

Quoted 4 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options. If unexpected options are passed in the EFI commandline, it will generate "unrecognized option" ouput for all unexpected options.

Quoted 8 lines
Quoted 1 line

... why is this?

The EFI boot code did this before any of the arm64 changes, and that behavior is unchanged.
The actual message is "WARNING: Unknown command line option"

I was simply trying to explain the current behavior regarding the EFI commandline.

Argh, I should have stripped that second sentence from the quoted context, as the question was regarding the apparently special ARM64 behavior you describe.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The current state of the arm64 code takes the Xen commandline from the FDT, but still looks in the EFI commandline for EFI boot specific options.

Quoted 8 lines
Quoted 5 lines

OK, I'll try address the above. This behavior is the "no config file case", which only
exists on arm64 - x86 always uses a config file when booted as an EFI application, since
for x86 GRUB does execute Xen as en EFI application when using multiboot2.

I have a feeling that you wrote that by mistake. As I said in my earlier emails multiboot2 on x86 EFI platform will not load EFI application as an EFI application.

Grr.. meant "does not execute" of course. I do get that now :)

Quoted 10 lines
Quoted 7 lines

The case of being executed as an EFI application, loaded by GRUB and provided module information via the multiboot2 (in FDT) protocol is unique to arm64. All the code
is common code, but since efi_arch_use_config_file() is always true for x86 the case
described only applies to arm64.

Right now it is true. Probably it will change after introducing multiboot2 protocol on x86.

So you expect to be using the efi_start() function mostly as is?

Quoted 2 lines

Daniel

#7 lore raw
Quoted 2 lines · Roy Franz
Quoted 1 line · Daniel Kiper

On Tue, Nov 04, 2014 at 10:39:53AM -0800, Roy Franz wrote:

[...]

Quoted 11 lines
Quoted 9 lines
Quoted 6 lines

The case of being executed as an EFI application, loaded by GRUB and provided module information via the multiboot2 (in FDT) protocol is unique to arm64. All the code
is common code, but since efi_arch_use_config_file() is always true for x86 the case
described only applies to arm64.

Right now it is true. Probably it will change after introducing multiboot2 protocol on x86.

So you expect to be using the efi_start() function mostly as is?

More or less. I am working on it right now.

Daniel