Skip to contentSkip to conversation

x86/boot: Improve paging mode diagnostics in create_dom0()

PATCH In review Andrew Cooper 2 participants 2 messages Jun 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/boot: Improve paging mode diagnostics in create_dom0()

I was presented with this:

(XEN) NX (Execute Disable) protection active
(XEN) d0 has maximum 416 PIRQs
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Error creating d0: -95
(XEN) ****************************************

which is less than helpful. It turns out to be the -EOPNOTSUPP from shadow_domain_init().

The real bug here is create_dom0() unconditionally assuming the presence of SHADOW_PAGING. Rework it to panic() rather than choosing a dom0_cfg which is guaranteed to fail. This results in:

(XEN) NX (Execute Disable) protection active (XEN)
(XEN) **************************************** (XEN) Panic on CPU 0:
(XEN) Neither HAP nor Shadow available for PVH domain (XEN) ****************************************

which is rather more helpful.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/setup.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
xen/arch/x86/setup.c +6 -3
index f32efa7c6045..24e4f5ac7f5d 100644
@@ -1033,9 +1033,12 @@ static struct domain *__init create_dom0(struct boot_info *bi)
 
     if ( opt_dom0_pvh )
     {
-        dom0_cfg.flags |= (XEN_DOMCTL_CDF_hvm |
-                           ((hvm_hap_supported() && !opt_dom0_shadow) ?
-                            XEN_DOMCTL_CDF_hap : 0));
+        dom0_cfg.flags |= XEN_DOMCTL_CDF_hvm;
+
+        if ( hvm_hap_supported() && !opt_dom0_shadow )
+            dom0_cfg.flags |= XEN_DOMCTL_CDF_hap;
+        else if ( !IS_ENABLED(CONFIG_SHADOW_PAGING) )
+            panic("Neither HAP nor Shadow available for PVH domain\n");
 
         dom0_cfg.arch.emulation_flags |=
             XEN_X86_EMU_LAPIC | XEN_X86_EMU_IOAPIC | XEN_X86_EMU_VPCI;

base-commit: cc7394164633e75fb61d52565f75271e0b7f1236

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Andrew Cooper

I was presented with this:

(XEN) NX (Execute Disable) protection active
(XEN) d0 has maximum 416 PIRQs
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Error creating d0: -95
(XEN) ****************************************

which is less than helpful. It turns out to be the -EOPNOTSUPP from shadow_domain_init().

The real bug here is create_dom0() unconditionally assuming the presence of SHADOW_PAGING. Rework it to panic() rather than choosing a dom0_cfg which is guaranteed to fail. This results in:

(XEN) NX (Execute Disable) protection active (XEN)
(XEN) **************************************** (XEN) Panic on CPU 0:
(XEN) Neither HAP nor Shadow available for PVH domain (XEN) ****************************************

Quoted 3 lines

which is rather more helpful.