git: ae95c02d02c2 - stable/13 - amd64: Call clock_init() after finishidentcpu()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 31 Mar 2022 16:07:50 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae95c02d02c29ddbb3767ca13731325be0688a28

commit ae95c02d02c29ddbb3767ca13731325be0688a28
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-05 00:32:39 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-31 16:05:44 +0000

    amd64: Call clock_init() after finishidentcpu()
    
    As in commit c3d830cf7c71, we should finalize CPU identification before
    probing the TSC frequency.
    
    Fixes:          84369dd52369 ("x86: Probe the TSC frequency earlier")
    Reported by:    khng
    
    (cherry picked from commit f7a6dccf426676bdd8c6be25491e57dca830de25)
---
 sys/amd64/amd64/machdep.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 870b113359ae..8fb65917f700 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1467,12 +1467,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
 	r_idt.rd_base = (long) idt;
 	lidt(&r_idt);
 
-	/*
-	 * Initialize the clock before the console so that console
-	 * initialization can use DELAY().
-	 */
-	clock_init();
-
 	/*
 	 * Use vt(4) by default for UEFI boot (during the sc(4)/vt(4)
 	 * transition).
@@ -1500,6 +1494,13 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
 	    &x86_rngds_mitg_enable);
 
 	finishidentcpu();	/* Final stage of CPU initialization */
+
+	/*
+	 * Initialize the clock before the console so that console
+	 * initialization can use DELAY().
+	 */
+	clock_init();
+
 	initializecpu();	/* Initialize CPU registers */
 
 	amd64_bsp_ist_init(pc);