[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABgObfb9DC744cQeaDeP5hbKhgVisCvxBew=pCP5JB6U1=oz-A@mail.gmail.com>
Date: Tue, 11 Jun 2024 16:11:23 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Binbin Wu <binbin.wu@...ux.intel.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 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. Or vmx.c as Sean says
below, but I am not sure I like the idea too much.
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