xen/x86: Check supported features even for PVH dom0

The supported features ELF notes was tested only if the dom0 was
PV. Factor out a function to check ELF notes and reuse it even
for PVH.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Frediano Ziglio authored and Andrew Cooper committed 2026-04-09 21:04:58 +01:00
1 parent c16b0e5273
commit 44429b6931
4 files changed
+19 -8

No files matched your search

+12
View File
@@ -320,6 +320,18 @@ unsigned long __init dom0_paging_pages(const struct domain *d,
return DIV_ROUND_UP(memkb, 1024) << (20 - PAGE_SHIFT);
}
int __init initdom_check_parms(
const struct domain *d, const struct elf_dom_parms *parms)
{
if ( parms->elf_notes[XEN_ELFNOTE_SUPPORTED_FEATURES].type != XEN_ENT_NONE &&
is_hardware_domain(d) && !test_bit(XENFEAT_dom0, parms->f_supported) )
{
printk("Kernel does not support Dom0 operation\n");
return -EINVAL;
}
return 0;
}
/*
* If allocation isn't specified, reserve 1/16th of available memory for
+3
View File
@@ -692,6 +692,9 @@ static int __init pvh_load_kernel(
return -EINVAL;
}
if ( (rc = initdom_check_parms(d, &parms)) != 0 )
return rc;
/* Copy the OS image and free temporary buffer. */
elf.dest_base = (void *)(parms.virt_kstart - parms.virt_base);
elf.dest_size = parms.virt_kend - parms.virt_kstart;
+2
View File
@@ -8,6 +8,8 @@
extern unsigned int dom0_memflags;
int initdom_check_parms(const struct domain *d,
const struct elf_dom_parms *parms);
unsigned long dom0_compute_nr_pages(struct domain *d,
struct elf_dom_parms *parms,
unsigned long initrd_len);
+2 -8
View File
@@ -494,14 +494,8 @@ static int __init dom0_construct(const struct boot_domain *bd)
return -EINVAL;
}
if ( parms.elf_notes[XEN_ELFNOTE_SUPPORTED_FEATURES].type != XEN_ENT_NONE )
{
if ( !pv_shim && !test_bit(XENFEAT_dom0, parms.f_supported) )
{
printk("Kernel does not support Dom0 operation\n");
return -EINVAL;
}
}
if ( (rc = initdom_check_parms(d, &parms)) != 0 )
return rc;
nr_pages = dom0_compute_nr_pages(d, &parms, initrd_len);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.