|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/x86: Check supported features even for PVH dom0
commit 44429b69319975f25d3762629b40fecdd4e3e554
Author: Frediano Ziglio <freddy77@xxxxxxxxx>
AuthorDate: Wed Apr 8 13:55:14 2026 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Apr 9 21:04:58 2026 +0100
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@xxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/dom0_build.c | 12 ++++++++++++
xen/arch/x86/hvm/dom0_build.c | 3 +++
xen/arch/x86/include/asm/dom0_build.h | 2 ++
xen/arch/x86/pv/dom0_build.c | 10 ++--------
4 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 864dd9e53e..80308ca9af 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -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
diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c
index d69a83b089..aa06cdb2f7 100644
--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -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;
diff --git a/xen/arch/x86/include/asm/dom0_build.h
b/xen/arch/x86/include/asm/dom0_build.h
index ff021c24af..1332f18cc6 100644
--- a/xen/arch/x86/include/asm/dom0_build.h
+++ b/xen/arch/x86/include/asm/dom0_build.h
@@ -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);
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 075a3646c2..12d8ba744a 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -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);
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |