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

[RFC PATCH v6 36/43] arm/altp2m: Add support for altp2m_activate_altp2m


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
  • Date: Mon, 20 Apr 2026 17:31:59 -0400
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 40.93.1.110) smtp.rcpttodomain=amd.com smtp.mailfrom=elektrobit.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=elektrobit.com; dkim=pass (signature was verified) header.d=elektrobit.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=elektrobit.com] dmarc=[1,1,header.from=elektrobit.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 213.95.148.172) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=elektrobit.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=elektrobit.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cnj600JVTUzVmDZRZYm/XxhEOfEfbLwT6rVorqjJHgk=; b=j5QLLsH29Ygz9Ofz+5c3Q8Ndx3wJRU6nNcx/HUG9Ll9YgNHPCHtQNMgal3aRogjfr6RXm4hjSPbulE0LD7MSwFm2lF6mCLwyTNvh846+YK/Nb6Irq/2+pEo2ws0vFP1JdeG2VWPMSJJw2V9CuGbP6XlvqCIov5zwYDPF7n/AWJJDisN+aoV2N5rpblcHZ68q1XMSGtNe9hiwpIcldCqNKNJfHa4G3bVDW8Yb+89jFjNOlAX5NN89+9IvbeFbI1/IDo6qRsMozR0RiqC5vSZxrySslTi+Svxh4vZFMkPyN2OQQSXUT8L2VfCiFBYhfzZ1bq2rxMfqTq8+ra2zU7S4nA==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cnj600JVTUzVmDZRZYm/XxhEOfEfbLwT6rVorqjJHgk=; b=Hltv94F6HbC+oIj8bafCHTNeznL0zCEyugnz2jb5rhOi+2iqqhzCUCS9ENt6XiIjgzohpWAXEMj/tJIHyjvl9cUgJA4XHSHlEkzo+Rl05Nh4tc3lr/zJ89pBGoG0+2Z4gvqRQNH70KwCmEPnAdKwam5YYtVaPM8sf/3u2ic3WpWkwHopiCaCdKepw5FTXSqyFBOv5Bp+yv1VoxtR1dpTIzR2mOQHu6AGc8N4itl6icXoCqehD+gwkr2Wf6FdGWtc+geJdX8g0y32wS3gb5r/0WlW7E8g77ExnSsbIurYFhu4RHQ7bCycTwQGmkFCUJ+f57Ky9xV4OA7BqxJZ7s+Ilw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=JJB+zpvg33Is5t+iVLLZsvNHr1WK4sNhpdBNE8wTZLFMJpy2M6wrtruiw9/c1Zrk8U4lw+WQixui3SzSk2ABMPolKsU3hFDyVG7bsztwtU99J086emY7/U6Qde6oihBwzbF1tyO7RchDdh6mRj1YMTrGwGRhoJDSdstC8vuLK7TL1ECOfi67X4NKWkhqM1BB1tANE1AW/xQwPuLdN/fAOg6xQQ8j5Ucx2rJWt3JmnNp9lyZZcZqGBLUNQcaSgW7ywB62FYGWWyIqJmG0r17ZULppdXvq+Zb6lZQhzPe30mQoFcJeZufVgiKg5aOkVgyDGcSq6e5Jk36noWj63hipUw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gAoq5k4IBmF04J6fsmGSwpLrXgn0LUf2YbnY121YLg5KhpemshZUgB4DhNBtNHP/ZZUpirVAf8dXsQFBDxm+irIfKMsjLDXwt94CBtG/mlxOj5zzt9Qg8Nh5TONBpU4T99s98IU1Iy5C6wOMVvYGs/+lNNhbUMYaQGHCWFgIcveLh8Xs2U+k9+D6/Uk1et7dzLyQKV6RrzfvcEYj6fVUnat2rVUxrylnpqBrrst5pB7IjEIE0mbD1yQe3iJd12ZVoEzxYeoMDQQ1j1XXvJWjZDfKm5ntz9Fj/GtO8zKlcz121O9GtmtZ6k4ynYP6CY0EB0s6Oxywv9oLI5n8a3vP5g==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=elektrobit.com header.i="@elektrobit.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=selector1 header.d=elektrobit.com header.i="@elektrobit.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 20 Apr 2026 21:33:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This commit adds the altp2m_activate_altp2m function on ARM. This makes it
possible to activate altp2m views in common altp2m routines (namely,
altp2m_init_by_id).

This is commit 2/2 of the altp2m_activate_altp2m phase.

Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
---
v6: Introduced this patch.

    While the ARM version of this function is very similar to the x86
    version of this function, I still think it makes sense to have this
    implemented on both architectures instead of using a common
    implementation. A significant portion of the function would need to be
    #ifdef CONFIG_X86/#else CONFIG_ARM gated (like p2m->min_mapped_gfn vs.
    p2m->lowest_mapped_gfn on ARM, for example). This would become even
    more of an issue if other architectures implement altp2m in the future,
    so I think it's best to keep these architecture specific.
---
 xen/arch/arm/altp2m.c             | 26 +++++++++++++++++++++++++-
 xen/arch/arm/include/asm/altp2m.h |  4 ++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/altp2m.c b/xen/arch/arm/altp2m.c
index aa48c17e11a3..aa56b3ca79b5 100644
--- a/xen/arch/arm/altp2m.c
+++ b/xen/arch/arm/altp2m.c
@@ -37,6 +37,31 @@ bool altp2m_view_is_visible(struct domain *d, unsigned int 
idx)
     return d->arch.altp2m_state[array_index_nospec(idx, d->nr_altp2m)] == 
ALTP2M_VISIBLE;
 }
 
+int altp2m_activate_altp2m(struct domain *d, unsigned int idx,
+                           p2m_access_t hvmmem_default_access)
+{
+    struct p2m_domain *hostp2m, *p2m;
+
+    ASSERT(idx < d->nr_altp2m);
+
+    p2m = d->altp2m_p2m[array_index_nospec(idx, d->nr_altp2m)];
+    hostp2m = p2m_get_hostp2m(d);
+
+    p2m_write_lock(p2m);
+
+    p2m->default_access = hvmmem_default_access;
+    p2m->domain = hostp2m->domain;
+
+    p2m->lowest_mapped_gfn = INVALID_GFN;
+    p2m->max_mapped_gfn = _gfn(0);
+
+    d->arch.altp2m_state[idx] = ALTP2M_VISIBLE;
+
+    p2m_write_unlock(p2m);
+
+    return 0;
+}
+
 int altp2m_set_view_visibility(struct domain *d, unsigned int altp2m_idx,
                                uint8_t visible)
 {
@@ -66,7 +91,6 @@ int altp2m_set_view_visibility_locked(struct domain *d, 
unsigned int altp2m_idx,
     return rc;
 }
 
-
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/arm/include/asm/altp2m.h 
b/xen/arch/arm/include/asm/altp2m.h
index f8d0dd799a4a..192240f48c33 100644
--- a/xen/arch/arm/include/asm/altp2m.h
+++ b/xen/arch/arm/include/asm/altp2m.h
@@ -48,6 +48,10 @@ int altp2m_set_view_visibility(struct domain *d, unsigned 
int altp2m_idx,
 int altp2m_set_view_visibility_locked(struct domain *d, unsigned int 
altp2m_idx,
                                       uint8_t visible);
 
+/* Activate an altp2m view */
+int altp2m_activate_altp2m(struct domain *d, unsigned int idx,
+                           p2m_access_t hvmmem_default_access);
+
 #else /* CONFIG_ALTP2M */
 
 static inline bool altp2m_supported(void)
-- 
2.34.1




 


Rackspace

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