[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211112153733.2767561-9-xiaoyao.li@intel.com>
Date: Fri, 12 Nov 2021 23:37:30 +0800
From: Xiaoyao Li <xiaoyao.li@...el.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>
Cc: xiaoyao.li@...el.com, erdemaktas@...gle.com,
Connor Kuehl <ckuehl@...hat.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
isaku.yamahata@...el.com, Kai Huang <kai.huang@...el.com>
Subject: [PATCH 08/11] KVM: x86: Disable INIT/SIPI for TDX
INIT/SIPI is not supportd for TDX guest. Disallow injecting interrupt with
delivery mode of INIT/SIPI, and add a check to reject INIT/SIPI
interrupt delivery mode.
Co-developed-by: Isaku Yamahata <isaku.yamahata@...el.com>
Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@...el.com>
---
arch/x86/kvm/irq_comm.c | 2 ++
arch/x86/kvm/x86.h | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c
index 705fc0dc0272..c51faa621aa4 100644
--- a/arch/x86/kvm/irq_comm.c
+++ b/arch/x86/kvm/irq_comm.c
@@ -130,6 +130,8 @@ static inline bool kvm_msi_route_invalid(struct kvm *kvm,
msg.arch_data.is_level) ||
(kvm_smm_unsupported(kvm) &&
msg.arch_data.delivery_mode == APIC_DELIVERY_MODE_SMI) ||
+ (kvm_init_sipi_unsupported(kvm) &&
+ msg.arch_data.delivery_mode == APIC_DELIVERY_MODE_INIT) ||
(kvm->arch.x2apic_format && (msg.address_hi & 0xff));
}
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index ab7c91ca2478..2203cc283e04 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -461,6 +461,11 @@ static __always_inline bool kvm_smm_unsupported(struct kvm *kvm)
return kvm->arch.vm_type == KVM_X86_TDX_VM;
}
+static __always_inline bool kvm_init_sipi_unsupported(struct kvm *kvm)
+{
+ return kvm->arch.vm_type == KVM_X86_TDX_VM;
+}
+
void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu);
void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu);
int kvm_spec_ctrl_test_value(u64 value);
--
2.27.0
Powered by blists - more mailing lists