[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v6 41/43] altp2m: Move altp2m_flush to common code
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
- Date: Mon, 20 Apr 2026 17:32:04 -0400
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 40.93.4.4) 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=v5iBIWyVgGmcouUlKkYdR5ODo5vGhPP2Z4ch8z9yjL8=; b=CRC4Ke7WwldP8SrDJndTQiLvs4Rsh+ie7rIrkAg4HhKvzaHhAoaH2L5METN7dyVI2Mvcdgb024CI+K4LXk6Oh9DQmBjspjv8OY92dxBw530jr0DJHhnJCuAG+hsUaFgECWQzlbeBqdoQpuzZFCtwdUXBWZXIo6Sh8cuYBCuVEIBA1FAKkvjwivo2hMmxw3gk3/aw718LK+FPGce8soQqt5rET96s0/HLUdWi7jVP684YmhmGhzP0NIW1OgrgNeKiymzjLNypzXujA0cbNsWnC7iIVaaaihzCWordnR9JxYyLraScOGhswqP8MtcXRA5LkyV4EWi4uf28DWLV86a6ug==
- 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=v5iBIWyVgGmcouUlKkYdR5ODo5vGhPP2Z4ch8z9yjL8=; b=xCdEeAWMjqr9rSRO0U285nwG4100hDKe2LZE3G1Wp90klxs8xiRxjJ89ddqyd5MLqr8FoC7RBrZvuKoss9H79MxiRu2MQX7InsctihJNSDNm33PR23DjECIT9VRlzqHInlk9zAMPUBktjuz1ko5Sql2zGfeX/m+lzaMjIKY+77zdiH+sW+D5odtiLD67m1fWeI0IdXwecObL70X/u+L6UddVtVcBCmLp9hmZhUG6Oh9ANNPSuJx3+wO5eyI5uFLJEG6HhKWhj924pmrdm2LjbkVki2lg3wNolJrCIo9fMc6D0jgLXR/6nsLUSmyQrBm3rHQ6lXvfpF3vrl2/ifUWnw==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=aGA81ZM5jZpEAtKeiiJKpcD0wQSrPx1rZ3a5gI9hqA30PGO+3UqvUe9PyTyBYQKrXFJVVsq/86lKghLfPiPbRaPYgLtbihCvE+LcPUex7QI5wDQ0/Tpk633OEWuhucDFZgVMkPz6udlUL55E7qO546q0Wg6x1j6KurXqhF7XlvJORQOTPypgx1ehTSRQtv1vSthlRydpu6QmKtq8LZG9lr6EebsrIpXsIgXl6G7w4+gj8j4MuwxbdYsZ3fCkwtgNZ4MGOYDzSsdG8Ly7i/D6tA2Wui4VfVxfBnDRFpIqEEmQ1bvQylERpHEAS8oap3MXnwQtC3/naY3vLP5EQnu3NA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T2ooh8zc6xOiI/OPfEqqNSvE8jQJm31OJVCdVS1Vbx7Ek6cKs1lu4ok8N9nWWp4op2ghtb8OKvDvHHHfBZ/pVGxyqqNbYjYh9/YBlgZtzvXOPVoIfxhE1Vo95/DVbdyu6ihyeBzLTVhOnYLXTt6paJAP2ZAMCa5mKTWOW9EDZhX99qt6N+phcBTSTd9Tqd/nT8CO8BGjVGqswczOC8eI0VkkFSekaBSvN2gFtmphsCsKlPMNBBSY8i057kDo/QWtrdLyj57M7V8YnYh9rHotU8XOkM7fW01I2yUYF+dLW9fROxYHJaXcdHcF00iJFcBrvWMQuhyIzD4yWYrzs827eQ==
- 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>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "Michal Orzel" <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>
- Delivery-date: Mon, 20 Apr 2026 21:34:03 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
This commit moves the altp2m_flush function to common code. This makes it
possible to call in the common implementation of HVMOP_set_domain_state.
This commit contains only code movement, and no change in functionality is
intended.
This is commit 1/2 of the altp2m_flush phase.
Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
---
v6: Introduced this patch.
---
xen/arch/x86/include/asm/altp2m.h | 2 --
xen/arch/x86/mm/altp2m.c | 16 ----------------
xen/common/altp2m.c | 18 ++++++++++++++++++
xen/include/xen/altp2m.h | 5 +++++
4 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/xen/arch/x86/include/asm/altp2m.h
b/xen/arch/x86/include/asm/altp2m.h
index 02b5e1a11220..d11f20f1e790 100644
--- a/xen/arch/x86/include/asm/altp2m.h
+++ b/xen/arch/x86/include/asm/altp2m.h
@@ -82,8 +82,6 @@ static inline bool altp2m_view_is_visible(struct domain *d,
unsigned int idx)
/* Switch alternate p2m for a single vcpu */
bool altp2m_switch_vcpu_by_id(struct vcpu *v, unsigned int idx);
-/* Flush all the alternate p2m's for a domain */
-void altp2m_flush(struct domain *d);
/* Find an available alternate p2m and make it valid */
int altp2m_init_next_available(struct domain *d, uint16_t *idx,
diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c
index 18f8a71f1682..de91d1e67709 100644
--- a/xen/arch/x86/mm/altp2m.c
+++ b/xen/arch/x86/mm/altp2m.c
@@ -253,22 +253,6 @@ void altp2m_reset_altp2m(struct domain *d, unsigned int
idx,
p2m_unlock(p2m);
}
-void altp2m_flush(struct domain *d)
-{
- unsigned int i;
-
- altp2m_lock(d);
-
- for ( i = 0; i < d->nr_altp2m; i++ )
- {
- altp2m_reset_altp2m(d, i, ALTP2M_DEACTIVATE);
- d->arch.altp2m_eptp[i] = mfn_x(INVALID_MFN);
- d->arch.altp2m_visible_eptp[i] = mfn_x(INVALID_MFN);
- }
-
- altp2m_unlock(d);
-}
-
int altp2m_activate_altp2m(struct domain *d, unsigned int idx,
p2m_access_t hvmmem_default_access)
{
diff --git a/xen/common/altp2m.c b/xen/common/altp2m.c
index 929449b1b03c..0dd3ecf226fd 100644
--- a/xen/common/altp2m.c
+++ b/xen/common/altp2m.c
@@ -123,6 +123,24 @@ int altp2m_init_by_id(struct domain *d, unsigned int idx)
return rc;
}
+#ifdef CONFIG_X86
+void altp2m_flush(struct domain *d)
+{
+ unsigned int i;
+
+ altp2m_lock(d);
+
+ for ( i = 0; i < d->nr_altp2m; i++ )
+ {
+ altp2m_reset_altp2m(d, i, ALTP2M_DEACTIVATE);
+ d->arch.altp2m_eptp[i] = mfn_x(INVALID_MFN);
+ d->arch.altp2m_visible_eptp[i] = mfn_x(INVALID_MFN);
+ }
+
+ altp2m_unlock(d);
+}
+#endif
+
/*
* altp2m operations are envisioned as being used in several different
* modes:
diff --git a/xen/include/xen/altp2m.h b/xen/include/xen/altp2m.h
index 8fc16346d95b..fa2c11f5432e 100644
--- a/xen/include/xen/altp2m.h
+++ b/xen/include/xen/altp2m.h
@@ -74,6 +74,11 @@ int do_altp2m_op(XEN_GUEST_HANDLE_PARAM(void) arg);
/* Make a specific alternate p2m valid */
int altp2m_init_by_id(struct domain *d, unsigned int idx);
+#ifdef CONFIG_X86
+/* Flush all the alternate p2m's for a domain */
+void altp2m_flush(struct domain *d);
+#endif
+
#else /* CONFIG_ALTP2M */
static inline bool altp2m_active(const struct domain *d)
--
2.34.1
|