[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230227215810.GN4175971@ls.amr.corp.intel.com>
Date: Mon, 27 Feb 2023 13:58:10 -0800
From: Isaku Yamahata <isaku.yamahata@...il.com>
To: "Huang, Kai" <kai.huang@...el.com>
Cc: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"sean.j.christopherson@...el.com" <sean.j.christopherson@...el.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"Shahar, Sagi" <sagis@...gle.com>,
"Aktas, Erdem" <erdemaktas@...gle.com>,
"isaku.yamahata@...il.com" <isaku.yamahata@...il.com>,
"dmatlack@...gle.com" <dmatlack@...gle.com>,
"Christopherson,, Sean" <seanjc@...gle.com>
Subject: Re: [PATCH v11 033/113] KVM: x86/mmu: Track shadow MMIO value on a
per-VM basis
On Mon, Jan 16, 2023 at 11:16:04AM +0000,
"Huang, Kai" <kai.huang@...el.com> wrote:
> > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
> > index 6111e3e9266d..dffacb7eb15a 100644
> > --- a/arch/x86/kvm/mmu/tdp_mmu.c
> > +++ b/arch/x86/kvm/mmu/tdp_mmu.c
> > @@ -19,6 +19,14 @@ int kvm_mmu_init_tdp_mmu(struct kvm *kvm)
> > {
> > struct workqueue_struct *wq;
> >
> > + /*
> > + * TDs require mmio_caching to clear suppress_ve bit of SPTE for GPA
> > + * of MMIO so that TD can convert #VE triggered by MMIO into
> > + * TDG.VP.VMCALL<MMIO>.
> > + */
> > + if (kvm->arch.vm_type == KVM_X86_TDX_VM && !enable_mmio_caching)
> > + return -EOPNOTSUPP;
>
> SEV-ES does the check in hardware_setup:
>
> void __init sev_hardware_setup(void)
> {
> ...
> /*
> * SEV-ES requires MMIO caching as KVM doesn't have access to the guest
> * instruction stream, i.e. can't emulate in response to a #NPF and
> * instead relies on #NPF(RSVD) being reflected into the guest as #VC
> * (the guest can then do a #VMGEXIT to request MMIO emulation).
> */
> if (!enable_mmio_caching)
> goto out;
>
> ...
> }
>
> TDX should be done in the same way.
>
> And IMO this chunk really doesn't belong to this patch -- I interpret this patch
> as a "infrastructure patch to track shadow MMIO value on per-VM basis" (which
> even should have no functional change IMHO), but this chunk is clearly doing
> more than that.
It's cleaner to do in hardware_setup(). So I moved the logic into
hardware_setup() and an independent patch.
--
Isaku Yamahata <isaku.yamahata@...il.com>
Powered by blists - more mailing lists