linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86,efi: Implement efi_no_storage_paranoia parameter
@ 2013-04-16 23:00 Richard Weinberger
  2013-04-16 23:16 ` Jiri Kosina
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2013-04-16 23:00 UTC (permalink / raw)
  To: matt.fleming
  Cc: cbouatmailru, ccross, keescook, tony.luck, linux-efi,
	linux-kernel, matthew.garrett, Richard Weinberger

Using this parameter one can disable the storage_size/2 check if
he is really sure that the UEFI does sane gc and fulfills the spec.

This parameter is useful if a devices uses more than 50% of the
storage by default.
The Intel DQSW67 desktop board is such a sucker for exmaple.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 Documentation/kernel-parameters.txt |  6 ++++++
 arch/x86/platform/efi/efi.c         | 15 ++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4609e81..d1cc3a9 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -788,6 +788,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	edd=		[EDD]
 			Format: {"off" | "on" | "skip[mbr]"}
 
+	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
+			you are really sure that your UEFI does sane gc and
+			fulfills the spec otherwise your board may brick.
+
 	eisa_irq_edge=	[PARISC,HW]
 			See header of drivers/parisc/eisa.c.
 
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 4959e3f..07524e1 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -113,6 +113,16 @@ static int __init setup_add_efi_memmap(char *arg)
 }
 early_param("add_efi_memmap", setup_add_efi_memmap);
 
+static bool efi_no_storage_paranoia;
+EXPORT_SYMBOL_GPL(efi_no_storage_paranoia);
+
+static int __init setup_storage_paranoia(char *arg)
+{
+	efi_no_storage_paranoia = true;
+	return 0;
+}
+early_param("efi_no_storage_paranoia", setup_storage_paranoia);
+
 
 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 {
@@ -1137,7 +1147,10 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
 	 */
 
 	if (!storage_size || size > remaining_size ||
-	    (max_size && size > max_size) ||
+	    (max_size && size > max_size))
+		return EFI_OUT_OF_RESOURCES;
+
+	if (!efi_no_storage_paranoia &&
 	    ((active_size + size + VAR_METADATA_SIZE > storage_size / 2) &&
 	     (remaining_size - size < storage_size / 2)))
 		return EFI_OUT_OF_RESOURCES;
-- 
1.8.1.4


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

* Re: [PATCH] x86,efi: Implement efi_no_storage_paranoia parameter
  2013-04-16 23:00 [PATCH] x86,efi: Implement efi_no_storage_paranoia parameter Richard Weinberger
@ 2013-04-16 23:16 ` Jiri Kosina
  2013-04-17  7:32   ` Richard Weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Kosina @ 2013-04-16 23:16 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: matt.fleming, cbouatmailru, ccross, keescook, tony.luck,
	linux-efi, linux-kernel, matthew.garrett

On Wed, 17 Apr 2013, Richard Weinberger wrote:

> Using this parameter one can disable the storage_size/2 check if
> he is really sure that the UEFI does sane gc and fulfills the spec.
> 
> This parameter is useful if a devices uses more than 50% of the
> storage by default.
> The Intel DQSW67 desktop board is such a sucker for exmaple.
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
>  Documentation/kernel-parameters.txt |  6 ++++++
>  arch/x86/platform/efi/efi.c         | 15 ++++++++++++++-
>  2 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index 4609e81..d1cc3a9 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -788,6 +788,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
>  	edd=		[EDD]
>  			Format: {"off" | "on" | "skip[mbr]"}
>  
> +	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
> +			you are really sure that your UEFI does sane gc and
> +			fulfills the spec otherwise your board may brick.
> +
>  	eisa_irq_edge=	[PARISC,HW]
>  			See header of drivers/parisc/eisa.c.
>  
> diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
> index 4959e3f..07524e1 100644
> --- a/arch/x86/platform/efi/efi.c
> +++ b/arch/x86/platform/efi/efi.c
> @@ -113,6 +113,16 @@ static int __init setup_add_efi_memmap(char *arg)
>  }
>  early_param("add_efi_memmap", setup_add_efi_memmap);
>  
> +static bool efi_no_storage_paranoia;
> +EXPORT_SYMBOL_GPL(efi_no_storage_paranoia);

Is there any particular reason to export this symbol?

-- 
Jiri Kosina
SUSE Labs


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

* Re: [PATCH] x86,efi: Implement efi_no_storage_paranoia parameter
  2013-04-16 23:16 ` Jiri Kosina
@ 2013-04-17  7:32   ` Richard Weinberger
  2013-04-17 14:55     ` Matt Fleming
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2013-04-17  7:32 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: matt.fleming, cbouatmailru, ccross, keescook, tony.luck,
	linux-efi, linux-kernel, matthew.garrett

Am 17.04.2013 01:16, schrieb Jiri Kosina:
> On Wed, 17 Apr 2013, Richard Weinberger wrote:
>> +static bool efi_no_storage_paranoia;
>> +EXPORT_SYMBOL_GPL(efi_no_storage_paranoia);
>
> Is there any particular reason to export this symbol?

I saw that the other parameters in that file are exported too
and other (efi) drivers may also be interested in that symbol.
So I thought it is a good idea to export it too.

Thanks,
//richard

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

* Re: [PATCH] x86,efi: Implement efi_no_storage_paranoia parameter
  2013-04-17  7:32   ` Richard Weinberger
@ 2013-04-17 14:55     ` Matt Fleming
  2013-04-17 14:56       ` Richard Weinberger
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Fleming @ 2013-04-17 14:55 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Jiri Kosina, matt.fleming, cbouatmailru, ccross, keescook,
	tony.luck, linux-efi, linux-kernel, matthew.garrett

On 17/04/13 08:32, Richard Weinberger wrote:
> Am 17.04.2013 01:16, schrieb Jiri Kosina:
>> On Wed, 17 Apr 2013, Richard Weinberger wrote:
>>> +static bool efi_no_storage_paranoia;
>>> +EXPORT_SYMBOL_GPL(efi_no_storage_paranoia);
>>
>> Is there any particular reason to export this symbol?
> 
> I saw that the other parameters in that file are exported too
> and other (efi) drivers may also be interested in that symbol.
> So I thought it is a good idea to export it too.

I've applied this patch but I did drop the EXPORT_SYMBOL_GPL() line. If
people want access to this symbol at some future date we can address
that later.

Thanks!

-- 
Matt Fleming, Intel Open Source Technology Center

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

* Re: [PATCH] x86,efi: Implement efi_no_storage_paranoia parameter
  2013-04-17 14:55     ` Matt Fleming
@ 2013-04-17 14:56       ` Richard Weinberger
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Weinberger @ 2013-04-17 14:56 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Jiri Kosina, matt.fleming, cbouatmailru, ccross, keescook,
	tony.luck, linux-efi, linux-kernel, matthew.garrett

Am 17.04.2013 16:55, schrieb Matt Fleming:
> On 17/04/13 08:32, Richard Weinberger wrote:
>> Am 17.04.2013 01:16, schrieb Jiri Kosina:
>>> On Wed, 17 Apr 2013, Richard Weinberger wrote:
>>>> +static bool efi_no_storage_paranoia;
>>>> +EXPORT_SYMBOL_GPL(efi_no_storage_paranoia);
>>>
>>> Is there any particular reason to export this symbol?
>>
>> I saw that the other parameters in that file are exported too
>> and other (efi) drivers may also be interested in that symbol.
>> So I thought it is a good idea to export it too.
>
> I've applied this patch but I did drop the EXPORT_SYMBOL_GPL() line. If
> people want access to this symbol at some future date we can address
> that later.

Okay. I'm fine with this!

Thanks,
//richard


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

end of thread, other threads:[~2013-04-17 14:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16 23:00 [PATCH] x86,efi: Implement efi_no_storage_paranoia parameter Richard Weinberger
2013-04-16 23:16 ` Jiri Kosina
2013-04-17  7:32   ` Richard Weinberger
2013-04-17 14:55     ` Matt Fleming
2013-04-17 14:56       ` Richard Weinberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).