All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  6:10 ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, Mark Salter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi,
	rtc-linux

noefi param can be used for arches other than X86 later, thus move it out of
x86 platform code.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 arch/x86/platform/efi/efi.c | 10 +---------
 drivers/firmware/efi/efi.c  | 13 +++++++++++++
 include/linux/efi.h         |  1 +
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 850da94..dd7aaa1 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -70,14 +70,6 @@ static efi_config_table_type_t arch_tables[] __initdata = {
 
 u64 efi_setup;		/* efi setup_data physical address */
 
-static bool disable_runtime __initdata = false;
-static int __init setup_noefi(char *arg)
-{
-	disable_runtime = true;
-	return 0;
-}
-early_param("noefi", setup_noefi);
-
 int add_efi_memmap;
 EXPORT_SYMBOL(add_efi_memmap);
 
@@ -492,7 +484,7 @@ void __init efi_init(void)
 	if (!efi_runtime_supported())
 		pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
 	else {
-		if (disable_runtime || efi_runtime_init())
+		if (efi_runtime_disabled() || efi_runtime_init())
 			return;
 	}
 	if (efi_memmap_init())
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 64ecbb5..c8f01a7 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -41,6 +41,19 @@ struct efi __read_mostly efi = {
 };
 EXPORT_SYMBOL(efi);
 
+static bool disable_runtime;
+static int __init setup_noefi(char *arg)
+{
+	disable_runtime = true;
+	return 0;
+}
+early_param("noefi", setup_noefi);
+
+bool efi_runtime_disabled(void)
+{
+	return disable_runtime;
+}
+
 static struct kobject *efi_kobj;
 static struct kobject *efivars_kobj;
 
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 45cb4ff..06d7c03 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1227,4 +1227,5 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
 				  unsigned long *load_addr,
 				  unsigned long *load_size);
 
+bool efi_runtime_disabled(void);
 #endif /* _LINUX_EFI_H */
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  6:10 ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Alessandro Zummo, Randy Dunlap, rtc-linux, Ard Biesheuvel,
	linux-efi, Catalin Marinas, Mark Salter, Will Deacon,
	linux-kernel, Leif Lindholm, Ingo Molnar, hpa, Thomas Gleixner,
	linux-arm-kernel

noefi param can be used for arches other than X86 later, thus move it out of
x86 platform code.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 arch/x86/platform/efi/efi.c | 10 +---------
 drivers/firmware/efi/efi.c  | 13 +++++++++++++
 include/linux/efi.h         |  1 +
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 850da94..dd7aaa1 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -70,14 +70,6 @@ static efi_config_table_type_t arch_tables[] __initdata = {
 
 u64 efi_setup;		/* efi setup_data physical address */
 
-static bool disable_runtime __initdata = false;
-static int __init setup_noefi(char *arg)
-{
-	disable_runtime = true;
-	return 0;
-}
-early_param("noefi", setup_noefi);
-
 int add_efi_memmap;
 EXPORT_SYMBOL(add_efi_memmap);
 
@@ -492,7 +484,7 @@ void __init efi_init(void)
 	if (!efi_runtime_supported())
 		pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
 	else {
-		if (disable_runtime || efi_runtime_init())
+		if (efi_runtime_disabled() || efi_runtime_init())
 			return;
 	}
 	if (efi_memmap_init())
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 64ecbb5..c8f01a7 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -41,6 +41,19 @@ struct efi __read_mostly efi = {
 };
 EXPORT_SYMBOL(efi);
 
+static bool disable_runtime;
+static int __init setup_noefi(char *arg)
+{
+	disable_runtime = true;
+	return 0;
+}
+early_param("noefi", setup_noefi);
+
+bool efi_runtime_disabled(void)
+{
+	return disable_runtime;
+}
+
 static struct kobject *efi_kobj;
 static struct kobject *efivars_kobj;
 
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 45cb4ff..06d7c03 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1227,4 +1227,5 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
 				  unsigned long *load_addr,
 				  unsigned long *load_size);
 
+bool efi_runtime_disabled(void);
 #endif /* _LINUX_EFI_H */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  6:10 ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: linux-arm-kernel

noefi param can be used for arches other than X86 later, thus move it out of
x86 platform code.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 arch/x86/platform/efi/efi.c | 10 +---------
 drivers/firmware/efi/efi.c  | 13 +++++++++++++
 include/linux/efi.h         |  1 +
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 850da94..dd7aaa1 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -70,14 +70,6 @@ static efi_config_table_type_t arch_tables[] __initdata = {
 
 u64 efi_setup;		/* efi setup_data physical address */
 
-static bool disable_runtime __initdata = false;
-static int __init setup_noefi(char *arg)
-{
-	disable_runtime = true;
-	return 0;
-}
-early_param("noefi", setup_noefi);
-
 int add_efi_memmap;
 EXPORT_SYMBOL(add_efi_memmap);
 
@@ -492,7 +484,7 @@ void __init efi_init(void)
 	if (!efi_runtime_supported())
 		pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
 	else {
-		if (disable_runtime || efi_runtime_init())
+		if (efi_runtime_disabled() || efi_runtime_init())
 			return;
 	}
 	if (efi_memmap_init())
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 64ecbb5..c8f01a7 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -41,6 +41,19 @@ struct efi __read_mostly efi = {
 };
 EXPORT_SYMBOL(efi);
 
+static bool disable_runtime;
+static int __init setup_noefi(char *arg)
+{
+	disable_runtime = true;
+	return 0;
+}
+early_param("noefi", setup_noefi);
+
+bool efi_runtime_disabled(void)
+{
+	return disable_runtime;
+}
+
 static struct kobject *efi_kobj;
 static struct kobject *efivars_kobj;
 
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 45cb4ff..06d7c03 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -1227,4 +1227,5 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
 				  unsigned long *load_addr,
 				  unsigned long *load_size);
 
+bool efi_runtime_disabled(void);
 #endif /* _LINUX_EFI_H */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/5] efi: add kernel param efi=noruntime
  2014-08-12  6:10 ` Dave Young
  (?)
@ 2014-08-12  6:10   ` Dave Young
  -1 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, Mark Salter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi,
	rtc-linux

noefi kernel param means actually disabling efi runtime, Per suggestion from
Leif Lindholm efi=noruntime should be better. But since noefi is already used
in X86 thus just adding another param efi=noruntime for same purpose.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 Documentation/kernel-parameters.txt |  4 +++-
 arch/x86/platform/efi/efi.c         | 12 ------------
 drivers/firmware/efi/efi.c          | 22 ++++++++++++++++++++++
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a8eb6af..09d8c54 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -992,11 +992,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			Format: {"off" | "on" | "skip[mbr]"}
 
 	efi=		[EFI]
-			Format: { "old_map" }
+			Format: { "old_map" | "noruntime" }
 			old_map [X86-64]: switch to the old ioremap-based EFI
 			runtime services mapping. 32-bit still uses this one by
 			default.
 
+			noruntime : disable EFI runtime services support
+
 	efi_no_storage_paranoia [EFI; X86]
 			Using this parameter you can use more than 50% of
 			your efi variable storage. Use this parameter only if
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index dd7aaa1..eae91be 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -929,15 +929,3 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 	}
 	return 0;
 }
-
-static int __init parse_efi_cmdline(char *str)
-{
-	if (*str == '=')
-		str++;
-
-	if (!strncmp(str, "old_map", 7))
-		set_bit(EFI_OLD_MEMMAP, &efi.flags);
-
-	return 0;
-}
-early_param("efi", parse_efi_cmdline);
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index c8f01a7..f3ec3f2 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -24,6 +24,7 @@
 #include <linux/of_fdt.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <asm/efi.h>
 
 struct efi __read_mostly efi = {
 	.mps        = EFI_INVALID_TABLE_ADDR,
@@ -54,6 +55,27 @@ bool efi_runtime_disabled(void)
 	return disable_runtime;
 }
 
+static int __init parse_efi_cmdline(char *str)
+{
+	if (*str == '=')
+		str++;
+
+#ifdef CONFIG_X86
+	if (!strncmp(str, "old_map", 7)) {
+		set_bit(EFI_OLD_MEMMAP, &efi.flags);
+		goto out;
+	}
+#endif
+	if (!strncmp(str, "noruntime", 9)) {
+		disable_runtime = true;
+		goto out;
+	}
+
+out:
+	return 0;
+}
+early_param("efi", parse_efi_cmdline);
+
 static struct kobject *efi_kobj;
 static struct kobject *efivars_kobj;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/5] efi: add kernel param efi=noruntime
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Alessandro Zummo, Randy Dunlap, rtc-linux, Ard Biesheuvel,
	linux-efi, Catalin Marinas, Mark Salter, Will Deacon,
	linux-kernel, Leif Lindholm, Ingo Molnar, hpa, Thomas Gleixner,
	linux-arm-kernel

noefi kernel param means actually disabling efi runtime, Per suggestion from
Leif Lindholm efi=noruntime should be better. But since noefi is already used
in X86 thus just adding another param efi=noruntime for same purpose.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 Documentation/kernel-parameters.txt |  4 +++-
 arch/x86/platform/efi/efi.c         | 12 ------------
 drivers/firmware/efi/efi.c          | 22 ++++++++++++++++++++++
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a8eb6af..09d8c54 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -992,11 +992,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			Format: {"off" | "on" | "skip[mbr]"}
 
 	efi=		[EFI]
-			Format: { "old_map" }
+			Format: { "old_map" | "noruntime" }
 			old_map [X86-64]: switch to the old ioremap-based EFI
 			runtime services mapping. 32-bit still uses this one by
 			default.
 
+			noruntime : disable EFI runtime services support
+
 	efi_no_storage_paranoia [EFI; X86]
 			Using this parameter you can use more than 50% of
 			your efi variable storage. Use this parameter only if
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index dd7aaa1..eae91be 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -929,15 +929,3 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 	}
 	return 0;
 }
-
-static int __init parse_efi_cmdline(char *str)
-{
-	if (*str == '=')
-		str++;
-
-	if (!strncmp(str, "old_map", 7))
-		set_bit(EFI_OLD_MEMMAP, &efi.flags);
-
-	return 0;
-}
-early_param("efi", parse_efi_cmdline);
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index c8f01a7..f3ec3f2 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -24,6 +24,7 @@
 #include <linux/of_fdt.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <asm/efi.h>
 
 struct efi __read_mostly efi = {
 	.mps        = EFI_INVALID_TABLE_ADDR,
@@ -54,6 +55,27 @@ bool efi_runtime_disabled(void)
 	return disable_runtime;
 }
 
+static int __init parse_efi_cmdline(char *str)
+{
+	if (*str == '=')
+		str++;
+
+#ifdef CONFIG_X86
+	if (!strncmp(str, "old_map", 7)) {
+		set_bit(EFI_OLD_MEMMAP, &efi.flags);
+		goto out;
+	}
+#endif
+	if (!strncmp(str, "noruntime", 9)) {
+		disable_runtime = true;
+		goto out;
+	}
+
+out:
+	return 0;
+}
+early_param("efi", parse_efi_cmdline);
+
 static struct kobject *efi_kobj;
 static struct kobject *efivars_kobj;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/5] efi: add kernel param efi=noruntime
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: linux-arm-kernel

noefi kernel param means actually disabling efi runtime, Per suggestion from
Leif Lindholm efi=noruntime should be better. But since noefi is already used
in X86 thus just adding another param efi=noruntime for same purpose.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 Documentation/kernel-parameters.txt |  4 +++-
 arch/x86/platform/efi/efi.c         | 12 ------------
 drivers/firmware/efi/efi.c          | 22 ++++++++++++++++++++++
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index a8eb6af..09d8c54 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -992,11 +992,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			Format: {"off" | "on" | "skip[mbr]"}
 
 	efi=		[EFI]
-			Format: { "old_map" }
+			Format: { "old_map" | "noruntime" }
 			old_map [X86-64]: switch to the old ioremap-based EFI
 			runtime services mapping. 32-bit still uses this one by
 			default.
 
+			noruntime : disable EFI runtime services support
+
 	efi_no_storage_paranoia [EFI; X86]
 			Using this parameter you can use more than 50% of
 			your efi variable storage. Use this parameter only if
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index dd7aaa1..eae91be 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -929,15 +929,3 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 	}
 	return 0;
 }
-
-static int __init parse_efi_cmdline(char *str)
-{
-	if (*str == '=')
-		str++;
-
-	if (!strncmp(str, "old_map", 7))
-		set_bit(EFI_OLD_MEMMAP, &efi.flags);
-
-	return 0;
-}
-early_param("efi", parse_efi_cmdline);
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index c8f01a7..f3ec3f2 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -24,6 +24,7 @@
 #include <linux/of_fdt.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <asm/efi.h>
 
 struct efi __read_mostly efi = {
 	.mps        = EFI_INVALID_TABLE_ADDR,
@@ -54,6 +55,27 @@ bool efi_runtime_disabled(void)
 	return disable_runtime;
 }
 
+static int __init parse_efi_cmdline(char *str)
+{
+	if (*str == '=')
+		str++;
+
+#ifdef CONFIG_X86
+	if (!strncmp(str, "old_map", 7)) {
+		set_bit(EFI_OLD_MEMMAP, &efi.flags);
+		goto out;
+	}
+#endif
+	if (!strncmp(str, "noruntime", 9)) {
+		disable_runtime = true;
+		goto out;
+	}
+
+out:
+	return 0;
+}
+early_param("efi", parse_efi_cmdline);
+
 static struct kobject *efi_kobj;
 static struct kobject *efivars_kobj;
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
  2014-08-12  6:10 ` Dave Young
  (?)
@ 2014-08-12  6:10   ` Dave Young
  -1 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, Mark Salter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi,
	rtc-linux

In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
should error out.

At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
the function or it will leak early mem.

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

diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index e72f310..324cdd1 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
 	int count = 0;
 	unsigned long flags;
 
-	if (!efi_enabled(EFI_BOOT)) {
+	mapsize = memmap.map_end - memmap.map;
+	early_memunmap(memmap.map, mapsize);
+
+	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {
 		pr_info("EFI services will not be available.\n");
 		return -1;
 	}
@@ -394,8 +397,6 @@ static int __init arm64_enter_virtual_mode(void)
 	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);
 	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
 						   mapsize);
 	memmap.map_end = memmap.map + mapsize;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Alessandro Zummo, Randy Dunlap, rtc-linux, Ard Biesheuvel,
	linux-efi, Catalin Marinas, Mark Salter, Will Deacon,
	linux-kernel, Leif Lindholm, Ingo Molnar, hpa, Thomas Gleixner,
	linux-arm-kernel

In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
should error out.

At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
the function or it will leak early mem.

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

diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index e72f310..324cdd1 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
 	int count = 0;
 	unsigned long flags;
 
-	if (!efi_enabled(EFI_BOOT)) {
+	mapsize = memmap.map_end - memmap.map;
+	early_memunmap(memmap.map, mapsize);
+
+	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {
 		pr_info("EFI services will not be available.\n");
 		return -1;
 	}
@@ -394,8 +397,6 @@ static int __init arm64_enter_virtual_mode(void)
 	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);
 	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
 						   mapsize);
 	memmap.map_end = memmap.map + mapsize;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: linux-arm-kernel

In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
should error out.

At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
the function or it will leak early mem.

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

diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
index e72f310..324cdd1 100644
--- a/arch/arm64/kernel/efi.c
+++ b/arch/arm64/kernel/efi.c
@@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
 	int count = 0;
 	unsigned long flags;
 
-	if (!efi_enabled(EFI_BOOT)) {
+	mapsize = memmap.map_end - memmap.map;
+	early_memunmap(memmap.map, mapsize);
+
+	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {
 		pr_info("EFI services will not be available.\n");
 		return -1;
 	}
@@ -394,8 +397,6 @@ static int __init arm64_enter_virtual_mode(void)
 	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);
 	memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map,
 						   mapsize);
 	memmap.map_end = memmap.map + mapsize;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 4/5] efi x86: clear EFI_RUNTIME_SERVICES bit in case failures other than SetVirtualAddressMap
  2014-08-12  6:10 ` Dave Young
  (?)
@ 2014-08-12  6:10   ` Dave Young
  -1 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, Mark Salter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi,
	rtc-linux

If enter virtual mode failed due to some reason other than the efi call
the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users
of efi runtime services can check the bit and handle the case instead of
assume efi runtime is ok.

Per Matt, if efi call SetVirtualAddressMap fails we will be not sure it's safe
to make any assumptions about the state of the system. so kernel panics instead
of clears EFI_RUNTIME_SERVICES bit.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 arch/x86/platform/efi/efi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index eae91be..c42f49b 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -724,6 +724,7 @@ static void __init kexec_enter_virtual_mode(void)
 	 */
 	if (!efi_is_native()) {
 		efi_unmap_memmap();
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
 	}
 
