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: 23d4e0d17b ("x86/shim: fix build with PV_SHIM_EXCLUSIVE and SHADOW_PAGING")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Jan Beulich committed 2025-08-12 11:40:28 +02:00
1 parent 353e595294
commit 2ae8a68df2
5 files changed
+14 -3

No files matched your search

+3
View File
@@ -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
+4
View File
@@ -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:
+1 -1
View File
@@ -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
+2
View File
@@ -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
+4 -2
View File
@@ -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
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.