Skip to contentSkip to conversation

UEFI: Don't use UEFI time services on 32-bit

PATCH In review Matthew Garrett 6 participants 13 messages Nov 29, 2013 – Dec 11, 2013 7 messages not in the archive

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

PATCH 1/1 UEFI: Don't use UEFI time services on 32-bit

UEFI time services are often broken once we're in virtual mode. We were already refusing to use them on 64-bit systems, but it turns out that they're also broken on some 32-bit firmware, including the Dell Venue. Disable them for now, we can revisit once we have the 1:1 mappings code incorporated.

---
 arch/x86/platform/efi/efi.c | 7 -------
 1 file changed, 7 deletions(-)
arch/x86/platform/efi/efi.c +0 -7
index 92c0234..cceb813 100644
@@ -690,13 +690,6 @@ void __init efi_init(void)
 
 	set_bit(EFI_MEMMAP, &x86_efi_facility);
 
-#ifdef CONFIG_X86_32
-	if (efi_is_native()) {
-		x86_platform.get_wallclock = efi_get_time;
-		x86_platform.set_wallclock = efi_set_rtc_mmss;
-	}
-#endif
-
 #if EFI_DEBUG
 	print_efi_memmap();
 #endif
Signature · 1 line
1.8.4.2

A message that is not in the archive (sent off-list or not yet received): 1385754283-2464-1-git-send-email-matthew.garrett-05XSO3Yj/[email protected]

#2 lore raw

Hi Matthew,

於 五,2013-11-29 於 14:44 -0500,Matthew Garrett 提到:

Quoted 11 lines

UEFI time services are often broken once we're in virtual mode. We were
already refusing to use them on 64-bit systems, but it turns out that they're also broken on some 32-bit firmware, including the Dell Venue. Disable them for now, we can revisit once we have the 1:1 mappings code
incorporated.

Does there have chance to test Borislav's EFI runtime mapping work on Dell Venue?

Borislav's patches here:
git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git#efi

I am sure his patchset can walkaround physical address accessing issue on a broken 64-bit machine. But, I didn't test it on 32-bit issue machine.

Thanks a lot!
Joey Lee

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 3 lines · joeyli

I am sure his patchset can walkaround physical address accessing issue on a broken 64-bit machine. But, I didn't test it on 32-bit issue machine.

Yeah, my patches don't change 32-bit so I wouldn't expect any difference, unfortunately.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#5 lore raw
In reply to a message not in the archive
Quoted 9 lines · joeyli

Does there have chance to test Borislav's EFI runtime mapping work on Dell Venue?

Borislav's patches here:
git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git#efi

I am sure his patchset can walkaround physical address accessing issue on a broken 64-bit machine. But, I didn't test it on 32-bit issue machine.

Unfortunately there's no guarantee that once you fix the physical accesses the runtime services will work. I've got a 64-bit box that returns vendor-specific error codes once physical address accesses are handled.

Signature · 1 line
Matt Fleming, Intel Open Source Technology Center
#6 lore raw
In reply to a message not in the archive
Quoted 17 lines · Matthew Garrett

UEFI time services are often broken once we're in virtual mode. We were already refusing to use them on 64-bit systems, but it turns out that they're also broken on some 32-bit firmware, including the Dell Venue. Disable them for now, we can revisit once we have the 1:1 mappings code incorporated.

---
 arch/x86/platform/efi/efi.c | 7 -------
 1 file changed, 7 deletions(-)
arch/x86/platform/efi/efi.c +0 -0
index 92c0234..cceb813 100644

arch/x86/platform/efi/efi.c void __init efi_init(void) · line 699

Quoted 10 lines
arch/x86/platform/efi/efi.c +0 -7
@@ -690,13 +690,6 @@ void __init efi_init(void)
 
 	set_bit(EFI_MEMMAP, &x86_efi_facility);
 
