]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
libxl/arm: Generate static ACPI DSDT table
authorShannon Zhao <shannon.zhao@linaro.org>
Thu, 29 Sep 2016 01:18:49 +0000 (18:18 -0700)
committerWei Liu <wei.liu2@citrix.com>
Fri, 30 Sep 2016 10:47:26 +0000 (11:47 +0100)
It uses static DSDT table like the way x86 uses. Currently the DSDT
table only contains processor device objects and it generates the
maximal objects which so far is 128.

While the GUEST_MAX_VCPUS is defined under __XEN__ or __XEN_TOOLS__, it
needs to add -D__XEN_TOOLS__ to compile mk_dsdt.c.

Also only check iasl for aarch64 in configure since ACPI on ARM32 is not
supported.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Acked-by: Julien Grall <julien.grall@arm.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
[ wei: run autogen.sh and fix compilation on x86 ]
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
tools/configure
tools/configure.ac
tools/libacpi/Makefile
tools/libacpi/mk_dsdt.c
tools/libxl/Makefile
tools/libxl/libxl_arm_acpi.c
xen/arch/arm/domain.c
xen/include/public/arch-arm.h

index 65ad241757b68130a625710a97fc57884007ecb9..e3cc3eab23cc5f840ee5b72fe70fb8d9c500ab23 100755 (executable)
@@ -7476,7 +7476,7 @@ then
     as_fn_error $? "Unable to find xgettext, please install xgettext" "$LINENO" 5
 fi
 case "$host_cpu" in
-i[3456]86|x86_64)
+i[3456]86|x86_64|aarch64)
     # Extract the first word of "iasl", so it can be a program name with args.
 set dummy iasl; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
index 5724ace2dfd0d3c88b5abb6178f9ad48b1e69cdd..794c615e6db900f98c1205736ccc7bb964ae0b26 100644 (file)
@@ -340,7 +340,7 @@ dnl "host" here means the platform on which the hypervisor and tools is
 dnl going to run, not the platform on which we are building (known as
 dnl "build" in gnu speak).
 case "$host_cpu" in
-i[[3456]]86|x86_64)
+i[[3456]]86|x86_64|aarch64)
     AX_PATH_PROG_OR_FAIL([IASL], [iasl])
     ;;
 esac
index 65a540e056d367daf9b964e8316be706ee8cf8c9..db7a3a966901b671cb51989db33c97886a1abdc7 100644 (file)
@@ -18,6 +18,7 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk
 MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
 
 C_SRC-$(GPL) = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c
+C_SRC-$(CONFIG_ARM) = $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
 C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_pvh.c $(C_SRC-y))
 H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h)
 
@@ -38,7 +39,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
        rm -f $(addprefix $(ACPI_BUILD_DIR)/, $*.aml $*.hex)
  
 $(MK_DSDT): mk_dsdt.c
-       $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
+       $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
 
 ifeq ($(GPL),y)
 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl gpl/mk_dsdt_gpl.sh $(MK_DSDT)
@@ -65,6 +66,11 @@ $(ACPI_BUILD_DIR)/dsdt_pvh.asl: dsdt_acpi_info.asl $(MK_DSDT)
        cat dsdt_acpi_info.asl >> $@
        $(MK_DSDT) --debug=$(debug) --maxcpu any --dm-version none >> $@
 
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
+       printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 3, \"Xen\", \"ARM\", 1)\n{" > $@.$(TMP_SUFFIX)
+       $(MK_DSDT) --debug=$(debug) >> $@.$(TMP_SUFFIX)
+       mv -f $@.$(TMP_SUFFIX) $@
+
 $(C_SRC): $(ACPI_BUILD_DIR)/%.c: iasl $(ACPI_BUILD_DIR)/%.asl
        iasl -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $(ACPI_BUILD_DIR)/$*.asl
        sed -e 's/AmlCode/$*/g' $(ACPI_BUILD_DIR)/$*.hex > $@.$(TMP_SUFFIX)
index 8130cbde46c78b70d4e51c254924d8e2d30c9361..4ae68bc9574c4f5fd0d61b2d2f7f8db72bf354a8 100644 (file)
 #include <getopt.h>
 #include <stdlib.h>
 #include <stdbool.h>
+#if defined(__i386__) || defined(__x86_64__)
 #include <xen/hvm/hvm_info_table.h>
+#elif defined(__aarch64__)
+#include <xen/arch-arm.h>
+#endif
 
 static unsigned int indent_level;
 static bool debug = false;
