[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ze-dCirMCOCsbsVJ@google.com>
Date: Mon, 11 Mar 2024 17:08:42 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Yan Zhao <yan.y.zhao@...el.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Lai Jiangshan <jiangshanlai@...il.com>,
"Paul E. McKenney" <paulmck@...nel.org>, Josh Triplett <josh@...htriplett.org>, kvm@...r.kernel.org,
rcu@...r.kernel.org, linux-kernel@...r.kernel.org,
Kevin Tian <kevin.tian@...el.com>, Yiwei Zhang <zzyiwei@...gle.com>
Subject: Re: [PATCH 1/5] KVM: x86: Remove VMX support for virtualizing guest
MTRR memtypes
On Mon, Mar 11, 2024, Yan Zhao wrote:
> On Fri, Mar 08, 2024 at 05:09:25PM -0800, Sean Christopherson wrote:
> > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > index 7a74388f9ecf..66bf79decdad 100644
> > --- a/arch/x86/kvm/vmx/vmx.c
> > +++ b/arch/x86/kvm/vmx/vmx.c
> > @@ -7596,39 +7596,27 @@ static int vmx_vm_init(struct kvm *kvm)
> >
> > static u8 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio)
> > {
> > - /* We wanted to honor guest CD/MTRR/PAT, but doing so could result in
> > - * memory aliases with conflicting memory types and sometimes MCEs.
> > - * We have to be careful as to what are honored and when.
> > - *
> > - * For MMIO, guest CD/MTRR are ignored. The EPT memory type is set to
> > - * UC. The effective memory type is UC or WC depending on guest PAT.
> > - * This was historically the source of MCEs and we want to be
> > - * conservative.
> > - *
> > - * When there is no need to deal with noncoherent DMA (e.g., no VT-d
> > - * or VT-d has snoop control), guest CD/MTRR/PAT are all ignored. The
> > - * EPT memory type is set to WB. The effective memory type is forced
> > - * WB.
> > - *
> > - * Otherwise, we trust guest. Guest CD/MTRR/PAT are all honored. The
> > - * EPT memory type is used to emulate guest CD/MTRR.
> > + /*
> > + * Force UC for host MMIO regions, as allowing the guest to access MMIO
> > + * with cacheable accesses will result in Machine Checks.
> This does not always force UC. If guest PAT is WC, the effecitve one is WC.
Doh, right, I keep forgetting that KVM doesn't ignore guest PAT for MMIO.
Powered by blists - more mailing lists