Re: [RFC PATCH v5 100/104] KVM: TDX: Silently discard SMI request

From: Paolo Bonzini
Date: Tue Apr 05 2022 - 18:04:09 EST


On 3/4/22 20:49, isaku.yamahata@xxxxxxxxx wrote:
From: Isaku Yamahata <isaku.yamahata@xxxxxxxxx>

TDX doesn't support system-management mode (SMM) and system-management
interrupt (SMI) in guest TDs. Because guest state (vcpu state, memory
state) is protected, it must go through the TDX module APIs to change guest
state, injecting SMI and changing vcpu mode into SMM. The TDX module
doesn't provide a way for VMM to inject SMI into guest TD and a way for VMM
to switch guest vcpu mode into SMM.

We have two options in KVM when handling SMM or SMI in the guest TD or the
device model (e.g. QEMU): 1) silently ignore the request or 2) return a
meaningful error.

For simplicity, we implemented the option 1).

Please also:

1) return zero from vmx_has_emulated_msr(MSR_IA32_SMBASE) for TDX virtual machines.

2) do a check for static_call(kvm_x86_has_emulated_msr)(kvm, MSR_IA32_SMBASE) in kvm_vcpu_ioctl_smi and __apic_accept_irq.

3) WARN_ON_ONCE in tdx_smi_allowed and tdx_enable_smi_window.

Paolo