[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v6 42/43] arm/altp2m: Add support for altp2m_flush
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
- Date: Mon, 20 Apr 2026 17:32:05 -0400
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 40.93.1.73) 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=LB6UB8nPNPDJ1HE6m3AZNiyAJltYGI2r4/Nm/aLYhC4=; b=jLVs9z2xzofau9m3ZT1VltZOFIby1kP3p2Om2m33fVvJ7Et3XbsY4fEBU1zEj+mVLae7jniBPB1L0NcsW+JZHimHuW0zE8SzTg48ghlrNgktcJqYfH7bNVtpkNYSrYJAGX/O5IN2qvyt9nkalHmGjxFDwpyA3q676940yMqTDKl/HVxTN/MrFqs1914H/kpESX2pwmwHoEK9aFxTlJHNXU/VYURDuFVOBGhAIeCnBW9XJxpd/IjkGZurndb2X9RQ0pMgLiZiKfT/Ps0nZsk127wgHz145Jz1dpFmxFa75UVTJKl9PI5ySARs7y/BZAIMurb5D/adTFYWT0VdCWvVcA==
- 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=LB6UB8nPNPDJ1HE6m3AZNiyAJltYGI2r4/Nm/aLYhC4=; b=oNzsDnwNZ3hW3nYWEEX0wfwbMKvsFIIT4VdBa9saQ8mqfCQjKfsT7YpDPMYyoB7Yx2T4YdEO/GyLChAzEduz8jtOLFcGLg28VrIyq2mSdDKTo2Z8wVKqE68DzoH+8u3EyCLAaozdRrkmQcFS1051DH6kMtWLPl0mIL4c1P/dzszQQRjIFT002OFsyxO85tyw/K74eSdmGMlrfFc5GIGP54u5PK/wsi23MSgFOuXOccPr5vx4ksa+HN2l0jC1FG8IZuWLR270fcjhbRBofRGaqtkpGz/2vogd78UWLvDkW50gGLCS7Tn0i3xLPaIFgQRXj0Du49WhU5+E6MFNvBXBig==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=QfxDAwOGhuwOOhRNDAhFecwO/twv8Ua/nLdlSrHHXpBfyC+ufbBIryVG9I4PyLEpQZhepD91KCFGN+sTKhDu+V46aTvpkTvQhGbM+msGz8kgrhs+QEi8DPEGO5G1jhSG6A7SEGai21wv3cRnW6Fma/sqJ3R4eZTZ4lSUAqyC4RrBXMiDwZq2wOHUDi/2XRKvt2ETbfbcfRCFTNEYOV/EZniYvQxzFgBccDiikWOfWVCemWntV4c5X+oDRZ1BBdeUGGT3WrKcqWvFu0+mAb6dUvH2Da9qjZsyKTuNzdekV/Bcq4ec+LSncVjW+R6Xs2INN5kktFSmpSS1HkDTBu6hdQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Iw4fK9+0SsQEVeh607QdPYVVrAaF/Vlw9FPSAlsfxdaVCAyuArXLk+5WOxFsGtIS6+/cwxS2iE8OEkMZE4VgvdnDt30QNqzzP8eTWH9LUs5iC3CZS8RcdJOBnGPFDICS4rXS2J/lk4aY+vqfvHVm76J5F9xSOOKXT1Gz43sCEYCLFwzn/YBWbu1i6u7Eaix/7al4hW7E3Qa/ys+eET7aD5jw996sLBd9lb79gLKTYNH3rYWVh3IegISIzwLidi2mOufcU7M+rzpC8KoM53xL5Umc1y0LqdQZDKgzxjxjbST6limSfvzV8TaBwgd3HdK+TV/9Tw9uAPuICfjw2IpRHA==
- 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>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Mon, 20 Apr 2026 21:33:57 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
This commit makes the altp2m_flush compatible with ARM by replacing the
x86-specific set view visibility code with the architecture independent
altp2m_set_view_visibility locked.
This is commit 2/2 of the altp2m_flush phase.
Signed-off-by: Rose Spangler <Rose.Spangler@xxxxxxxxxxxxxx>
---
v6: Introduced this patch.
There is a small amount of additional overhead introduced on x86 by
replacing these direct array sets with calls to
altp2m_set_view_visibility_locked. That function also calls
altp2m_is_eptp_valid, which performs additional checks, and also bounds
the array sets with array_index_nospec, which isn't technically
necessary here since we can be certain that the array set will be less
than nr_altp2m. This could be resolved by introducing another
altp2m_set_view_visibility variant (ex.
altp2m_set_view_visibility_unchecked?) which would replace usages of
altp2m_set_view_visibility_locked, but I'm not sure if the overhead is
enough to matter here.
---
xen/common/altp2m.c | 5 +----
xen/include/xen/altp2m.h | 2 --
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/xen/common/altp2m.c b/xen/common/altp2m.c
index 0dd3ecf226fd..d980ebed08ab 100644
--- a/xen/common/altp2m.c
+++ b/xen/common/altp2m.c
@@ -123,7 +123,6 @@ 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;
@@ -133,13 +132,11 @@ void altp2m_flush(struct domain *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_set_view_visibility_locked(d, i, 0);
}
altp2m_unlock(d);
}
-#endif
/*
* altp2m operations are envisioned as being used in several different
diff --git a/xen/include/xen/altp2m.h b/xen/include/xen/altp2m.h
index fa2c11f5432e..5222c24ef418 100644
--- a/xen/include/xen/altp2m.h
+++ b/xen/include/xen/altp2m.h
@@ -74,10 +74,8 @@ 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 */
--
2.34.1
|