@@ -797,6 +798,7 @@ static void __init __efi_enter_virtual_mode(void)
 	new_memmap = efi_map_regions(&count, &pg_shift);
 	if (!new_memmap) {
 		pr_err("Error reallocating memory, EFI runtime non-functional!\n");
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
 	}
 
@@ -804,8 +806,10 @@ static void __init __efi_enter_virtual_mode(void)
 
 	BUG_ON(!efi.systab);
 
-	if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift))
+	if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift)) {
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
+	}
 
 	efi_sync_low_kernel_mappings();
 	efi_dump_pagetable();
@@ -882,8 +886,10 @@ static void __init __efi_enter_virtual_mode(void)
 
 void __init efi_enter_virtual_mode(void)
 {
-	if (efi_enabled(EFI_PARAVIRT))
+	if (efi_enabled(EFI_PARAVIRT)) {
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
+	}
 
 	if (efi_setup)
 		kexec_enter_virtual_mode();
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 4/5] efi x86: clear EFI_RUNTIME_SERVICES bit in case failures other than SetVirtualAddressMap
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Alessandro Zummo, Randy Dunlap, rtc-linux, Ard Biesheuvel,
	linux-efi, Catalin Marinas, Mark Salter, Will Deacon,
	linux-kernel, Leif Lindholm, Ingo Molnar, hpa, Thomas Gleixner,
	linux-arm-kernel

If enter virtual mode failed due to some reason other than the efi call
the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users
of efi runtime services can check the bit and handle the case instead of
assume efi runtime is ok.

Per Matt, if efi call SetVirtualAddressMap fails we will be not sure it's safe
to make any assumptions about the state of the system. so kernel panics instead
of clears EFI_RUNTIME_SERVICES bit.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 arch/x86/platform/efi/efi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index eae91be..c42f49b 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -724,6 +724,7 @@ static void __init kexec_enter_virtual_mode(void)
 	 */
 	if (!efi_is_native()) {
 		efi_unmap_memmap();
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
 	}
 
@@ -797,6 +798,7 @@ static void __init __efi_enter_virtual_mode(void)
 	new_memmap = efi_map_regions(&count, &pg_shift);
 	if (!new_memmap) {
 		pr_err("Error reallocating memory, EFI runtime non-functional!\n");
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
 	}
 
@@ -804,8 +806,10 @@ static void __init __efi_enter_virtual_mode(void)
 
 	BUG_ON(!efi.systab);
 
-	if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift))
+	if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift)) {
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
+	}
 
 	efi_sync_low_kernel_mappings();
 	efi_dump_pagetable();
@@ -882,8 +886,10 @@ static void __init __efi_enter_virtual_mode(void)
 
 void __init efi_enter_virtual_mode(void)
 {
-	if (efi_enabled(EFI_PARAVIRT))
+	if (efi_enabled(EFI_PARAVIRT)) {
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
+	}
 
 	if (efi_setup)
 		kexec_enter_virtual_mode();
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 4/5] efi x86: clear EFI_RUNTIME_SERVICES bit in case failures other than SetVirtualAddressMap
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: linux-arm-kernel

If enter virtual mode failed due to some reason other than the efi call
the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users
of efi runtime services can check the bit and handle the case instead of
assume efi runtime is ok.

Per Matt, if efi call SetVirtualAddressMap fails we will be not sure it's safe
to make any assumptions about the state of the system. so kernel panics instead
of clears EFI_RUNTIME_SERVICES bit.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 arch/x86/platform/efi/efi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index eae91be..c42f49b 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -724,6 +724,7 @@ static void __init kexec_enter_virtual_mode(void)
 	 */
 	if (!efi_is_native()) {
 		efi_unmap_memmap();
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
 	}
 
@@ -797,6 +798,7 @@ static void __init __efi_enter_virtual_mode(void)
 	new_memmap = efi_map_regions(&count, &pg_shift);
 	if (!new_memmap) {
 		pr_err("Error reallocating memory, EFI runtime non-functional!\n");
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
 	}
 
@@ -804,8 +806,10 @@ static void __init __efi_enter_virtual_mode(void)
 
 	BUG_ON(!efi.systab);
 
-	if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift))
+	if (efi_setup_page_tables(__pa(new_memmap), 1 << pg_shift)) {
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
+	}
 
 	efi_sync_low_kernel_mappings();
 	efi_dump_pagetable();
@@ -882,8 +886,10 @@ static void __init __efi_enter_virtual_mode(void)
 
 void __init efi_enter_virtual_mode(void)
 {
-	if (efi_enabled(EFI_PARAVIRT))
+	if (efi_enabled(EFI_PARAVIRT)) {
+		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
 		return;
+	}
 
 	if (efi_setup)
 		kexec_enter_virtual_mode();
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 5/5] efi_rtc: probe function error out in case no efi runtime enabled
  2014-08-12  6:10 ` Dave Young
  (?)
@ 2014-08-12  6:10   ` Dave Young
  -1 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, Mark Salter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi,
	rtc-linux

efi rtc depends on efi runtime services, so if efi runtime services are not
usable it should error out.

Without this patch rtc-efi will panic with 'noefi' boot

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 drivers/rtc/rtc-efi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c
index 8225b89..8c02ed8 100644
--- a/drivers/rtc/rtc-efi.c
+++ b/drivers/rtc/rtc-efi.c
@@ -213,6 +213,9 @@ static int __init efi_rtc_probe(struct platform_device *dev)
 {
 	struct rtc_device *rtc;
 
+	if (!efi_enabled(EFI_RUNTIME_SERVICES))
+		return -ENODEV;
+
 	rtc = devm_rtc_device_register(&dev->dev, "rtc-efi", &efi_rtc_ops,
 					THIS_MODULE);
 	if (IS_ERR(rtc))
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 5/5] efi_rtc: probe function error out in case no efi runtime enabled
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Alessandro Zummo, Randy Dunlap, rtc-linux, Ard Biesheuvel,
	linux-efi, Catalin Marinas, Mark Salter, Will Deacon,
	linux-kernel, Leif Lindholm, Ingo Molnar, hpa, Thomas Gleixner,
	linux-arm-kernel

efi rtc depends on efi runtime services, so if efi runtime services are not
usable it should error out.

Without this patch rtc-efi will panic with 'noefi' boot

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 drivers/rtc/rtc-efi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c
index 8225b89..8c02ed8 100644
--- a/drivers/rtc/rtc-efi.c
+++ b/drivers/rtc/rtc-efi.c
@@ -213,6 +213,9 @@ static int __init efi_rtc_probe(struct platform_device *dev)
 {
 	struct rtc_device *rtc;
 
+	if (!efi_enabled(EFI_RUNTIME_SERVICES))
+		return -ENODEV;
+
 	rtc = devm_rtc_device_register(&dev->dev, "rtc-efi", &efi_rtc_ops,
 					THIS_MODULE);
 	if (IS_ERR(rtc))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 5/5] efi_rtc: probe function error out in case no efi runtime enabled
@ 2014-08-12  6:10   ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  6:10 UTC (permalink / raw)
  To: linux-arm-kernel

efi rtc depends on efi runtime services, so if efi runtime services are not
usable it should error out.

