@@ -96,6 +96,7 @@ void __init builder_init(struct boot_info *bi)
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 |= BUILD_CAPS_CONTROL;
bi->nr_domains = 1;
}
}
@@ -158,6 +158,18 @@ static int __init process_domain_node(
bd->max_vcpus = val;
printk(" max vcpus: %d\n", bd->max_vcpus);
}
+ else if ( strncmp(prop_name, "capabilities", name_len) == 0 )
+ {
+ if ( fdt_prop_as_u32(prop, &bd->capabilities) != 0 )
+ {
+ printk(" failed processing domain id for domain %s\n", name);
+ return -EINVAL;
+ }
+ printk(" caps: ");
+ if ( bd->capabilities & BUILD_CAPS_CONTROL )
+ printk("c");
+ printk("\n");
+ }
}
fdt_for_each_subnode(node, fdt, dom_node)
@@ -15,6 +15,10 @@ struct boot_domain {
domid_t domid;
+#define BUILD_CAPS_NONE (0)
+#define BUILD_CAPS_CONTROL (1 << 0)
+ uint32_t capabilities;
+
/* On | Off */
#define BUILD_MODE_PARAVIRT (1 << 0) /* PV | PVH/HVM */
#define BUILD_MODE_ENABLE_DM (1 << 1) /* HVM | PVH */
@@ -1002,6 +1002,7 @@ static size_t __init domain_cmdline_size(
static struct domain *__init create_dom0(struct boot_info *bi)
{
char *cmdline = NULL;
+ unsigned int create_flags = 0;
struct xen_domctl_createdomain dom0_cfg = {
.flags = IS_ENABLED(CONFIG_TBOOT) ? XEN_DOMCTL_CDF_s3_integrity : 0,
.max_evtchn_port = -1,
@@ -1033,7 +1034,10 @@ static struct domain *__init create_dom0(struct boot_info *bi)
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);
+ if ( bd->capabilities & BUILD_CAPS_CONTROL )
+ create_flags |= CDF_privileged;
+ d = domain_create(bd->domid, &dom0_cfg,
+ pv_shim ? 0 : create_flags);
if ( IS_ERR(d) )
panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d));