-#ifdef CONFIG_X86_32
-	if (efi_is_native()) {
-		x86_platform.get_wallclock = efi_get_time;
-		x86_platform.set_wallclock = efi_set_rtc_mmss;
-	}
-#endif
-

Does the Dell Venue have either an ACPI TAD or one of the PNP0B0x devices exposed?

-hpa

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 4 lines · H. Peter Anvin

Does the Dell Venue have either an ACPI TAD or one of the PNP0B0x devices exposed?

Ping on this?

Either way, I maintain what I have said in the past:

Unless we find evidence to the contrary, we should probably do:

ACPI TAD > PNP0B0x > EFI > hard probing

It might even be that the EFI can't be trusted enough to be in the list at all.

-hpa

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 1 line · H. Peter Anvin

Ping on this?

No TAD, yes ACPI declaration for RTC.

Quoted 3 lines

Unless we find evidence to the contrary, we should probably do:

ACPI TAD > PNP0B0x > EFI > hard probing

EFI is preferable to PNP in that it gives us a timezone, and Windows certainly calls the EFI time functions. *However*, it doesn't appear to do so once the system is booted. So we probably want to call it in the boot stub and find some way to pass the timezone information up to the kernel, and then spend some more time instrumenting Windows to figure out how it makes time calls.

Signature · 1 line
Matthew Garrett <[email protected]>
#11 lore raw
Quoted 5 lines · Matthew Garrett
Quoted 1 line · H. Peter Anvin

Ping on this?

No TAD, yes ACPI declaration for RTC.

OK, that is unfortunate.

Quoted 10 lines
Quoted 3 lines

Unless we find evidence to the contrary, we should probably do:

ACPI TAD > PNP0B0x > EFI > hard probing

EFI is preferable to PNP in that it gives us a timezone, and Windows certainly calls the EFI time functions. *However*, it doesn't appear to do so once the system is booted. So we probably want to call it in the boot stub and find some way to pass the timezone information up to the kernel, and then spend some more time instrumenting Windows to figure out how it makes time calls.

TAD would also give us the timezone. I'm not sure how you can realistically only use the time function during boot, however, unless you inherently assume it is coherent with the hardware RTC, since you wouldn't be able to set it.

I suspect that means that Windows doesn't set the timezone information, which is highly unfortunate since Windows is the main offender in not using UTC time.

-hpa

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 6 lines · Matthew Garrett

EFI is preferable to PNP in that it gives us a timezone, and Windows certainly calls the EFI time functions. *However*, it doesn't appear to do so once the system is booted. So we probably want to call it in the boot stub and find some way to pass the timezone information up to the kernel, and then spend some more time instrumenting Windows to figure out how it makes time calls.

Quoted 4 lines

TAD would also give us the timezone. I'm not sure how you can realistically only use the time function during boot, however, unless you inherently assume it is coherent with the hardware RTC, since you wouldn't be able to set it.

If we can verify that Windows actually uses TAD then I'd agree it's preferable to EFI, but if we can't then I wouldn't be so sure. I'll redo my Windows instrumentation and figure out under which circumstances it's calling the time functions.

Signature · 1 line
Matthew Garrett <[email protected]>
#14 lore raw
Quoted 11 lines · Matthew Garrett
Quoted 5 lines

TAD would also give us the timezone. I'm not sure how you can realistically only use the time function during boot, however, unless you inherently assume it is coherent with the hardware RTC, since you wouldn't be able to set it.

If we can verify that Windows actually uses TAD then I'd agree it's preferable to EFI, but if we can't then I wouldn't be so sure. I'll redo my Windows instrumentation and figure out under which circumstances it's calling the time functions.

Well, *which version* of Windows is a big question here. Keep in mind that the TAD was only introduced with ACPI 5 so it is quite a new feature. I would really like to see it implemented in SeaBIOS and/or OVMF so we can test it out in Qemu.

-hpa

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

於 二,2013-12-10 於 15:51 -0800,H. Peter Anvin 提到:

