return 0;
}
+static int make_reserved_nodes(libxl__gc *gc, void *fdt,
+ libxl_domain_config *d_config)
+{
+ int res, i;
+ const char *name;
+
+ if (d_config->num_sshms == 0)
+ return 0;
+
+ res = fdt_begin_node(fdt, "reserved-memory");
+ if (res) return res;
+
+ res = fdt_property_cell(fdt, "#address-cells", GUEST_ROOT_ADDRESS_CELLS);
+ if (res) return res;
+
+ res = fdt_property_cell(fdt, "#size-cells", GUEST_ROOT_SIZE_CELLS);
+ if (res) return res;
+
+ res = fdt_property(fdt, "ranges", NULL, 0);
+ if (res) return res;
+
+ for (i = 0; i < d_config->num_sshms; i++) {
+ uint64_t start = d_config->sshms[i].begin;
+
+ if (d_config->sshms[i].offset != LIBXL_SSHM_RANGE_UNKNOWN)
+ start += d_config->sshms[i].offset;
+
+ name = GCSPRINTF("xen-shmem@%"PRIx64, start);
+
+ res = fdt_begin_node(fdt, name);
+ if (res) return res;
+
+ res = fdt_property_regs(gc, fdt, GUEST_ROOT_ADDRESS_CELLS,
+ GUEST_ROOT_SIZE_CELLS, 1, start,
+ d_config->sshms[i].size);
+ if (res) return res;
+
+ res = fdt_property_compat(gc, fdt, 1, "xen,shared-memory-v1");
+ if (res) return res;
+
+ res = fdt_property_string(fdt, "xen,id", d_config->sshms[i].id);
+ if (res) return res;
+
+ if (d_config->sshms[i].role == LIBXL_SSHM_ROLE_BORROWER) {
+ res = fdt_property_u64(fdt, "xen,offset",
+ d_config->sshms[i].offset);
+ if (res) return res;
+ }
+
+ res = fdt_end_node(fdt);
+ if (res) return res;
+ }
+
+ res = fdt_end_node(fdt);
+ if (res) return res;
+
+ return 0;
+}
+
static int make_gicv2_node(libxl__gc *gc, void *fdt,
uint64_t gicd_base, uint64_t gicd_size,
uint64_t gicc_base, uint64_t gicc_size)
#define FDT_MAX_SIZE (1<<20)
-static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_build_info *info,
+static int libxl__prepare_dtb(libxl__gc *gc, libxl_domain_config *d_config,
libxl__domain_build_state *state,
struct xc_dom_image *dom)
{
+ libxl_domain_build_info *info = &d_config->b_info;
void *fdt = NULL;
void *pfdt = NULL;
int rc, res;
FDT( make_psci_node(gc, fdt) );
FDT( make_memory_nodes(gc, fdt, dom) );
+ FDT( make_reserved_nodes(gc, fdt, d_config) );
switch (info->arch_arm.gic_version) {
case LIBXL_GIC_VERSION_V2:
}
int libxl__arch_domain_init_hw_description(libxl__gc *gc,
- libxl_domain_build_info *info,
+ libxl_domain_config *d_config,
libxl__domain_build_state *state,
struct xc_dom_image *dom)
{
int rc;
uint64_t val;
+ libxl_domain_build_info *info = &d_config->b_info;
if (info->type != LIBXL_DOMAIN_TYPE_PVH) {
LOG(ERROR, "Unsupported Arm guest type %s",
if (rc)
return rc;
- rc = libxl__prepare_dtb(gc, info, state, dom);
+ rc = libxl__prepare_dtb(gc, d_config, state, dom);
if (rc) goto out;
if (!libxl_defbool_val(info->acpi)) {