]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
x86/hyperv: Allow Hyper-V to inject STIMER0 interrupts
authorTianyu Lan <ltykernel@gmail.com>
Thu, 18 Sep 2025 15:00:22 +0000 (11:00 -0400)
committerWei Liu <wei.liu@kernel.org>
Sat, 15 Nov 2025 06:18:14 +0000 (06:18 +0000)
When Secure AVIC is enabled, call Secure AVIC
function to allow Hyper-V to inject STIMER0 interrupt.

Reviewed-by: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Tianyu Lan <tiala@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
arch/x86/hyperv/hv_init.c

index e890fd37e9c2d278fac80eb71329ac51931c3363..21ed8963fafd395f6297f236174c4aab2f869b1c 100644 (file)
@@ -170,6 +170,10 @@ static int hv_cpu_init(unsigned int cpu)
                wrmsrq(HV_X64_MSR_VP_ASSIST_PAGE, msr.as_uint64);
        }
 
+       /* Allow Hyper-V stimer vector to be injected from Hypervisor. */
+       if (ms_hyperv.misc_features & HV_STIMER_DIRECT_MODE_AVAILABLE)
+               apic_update_vector(cpu, HYPERV_STIMER0_VECTOR, true);
+
        return hyperv_init_ghcb();
 }
 
@@ -277,6 +281,9 @@ static int hv_cpu_die(unsigned int cpu)
                *ghcb_va = NULL;
        }
 
+       if (ms_hyperv.misc_features & HV_STIMER_DIRECT_MODE_AVAILABLE)
+               apic_update_vector(cpu, HYPERV_STIMER0_VECTOR, false);
+
        hv_common_cpu_die(cpu);
 
        if (hv_vp_assist_page && hv_vp_assist_page[cpu]) {