[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 08/16] x86/P2M: PoD, altp2m, and nested-p2m are HVM-only


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 5 Jul 2021 18:09:33 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y519G2kPDVMzATqyC7RjCSlK3dqw0cUbYWZl2eMBtQs=; b=R3r9ck0aSgjbU+5YnKfVp4jm+EBKwVav06ughNPFLddzzCjjXeEEnqCS+bHlcmyCUKLc3yxDll0SyrrOijxCOvdFv2qJS/ewPVZOcS13qs9djGFPFK41s4re75ZrRYtndpTDqI3x0+GfVJCicbGIhQ+fX1/LkABNB2Ujch85W5wmfPP+TzEMgb/Uy3Gk2BcZmB+TI6HlubhxaP+GwUmWP28HHztVXBxKuz+QSYazuknEAvZdKXr2eEvYC3hb6/AhUta2rsXo323nKPexpTHQaGeCvhrEnJjLl0OhG4iwFM+fUuiEGSJVyT4ddevpJyEPo0wSqUlM/uJfiAIhxaLtnQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cJdjbEC5SB16phTMi/MrUCGzUiYVJd4uQX2zRH+NJtrdkLVxLUnHWAXh/8e2s69G1totuRJt2GmPJKworjtUyQgV1G+TkZPJkJcbXaCDwhrzS0kY4MAGoOYgQEnTf4YMczbRuPTQF6evL+bhMFmYIrmEw8VQgDIkAWFWOx/yLjMm9mbvCv5WT10IESKL+vkQVA9kcJfyCU2x368fjCCyloN6ALzQ3/RhTY9XTFoT6cKpNZR728a77K5Za5qrQsPDaNBd9gk8UUsqzX0Xf5DFbj+8BdhQcx0yvuPfFyKgciIAKpO9og0+Ve92BIW0qz24jHat/RpBlMXIL7Ez8OxWhw==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>
  • Delivery-date: Mon, 05 Jul 2021 16:09:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

There's no need to initialize respective data for PV domains. Note that
p2m_teardown_{alt,nested}p2m() will handle the lack-of-initialization
case fine.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -102,6 +102,9 @@ static int p2m_initialise(struct domain
     p2m->default_access = p2m_access_rwx;
     p2m->p2m_class = p2m_host;
 
+    if ( !is_hvm_domain(d) )
+        return 0;
+
     p2m_pod_init(p2m);
     p2m_nestedp2m_init(p2m);
 
@@ -259,7 +262,7 @@ int p2m_init(struct domain *d)
     int rc;
 
     rc = p2m_init_hostp2m(d);
-    if ( rc )
+    if ( rc || !is_hvm_domain(d) )
         return rc;
 
 #ifdef CONFIG_HVM
--- a/xen/arch/x86/mm/p2m.h
+++ b/xen/arch/x86/mm/p2m.h
@@ -17,6 +17,8 @@
 
 #include <xen/mem_access.h>
 
+void p2m_pod_init(struct p2m_domain *p2m);
+
 int p2m_add_identity_entry(struct domain *d, unsigned long gfn,
                            p2m_access_t p2ma, unsigned int flag);
 int p2m_remove_identity_entry(struct domain *d, unsigned long gfn);
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1135,6 +1135,12 @@ p2m_pod_demand_populate(struct p2m_domai
     mfn_t mfn;
     unsigned long i;
 
+    if ( !p2m_is_hostp2m(p2m) )
+    {
+        ASSERT_UNREACHABLE();
+        return false;
+    }
+
     ASSERT(gfn_locked_by_me(p2m, gfn));
     pod_lock(p2m);
 
--- a/xen/include/asm-x86/p2m.h
+++ b/xen/include/asm-x86/p2m.h
@@ -679,8 +679,6 @@ static inline long p2m_pod_entry_count(c
     return p2m->pod.entry_count;
 }
 
-void p2m_pod_init(struct p2m_domain *p2m);
-
 #else
 
 static inline bool
@@ -709,8 +707,6 @@ static inline long p2m_pod_entry_count(c
     return 0;
 }
 
-static inline void p2m_pod_init(struct p2m_domain *p2m) {}
-
 #endif
 
 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.