From: Petr Beneš <w1be...@gmail.com>

Wrap the p2m_is_altp2m() check with IS_ENABLED(CONFIG_ALTP2M) to allow the
compiler to short-circuit the condition at build time when ALTP2M is disabled.

Signed-off-by: Petr Beneš <w1be...@gmail.com>
---
 xen/arch/x86/include/asm/p2m.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index 4358cc15a2..58b56e575e 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -437,7 +437,7 @@ static inline bool p2m_is_nestedp2m(const struct p2m_domain 
*p2m)
 
 static inline bool p2m_is_altp2m(const struct p2m_domain *p2m)
 {
-    return p2m->p2m_class == p2m_alternate;
+    return IS_ENABLED(CONFIG_ALTP2M) && p2m->p2m_class == p2m_alternate;
 }
 
 #ifdef CONFIG_HVM
-- 
2.34.1


Reply via email to