[PATCH 1/2] x86/mm: drop paging_get_mode()

Jan Beulich posted 2 patches 4 months, 2 weeks ago
[PATCH 1/2] x86/mm: drop paging_get_mode()
Posted by Jan Beulich 4 months, 2 weeks ago
The function was introduced without any caller, and never gained any.
Thus it has always been violating Misra rule 2.1 (unreachable code).

Fixes: dd6de3ab9985 ("Implement Nested-on-Nested")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -225,7 +225,6 @@ int paging_enable(struct domain *d, u32
 
 #define paging_get_hostmode(v)		((v)->arch.paging.mode)
 #define paging_get_nestedmode(v)	((v)->arch.paging.nestedmode)
-const struct paging_mode *paging_get_mode(struct vcpu *v);
 void paging_update_nestedmode(struct vcpu *v);
 
 /* Page fault handler
--- unstable.orig/xen/arch/x86/mm/paging.c	2025-08-05 08:59:15.512131147 +0200
+++ unstable/xen/arch/x86/mm/paging.c	2025-08-05 09:00:24.160657794 +0200
@@ -946,14 +946,6 @@ void paging_dump_vcpu_info(struct vcpu *
     }
 }
 
-const struct paging_mode *paging_get_mode(struct vcpu *v)
-{
-    if (!nestedhvm_is_n2(v))
-        return paging_get_hostmode(v);
-
-    return paging_get_nestedmode(v);
-}
-
 #ifdef CONFIG_HVM
 void paging_update_nestedmode(struct vcpu *v)
 {
Re: [PATCH 1/2] x86/mm: drop paging_get_mode()
Posted by Andrew Cooper 4 months, 2 weeks ago
On 05/08/2025 8:58 am, Jan Beulich wrote:
> The function was introduced without any caller, and never gained any.
> Thus it has always been violating Misra rule 2.1 (unreachable code).
>
> Fixes: dd6de3ab9985 ("Implement Nested-on-Nested")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

I'm still not certain how this will shake out in nested-virt, but I'm
reasonably sure it wont end up like this.

~Andrew