xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Tim Deegan <tim@xen.org>
Subject: [PATCH] nestedhvm: do not translate INVALID_GFN
Date: Tue, 31 Jul 2012 17:37:20 +0200	[thread overview]
Message-ID: <5017FBB0.7060500@amd.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]


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 <Christoph.Egger@amd.com>
CC: Tim Deegan <tim@xen.org>

-- 
---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

[-- Attachment #2: xen_p2m.diff --]
[-- Type: text/plain, Size: 958 bytes --]

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);

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2012-07-31 15:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 15:37 Christoph Egger [this message]
2012-08-02 11:19 ` [PATCH] nestedhvm: do not translate INVALID_GFN Tim Deegan
2012-08-02 11:28   ` Christoph Egger
2012-08-02 11:35     ` Tim Deegan
2012-08-02 12:14       ` Christoph Egger
2012-08-02 13:45         ` Tim Deegan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5017FBB0.7060500@amd.com \
    --to=christoph.egger@amd.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).