Without this patch rtc-efi will panic with 'noefi' boot

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 drivers/rtc/rtc-efi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c
index 8225b89..8c02ed8 100644
--- a/drivers/rtc/rtc-efi.c
+++ b/drivers/rtc/rtc-efi.c
@@ -213,6 +213,9 @@ static int __init efi_rtc_probe(struct platform_device *dev)
 {
 	struct rtc_device *rtc;
 
+	if (!efi_enabled(EFI_RUNTIME_SERVICES))
+		return -ENODEV;
+
 	rtc = devm_rtc_device_register(&dev->dev, "rtc-efi", &efi_rtc_ops,
 					THIS_MODULE);
 	if (IS_ERR(rtc))
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  6:52   ` Randy Dunlap
  0 siblings, 0 replies; 35+ messages in thread
From: Randy Dunlap @ 2014-08-12  6:52 UTC (permalink / raw)
  To: Dave Young, Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, Mark Salter,
	linux-kernel, linux-arm-kernel, linux-efi, rtc-linux

On 08/11/14 23:10, Dave Young wrote:
> noefi param can be used for arches other than X86 later, thus move it out of
> x86 platform code.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/x86/platform/efi/efi.c | 10 +---------
>  drivers/firmware/efi/efi.c  | 13 +++++++++++++
>  include/linux/efi.h         |  1 +
>  3 files changed, 15 insertions(+), 9 deletions(-)

This line in Documentation/kernel-parameters.txt needs to be updated:

	noefi		[X86] Disable EFI runtime services support.


> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 850da94..dd7aaa1 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -70,14 +70,6 @@ static efi_config_table_type_t arch_tables[] __initdata = {
>  
>  u64 efi_setup;		/* efi setup_data physical address */
>  
> -static bool disable_runtime __initdata = false;
> -static int __init setup_noefi(char *arg)
> -{
> -	disable_runtime = true;
> -	return 0;
> -}
> -early_param("noefi", setup_noefi);
> -
>  int add_efi_memmap;
>  EXPORT_SYMBOL(add_efi_memmap);
>  
> @@ -492,7 +484,7 @@ void __init efi_init(void)
>  	if (!efi_runtime_supported())
>  		pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
>  	else {
> -		if (disable_runtime || efi_runtime_init())
> +		if (efi_runtime_disabled() || efi_runtime_init())
>  			return;
>  	}
>  	if (efi_memmap_init())
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 64ecbb5..c8f01a7 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -41,6 +41,19 @@ struct efi __read_mostly efi = {
>  };
>  EXPORT_SYMBOL(efi);
>  
> +static bool disable_runtime;
> +static int __init setup_noefi(char *arg)
> +{
> +	disable_runtime = true;
> +	return 0;
> +}
> +early_param("noefi", setup_noefi);
> +
> +bool efi_runtime_disabled(void)
> +{
> +	return disable_runtime;
> +}
> +
>  static struct kobject *efi_kobj;
>  static struct kobject *efivars_kobj;
>  
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 45cb4ff..06d7c03 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -1227,4 +1227,5 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
>  				  unsigned long *load_addr,
>  				  unsigned long *load_size);
>  
> +bool efi_runtime_disabled(void);
>  #endif /* _LINUX_EFI_H */
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  6:52   ` Randy Dunlap
  0 siblings, 0 replies; 35+ messages in thread
From: Randy Dunlap @ 2014-08-12  6:52 UTC (permalink / raw)
  To: Dave Young, Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar,
	hpa-YMNOUZJC4hwAvxtiuMwx3w, Alessandro Zummo, Leif Lindholm,
	Ard Biesheuvel, Mark Salter, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-efi-u79uwXL29TY76Z2rM5mHXA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw

On 08/11/14 23:10, Dave Young wrote:
> noefi param can be used for arches other than X86 later, thus move it out of
> x86 platform code.
> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  arch/x86/platform/efi/efi.c | 10 +---------
>  drivers/firmware/efi/efi.c  | 13 +++++++++++++
>  include/linux/efi.h         |  1 +
>  3 files changed, 15 insertions(+), 9 deletions(-)

This line in Documentation/kernel-parameters.txt needs to be updated:

	noefi		[X86] Disable EFI runtime services support.


> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 850da94..dd7aaa1 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -70,14 +70,6 @@ static efi_config_table_type_t arch_tables[] __initdata = {
>  
>  u64 efi_setup;		/* efi setup_data physical address */
>  
> -static bool disable_runtime __initdata = false;
> -static int __init setup_noefi(char *arg)
> -{
> -	disable_runtime = true;
> -	return 0;
> -}
> -early_param("noefi", setup_noefi);
> -
>  int add_efi_memmap;
>  EXPORT_SYMBOL(add_efi_memmap);
>  
> @@ -492,7 +484,7 @@ void __init efi_init(void)
>  	if (!efi_runtime_supported())
>  		pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
>  	else {
> -		if (disable_runtime || efi_runtime_init())
> +		if (efi_runtime_disabled() || efi_runtime_init())
>  			return;
>  	}
>  	if (efi_memmap_init())
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 64ecbb5..c8f01a7 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -41,6 +41,19 @@ struct efi __read_mostly efi = {
>  };
>  EXPORT_SYMBOL(efi);
>  
> +static bool disable_runtime;
> +static int __init setup_noefi(char *arg)
> +{
> +	disable_runtime = true;
> +	return 0;
> +}
> +early_param("noefi", setup_noefi);
> +
> +bool efi_runtime_disabled(void)
> +{
> +	return disable_runtime;
> +}
> +
>  static struct kobject *efi_kobj;
>  static struct kobject *efivars_kobj;
>  
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 45cb4ff..06d7c03 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -1227,4 +1227,5 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
>  				  unsigned long *load_addr,
>  				  unsigned long *load_size);
>  
> +bool efi_runtime_disabled(void);
>  #endif /* _LINUX_EFI_H */
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  6:52   ` Randy Dunlap
  0 siblings, 0 replies; 35+ messages in thread
From: Randy Dunlap @ 2014-08-12  6:52 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/11/14 23:10, Dave Young wrote:
> noefi param can be used for arches other than X86 later, thus move it out of
> x86 platform code.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/x86/platform/efi/efi.c | 10 +---------
>  drivers/firmware/efi/efi.c  | 13 +++++++++++++
>  include/linux/efi.h         |  1 +
>  3 files changed, 15 insertions(+), 9 deletions(-)

This line in Documentation/kernel-parameters.txt needs to be updated:

	noefi		[X86] Disable EFI runtime services support.


> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 850da94..dd7aaa1 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -70,14 +70,6 @@ static efi_config_table_type_t arch_tables[] __initdata = {
>  
>  u64 efi_setup;		/* efi setup_data physical address */
>  
> -static bool disable_runtime __initdata = false;
> -static int __init setup_noefi(char *arg)
> -{
> -	disable_runtime = true;
> -	return 0;
> -}
> -early_param("noefi", setup_noefi);
> -
>  int add_efi_memmap;
>  EXPORT_SYMBOL(add_efi_memmap);
>  
> @@ -492,7 +484,7 @@ void __init efi_init(void)
>  	if (!efi_runtime_supported())
>  		pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
>  	else {
> -		if (disable_runtime || efi_runtime_init())
> +		if (efi_runtime_disabled() || efi_runtime_init())
>  			return;
>  	}
>  	if (efi_memmap_init())
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 64ecbb5..c8f01a7 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -41,6 +41,19 @@ struct efi __read_mostly efi = {
>  };
>  EXPORT_SYMBOL(efi);
>  
> +static bool disable_runtime;
> +static int __init setup_noefi(char *arg)
> +{
> +	disable_runtime = true;
> +	return 0;
> +}
> +early_param("noefi", setup_noefi);
> +
> +bool efi_runtime_disabled(void)
> +{
> +	return disable_runtime;
> +}
> +
>  static struct kobject *efi_kobj;
>  static struct kobject *efivars_kobj;
>  
> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 45cb4ff..06d7c03 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -1227,4 +1227,5 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
>  				  unsigned long *load_addr,
>  				  unsigned long *load_size);
>  
> +bool efi_runtime_disabled(void);
>  #endif /* _LINUX_EFI_H */
> 


-- 
~Randy

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] efi: move noefi early param code out of x86 arch code
  2014-08-12  6:52   ` Randy Dunlap
  (?)
@ 2014-08-12  7:14     ` Dave Young
  -1 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  7:14 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Matt Fleming, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, hpa, Alessandro Zummo, Leif Lindholm,
	Ard Biesheuvel, Mark Salter, linux-kernel, linux-arm-kernel,
	linux-efi, rtc-linux

On 08/11/14 at 11:52pm, Randy Dunlap wrote:
> On 08/11/14 23:10, Dave Young wrote:
> > noefi param can be used for arches other than X86 later, thus move it out of
> > x86 platform code.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> >  arch/x86/platform/efi/efi.c | 10 +---------
> >  drivers/firmware/efi/efi.c  | 13 +++++++++++++
> >  include/linux/efi.h         |  1 +
> >  3 files changed, 15 insertions(+), 9 deletions(-)
> 
> This line in Documentation/kernel-parameters.txt needs to be updated:
> 
> 	noefi		[X86] Disable EFI runtime services support.

Randy, thanks

Will update the documentation.

Dave

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  7:14     ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  7:14 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Alessandro Zummo, Matt Fleming, rtc-linux, Ard Biesheuvel,
	linux-efi, Catalin Marinas, Mark Salter, Will Deacon,
	linux-kernel, Leif Lindholm, Ingo Molnar, hpa, Thomas Gleixner,
	linux-arm-kernel

On 08/11/14 at 11:52pm, Randy Dunlap wrote:
> On 08/11/14 23:10, Dave Young wrote:
> > noefi param can be used for arches other than X86 later, thus move it out of
> > x86 platform code.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> >  arch/x86/platform/efi/efi.c | 10 +---------
> >  drivers/firmware/efi/efi.c  | 13 +++++++++++++
> >  include/linux/efi.h         |  1 +
> >  3 files changed, 15 insertions(+), 9 deletions(-)
> 
> This line in Documentation/kernel-parameters.txt needs to be updated:
> 
> 	noefi		[X86] Disable EFI runtime services support.

Randy, thanks

Will update the documentation.

Dave

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 1/5] efi: move noefi early param code out of x86 arch code
@ 2014-08-12  7:14     ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-12  7:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/11/14 at 11:52pm, Randy Dunlap wrote:
> On 08/11/14 23:10, Dave Young wrote:
> > noefi param can be used for arches other than X86 later, thus move it out of
> > x86 platform code.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> >  arch/x86/platform/efi/efi.c | 10 +---------
> >  drivers/firmware/efi/efi.c  | 13 +++++++++++++
> >  include/linux/efi.h         |  1 +
> >  3 files changed, 15 insertions(+), 9 deletions(-)
> 
> This line in Documentation/kernel-parameters.txt needs to be updated:
> 
> 	noefi		[X86] Disable EFI runtime services support.

Randy, thanks

Will update the documentation.

Dave

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
@ 2014-08-12 10:46     ` Will Deacon
  0 siblings, 0 replies; 35+ messages in thread
From: Will Deacon @ 2014-08-12 10:46 UTC (permalink / raw)
  To: Dave Young
  Cc: Matt Fleming, Catalin Marinas, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, msalter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi,
	rtc-linux

On Tue, Aug 12, 2014 at 07:10:20AM +0100, Dave Young wrote:
> In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
> should error out.
> 
> At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
> the function or it will leak early mem.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/arm64/kernel/efi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index e72f310..324cdd1 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
>  	int count = 0;
>  	unsigned long flags;
>  
> -	if (!efi_enabled(EFI_BOOT)) {
> +	mapsize = memmap.map_end - memmap.map;
> +	early_memunmap(memmap.map, mapsize);
> +
> +	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {

Hmm, is this right? We only set EFI_BOOT if we find EFI parameters in the
DT (see efi_init -> uefi_init), so you run the risk of unmapping something
we never mapped here.

Furthermore, there seems to be a leak in uefi_init anyway, as we return
-EINVAL if the signature of the EFI table doesn't match without unmapping it
first.

Will

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
@ 2014-08-12 10:46     ` Will Deacon
  0 siblings, 0 replies; 35+ messages in thread
From: Will Deacon @ 2014-08-12 10:46 UTC (permalink / raw)
  To: Dave Young
  Cc: Matt Fleming, Catalin Marinas, Thomas Gleixner, Ingo Molnar,
	hpa-YMNOUZJC4hwAvxtiuMwx3w, Alessandro Zummo, Leif Lindholm,
	Ard Biesheuvel, msalter-H+wXaHxf7aLQT0dZR+AlfA, Randy Dunlap,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-efi-u79uwXL29TY76Z2rM5mHXA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw

On Tue, Aug 12, 2014 at 07:10:20AM +0100, Dave Young wrote:
> In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
> should error out.
> 
> At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
> the function or it will leak early mem.
> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  arch/arm64/kernel/efi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index e72f310..324cdd1 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
>  	int count = 0;
>  	unsigned long flags;
>  
> -	if (!efi_enabled(EFI_BOOT)) {
> +	mapsize = memmap.map_end - memmap.map;
> +	early_memunmap(memmap.map, mapsize);
> +
> +	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {

Hmm, is this right? We only set EFI_BOOT if we find EFI parameters in the
DT (see efi_init -> uefi_init), so you run the risk of unmapping something
we never mapped here.

Furthermore, there seems to be a leak in uefi_init anyway, as we return
-EINVAL if the signature of the EFI table doesn't match without unmapping it
first.

Will

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
@ 2014-08-12 10:46     ` Will Deacon
  0 siblings, 0 replies; 35+ messages in thread
From: Will Deacon @ 2014-08-12 10:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 12, 2014 at 07:10:20AM +0100, Dave Young wrote:
> In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
> should error out.
> 
> At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
> the function or it will leak early mem.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/arm64/kernel/efi.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> index e72f310..324cdd1 100644
> --- a/arch/arm64/kernel/efi.c
> +++ b/arch/arm64/kernel/efi.c
> @@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
>  	int count = 0;
>  	unsigned long flags;
>  
> -	if (!efi_enabled(EFI_BOOT)) {
> +	mapsize = memmap.map_end - memmap.map;
> +	early_memunmap(memmap.map, mapsize);
> +
> +	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {

Hmm, is this right? We only set EFI_BOOT if we find EFI parameters in the
DT (see efi_init -> uefi_init), so you run the risk of unmapping something
we never mapped here.

Furthermore, there seems to be a leak in uefi_init anyway, as we return
-EINVAL if the signature of the EFI table doesn't match without unmapping it
first.

Will

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
  2014-08-12 10:46     ` Will Deacon
  (?)
@ 2014-08-13  1:29       ` Dave Young
  -1 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-13  1:29 UTC (permalink / raw)
  To: Will Deacon
  Cc: Matt Fleming, Catalin Marinas, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, msalter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi

On 08/12/14 at 11:46am, Will Deacon wrote:
> On Tue, Aug 12, 2014 at 07:10:20AM +0100, Dave Young wrote:
> > In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
> > should error out.
> > 
> > At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
> > the function or it will leak early mem.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> >  arch/arm64/kernel/efi.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> > index e72f310..324cdd1 100644
> > --- a/arch/arm64/kernel/efi.c
> > +++ b/arch/arm64/kernel/efi.c
> > @@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
> >  	int count = 0;
> >  	unsigned long flags;
> >  
> > -	if (!efi_enabled(EFI_BOOT)) {
> > +	mapsize = memmap.map_end - memmap.map;
> > +	early_memunmap(memmap.map, mapsize);
> > +
> > +	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {
> 
> Hmm, is this right? We only set EFI_BOOT if we find EFI parameters in the
> DT (see efi_init -> uefi_init), so you run the risk of unmapping something
> we never mapped here.

Good catch, I missed the case. will fix it in next update

> 
> Furthermore, there seems to be a leak in uefi_init anyway, as we return
> -EINVAL if the signature of the EFI table doesn't match without unmapping it
> first.

Yes, will add a new patch to fix the error handling in uefi_init.

BTW, Matt, I forgot to cc Xen/SGI people, will send an update soon and cc them.

Thanks
Dave

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
@ 2014-08-13  1:29       ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-13  1:29 UTC (permalink / raw)
  To: Will Deacon
  Cc: Alessandro Zummo, Matt Fleming, Ard Biesheuvel, linux-efi,
	Catalin Marinas, msalter, linux-kernel, Leif Lindholm,
	Ingo Molnar, Randy Dunlap, hpa, Thomas Gleixner,
	linux-arm-kernel

On 08/12/14 at 11:46am, Will Deacon wrote:
> On Tue, Aug 12, 2014 at 07:10:20AM +0100, Dave Young wrote:
> > In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
> > should error out.
> > 
> > At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
> > the function or it will leak early mem.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> >  arch/arm64/kernel/efi.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> > index e72f310..324cdd1 100644
> > --- a/arch/arm64/kernel/efi.c
> > +++ b/arch/arm64/kernel/efi.c
> > @@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
> >  	int count = 0;
> >  	unsigned long flags;
> >  
> > -	if (!efi_enabled(EFI_BOOT)) {
> > +	mapsize = memmap.map_end - memmap.map;
> > +	early_memunmap(memmap.map, mapsize);
> > +
> > +	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {
> 
> Hmm, is this right? We only set EFI_BOOT if we find EFI parameters in the
> DT (see efi_init -> uefi_init), so you run the risk of unmapping something
> we never mapped here.

Good catch, I missed the case. will fix it in next update

> 
> Furthermore, there seems to be a leak in uefi_init anyway, as we return
> -EINVAL if the signature of the EFI table doesn't match without unmapping it
> first.

Yes, will add a new patch to fix the error handling in uefi_init.

BTW, Matt, I forgot to cc Xen/SGI people, will send an update soon and cc them.

Thanks
Dave

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi
@ 2014-08-13  1:29       ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-13  1:29 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/12/14 at 11:46am, Will Deacon wrote:
> On Tue, Aug 12, 2014 at 07:10:20AM +0100, Dave Young wrote:
> > In case efi runtime disabled via noefi kernel cmdline arm64_enter_virtual_mode
> > should error out.
> > 
> > At the same time move early_memunmap(memmap.map, mapsize) to the beginning of
> > the function or it will leak early mem.
> > 
> > Signed-off-by: Dave Young <dyoung@redhat.com>
> > ---
> >  arch/arm64/kernel/efi.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c
> > index e72f310..324cdd1 100644
> > --- a/arch/arm64/kernel/efi.c
> > +++ b/arch/arm64/kernel/efi.c
> > @@ -386,7 +386,10 @@ static int __init arm64_enter_virtual_mode(void)
> >  	int count = 0;
> >  	unsigned long flags;
> >  
> > -	if (!efi_enabled(EFI_BOOT)) {
> > +	mapsize = memmap.map_end - memmap.map;
> > +	early_memunmap(memmap.map, mapsize);
> > +
> > +	if (!efi_enabled(EFI_BOOT) || efi_runtime_disabled()) {
> 
> Hmm, is this right? We only set EFI_BOOT if we find EFI parameters in the
> DT (see efi_init -> uefi_init), so you run the risk of unmapping something
> we never mapped here.

Good catch, I missed the case. will fix it in next update

> 
> Furthermore, there seems to be a leak in uefi_init anyway, as we return
> -EINVAL if the signature of the EFI table doesn't match without unmapping it
> first.

Yes, will add a new patch to fix the error handling in uefi_init.

BTW, Matt, I forgot to cc Xen/SGI people, will send an update soon and cc them.

Thanks
Dave

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 2/5] efi: add kernel param efi=noruntime
  2014-08-12  6:10   ` Dave Young
  (?)
@ 2014-08-13  8:13     ` Dave Young
  -1 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-13  8:13 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Catalin Marinas, Will Deacon, Thomas Gleixner, Ingo Molnar, hpa,
	Alessandro Zummo, Leif Lindholm, Ard Biesheuvel, Mark Salter,
	Randy Dunlap, linux-kernel, linux-arm-kernel, linux-efi,
	rtc-linux

On 08/12/14 at 02:10pm, Dave Young wrote:
> noefi kernel param means actually disabling efi runtime, Per suggestion from
> Leif Lindholm efi=noruntime should be better. But since noefi is already used
> in X86 thus just adding another param efi=noruntime for same purpose.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  Documentation/kernel-parameters.txt |  4 +++-
>  arch/x86/platform/efi/efi.c         | 12 ------------
>  drivers/firmware/efi/efi.c          | 22 ++++++++++++++++++++++
>  3 files changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index a8eb6af..09d8c54 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -992,11 +992,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>  			Format: {"off" | "on" | "skip[mbr]"}
>  
>  	efi=		[EFI]
> -			Format: { "old_map" }
> +			Format: { "old_map" | "noruntime" }
>  			old_map [X86-64]: switch to the old ioremap-based EFI
>  			runtime services mapping. 32-bit still uses this one by
>  			default.
>  
> +			noruntime : disable EFI runtime services support
> +
>  	efi_no_storage_paranoia [EFI; X86]
>  			Using this parameter you can use more than 50% of
>  			your efi variable storage. Use this parameter only if
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index dd7aaa1..eae91be 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -929,15 +929,3 @@ u64 efi_mem_attributes(unsigned long phys_addr)
>  	}
>  	return 0;
>  }
> -
> -static int __init parse_efi_cmdline(char *str)
> -{
> -	if (*str == '=')
> -		str++;
> -
> -	if (!strncmp(str, "old_map", 7))
> -		set_bit(EFI_OLD_MEMMAP, &efi.flags);
> -
> -	return 0;
> -}
> -early_param("efi", parse_efi_cmdline);
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index c8f01a7..f3ec3f2 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -24,6 +24,7 @@
>  #include <linux/of_fdt.h>
>  #include <linux/io.h>
>  #include <linux/platform_device.h>
> +#include <asm/efi.h>
>  
>  struct efi __read_mostly efi = {
>  	.mps        = EFI_INVALID_TABLE_ADDR,
> @@ -54,6 +55,27 @@ bool efi_runtime_disabled(void)
>  	return disable_runtime;
>  }
>  
> +static int __init parse_efi_cmdline(char *str)
> +{
> +	if (*str == '=')
> +		str++;
> +
> +#ifdef CONFIG_X86
> +	if (!strncmp(str, "old_map", 7)) {
> +		set_bit(EFI_OLD_MEMMAP, &efi.flags);
> +		goto out;
> +	}
> +#endif
> +	if (!strncmp(str, "noruntime", 9)) {
> +		disable_runtime = true;
> +		goto out;
> +	}
> +

For sharing functions I moved old_map here, but rethinking about it maybe
it's better to keep it in arch code.

Matt, I see you have some code for libstub option parsing, I will rebase
on your efi/next and I'm thinking to add a generic function for parsing
params like below (for old_map, but libstub can not use it):

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c90d3cd..c73a7df5 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -932,26 +932,8 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 
 static int __init parse_efi_cmdline(char *str)
 {
-	if (*str == '=')
-		str++;
-
-	while (*str) {
-		if (!strncmp(str, "old_map", 7)) {
-			set_bit(EFI_OLD_MEMMAP, &efi.flags);
-			str += strlen("old_map");
-		}
-
-		/*
-		 * Skip any options we don't understand. Presumably
-		 * they apply to the EFI boot stub.
-		 */
-		while (*str && *str != ',')
-			str++;
-
-		/* If we hit a delimiter, skip it */
-		if (*str == ',')
-			str++;
-	}
+	if (parse_option_str(str, "old_map"))
+		set_bit(EFI_OLD_MEMMAP, &efi.flags);
 
 	return 0;
 }
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4c52907..d612718 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -407,6 +407,7 @@ int vsscanf(const char *, const char *, va_list);
 extern int get_option(char **str, int *pint);
 extern char *get_options(const char *str, int nints, int *ints);
 extern unsigned long long memparse(const char *ptr, char **retptr);
+extern bool parse_option_str(const char *str, const char *option);
 
 extern int core_kernel_text(unsigned long addr);
 extern int core_kernel_data(unsigned long addr);
diff --git a/lib/cmdline.c b/lib/cmdline.c
index d4932f7..f384125 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -155,3 +155,32 @@ unsigned long long memparse(const char *ptr, char **retptr)
 	return ret;
 }
 EXPORT_SYMBOL(memparse);
+
+/**
+ *	parse_option_str - Parse a string and check an option is set or not 
+ *	@str: String to be parsed
+ *	@option: the option name
+ *
+ *	This function parses a string containing a comma-separated
+ *	list of strings like a=b,c.
+ *
+ *	Return true if there's such option in the string, or return false.
+ */
++bool parse_option_str(const char *str, const char *option)
+{
+	while (*str) {
+		if (!strncmp(str, option, strlen(option))) {
+			str += strlen(option);
+			if (!*str || *str == ',')
+				return true;
+		}
+
+		while (*str && *str != ',')
+			str++;
+
+		if (*str == ',')
+			str++;
+	}
+
+	return false;
+}

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 2/5] efi: add kernel param efi=noruntime
@ 2014-08-13  8:13     ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-13  8:13 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Alessandro Zummo, Randy Dunlap, rtc-linux, Ard Biesheuvel,
	linux-efi, Catalin Marinas, Mark Salter, Will Deacon,
	linux-kernel, Leif Lindholm, Ingo Molnar, hpa, Thomas Gleixner,
	linux-arm-kernel

On 08/12/14 at 02:10pm, Dave Young wrote:
> noefi kernel param means actually disabling efi runtime, Per suggestion from
> Leif Lindholm efi=noruntime should be better. But since noefi is already used
> in X86 thus just adding another param efi=noruntime for same purpose.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  Documentation/kernel-parameters.txt |  4 +++-
>  arch/x86/platform/efi/efi.c         | 12 ------------
>  drivers/firmware/efi/efi.c          | 22 ++++++++++++++++++++++
>  3 files changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index a8eb6af..09d8c54 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -992,11 +992,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>  			Format: {"off" | "on" | "skip[mbr]"}
>  
>  	efi=		[EFI]
> -			Format: { "old_map" }
> +			Format: { "old_map" | "noruntime" }
>  			old_map [X86-64]: switch to the old ioremap-based EFI
>  			runtime services mapping. 32-bit still uses this one by
>  			default.
>  
> +			noruntime : disable EFI runtime services support
> +
>  	efi_no_storage_paranoia [EFI; X86]
>  			Using this parameter you can use more than 50% of
>  			your efi variable storage. Use this parameter only if
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index dd7aaa1..eae91be 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -929,15 +929,3 @@ u64 efi_mem_attributes(unsigned long phys_addr)
>  	}
>  	return 0;
>  }
> -
> -static int __init parse_efi_cmdline(char *str)
> -{
> -	if (*str == '=')
> -		str++;
> -
> -	if (!strncmp(str, "old_map", 7))
> -		set_bit(EFI_OLD_MEMMAP, &efi.flags);
> -
> -	return 0;
> -}
> -early_param("efi", parse_efi_cmdline);
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index c8f01a7..f3ec3f2 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -24,6 +24,7 @@
>  #include <linux/of_fdt.h>
>  #include <linux/io.h>
>  #include <linux/platform_device.h>
> +#include <asm/efi.h>
>  
>  struct efi __read_mostly efi = {
>  	.mps        = EFI_INVALID_TABLE_ADDR,
> @@ -54,6 +55,27 @@ bool efi_runtime_disabled(void)
>  	return disable_runtime;
>  }
>  
> +static int __init parse_efi_cmdline(char *str)
> +{
> +	if (*str == '=')
> +		str++;
> +
> +#ifdef CONFIG_X86
> +	if (!strncmp(str, "old_map", 7)) {
> +		set_bit(EFI_OLD_MEMMAP, &efi.flags);
> +		goto out;
> +	}
> +#endif
> +	if (!strncmp(str, "noruntime", 9)) {
> +		disable_runtime = true;
> +		goto out;
> +	}
> +

For sharing functions I moved old_map here, but rethinking about it maybe
it's better to keep it in arch code.

Matt, I see you have some code for libstub option parsing, I will rebase
on your efi/next and I'm thinking to add a generic function for parsing
params like below (for old_map, but libstub can not use it):

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c90d3cd..c73a7df5 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -932,26 +932,8 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 
 static int __init parse_efi_cmdline(char *str)
 {
-	if (*str == '=')
-		str++;
-
-	while (*str) {
-		if (!strncmp(str, "old_map", 7)) {
-			set_bit(EFI_OLD_MEMMAP, &efi.flags);
-			str += strlen("old_map");
-		}
-
-		/*
-		 * Skip any options we don't understand. Presumably
-		 * they apply to the EFI boot stub.
-		 */
-		while (*str && *str != ',')
-			str++;
-
-		/* If we hit a delimiter, skip it */
-		if (*str == ',')
-			str++;
-	}
+	if (parse_option_str(str, "old_map"))
+		set_bit(EFI_OLD_MEMMAP, &efi.flags);
 
 	return 0;
 }
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4c52907..d612718 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -407,6 +407,7 @@ int vsscanf(const char *, const char *, va_list);
 extern int get_option(char **str, int *pint);
 extern char *get_options(const char *str, int nints, int *ints);
 extern unsigned long long memparse(const char *ptr, char **retptr);
+extern bool parse_option_str(const char *str, const char *option);
 
 extern int core_kernel_text(unsigned long addr);
 extern int core_kernel_data(unsigned long addr);
diff --git a/lib/cmdline.c b/lib/cmdline.c
index d4932f7..f384125 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -155,3 +155,32 @@ unsigned long long memparse(const char *ptr, char **retptr)
 	return ret;
 }
 EXPORT_SYMBOL(memparse);
+
+/**
+ *	parse_option_str - Parse a string and check an option is set or not 
+ *	@str: String to be parsed
+ *	@option: the option name
+ *
+ *	This function parses a string containing a comma-separated
+ *	list of strings like a=b,c.
+ *
+ *	Return true if there's such option in the string, or return false.
+ */
++bool parse_option_str(const char *str, const char *option)
+{
+	while (*str) {
+		if (!strncmp(str, option, strlen(option))) {
+			str += strlen(option);
+			if (!*str || *str == ',')
+				return true;
+		}
+
+		while (*str && *str != ',')
+			str++;
+
+		if (*str == ',')
+			str++;
+	}
+
+	return false;
+}

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH 2/5] efi: add kernel param efi=noruntime
@ 2014-08-13  8:13     ` Dave Young
  0 siblings, 0 replies; 35+ messages in thread
From: Dave Young @ 2014-08-13  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/12/14 at 02:10pm, Dave Young wrote:
> noefi kernel param means actually disabling efi runtime, Per suggestion from
> Leif Lindholm efi=noruntime should be better. But since noefi is already used
> in X86 thus just adding another param efi=noruntime for same purpose.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  Documentation/kernel-parameters.txt |  4 +++-
>  arch/x86/platform/efi/efi.c         | 12 ------------
>  drivers/firmware/efi/efi.c          | 22 ++++++++++++++++++++++
>  3 files changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index a8eb6af..09d8c54 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -992,11 +992,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>  			Format: {"off" | "on" | "skip[mbr]"}
>  
>  	efi=		[EFI]
> -			Format: { "old_map" }
> +			Format: { "old_map" | "noruntime" }
>  			old_map [X86-64]: switch to the old ioremap-based EFI
>  			runtime services mapping. 32-bit still uses this one by
>  			default.
>  
> +			noruntime : disable EFI runtime services support
> +
>  	efi_no_storage_paranoia [EFI; X86]
>  			Using this parameter you can use more than 50% of
>  			your efi variable storage. Use this parameter only if
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index dd7aaa1..eae91be 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -929,15 +929,3 @@ u64 efi_mem_attributes(unsigned long phys_addr)
>  	}
>  	return 0;
>  }
> -
> -static int __init parse_efi_cmdline(char *str)
> -{
> -	if (*str == '=')
> -		str++;
> -
> -	if (!strncmp(str, "old_map", 7))
> -		set_bit(EFI_OLD_MEMMAP, &efi.flags);
> -
> -	return 0;
> -}
> -early_param("efi", parse_efi_cmdline);
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index c8f01a7..f3ec3f2 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -24,6 +24,7 @@
>  #include <linux/of_fdt.h>
>  #include <linux/io.h>
>  #include <linux/platform_device.h>
> +#include <asm/efi.h>
>  
>  struct efi __read_mostly efi = {
>  	.mps        = EFI_INVALID_TABLE_ADDR,
> @@ -54,6 +55,27 @@ bool efi_runtime_disabled(void)
>  	return disable_runtime;
>  }
>  
> +static int __init parse_efi_cmdline(char *str)
> +{
> +	if (*str == '=')
> +		str++;
> +
> +#ifdef CONFIG_X86
> +	if (!strncmp(str, "old_map", 7)) {
> +		set_bit(EFI_OLD_MEMMAP, &efi.flags);
> +		goto out;
> +	}
> +#endif
> +	if (!strncmp(str, "noruntime", 9)) {
> +		disable_runtime = true;
> +		goto out;
> +	}
> +

For sharing functions I moved old_map here, but rethinking about it maybe
it's better to keep it in arch code.

Matt, I see you have some code for libstub option parsing, I will rebase
on your efi/next and I'm thinking to add a generic function for parsing
params like below (for old_map, but libstub can not use it):

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c90d3cd..c73a7df5 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -932,26 +932,8 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 
 static int __init parse_efi_cmdline(char *str)
 {
-	if (*str == '=')
-		str++;
-
-	while (*str) {
-		if (!strncmp(str, "old_map", 7)) {
-			set_bit(EFI_OLD_MEMMAP, &efi.flags);
-			str += strlen("old_map");
-		}
-
-		/*
-		 * Skip any options we don't understand. Presumably
-		 * they apply to the EFI boot stub.
-		 */
-		while (*str && *str != ',')
-			str++;
-
-		/* If we hit a delimiter, skip it */
-		if (*str == ',')
-			str++;
-	}
+	if (parse_option_str(str, "old_map"))
+		set_bit(EFI_OLD_MEMMAP, &efi.flags);
 
 	return 0;
 }
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 4c52907..d612718 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -407,6 +407,7 @@ int vsscanf(const char *, const char *, va_list);
 extern int get_option(char **str, int *pint);
 extern char *get_options(const char *str, int nints, int *ints);
 extern unsigned long long memparse(const char *ptr, char **retptr);
+extern bool parse_option_str(const char *str, const char *option);
 
 extern int core_kernel_text(unsigned long addr);
 extern int core_kernel_data(unsigned long addr);
diff --git a/lib/cmdline.c b/lib/cmdline.c
index d4932f7..f384125 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -155,3 +155,32 @@ unsigned long long memparse(const char *ptr, char **retptr)
 	return ret;
 }
 EXPORT_SYMBOL(memparse);
+
+/**
+ *	parse_option_str - Parse a string and check an option is set or not 
+ *	@str: String to be parsed
+ *	@option: the option name
+ *
+ *	This function parses a string containing a comma-separated
+ *	list of strings like a=b,c.
+ *
+ *	Return true if there's such option in the string, or return false.
+ */
++bool parse_option_str(const char *str, const char *option)
+{
+	while (*str) {
+		if (!strncmp(str, option, strlen(option))) {
+			str += strlen(option);
+			if (!*str || *str == ',')
+				return true;
+		}
+
+		while (*str && *str != ',')
+			str++;
+
+		if (*str == ',')
+			str++;
+	}
+
+	return false;
+}

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH 2/5] efi: add kernel param efi=noruntime
  2014-08-13  8:13     ` Dave Young
@ 2014-08-13 14:22       ` Matt Fleming
  -1 siblings, 0 replies; 35+ messages in thread
From: Matt Fleming @ 2014-08-13 14:22 UTC (permalink / raw)
  To: Dave Young
  Cc: Matt Fleming, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, hpa, Alessandro Zummo, Leif Lindholm,
	Ard Biesheuvel, Mark Salter, Randy Dunlap, linux-kernel,
	linux-arm-kernel, linux-efi, rtc-linux

On Wed, 13 Aug, at 04:13:47PM, Dave Young wrote:
> 
> For sharing functions I moved old_map here, but rethinking about it maybe
> it's better to keep it in arch code.
> 
> Matt, I see you have some code for libstub option parsing, I will rebase
> on your efi/next and I'm thinking to add a generic function for parsing
> params like below (for old_map, but libstub can not use it):
 
Makes sense to me.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 2/5] efi: add kernel param efi=noruntime
@ 2014-08-13 14:22       ` Matt Fleming
  0 siblings, 0 replies; 35+ messages in thread
From: Matt Fleming @ 2014-08-13 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 13 Aug, at 04:13:47PM, Dave Young wrote:
> 
> For sharing functions I moved old_map here, but rethinking about it maybe
> it's better to keep it in arch code.
> 
> Matt, I see you have some code for libstub option parsing, I will rebase
> on your efi/next and I'm thinking to add a generic function for parsing
> params like below (for old_map, but libstub can not use it):
 
Makes sense to me.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 4/5] efi x86: clear EFI_RUNTIME_SERVICES bit in case failures other than SetVirtualAddressMap
@ 2014-08-13 14:27     ` Matt Fleming
  0 siblings, 0 replies; 35+ messages in thread
From: Matt Fleming @ 2014-08-13 14:27 UTC (permalink / raw)
  To: Dave Young
  Cc: Matt Fleming, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, hpa, Alessandro Zummo, Leif Lindholm,
	Ard Biesheuvel, Mark Salter, Randy Dunlap, linux-kernel,
	linux-arm-kernel, linux-efi, rtc-linux

On Tue, 12 Aug, at 02:10:21PM, Dave Young wrote:
> If enter virtual mode failed due to some reason other than the efi call
> the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users
> of efi runtime services can check the bit and handle the case instead of
> assume efi runtime is ok.
> 
> Per Matt, if efi call SetVirtualAddressMap fails we will be not sure it's safe
> to make any assumptions about the state of the system. so kernel panics instead
> of clears EFI_RUNTIME_SERVICES bit.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/x86/platform/efi/efi.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

[...]

> @@ -882,8 +886,10 @@ static void __init __efi_enter_virtual_mode(void)
>  
>  void __init efi_enter_virtual_mode(void)
>  {
> -	if (efi_enabled(EFI_PARAVIRT))
> +	if (efi_enabled(EFI_PARAVIRT)) {
> +		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
>  		return;
> +	}

The EFI_PARAVIRT folks purposely do not set this bit, so there should be
no reason to clear it here.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH 4/5] efi x86: clear EFI_RUNTIME_SERVICES bit in case failures other than SetVirtualAddressMap
@ 2014-08-13 14:27     ` Matt Fleming
  0 siblings, 0 replies; 35+ messages in thread
From: Matt Fleming @ 2014-08-13 14:27 UTC (permalink / raw)
  To: Dave Young
  Cc: Matt Fleming, Catalin Marinas, Will Deacon, Thomas Gleixner,
	Ingo Molnar, hpa-YMNOUZJC4hwAvxtiuMwx3w, Alessandro Zummo,
	Leif Lindholm, Ard Biesheuvel, Mark Salter, Randy Dunlap,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-efi-u79uwXL29TY76Z2rM5mHXA,
	rtc-linux-/JYPxA39Uh5TLH3MbocFFw

On Tue, 12 Aug, at 02:10:21PM, Dave Young wrote:
> If enter virtual mode failed due to some reason other than the efi call
> the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users
> of efi runtime services can check the bit and handle the case instead of
> assume efi runtime is ok.
> 
> Per Matt, if efi call SetVirtualAddressMap fails we will be not sure it's safe
> to make any assumptions about the state of the system. so kernel panics instead
> of clears EFI_RUNTIME_SERVICES bit.
> 
> Signed-off-by: Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  arch/x86/platform/efi/efi.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

[...]

> @@ -882,8 +886,10 @@ static void __init __efi_enter_virtual_mode(void)
>  
>  void __init efi_enter_virtual_mode(void)
>  {
> -	if (efi_enabled(EFI_PARAVIRT))
> +	if (efi_enabled(EFI_PARAVIRT)) {
> +		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
>  		return;
> +	}

The EFI_PARAVIRT folks purposely do not set this bit, so there should be
no reason to clear it here.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH 4/5] efi x86: clear EFI_RUNTIME_SERVICES bit in case failures other than SetVirtualAddressMap
@ 2014-08-13 14:27     ` Matt Fleming
  0 siblings, 0 replies; 35+ messages in thread
From: Matt Fleming @ 2014-08-13 14:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 12 Aug, at 02:10:21PM, Dave Young wrote:
> If enter virtual mode failed due to some reason other than the efi call
> the EFI_RUNTIME_SERVICES bit in efi.flags should be cleared thus users
> of efi runtime services can check the bit and handle the case instead of
> assume efi runtime is ok.
> 
> Per Matt, if efi call SetVirtualAddressMap fails we will be not sure it's safe
> to make any assumptions about the state of the system. so kernel panics instead
> of clears EFI_RUNTIME_SERVICES bit.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---
>  arch/x86/platform/efi/efi.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

[...]

> @@ -882,8 +886,10 @@ static void __init __efi_enter_virtual_mode(void)
>  
>  void __init efi_enter_virtual_mode(void)
>  {
> -	if (efi_enabled(EFI_PARAVIRT))
> +	if (efi_enabled(EFI_PARAVIRT)) {
> +		clear_bit(EFI_RUNTIME_SERVICES, &efi.flags);
>  		return;
> +	}

The EFI_PARAVIRT folks purposely do not set this bit, so there should be
no reason to clear it here.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2014-08-13 14:27 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-12  6:10 [PATCH 1/5] efi: move noefi early param code out of x86 arch code Dave Young
2014-08-12  6:10 ` Dave Young
2014-08-12  6:10 ` Dave Young
2014-08-12  6:10 ` [PATCH 2/5] efi: add kernel param efi=noruntime Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-13  8:13   ` Dave Young
2014-08-13  8:13     ` Dave Young
2014-08-13  8:13     ` Dave Young
2014-08-13 14:22     ` Matt Fleming
2014-08-13 14:22       ` Matt Fleming
2014-08-12  6:10 ` [PATCH 3/5] efi arm64: do not enter virtual mode in case booting with efi=noruntime or noefi Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-12 10:46   ` Will Deacon
2014-08-12 10:46     ` Will Deacon
2014-08-12 10:46     ` Will Deacon
2014-08-13  1:29     ` Dave Young
2014-08-13  1:29       ` Dave Young
2014-08-13  1:29       ` Dave Young
2014-08-12  6:10 ` [PATCH 4/5] efi x86: clear EFI_RUNTIME_SERVICES bit in case failures other than SetVirtualAddressMap Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-13 14:27   ` Matt Fleming
2014-08-13 14:27     ` Matt Fleming
2014-08-13 14:27     ` Matt Fleming
2014-08-12  6:10 ` [PATCH 5/5] efi_rtc: probe function error out in case no efi runtime enabled Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-12  6:10   ` Dave Young
2014-08-12  6:52 ` [PATCH 1/5] efi: move noefi early param code out of x86 arch code Randy Dunlap
2014-08-12  6:52   ` Randy Dunlap
2014-08-12  6:52   ` Randy Dunlap
2014-08-12  7:14   ` Dave Young
2014-08-12  7:14     ` Dave Young
2014-08-12  7:14     ` Dave Young

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.