diff mbox

[1/2] UEFI arm64: add noefi boot param

Message ID 20140806083825.GA31711@dhcp-16-198.nay.redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Young Aug. 6, 2014, 8:38 a.m. UTC
Adding a noefi boot param like in X86 to disable efi runtime services support.

This will be useful for debugging uefi problems. Also it will be useful
for later kexec/kdump work. Kexec on uefi support in X86 depends on a fixed vm
area specific for uefi runtime 1:1 mapping, kernel will switch to a different
page table for any uefi runtime callback in virtual mode. In arm64 similar
work probably is necessary. But kexec boot will just works with 'noefi' with
the limitaion of lacking runtime services. The runtime services is not critical
for kdump kernel for now. So as for kexec/kdump just leave the 1:1 mapping a
future work.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 arch/arm64/kernel/efi.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

Comments

Will Deacon Aug. 6, 2014, 12:39 p.m. UTC | #1
On Wed, Aug 06, 2014 at 09:38:25AM +0100, Dave Young wrote:
> Adding a noefi boot param like in X86 to disable efi runtime services support.
> 
> This will be useful for debugging uefi problems. Also it will be useful
> for later kexec/kdump work. Kexec on uefi support in X86 depends on a fixed vm
> area specific for uefi runtime 1:1 mapping, kernel will switch to a different
> page table for any uefi runtime callback in virtual mode. In arm64 similar
> work probably is necessary. But kexec boot will just works with 'noefi' with
> the limitaion of lacking runtime services. The runtime services is not critical
> for kdump kernel for now. So as for kexec/kdump just leave the 1:1 mapping a
> future work.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>

This looks fine to me, but I'd like Leif's ack before I merge it. Leif?

Will

> ---
>  arch/arm64/kernel/efi.c |   17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6/arch/arm64/kernel/efi.c
> ===================================================================
> --- linux-2.6.orig/arch/arm64/kernel/efi.c
> +++ linux-2.6/arch/arm64/kernel/efi.c
> @@ -31,6 +31,14 @@ static efi_runtime_services_t *runtime;
>  
>  static u64 efi_system_table;
>  
> +static bool disable_runtime __initdata = false;
> +static int __init setup_noefi(char *arg)
> +{
> +	disable_runtime = true;
> +	return 0;
> +}
> +early_param("noefi", setup_noefi);
> +
>  static int uefi_debug __initdata;
>  static int __init uefi_debug_setup(char *str)
>  {
> @@ -391,11 +399,14 @@ static int __init arm64_enter_virtual_mo
>  		return -1;
>  	}
>  
> -	pr_info("Remapping and enabling EFI services.\n");
> -
> -	/* replace early memmap mapping with permanent mapping */
>  	mapsize = memmap.map_end - memmap.map;
>  	early_memunmap(memmap.map, mapsize);
> +
> +	if (disable_runtime)
> +		return -ENODEV;
> +
> +	pr_info("Remapping and enabling EFI services.\n");
> +	/* replace early memmap mapping with permanent mapping */
>  	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
>  						   mapsize);
>  	memmap.map_end = memmap.map + mapsize;
>
Ard Biesheuvel Aug. 6, 2014, 12:40 p.m. UTC | #2
On 6 August 2014 10:38, Dave Young <dyoung@redhat.com> wrote:
>
> Adding a noefi boot param like in X86 to disable efi runtime services support.
>
> This will be useful for debugging uefi problems. Also it will be useful
> for later kexec/kdump work. Kexec on uefi support in X86 depends on a fixed vm
> area specific for uefi runtime 1:1 mapping, kernel will switch to a different
> page table for any uefi runtime callback in virtual mode. In arm64 similar
> work probably is necessary. But kexec boot will just works with 'noefi' with
> the limitaion of lacking runtime services. The runtime services is not critical
> for kdump kernel for now. So as for kexec/kdump just leave the 1:1 mapping a
> future work.
>

Can we find a better name? You will still be using the UEFI memory map
rather than the DT memory nodes (which will have been deleted by the
stub), and things like SMBIOS and ACPI that hinge off UEFI remain
enabled as well.

Other than that, the patch looks fine to me

Regards,
Ard.


> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/arm64/kernel/efi.c |   17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
>
> Index: linux-2.6/arch/arm64/kernel/efi.c
> ===================================================================
> --- linux-2.6.orig/arch/arm64/kernel/efi.c
> +++ linux-2.6/arch/arm64/kernel/efi.c
> @@ -31,6 +31,14 @@ static efi_runtime_services_t *runtime;
>
>  static u64 efi_system_table;
>
> +static bool disable_runtime __initdata = false;
> +static int __init setup_noefi(char *arg)
> +{
> +       disable_runtime = true;
> +       return 0;
> +}
> +early_param("noefi", setup_noefi);
> +
>  static int uefi_debug __initdata;
>  static int __init uefi_debug_setup(char *str)
>  {
> @@ -391,11 +399,14 @@ static int __init arm64_enter_virtual_mo
>                 return -1;
>         }
>
> -       pr_info("Remapping and enabling EFI services.\n");
> -
> -       /* replace early memmap mapping with permanent mapping */
>         mapsize = memmap.map_end - memmap.map;
>         early_memunmap(memmap.map, mapsize);
> +
> +       if (disable_runtime)
> +               return -ENODEV;
> +
> +       pr_info("Remapping and enabling EFI services.\n");
> +       /* replace early memmap mapping with permanent mapping */
>         memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
>                                                    mapsize);
>         memmap.map_end = memmap.map + mapsize;
Dave Young Aug. 7, 2014, 1:28 a.m. UTC | #3
On 08/06/14 at 02:40pm, Ard Biesheuvel wrote:
> On 6 August 2014 10:38, Dave Young <dyoung@redhat.com> wrote:
> >
> > Adding a noefi boot param like in X86 to disable efi runtime services support.
> >
> > This will be useful for debugging uefi problems. Also it will be useful
> > for later kexec/kdump work. Kexec on uefi support in X86 depends on a fixed vm
> > area specific for uefi runtime 1:1 mapping, kernel will switch to a different
> > page table for any uefi runtime callback in virtual mode. In arm64 similar
> > work probably is necessary. But kexec boot will just works with 'noefi' with
> > the limitaion of lacking runtime services. The runtime services is not critical
> > for kdump kernel for now. So as for kexec/kdump just leave the 1:1 mapping a
> > future work.
> >
> 
> Can we find a better name? You will still be using the UEFI memory map
> rather than the DT memory nodes (which will have been deleted by the
> stub), and things like SMBIOS and ACPI that hinge off UEFI remain
> enabled as well.
> 
Hi, Ard

Leif suggested efi=noruntime, I think that will be better to you?

Thanks for review.
Dave
Ard Biesheuvel Aug. 7, 2014, 7:07 a.m. UTC | #4
> On 7 aug. 2014, at 03:28, Dave Young <dyoung@redhat.com> wrote:
> 
>> On 08/06/14 at 02:40pm, Ard Biesheuvel wrote:
>>> On 6 August 2014 10:38, Dave Young <dyoung@redhat.com> wrote:
>>> 
>>> Adding a noefi boot param like in X86 to disable efi runtime services support.
>>> 
>>> This will be useful for debugging uefi problems. Also it will be useful
>>> for later kexec/kdump work. Kexec on uefi support in X86 depends on a fixed vm
>>> area specific for uefi runtime 1:1 mapping, kernel will switch to a different
>>> page table for any uefi runtime callback in virtual mode. In arm64 similar
>>> work probably is necessary. But kexec boot will just works with 'noefi' with
>>> the limitaion of lacking runtime services. The runtime services is not critical
>>> for kdump kernel for now. So as for kexec/kdump just leave the 1:1 mapping a
>>> future work.
>> 
>> Can we find a better name? You will still be using the UEFI memory map
>> rather than the DT memory nodes (which will have been deleted by the
>> stub), and things like SMBIOS and ACPI that hinge off UEFI remain
>> enabled as well.
> Hi, Ard
> 
> Leif suggested efi=noruntime, I think that will be better to you?
> 

Yes, that sounds perfect to me

Ard.

> Thanks for review.
> Dave
diff mbox

Patch

Index: linux-2.6/arch/arm64/kernel/efi.c
===================================================================
--- linux-2.6.orig/arch/arm64/kernel/efi.c
+++ linux-2.6/arch/arm64/kernel/efi.c
@@ -31,6 +31,14 @@  static efi_runtime_services_t *runtime;
 
 static u64 efi_system_table;
 
+static bool disable_runtime __initdata = false;
+static int __init setup_noefi(char *arg)
+{
+	disable_runtime = true;
+	return 0;
+}
+early_param("noefi", setup_noefi);
+
 static int uefi_debug __initdata;
 static int __init uefi_debug_setup(char *str)
 {
@@ -391,11 +399,14 @@  static int __init arm64_enter_virtual_mo
 		return -1;
 	}
 
-	pr_info("Remapping and enabling EFI services.\n");
-
-	/* replace early memmap mapping with permanent mapping */
 	mapsize = memmap.map_end - memmap.map;
 	early_memunmap(memmap.map, mapsize);
+
+	if (disable_runtime)
+		return -ENODEV;
+
+	pr_info("Remapping and enabling EFI services.\n");
+	/* replace early memmap mapping with permanent mapping */
 	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
 						   mapsize);
 	memmap.map_end = memmap.map + mapsize;