|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/mm: correct PG_log_dirty definition
commit 2ae8a68df21e70cc0cde65d661c85b98f1a462f6
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Aug 12 09:57:40 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Aug 12 11:40:28 2025 +0200
x86/mm: correct PG_log_dirty definition
While it is correct that in shim-exclusive mode log-dirty handling is
all unreachable code, the present conditional still isn't correct: In a
HVM=n and SHADOW_PAGING=n configuration log-dirty code also is all
unreachable (and hence violating Misra rule 2.1).
As we're aiming at moving away from special casing PV_SHIM_EXCLUSIVE=y,
don't retain that part of the conditional.
Because of hypercall-defs.c we need to carry out the dependency by
introducing a new auxiliary PAGING control.
Since compiling out mm/paging.c altogether would entail further changes,
merely conditionalize the one function in there (paging_enable()) which
would otherwise remain unreachable (Misra rule 2.1 again) when PAGING=n.
Fixes: 23d4e0d17b76 ("x86/shim: fix build with PV_SHIM_EXCLUSIVE and
SHADOW_PAGING")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/Kconfig | 3 +++
xen/arch/x86/domctl.c | 4 ++++
xen/arch/x86/include/asm/paging.h | 2 +-
xen/arch/x86/mm/paging.c | 2 ++
xen/include/hypercall-defs.c | 6 ++++--
5 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index a45ce106e2..3f0f3a0f3a 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -162,6 +162,9 @@ config SHADOW_PAGING
If unsure, say Y.
+config PAGING
+ def_bool HVM || SHADOW_PAGING
+
config BIGMEM
bool "big memory support"
default n
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 3e94af51a7..f07cae6a70 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -213,11 +213,15 @@ long arch_do_domctl(
{
case XEN_DOMCTL_shadow_op:
+#ifdef CONFIG_PAGING
ret = paging_domctl(d, &domctl->u.shadow_op, u_domctl, 0);
if ( ret == -ERESTART )
return hypercall_create_continuation(
__HYPERVISOR_paging_domctl_cont, "h", u_domctl);
copyback = true;
+#else
+ ret = -EOPNOTSUPP;
+#endif
break;
case XEN_DOMCTL_ioport_permission:
diff --git a/xen/arch/x86/include/asm/paging.h
b/xen/arch/x86/include/asm/paging.h
index 94c31a268e..768b077ebd 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -55,7 +55,7 @@
#define PG_translate 0
#define PG_external 0
#endif
-#if defined(CONFIG_HVM) || !defined(CONFIG_PV_SHIM_EXCLUSIVE)
+#ifdef CONFIG_PAGING
/* Enable log dirty mode */
#define PG_log_dirty (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift)
#else
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 165e0f88c2..3aafb0990b 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -864,6 +864,7 @@ void paging_final_teardown(struct domain *d)
p2m_final_teardown(d);
}
+#ifdef CONFIG_PAGING
/* Enable an arbitrary paging-assistance mode. Call once at domain
* creation. */
int paging_enable(struct domain *d, u32 mode)
@@ -889,6 +890,7 @@ int paging_enable(struct domain *d, u32 mode)
else
return shadow_enable(d, mode);
}
+#endif
#ifdef CONFIG_HVM
/* Called from the guest to indicate that a process is being torn down
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index c1081d87a2..8370b4b289 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -197,9 +197,11 @@ dm_op(domid_t domid, unsigned int nr_bufs, xen_dm_op_buf_t
*bufs)
#ifdef CONFIG_SYSCTL
sysctl(xen_sysctl_t *u_sysctl)
#endif
+#if defined(CONFIG_X86) && defined(CONFIG_PAGING)
+paging_domctl_cont(xen_domctl_t *u_domctl)
+#endif
#ifndef CONFIG_PV_SHIM_EXCLUSIVE
domctl(xen_domctl_t *u_domctl)
-paging_domctl_cont(xen_domctl_t *u_domctl)
platform_op(xen_platform_op_t *u_xenpf_op)
#endif
#ifdef CONFIG_HVM
@@ -296,7 +298,7 @@ dm_op compat do compat
do do
hypfs_op do do do do do
#endif
mca do do - - -
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#if defined(CONFIG_X86) && defined(CONFIG_PAGING)
paging_domctl_cont do do do do -
#endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |