Skip to contentSkip to conversation

x86, efi: Convert efi_phys_get_time() args to physical addresses

PATCH In review Matt Fleming 3 participants 6 messages Oct 11, 2011 – Dec 5, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86, efi: Convert efi_phys_get_time() args to physical addresses

From: Maurice Ma <[email protected]>

Because callers of efi_phys_get_time() pass virtual stack addresses as arguments, we need to find their corresponding physical addresses and when calling GetTime() in physical mode.

Without this patch the following line is printed on boot,

"Oops: efitime: can't read time!"

Cc Matthew Garrett <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Zhang Rui <[email protected]>
---
 arch/x86/platform/efi/efi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/platform/efi/efi.c +2 -1
index 3ae4128..d182bba 100644
@@ -237,7 +237,8 @@ static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
 
 	spin_lock_irqsave(&rtc_lock, flags);
 	efi_call_phys_prelog();
-	status = efi_call_phys2(efi_phys.get_time, tm, tc);
+	status = efi_call_phys2(efi_phys.get_time, virt_to_phys(tm),
+				virt_to_phys(tc));
 	efi_call_phys_epilog();
 	spin_unlock_irqrestore(&rtc_lock, flags);
 	return status;
Signature · 1 line
1.7.4.4
#1 lore raw
Quoted 18 lines · Matt Fleming

From: Maurice Ma <[email protected]>

Because callers of efi_phys_get_time() pass virtual stack addresses as arguments, we need to find their corresponding physical addresses and when calling GetTime() in physical mode.

Without this patch the following line is printed on boot,

"Oops: efitime: can't read time!"

Cc Matthew Garrett <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Zhang Rui <[email protected]>
Quoted 3 lines
---
 arch/x86/platform/efi/efi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Ping?

#2 lore raw
Quoted 3 lines · Matt Fleming

Ping?

Is this -stable material?

-hpa

#3 lore raw
Quoted 6 lines · H. Peter Anvin
Quoted 3 lines · Matt Fleming

Ping?

Is this -stable material?

I don't think so. It only affects things early in boot (before efi_enter_virtual_mode()) is called. Once we've called SetVirtualAddressMap() we call virt_efi_get_time() to get the time and everything works fine.

I don't think this bug is even visible to the user apart from the "Oops:
efitime: can't read time!" message displayed on boot. It certainly doesn't cause a crash or anything like that.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#4 lore raw
In reply to H. Peter Anvin
Quoted 6 lines · H. Peter Anvin
Quoted 3 lines · Matt Fleming

Ping?

Is this -stable material?

Are you picking this up, Peter?

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#5 lore raw
In reply to Matt Fleming
Commit-ID:  e9a9eca517d4cd94e816538efc400257e34bc63e
Gitweb:     http://git.kernel.org/tip/e9a9eca517d4cd94e816538efc400257e34bc63e
Author:     Maurice Ma <[email protected]>
AuthorDate: Tue, 11 Oct 2011 11:52:13 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 5 Dec 2011 12:45:14 +0100

x86, efi: Convert efi_phys_get_time() args to physical addresses

Because callers of efi_phys_get_time() pass virtual stack addresses as arguments, we need to find their corresponding physical addresses and when calling GetTime() in physical mode.

Without this patch the following line is printed on boot,

"Oops: efitime: can't read time!"

---
 arch/x86/platform/efi/efi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/platform/efi/efi.c +2 -1
index 37718f0..d2376eb 100644
@@ -238,7 +238,8 @@ static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
 
 	spin_lock_irqsave(&rtc_lock, flags);
 	efi_call_phys_prelog();
-	status = efi_call_phys2(efi_phys.get_time, tm, tc);
+	status = efi_call_phys2(efi_phys.get_time, virt_to_phys(tm),
+				virt_to_phys(tc));
 	efi_call_phys_epilog();
 	spin_unlock_irqrestore(&rtc_lock, flags);
 	return status;