[PATCH MANUALSEL 5.10 2/4] KVM: VMX: clear vmx_x86_ops.sync_pir_to_irr if APICv is disabled

From: Sasha Levin
Date: Mon Dec 13 2021 - 09:20:31 EST


From: Paolo Bonzini <pbonzini@xxxxxxxxxx>

[ Upstream commit e90e51d5f01d2baae5dcce280866bbb96816e978 ]

There is nothing to synchronize if APICv is disabled, since neither
other vCPUs nor assigned devices can set PIR.ON.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
arch/x86/kvm/vmx/vmx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 5b7664d51dc2b..dff8ab5a53280 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7814,10 +7814,10 @@ static __init int hardware_setup(void)
ple_window_shrink = 0;
}

- if (!cpu_has_vmx_apicv()) {
+ if (!cpu_has_vmx_apicv())
enable_apicv = 0;
+ if (!enable_apicv)
vmx_x86_ops.sync_pir_to_irr = NULL;
- }

if (cpu_has_vmx_tsc_scaling()) {
kvm_has_tsc_control = true;
--
2.33.0