All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/shadow: Delete the none.c dummy file
@ 2026-02-09 10:41 Alejandro Vallejo
  2026-02-09 14:36 ` Jan Beulich
  2026-02-09 14:42 ` Roger Pau Monné
  0 siblings, 2 replies; 13+ messages in thread
From: Alejandro Vallejo @ 2026-02-09 10:41 UTC (permalink / raw)
  To: xen-devel
  Cc: Alejandro Vallejo, Jan Beulich, Andrew Cooper,
	Roger Pau Monné, Tim Deegan

It only has 2 callers, both of which can be conditionally removed.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
---
I'd be ok conditionalising the else branch on...

    IS_ENABLED(CONFIG_SHADOW_PAGING )|| IS_ENABLED(CONFIG_LOG_DIRTY)

logdirty patch: https://lore.kernel.org/xen-devel/20260209103118.5885-1-alejandro.garciavallejo@amd.com

... to avoid the danger of stale pointers, with required changes elsewhere so
none.c is only compiled out in that case.

I'm not sure how much it matters seeing how they are all unreachable.
---
 xen/arch/x86/mm/Makefile        |  2 +-
 xen/arch/x86/mm/paging.c        |  4 +-
 xen/arch/x86/mm/shadow/Makefile |  4 --
 xen/arch/x86/mm/shadow/none.c   | 77 ---------------------------------
 4 files changed, 3 insertions(+), 84 deletions(-)
 delete mode 100644 xen/arch/x86/mm/shadow/none.c

diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 960f6e8409..066c4caff3 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -1,4 +1,4 @@
-obj-y += shadow/
+obj-$(CONFIG_SHADOW_PAGING) += shadow/
 obj-$(CONFIG_HVM) += hap/
 
 obj-$(CONFIG_ALTP2M) += altp2m.o
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 2396f81ad5..5f70254cec 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -634,7 +634,7 @@ int paging_domain_init(struct domain *d)
      */
     if ( hap_enabled(d) )
         hap_domain_init(d);
-    else
+    else if ( IS_ENABLED(CONFIG_SHADOW_PAGING) )
         rc = shadow_domain_init(d);
 
     return rc;
@@ -645,7 +645,7 @@ void paging_vcpu_init(struct vcpu *v)
 {
     if ( hap_enabled(v->domain) )
         hap_vcpu_init(v);
-    else
+    else if ( IS_ENABLED(CONFIG_SHADOW_PAGING) )
         shadow_vcpu_init(v);
 }
 
diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 3012fa127d..119989ca4d 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -1,7 +1,3 @@
-ifeq ($(CONFIG_SHADOW_PAGING),y)
 obj-y += common.o set.o
 obj-$(CONFIG_HVM) += hvm.o guest_2.o guest_3.o guest_4.o oos.o
 obj-$(CONFIG_PV) += pv.o guest_4.o
-else
-obj-y += none.o
-endif
diff --git a/xen/arch/x86/mm/shadow/none.c b/xen/arch/x86/mm/shadow/none.c
deleted file mode 100644
index 2a4005a795..0000000000
--- a/xen/arch/x86/mm/shadow/none.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <xen/mm.h>
-#include <asm/shadow.h>
-
-static int cf_check _toggle_log_dirty(struct domain *d)
-{
-    ASSERT(is_pv_domain(d));
-    return -EOPNOTSUPP;
-}
-
-static void cf_check _clean_dirty_bitmap(struct domain *d)
-{
-    ASSERT(is_pv_domain(d));
-}
-
-static void cf_check _update_paging_modes(struct vcpu *v)
-{
-    ASSERT_UNREACHABLE();
-}
-
-int shadow_domain_init(struct domain *d)
-{
-    /* For HVM set up pointers for safety, then fail. */
-    static const struct log_dirty_ops sh_none_ops = {
-        .enable  = _toggle_log_dirty,
-        .disable = _toggle_log_dirty,
-        .clean   = _clean_dirty_bitmap,
-    };
-
-    paging_log_dirty_init(d, &sh_none_ops);
-
-    d->arch.paging.update_paging_modes = _update_paging_modes;
-
-    return is_hvm_domain(d) ? -EOPNOTSUPP : 0;
-}
-
-static int cf_check _page_fault(
-    struct vcpu *v, unsigned long va, struct cpu_user_regs *regs)
-{
-    ASSERT_UNREACHABLE();
-    return 0;
-}
-
-static bool cf_check _invlpg(struct vcpu *v, unsigned long linear)
-{
-    ASSERT_UNREACHABLE();
-    return true;
-}
-
-#ifdef CONFIG_HVM
-static unsigned long cf_check _gva_to_gfn(
-    struct vcpu *v, struct p2m_domain *p2m, unsigned long va, uint32_t *pfec)
-{
-    ASSERT_UNREACHABLE();
-    return gfn_x(INVALID_GFN);
-}
-#endif
-
-static pagetable_t cf_check _update_cr3(struct vcpu *v, bool noflush)
-{
-    ASSERT_UNREACHABLE();
-    return pagetable_null();
-}
-
-static const struct paging_mode sh_paging_none = {
-    .page_fault                    = _page_fault,
-    .invlpg                        = _invlpg,
-#ifdef CONFIG_HVM
-    .gva_to_gfn                    = _gva_to_gfn,
-#endif
-    .update_cr3                    = _update_cr3,
-};
-
-void shadow_vcpu_init(struct vcpu *v)
-{
-    ASSERT(is_pv_vcpu(v));
-    v->arch.paging.mode = &sh_paging_none;
-}

base-commit: 1ee8b11c1106dca6b8fe0d54c0e79146bb6545f0
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-02-09 17:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 10:41 [PATCH] x86/shadow: Delete the none.c dummy file Alejandro Vallejo
2026-02-09 14:36 ` Jan Beulich
2026-02-09 15:06   ` Alejandro Vallejo
2026-02-09 15:14     ` Jan Beulich
2026-02-09 14:42 ` Roger Pau Monné
2026-02-09 15:35   ` Alejandro Vallejo
2026-02-09 15:55     ` Roger Pau Monné
2026-02-09 16:04       ` Jan Beulich
2026-02-09 16:17         ` Roger Pau Monné
2026-02-09 16:20       ` Alejandro Vallejo
2026-02-09 16:31         ` Jan Beulich
2026-02-09 16:35         ` Roger Pau Monné
2026-02-09 17:01         ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.