x86: get_page_from_gfn() should not return misleading type
authorJan Beulich <jbeulich@suse.com>
Mon, 12 Jun 2017 07:29:45 +0000 (09:29 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 12 Jun 2017 07:29:45 +0000 (09:29 +0200)
It is not impossible that the page owner is dom_io. While no current
caller cares about this case, let's nevertheless return an appropriate
type even in that case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/include/asm-x86/p2m.h

index 408f7dabee08747f338e2902226334fa64f81a63..e73660924178b077c7dd7d4f535c77a7dde06b5f 100644 (file)
@@ -479,9 +479,9 @@ static inline struct page_info *get_page_from_gfn(
     if ( paging_mode_translate(d) )
         return get_page_from_gfn_p2m(d, p2m_get_hostp2m(d), gfn, t, NULL, q);
 
-    /* Non-translated guests see 1-1 RAM mappings everywhere */
-    if (t)
-        *t = p2m_ram_rw;
+    /* Non-translated guests see 1-1 RAM / MMIO mappings everywhere */
+    if ( t )
+        *t = likely(d != dom_io) ? p2m_ram_rw : p2m_mmio_direct;
     page = __mfn_to_page(gfn);
     return mfn_valid(_mfn(gfn)) && get_page(page, d) ? page : NULL;
 }