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@xxxxxxxxx> Signed-off-by: Isaku Yamahata <isaku.yamahata@xxxxxxxxx> Signed-off-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx> --- 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