From: Tim Deegan Subject: Re: [PATCH] nested EPT: fixing wrong handling for L2 guest's direct mmio access Date: Fri, 17 Jan 2014 14:10:38 +0100 Message-ID: <20140117131038.GA59786@deinos.phlegethon.org> References: <1389940508-2239-1-git-send-email-yang.z.zhang@intel.com> <52D8F10A.7080501@amazon.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <52D8F10A.7080501@amazon.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Egger, Christoph" Cc: JBeulich@suse.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, xen-devel@lists.xen.org, jun.nakajima@intel.com, Yang Zhang , xiantao.zhang@intel.com List-Id: xen-devel@lists.xenproject.org At 09:59 +0100 on 17 Jan (1389949194), Egger, Christoph wrote: > On 17.01.14 07:35, Yang Zhang wrote: > > From: Yang Zhang > > > > L2 guest will access the physical device directly(nested VT-d). For such access, > > Shadow EPT table should point to device's MMIO. But in current logic, L0 doesn't > > distinguish the MMIO whether from qemu or physical device when building shadow EPT table. > > This is wrong. This patch will setup the correct shadow EPT table for such MMIO ranges. > > > > Signed-off-by: Yang Zhang > > --- > > xen/arch/x86/mm/hap/nested_hap.c | 10 ++++++++-- > > xen/include/asm-x86/hvm/nestedhvm.h | 1 + > > 2 files changed, 9 insertions(+), 2 deletions(-) > > > > diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c > > index c2ef1d1..38e2327 100644 > > --- a/xen/arch/x86/mm/hap/nested_hap.c > > +++ b/xen/arch/x86/mm/hap/nested_hap.c > > @@ -170,8 +170,11 @@ nestedhap_walk_L0_p2m(struct p2m_domain *p2m, paddr_t L1_gpa, paddr_t *L0_gpa, > > mfn = get_gfn_type_access(p2m, L1_gpa >> PAGE_SHIFT, p2mt, p2ma, > > 0, page_order); > > > > + rc = NESTEDHVM_PAGEFAULT_DIRECT_MMIO; > > + if ( *p2mt == p2m_mmio_direct ) > > + goto direct_mmio_out; > > rc = NESTEDHVM_PAGEFAULT_MMIO; > > - if ( p2m_is_mmio(*p2mt) ) > > + if ( *p2mt == p2m_mmio_dm ) > > goto out; > > Why does p2m_is_mmio() not cover p2m_mmio_direct ? It does. This code is changing to cover the two kinds of mmio separately. Tim.