@@ -104,9 +108,15 @@ static struct option options[] = {
 
 int main(int argc, char **argv)
 {
-    unsigned int slot, cpu, max_cpus = HVM_MAX_VCPUS;
+    unsigned int slot, cpu, max_cpus;
     dm_version dm_version = QEMU_XEN_TRADITIONAL;
 
+#if defined(__i386__) || defined(__x86_64__)
+    max_cpus = HVM_MAX_VCPUS;
+#elif defined(__aarch64__)
+    max_cpus = GUEST_MAX_VCPUS;
+#endif
+
     for ( ; ; )
     {
         int opt = getopt_long(argc, argv, "", options, NULL);
@@ -159,6 +169,7 @@ int main(int argc, char **argv)
     /**** Processor start ****/
     push_block("Scope", "\\_SB");
 
+#if defined(__i386__) || defined(__x86_64__)
     /* MADT checksum */
     stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
     push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
@@ -172,6 +183,7 @@ int main(int argc, char **argv)
     pop_block();
     stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
     pop_block();
+#endif
 
     /* Define processor objects and control methods. */
     for ( cpu = 0; cpu < max_cpus; cpu++)
@@ -180,6 +192,11 @@ int main(int argc, char **argv)
 
         stmt("Name", "_HID, \"ACPI0007\"");
 
+        stmt("Name", "_UID, %d", cpu);
+#if defined(__aarch64__)
+        pop_block();
+        continue;
+#endif
         /* Name this processor's MADT LAPIC descriptor. */
         stmt("OperationRegion", 
              "MATR, SystemMemory, Add(\\_SB.MAPA, %d), 8", cpu*8);
@@ -218,6 +235,14 @@ int main(int argc, char **argv)
         pop_block();
     }
 
+#if defined(__aarch64__)
+    pop_block();
+    /**** Processor end ****/
+    pop_block();
+    /**** DSDT DefinitionBlock end ****/
+    return 0;
+#endif
+
     /* Operation Region 'PRST': bitmask of online CPUs. */
     stmt("OperationRegion", "PRST, SystemIO, 0xaf00, 32");
     push_block("Field", "PRST, ByteAcc, NoLock, Preserve");
index d8cd5f97d77476810c31bd462ebd770a504afd57..c4e41179090ab59ca53e0bf58391998af8fef25a 100644 (file)
@@ -91,7 +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
 ifeq ($(CONFIG_ARM_64),y)
-LIBXL_OBJS-y += libxl_arm_acpi.o
+LIBXL_OBJS-y += libxl_arm_acpi.o dsdt_anycpu_arm.o
+dsdt_anycpu_arm.c:
+       $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR)
+
 libxl_arm_acpi.o: libxl_arm_acpi.c
        $(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
 else
index 5bf9396114794ee4447b074577dba0314953aa9a..06dff5f4e397f2fb1d2dfe3d6c2a791d1450c249 100644 (file)
@@ -29,6 +29,11 @@ typedef uint64_t u64;
 #include <acpi/acconfig.h>
 #include <acpi/actbl.h>
 
+_hidden
+extern const unsigned char dsdt_anycpu_arm[];
+_hidden
+extern const int dsdt_anycpu_arm_len;
+
 int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info,
                         struct xc_dom_image *dom)
 {
index c3bf41998d9feacbe30543ed507e40a8246ddb5d..7e43691aafa608c48aa5eefefbe55a9882e6f76e 100644 (file)
@@ -554,6 +554,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
 {
     int rc, count = 0;
 
+    BUILD_BUG_ON(GUEST_MAX_VCPUS < MAX_VIRT_CPUS);
     d->arch.relmem = RELMEM_not_started;
 
     /* Idle domains do not need this setup */
index 498d03d703f4b473a147a58c9ce8dcc4720b92e0..bd974fb13d1a319e9672e8015da91891874805e4 100644 (file)
@@ -435,6 +435,9 @@ typedef uint64_t xen_callback_t;
 #define GUEST_RAM_BANK_BASES   { GUEST_RAM0_BASE, GUEST_RAM1_BASE }
 #define GUEST_RAM_BANK_SIZES   { GUEST_RAM0_SIZE, GUEST_RAM1_SIZE }
 
+/* Current supported guest VCPUs */
+#define GUEST_MAX_VCPUS 128
+
 /* Interrupts */
 #define GUEST_TIMER_VIRT_PPI    27
 #define GUEST_TIMER_PHYS_S_PPI  29