@@ -91,6 +91,10 @@ acpi:
LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o libxl_psr.o libxl_x86_acpi.o
LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_arm.o libxl_libfdt_compat.o
+LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_acpi.o
+
+libxl_arm_acpi.o: libxl_arm_acpi.c
+ $(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
ifeq ($(CONFIG_NetBSD),y)
LIBXL_OBJS-y += libxl_netbsd.o
@@ -1,6 +1,7 @@
#include "libxl_internal.h"
#include "libxl_arch.h"
#include "libxl_libfdt_compat.h"
+#include "libxl_arm.h"
#include <xc_dom.h>
#include <stdbool.h>
@@ -885,8 +886,24 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
libxl__domain_build_state *state,
struct xc_dom_image *dom)
{
+ int rc;
+
assert(info->type == LIBXL_DOMAIN_TYPE_PV);
- return libxl__prepare_dtb(gc, info, state, dom);
+ rc = libxl__prepare_dtb(gc, info, state, dom);
+ if (rc)
+ return rc;
+
+ if (!libxl_defbool_val(info->arch_arm.acpi)) {
+ LOG(DEBUG, "Generating ACPI tables is disabled by user.");
+ return 0;
+ }
+
+ if (strcmp(dom->guest_type, "xen-3.0-aarch64")) {
+ LOG(ERROR, "Can not enable xl option 'acpi' for %s", dom->guest_type);
+ return ERROR_FAIL;
+ }
+
+ return libxl__prepare_acpi(gc, info, state, dom);
}
static void finalise_one_memory_node(libxl__gc *gc, void *fdt,
new file mode 100644
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2016 Linaro Ltd.
+ *
+ * Author: Shannon Zhao <shannon.zhao@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "libxl_internal.h"
+#include "libxl_arch.h"
+
+#include <xc_dom.h>
+
+_hidden
+int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
+ libxl__domain_build_state *state,
+ struct xc_dom_image *dom);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
new file mode 100644
@@ -0,0 +1,56 @@
+/*
+ * ARM DomU ACPI generation
+ *
+ * Copyright (C) 2016 Linaro Ltd.
+ *
+ * Author: Shannon Zhao <shannon.zhao@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; version 2.1 only. with the special
+ * exception on linking described in file LICENSE.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ */
+
+#include "libxl_arm.h"
+
+#include <stdint.h>
+
+typedef uint8_t u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+
+#include <acpi/acconfig.h>
+#include <acpi/actbl.h>
+
+int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
+ libxl__domain_build_state *state,
+ struct xc_dom_image *dom)
+{
+ const libxl_version_info *vers;
+
+ vers = libxl_get_version_info(CTX);
+ if (vers == NULL)
+ return ERROR_FAIL;
+
+ LOG(DEBUG, "constructing ACPI tables for Xen version %d.%d guest",
+ vers->xen_version_major, vers->xen_version_minor);
+
+ dom->acpitable_blob = NULL;
+ dom->acpitable_size = 0;
+
+ return 0;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */