diff mbox series

[RFC,17/26] KVM: VMX: Allow to inject thermal interrupt without HFI update

Message ID 20240203091214.411862-18-zhao1.liu@linux.intel.com (mailing list archive)
State RFC, archived
Headers show
Series Intel Thread Director Virtualization | expand

Commit Message

Zhao Liu Feb. 3, 2024, 9:12 a.m. UTC
From: Zhao Liu <zhao1.liu@intel.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@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 arch/x86/kvm/vmx/vmx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

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);
 }