public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: joeyli <jlee@suse.com>
To: Matthew Garrett <matthew.garrett@nebula.com>
Cc: "rja@sgi.com" <rja@sgi.com>,
	"mingo@kernel.org" <mingo@kernel.org>,
	"torvalds@linux-foundation.org" <torvalds@linux-foundation.org>,
	"bp@alien8.de" <bp@alien8.de>,
	"jkosina@suse.cz" <jkosina@suse.cz>,
	"matt.fleming@intel.com" <matt.fleming@intel.com>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"hpa@linux.intel.com" <hpa@linux.intel.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"oneukum@suse.de" <oneukum@suse.de>
Subject: Re: [PATCH] Modify UEFI anti-bricking code
Date: Tue, 04 Jun 2013 11:35:33 +0800	[thread overview]
Message-ID: <1370316933.30695.7.camel@linux-s257.site> (raw)
In-Reply-To: <1370277079.6315.14.camel@x230.lan>

於 一,2013-06-03 於 16:31 +0000,Matthew Garrett 提到:
> On Tue, 2013-06-04 at 00:13 +0800, joeyli wrote:
> 
> > Oliver raised a question for if power fails between that succesful
> > attempt and the deletion?
> 
> It's a pretty tiny window, but sure. Making sure we delete it seems
> sensible. In that case we should make the GUID a #define rather than
> write it out twice.
> 

Base on your patch, the following diff moved DUMMY GUID to #define, and
add a static efi name string:


Thanks a lot!
Joey Lee


diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 63e167a..cc3cfe8 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -53,6 +53,11 @@
 
 #define EFI_DEBUG	1
 
+#define EFI_DUMMY_GUID \
+	EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9)
+
+static efi_char16_t efi_dummy_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
+
 struct efi __read_mostly efi = {
 	.mps        = EFI_INVALID_TABLE_ADDR,
 	.acpi       = EFI_INVALID_TABLE_ADDR,
@@ -981,6 +986,9 @@ void __init efi_enter_virtual_mode(void)
 		runtime_code_page_mkexec();
 
 	kfree(new_memmap);
+
+	/* clean DUMMY object */
+	efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID, 0, 0, NULL);
 }
 
 /*
@@ -1051,21 +1059,17 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
 		 */
 		unsigned long dummy_size = remaining_size + 1024;
 		void *dummy = kmalloc(dummy_size, GFP_ATOMIC);
-		efi_char16_t efi_name[6] = { 'D', 'U', 'M', 'M', 'Y', 0 };
-		efi_guid_t guid = EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e,
-					   0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92,
-					   0xa9);
 
-		status = efi.set_variable(efi_name, &guid, attributes,
-					  dummy_size, dummy);
+		status = efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
+					  attributes, dummy_size, dummy);
 
 		if (status == EFI_SUCCESS) {
 			/*
 			 * This should have failed, so if it didn't make sure
 			 * that we delete it...
 			 */
-			efi.set_variable(efi_name, &guid, attributes, 0,
-					 dummy);
+			efi.set_variable(efi_dummy_name, &EFI_DUMMY_GUID,
+					 attributes, 0, dummy);
 		}
 
 		/*


  reply	other threads:[~2013-06-04  3:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01 20:06 [PATCH] Modify UEFI anti-bricking code Matthew Garrett
2013-06-02 15:48 ` Russ Anderson
2013-06-03 12:17 ` Matt Fleming
2013-06-03 14:58   ` Matthew Garrett
2013-06-03 16:13 ` joeyli
2013-06-03 16:31   ` Matthew Garrett
2013-06-04  3:35     ` joeyli [this message]
2013-06-05 14:49       ` Fleming, Matt
2013-06-05 14:53         ` Matthew Garrett
2013-06-05 15:59           ` Matt Fleming
2013-06-05 16:08             ` Matthew Garrett
2013-06-05 19:59               ` Matt Fleming
2013-06-06  2:24               ` joeyli
2013-06-05 20:19             ` H. Peter Anvin
2013-06-06  5:05             ` joeyli
2013-06-06  5:41               ` joeyli
2013-06-06  5:42               ` Matthew Garrett
2013-06-06  7:40                 ` joeyli
2013-06-06  9:25                   ` Matt Fleming
2013-06-06 14:48                     ` Russ Anderson
2013-06-06 15:00                       ` Matt Fleming
2013-06-06 15:28                         ` Russ Anderson
2013-06-10 18:54                     ` Russ Anderson
2013-06-04  5:29 ` Lingzhu Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370316933.30695.7.camel@linux-s257.site \
    --to=jlee@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=hpa@linux.intel.com \
    --cc=jkosina@suse.cz \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=matthew.garrett@nebula.com \
    --cc=mingo@kernel.org \
    --cc=oneukum@suse.de \
    --cc=rja@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox