[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f4029895-01c2-453a-9104-71475cd821ab@linux.intel.com>
Date: Wed, 12 Jun 2024 21:06:40 +0800
From: Binbin Wu <binbin.wu@...ux.intel.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Sean Christopherson <seanjc@...gle.com>, isaku.yamahata@...el.com,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
erdemaktas@...gle.com, Sagi Shahar <sagis@...gle.com>,
Kai Huang <kai.huang@...el.com>, chen.bo@...el.com, hang.yuan@...el.com,
tina.zhang@...el.com
Subject: Re: [PATCH v19 116/130] KVM: TDX: Silently discard SMI request
On 6/11/2024 10:11 PM, Paolo Bonzini wrote:
> On Tue, Jun 11, 2024 at 3:18 PM Binbin Wu <binbin.wu@...ux.intel.com> wrote:
>>>> }
>>>>
>>>> diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
>>>> index ed46e7e57c18..4f3b872cd401 100644
>>>> --- a/arch/x86/kvm/vmx/main.c
>>>> +++ b/arch/x86/kvm/vmx/main.c
>>>> @@ -283,6 +283,43 @@ static void vt_msr_filter_changed(struct kvm_vcpu *vcpu)
>>>> vmx_msr_filter_changed(vcpu);
>>>> }
>>>>
>>>> +#ifdef CONFIG_KVM_SMM
>>>> +static int vt_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection)
>>>> +{
>>>> + if (is_td_vcpu(vcpu))
>>>> + return tdx_smi_allowed(vcpu, for_injection);
>>> Adding stubs for something that TDX will never support is silly. Bug the VM and
>>> return an error.
>>>
>>> if (KVM_BUG_ON(is_td_vcpu(vcpu)))
>>> return -EIO;
>> is_td_vcpu() is defined in tdx.h.
>> Do you mind using open code to check whether the VM is TD in vmx.c?
>> "vcpu->kvm->arch.vm_type == KVM_X86_TDX_VM"
> I'd move it to some place that main.c can see.
is_td_vcpu() can be seen in main.c
> Or vmx.c as Sean says
> below, but I am not sure I like the idea too much.
Which you may not like? Remove the vt_* wrapper or use KVM_BUG_ON()?
>
> Paolo
>
>>> And I wouldn't even bother with vt_* wrappers, just put that right in vmx_*().
>>> Same thing for everything below.
> If it's a KVM_BUG_ON()
>
Powered by blists - more mailing lists