Quoted 13 lines · Matthew Garrett
Quoted 11 lines
Quoted 5 lines

TAD would also give us the timezone. I'm not sure how you can realistically only use the time function during boot, however, unless you inherently assume it is coherent with the hardware RTC, since you wouldn't be able to set it.

If we can verify that Windows actually uses TAD then I'd agree it's preferable to EFI, but if we can't then I wouldn't be so sure. I'll redo my Windows instrumentation and figure out under which circumstances it's calling the time functions.

Quoted 7 lines

Well, *which version* of Windows is a big question here. Keep in mind that the TAD was only introduced with ACPI 5 so it is quite a new feature. I would really like to see it implemented in SeaBIOS and/or OVMF so we can test it out in Qemu.

-hpa

Actually, I am working on the timezone support of ACPI TIME and EFI TIME. My current implementation is using EFI time services to deal with clock in RTC.

The ACPI TAD is a generic device that need parse DSDT for access it. The DSDT parser is in subsystem initial stage. But in start_kernel, the timekeeping_init() call wallclock functions to deal system clock with RTC, it's too early for access ACPI TAD, so it still access CMOS interface unless switch it to EFI services.

If we adapt to ACPI TAD, then how does system clock deal with RTC through it when system boot?

Thanks
Joey Lee

A message that is not in the archive (sent off-list or not yet received): 1386721257.3539.1717.camel-ONCj+Eqt86TasUa73XJKwA@public.gmane.org

#18 lore raw
Quoted 5 lines · joeyli

Actually, I am working on the timezone support of ACPI TIME and EFI TIME. My current implementation is using EFI time services to deal with clock in RTC.

Quoted 9 lines

The ACPI TAD is a generic device that need parse DSDT for access it. The DSDT parser is in subsystem initial stage. But in start_kernel, the timekeeping_init() call wallclock functions to deal system clock with RTC, it's too early for access ACPI TAD, so it still access CMOS interface unless switch it to EFI services.

If we adapt to ACPI TAD, then how does system clock deal with RTC through it when system boot?

I don't really have a good answer for that. We could call the EFI services from the boot stub, of course, and pass in an approximate time (and perhaps the TSC value to go with it), but I'm not sure if that will be adequate.

The other alternative would be to either parse ACPI earlier or initialize wall time later.

-hpa

#19 lore raw

[tip:x86/urgent] x86, efi: Don't use (U) EFI time services on 32 bit

In reply to Matthew Garrett
x86, efi: Don't use (U)EFI time services on 32 bit
Commit-ID:  04bf9ba720fcc4fa313fa122b799ae0989b6cd50
Gitweb:     http://git.kernel.org/tip/04bf9ba720fcc4fa313fa122b799ae0989b6cd50
Author:     Matthew Garrett <[email protected]>
AuthorDate: Fri, 29 Nov 2013 14:44:43 -0500
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 10 Dec 2013 15:02:34 -0800

x86, efi: Don't use (U)EFI time services on 32 bit

UEFI time services are often broken once we're in virtual mode. We were already refusing to use them on 64-bit systems, but it turns out that they're also broken on some 32-bit firmware, including the Dell Venue. Disable them for now, we can revisit once we have the 1:1 mappings code incorporated.

---
 arch/x86/platform/efi/efi.c | 7 -------
 1 file changed, 7 deletions(-)
arch/x86/platform/efi/efi.c +0 -7
index 92c0234..cceb813 100644
@@ -690,13 +690,6 @@ void __init efi_init(void)
 
 	set_bit(EFI_MEMMAP, &x86_efi_facility);
 
-#ifdef CONFIG_X86_32
-	if (efi_is_native()) {
-		x86_platform.get_wallclock = efi_get_time;
-		x86_platform.set_wallclock = efi_set_rtc_mmss;
-	}
-#endif
-
 #if EFI_DEBUG
 	print_efi_memmap();
 #endif