[PATCH] UBUNTU: SAUCE: clocksource: hyper-v: Use Invariant-TSC even if hv_read_tsc_page is hidden
Tim Gardner
tim.gardner at canonical.com
Sat Jan 28 22:50:13 UTC 2023
From: Dexuan Cui <decui at microsoft.com>
BugLink: https://bugs.launchpad.net/bugs/2004090
ms_hyperv_init_platform() hides HV_MSR_REFERENCE_TSC_AVAILABLE for TDX
guests in favor of Invariant-TSC. In this case, we should also downgrade
the rating of hyperv_cs_msr.rating, so Invariant-TSC can be used by default.
Signed-off-by: Dexuan Cui <decui at microsoft.com>
(cherry picked from commit 367f18c06ac999c2822b0c24f50a87994635d4bd https://github.com/dcui/tdx.git)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
drivers/clocksource/hyperv_timer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c
index 18de1f439ffd..52a110fd99eb 100644
--- a/drivers/clocksource/hyperv_timer.c
+++ b/drivers/clocksource/hyperv_timer.c
@@ -499,9 +499,6 @@ static bool __init hv_init_tsc_clocksource(void)
union hv_reference_tsc_msr tsc_msr;
phys_addr_t phys_addr;
- if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE))
- return false;
-
if (hv_root_partition)
return false;
@@ -521,6 +518,9 @@ static bool __init hv_init_tsc_clocksource(void)
hyperv_cs_msr.rating = 250;
}
+ if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE))
+ return false;
+
hv_read_reference_counter = read_hv_clock_tsc;
phys_addr = virt_to_phys(hv_get_tsc_page());
--
2.34.1
More information about the kernel-team
mailing list