tsc: Change default tsc calibration method to EFI on EFI systems
PATCH 1/1 tsc: Change default tsc calibration method to EFI on EFI systems
On efi systems, make efi based tsc calibration the default, followed by the pmtimer before using the pit. This prevents Grub boot failure on newer x86 systems that power gate the pit.
--- grub-core/kern/i386/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/i386/tsc.c +1 -1
@@ -68,7 +68,7 @@ grub_tsc_init (void)#ifdef GRUB_MACHINE_XEN (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) - (void ) (grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ()); + (void ) (grub_tsc_calibrate_from_efi () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_COREBOOT ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||calibrate_tsc_hardcode ());#else
Signature · 1 line
2.13.5
Quoted 14 lines · On Wed, 6 Sep 2017 13:20:54 -0700 "David E. Box"…
On efi systems, make efi based tsc calibration the default, followed by the pmtimer before using the pit. This prevents Grub boot failure on newer x86 systems that power gate the pit.
Signed-off-by David E. Box <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/kern/i386/tsc.c +0
-0
grub-core/kern/i386/tsc.c grub_tsc_init (void) · line 74
Quoted 8 lines
grub-core/kern/i386/tsc.c +1
-1@@ -68,7 +68,7 @@ grub_tsc_init (void)#ifdef GRUB_MACHINE_XEN (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) - (void ) (grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ()); + (void ) (grub_tsc_calibrate_from_efi () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_COREBOOT ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||calibrate_tsc_hardcode ());#else
Good catch!
Noted the baked-in, minor style cleanup:
grub_tsc_calibrate_from_efi() -> grub_tsc_calibrate_from_efi ()
You have my:
Cheers
Dear David,
Am Mittwoch, den 06.09.2017, 13:20 -0700 schrieb David E. Box:
Quoted 3 lines
On efi systems, make efi based tsc calibration the default, followed by the pmtimer before using the pit. This prevents Grub boot failure on newer x86 systems that power gate the pit.
Could you please be specific, what “newer x86 systems” are? Also, what is the “GRUB boot failure”? A hang?
What about older EFI x86 systems? Is there a chance, that they hang now?
Quoted 10 lines
Signed-off-by David E. Box <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/kern/i386/tsc.c +0
-0
grub-core/kern/i386/tsc.c grub_tsc_init (void) · line 74
Quoted 8 lines
grub-core/kern/i386/tsc.c +1
-1@@ -68,7 +68,7 @@ grub_tsc_init (void)#ifdef GRUB_MACHINE_XEN (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) - (void ) (grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_efi () ||calibrate_tsc_hardcode ()); + (void ) (grub_tsc_calibrate_from_efi () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_COREBOOT ) (void ) (grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_pit () ||calibrate_tsc_hardcode ());#else
Thanks,
Paul
Hi Paul,
Quoted 10 lines · Paul Menzel
Dear David,
Am Mittwoch, den 06.09.2017, 13:20 -0700 schrieb David E. Box:
Quoted 5 lines
On efi systems, make efi based tsc calibration the default, followed by
the pmtimer before using the pit. This prevents Grub boot failure on
newer x86 systems that power gate the pit.
Quoted 3 lines
Could you please be specific, what “newer x86 systems” are? Also, what
is the “GRUB boot failure”? A hang?
Intel SoC's supporting the S0ix feature require the 8254 to be power gated. This feature as been around as early as the Cherry Trail line. In order to support this some firmware configurations clock gate the 8254 by default. This causes grub to hang on these systems when they attempt to use it to calibrate the tsc.
See section 18.9.2.4 in https://www.intel.com/content/www/us/en/process
ors/atom/atom-z8000-datasheet-vol-1.html
Quoted 4 lines
What about older EFI x86 systems? Is there a chance, that they hang now?support this some firmware configurations clock gate the 8254 by default. This causes grub to hang on t
Can't say for sure. I have no reason to suspect so. Such a system would have to have no (or broken) support for the EFI_STALL boot service command, which has been around since EFI 1.0.
Quoted 29 lines
Quoted 19 lines
Signed-off-by David E. Box <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/kern/i386/tsc.c +1
-1@@ -68,7 +68,7 @@ grub_tsc_init (void)#ifdef GRUB_MACHINE_XEN (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) - (void ) (grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_efi () || calibrate_tsc_hardcode()); + (void) (grub_tsc_calibrate_from_efi () ||Quoted 6 lines
grub_tsc_calibrate_from_pmtimer() ||grub_tsc_calibrate_from_pit() ||calibrate_tsc_hardcode());
#elif defined (GRUB_MACHINE_COREBOOT)
(void) (grub_tsc_calibrate_from_pmtimer() ||grub_tsc_calibrate_from_pit() ||calibrate_tsc_hardcode());
#elseThanks,
Quoted 1 line
Paul
Dave
Quoted 4 lines · On Wed, Sep 6, 2017, 22:21 David E. Box <[email protected]> wrote:
On efi systems, make efi based tsc calibration the default, followed by the pmtimer before using the pit. This prevents Grub boot failure on newer x86 systems that power gate the pit.
Why does put code fail? I think it was changed to detect gated pit. Also I'd prefer to use pmtimer first as we had problems with event and time routines on some Macs. Any reason not to use pmtimer first?
Quoted 33 lines
Signed-off-by David E. Box <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/kern/i386/tsc.c +0
-1@@ -68,7 +68,7 @@ grub_tsc_init (void)#ifdef GRUB_MACHINE_XEN (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) - (void) (grub_tsc_calibrate_from_pit () ||
grub_tsc_calibrate_from_pmtimer() ||grub_tsc_calibrate_from_efi()||calibrate_tsc_hardcode());
+ (void) (grub_tsc_calibrate_from_efi() ||grub_tsc_calibrate_from_pmtimer() ||grub_tsc_calibrate_from_pit() ||calibrate_tsc_hardcode());
#elif defined (GRUB_MACHINE_COREBOOT)
(void) (grub_tsc_calibrate_from_pmtimer() ||grub_tsc_calibrate_from_pit() ||calibrate_tsc_hardcode());
#else
--
2.13.5_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 11 lines · Vladimir 'phcoder' Serbinenko
Quoted 5 lines · On Wed, Sep 6, 2017, 22:21 David E. Box <[email protected]> wrote:
On efi systems, make efi based tsc calibration the default, followed by
the pmtimer before using the pit. This prevents Grub boot failure on
newer x86 systems that power gate the pit.Why does put code fail? I think it was changed to detect gated pit.
On these systems, even though the pit is gated the timer2 latch logic still works. So when the tics are set the latch still goes from high to active low as expected for a functional timer. But since the device is clock gated it never counts down and the bit never gets reset, leading to an infinite loop.
Quoted 2 lines
Also I'd prefer to use pmtimer first as we had problems with event and time routines on some Macs. Any reason not to use pmtimer first?
No reason not to use pmtimer first. I had not considered boot speed as well which must be prioritized. I'll submit a new patch.
Quoted 37 lines
Quoted 28 lines
Signed-off-by David E. Box <[email protected]>--- grub-core/kern/i386/tsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)grub-core/kern/i386/tsc.c +1
-1@@ -68,7 +68,7 @@ grub_tsc_init (void)#ifdef GRUB_MACHINE_XEN (void ) (grub_tsc_calibrate_from_xen () ||calibrate_tsc_hardcode ());#elif defined (GRUB_MACHINE_EFI ) - (void ) (grub_tsc_calibrate_from_pit () ||grub_tsc_calibrate_from_pmtimer () ||grub_tsc_calibrate_from_efi () || calibrate_tsc_hardcode()); + (void) (grub_tsc_calibrate_from_efi () ||
grub_tsc_calibrate_from_pmtimer() ||grub_tsc_calibrate_from_pit() ||calibrate_tsc_hardcode());
#elif defined (GRUB_MACHINE_COREBOOT)
(void) (grub_tsc_calibrate_from_pmtimer() ||grub_tsc_calibrate_from_pit() ||calibrate_tsc_hardcode());
#else
--
2.13.5Quoted 4 lines
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel