From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: [PATCH] nestedhvm: do not translate INVALID_GFN Date: Tue, 31 Jul 2012 17:37:20 +0200 Message-ID: <5017FBB0.7060500@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060906030601020108050009" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "xen-devel@lists.xen.org" Cc: Tim Deegan List-Id: xen-devel@lists.xenproject.org --------------060906030601020108050009 Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit Do not translate INVALID_GFN as l2 guest gfn into l1 guest gfn. Pass correct pfec for translation into l1 guest gfn. Found with Hyper-V. Signed-off-by: Christoph Egger CC: Tim Deegan -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85689 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632 --------------060906030601020108050009 Content-Type: text/plain; charset="us-ascii"; name="xen_p2m.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen_p2m.diff" Content-Description: xen_p2m.diff diff -r 8330198c3240 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Fri Jul 27 12:24:03 2012 +0200 +++ b/xen/arch/x86/mm/p2m.c Tue Jul 31 16:49:54 2012 +0200 @@ -1582,12 +1582,19 @@ unsigned long paging_gva_to_gfn(struct v struct p2m_domain *p2m; const struct paging_mode *mode; uint64_t ncr3 = nhvm_vcpu_hostcr3(v); + uint32_t pfec1 = *pfec; /* translate l2 guest va into l2 guest gfn */ p2m = p2m_get_nestedp2m(v, ncr3); mode = paging_get_nestedmode(v); gfn = mode->gva_to_gfn(v, p2m, va, pfec); + /* if l1 guest maps its mmio pages into the + * l2 guest then we see this case here. */ + if (gfn == INVALID_GFN) + return INVALID_GFN; + *pfec = pfec1; + /* translate l2 guest gfn into l1 guest gfn */ return hostmode->p2m_ga_to_gfn(v, hostp2m, ncr3, gfn << PAGE_SHIFT, pfec, NULL); --------------060906030601020108050009 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --------------060906030601020108050009--