On 09.02.2026 17:11, Roger Pau Monné wrote:
> On Mon, Feb 09, 2026 at 05:02:26PM +0100, Alejandro Vallejo wrote:
>> On Mon Feb 9, 2026 at 3:40 PM CET, Roger Pau Monne wrote:
>>> If shadow paging has been compiled out short circuit the creation of HVM
>>> guests that attempt to use shadow paging at arch_sanitise_domain_config().
>>> There's no need to further build the domain when creation is doomed to fail
>>> later on.
>>>
>>> Signed-off-by: Roger Pau Monné <[email protected]>
>>> ---
>>>  xen/arch/x86/domain.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
>>> index 8b2f33f1a06c..8eb1509782ef 100644
>>> --- a/xen/arch/x86/domain.c
>>> +++ b/xen/arch/x86/domain.c
>>> @@ -627,6 +627,12 @@ int arch_sanitise_domain_config(struct 
>>> xen_domctl_createdomain *config)
>>>          return -EINVAL;
>>>      }
>>>  
>>> +    if ( hvm && !hap && !IS_ENABLED(CONFIG_SHADOW_PAGING) )
>>> +    {
>>> +        dprintk(XENLOG_INFO, "Shadow paging requested but not 
>>> available\n");
>>
>> nit: s/requested/required/, maybe?
> 
> The wording matches the rest of the messages in
> arch_sanitise_domain_config().  I'm not saying that makes it correct,
> but if we word this differently we should also change the others
> IMO.

+1

>> Also, with this in place can't we get rid of the panic in create_dom0() that
>> checks an identical condition?
> 
> Hm, I would possibly leave that one, as I think it's clearer for the
> dom0 case.  Otherwise someone using a build without HAP or shadow and
> attempting to boot in PVH mode will get a message saying: "Shadow
> paging requested but not available", which is IMO less clear than
> getting a "Neither HAP nor Shadow available for PVH domain" error
> message.
> 
> Just my thinking, both checks achieve the same result, but the error
> message in the create_dom0() instance is more helpful in the context
> of dom0 creation.

+1

Jan

Reply via email to