[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240203091214.411862-18-zhao1.liu@linux.intel.com>
Date: Sat, 3 Feb 2024 17:12:05 +0800
From: Zhao Liu <zhao1.liu@...ux.intel.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H . Peter Anvin" <hpa@...or.com>,
kvm@...r.kernel.org,
linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
x86@...nel.org
Cc: Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>,
Len Brown <len.brown@...el.com>,
Zhang Rui <rui.zhang@...el.com>,
Zhenyu Wang <zhenyu.z.wang@...el.com>,
Zhuocheng Ding <zhuocheng.ding@...el.com>,
Dapeng Mi <dapeng1.mi@...el.com>,
Yanting Jiang <yanting.jiang@...el.com>,
Yongwei Ma <yongwei.ma@...el.com>,
Vineeth Pillai <vineeth@...byteword.org>,
Suleiman Souhlal <suleiman@...gle.com>,
Masami Hiramatsu <mhiramat@...gle.com>,
David Dai <davidai@...gle.com>,
Saravana Kannan <saravanak@...gle.com>,
Zhao Liu <zhao1.liu@...el.com>
Subject: [RFC 17/26] KVM: VMX: Allow to inject thermal interrupt without HFI update
From: Zhao Liu <zhao1.liu@...el.com>
When the HFI table memory address is set by MSR_IA32_HW_FEEDBACK_PTR or
when MSR_IA32_HW_FEEDBACK_CONFIG enables the HFI feature, the hardware
sends an initial HFI notification via thermal interrupt and sets the
thermal status bit.
To prepare for the above cases, extend vmx_update_hfi_table() to allow
the forced thermal interrupt injection (with the thermal status bit set)
regardless of whether there is the HFI table change to be updated.
Tested-by: Yanting Jiang <yanting.jiang@...el.com>
Signed-off-by: Zhao Liu <zhao1.liu@...el.com>
---
arch/x86/kvm/vmx/vmx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 44c09c995120..97bb7b304213 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -1616,7 +1616,7 @@ static int vmx_build_hfi_table(struct kvm *kvm)
return 1;
}
-static void vmx_update_hfi_table(struct kvm *kvm)
+static void vmx_update_hfi_table(struct kvm *kvm, bool forced_int)
{
struct kvm_vmx *kvm_vmx = to_kvm_vmx(kvm);
struct hfi_desc *kvm_vmx_hfi = &kvm_vmx->pkg_therm.hfi_desc;
@@ -1635,7 +1635,7 @@ static void vmx_update_hfi_table(struct kvm *kvm)
}
ret = vmx_build_hfi_table(kvm);
- if (ret <= 0)
+ if (ret < 0 || (!ret && !forced_int))
return;
kvm_vmx_hfi->hfi_update_status = true;
@@ -1731,7 +1731,7 @@ static void vmx_dynamic_update_hfi_table(struct kvm_vcpu *vcpu)
* of the same VM are sharing the one HFI table. Therefore, one
* vCPU can update the HFI table for the whole VM.
*/
- vmx_update_hfi_table(vcpu->kvm);
+ vmx_update_hfi_table(vcpu->kvm, false);
mutex_unlock(&kvm_vmx->pkg_therm.pkg_therm_lock);
}
--
2.34.1
Powered by blists - more mailing lists