[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v6 12/12] x86/hyperlaunch: add capabilities to boot domain
From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx> Introduce the ability to assign capabilities to a domain via its definition in device tree. The capability property is a bitfield in both the device tree and `struct boot_domain`. Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx> Signed-off-by: Alejandro Vallejo <agarciav@xxxxxxx> Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx> --- v6: * Reworded the commit message to reflect the fact that the DOMAIN_CAPS_HARDWARE is also done here. * Conditionalise setting CDF_iommu to DOMAIN_CAPS_HARDWARE being set. --- xen/arch/x86/include/asm/boot-domain.h | 3 +++ xen/arch/x86/setup.c | 7 +++++-- xen/common/domain-builder/fdt.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/asm/boot-domain.h index 969c02a6ea..cb5351241a 100644 --- a/xen/arch/x86/include/asm/boot-domain.h +++ b/xen/arch/x86/include/asm/boot-domain.h @@ -13,6 +13,9 @@ struct boot_domain { domid_t domid; + /* Bitmap. See DOMAIN_CAPS_MASK for a list */ + uint32_t capabilities; + /* On | Off */ #define BUILD_MODE_PARAVIRT (1 << 0) /* PV | PVH/HVM */ #define BUILD_MODE_ENABLE_DM (1 << 1) /* HVM | PVH */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 4a3c41ad71..6a1e874b2e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -62,6 +62,7 @@ #include <xsm/xsm.h> +#include <public/bootfdt.h> #include <public/version.h> #ifdef CONFIG_COMPAT #include <compat/platform.h> @@ -1044,14 +1045,15 @@ static struct domain *__init create_dom0(struct boot_info *bi) XEN_X86_EMU_LAPIC | XEN_X86_EMU_IOAPIC | XEN_X86_EMU_VPCI; } - if ( iommu_enabled ) + if ( iommu_enabled && (bd->capabilities & DOMAIN_CAPS_HARDWARE) ) dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu; if ( bd->domid == DOMID_INVALID ) /* Create initial domain. Not d0 for pvshim. */ bd->domid = get_initial_domain_id(); d = domain_create(bd->domid, &dom0_cfg, - pv_shim ? 0 : CDF_privileged | CDF_hardware); + ((bd->capabilities & DOMAIN_CAPS_CONTROL) ? CDF_privileged : 0) | + ((bd->capabilities & DOMAIN_CAPS_HARDWARE) ? CDF_hardware : 0)); if ( IS_ERR(d) ) panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d)); @@ -1314,6 +1316,7 @@ void asmlinkage __init noreturn __start_xen(void) i = first_boot_module_index(bi, BOOTMOD_UNKNOWN); bi->mods[i].type = BOOTMOD_KERNEL; bi->domains[0].kernel = &bi->mods[i]; + bi->domains[0].capabilities = pv_shim ? 0 : DOMAIN_CAPS_MASK; bi->nr_domains = 1; bi->hyperlaunch_enabled = false; } diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fdt.c index 02cfe8085d..232621ae46 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -7,6 +7,7 @@ #include <xen/init.h> #include <xen/lib.h> #include <xen/libfdt/libfdt.h> +#include <public/bootfdt.h> #include <xen/sizes.h> #include <asm/bootinfo.h> @@ -313,6 +314,28 @@ static int __init fdt_process_domain_node( bd->max_vcpus = val; printk(XENLOG_INFO " cpus: %d\n", bd->max_vcpus); } + else if ( !strncmp(prop_name, "capabilities", name_len) ) + { + if ( (rc = fdt_prop_as_u32(prop, &bd->capabilities)) ) + { + printk(XENLOG_ERR + " bad \"capabilities\" on domain %s\n", name); + return rc; + } + + if ( bd->capabilities & ~DOMAIN_CAPS_MASK ) + { + printk(XENLOG_WARNING " unknown capabilities: %#x\n", + bd->capabilities & ~DOMAIN_CAPS_MASK); + + bd->capabilities &= DOMAIN_CAPS_MASK; + } + + printk(XENLOG_INFO " caps: %s%s%s\n", + (bd->capabilities & DOMAIN_CAPS_CONTROL) ? "c" : "", + (bd->capabilities & DOMAIN_CAPS_HARDWARE) ? "h" : "", + (bd->capabilities & DOMAIN_CAPS_XENSTORE) ? "x" : ""); + } } fdt_for_each_subnode(node, fdt, dom_node) -- 2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |