All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, wei.liu2@citrix.com,
	ian.jackson@eu.citrix.com, peter.huangpeng@huawei.com,
	julien.grall@arm.com, shannon.zhao@linaro.org,
	boris.ostrovsky@oracle.com
Subject: [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table
Date: Fri, 2 Sep 2016 10:55:26 +0800	[thread overview]
Message-ID: <1472784939-14404-4-git-send-email-zhaoshenglong@huawei.com> (raw)
In-Reply-To: <1472784939-14404-1-git-send-email-zhaoshenglong@huawei.com>

From: Shannon Zhao <shannon.zhao@linaro.org>

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>
---
Note: this patch needs to be rebased on Boris's v3 patchset for only 
generating dsdt_anycpu_arm.c for ARM64.
---
 tools/configure.ac            |  2 +-
 tools/libacpi/Makefile        | 13 ++++++++++++-
 tools/libacpi/mk_dsdt.c       | 27 ++++++++++++++++++++++++++-
 tools/libxl/Makefile          |  5 ++++-
 tools/libxl/libxl_arm_acpi.c  |  5 +++++
 xen/arch/arm/domain.c         |  1 +
 xen/include/public/arch-arm.h |  3 +++
 7 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/tools/configure.ac b/tools/configure.ac
index 0229d44..b4e0c80 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -335,7 +335,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
diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index d741ac5..b1965cc 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -19,6 +19,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
 
 # Sources to be generated
 C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c  dsdt_anycpu_qemu_xen.c dsdt_pvh.c)
+C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
 H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h)
 
 vpath iasl $(PATH)
@@ -32,7 +33,7 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl iasl
 	cd $(CURDIR)
 
 $(MK_DSDT): mk_dsdt.c
-	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -o $@ mk_dsdt.c
+	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
 
 $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
 	awk 'NR > 1 {print s} {s=$$0}' $< > $@
@@ -62,6 +63,16 @@ $(ACPI_BUILD_DIR)/dsdt_pvh.c: iasl $(ACPI_BUILD_DIR)/dsdt_pvh.asl
 	echo "int dsdt_pvh_len=sizeof(dsdt_pvh);" >>$@
 	rm -f $(ACPI_BUILD_DIR)/$*.aml $(ACPI_BUILD_DIR)/$*.hex
 
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
+	printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 3, \"Xen\", \"ARM\", 1)\n{" > $@
+	$(MK_DSDT) --debug=$(debug) >> $@
+
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c: iasl $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
+	iasl -vs -p $(ACPI_BUILD_DIR)/$* -tc $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
+	sed -e 's/AmlCode/dsdt_anycpu_arm/g' $(ACPI_BUILD_DIR)/$*.hex >$@
+	echo "int dsdt_anycpu_arm_len=sizeof(dsdt_anycpu_arm);" >>$@
+	rm -f $(ACPI_BUILD_DIR)/$*.aml $(ACPI_BUILD_DIR)/$*.hex
+
 iasl:
 	@echo
 	@echo "ACPI ASL compiler (iasl) is needed"
diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 7d76784..a56e0f0 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -17,7 +17,11 @@
 #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,10 +108,16 @@ static struct option options[] = {
 
 int main(int argc, char **argv)
 {
-    unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
+    unsigned int slot, dev, intx, link, cpu, max_cpus;
     dm_version dm_version = QEMU_XEN_TRADITIONAL;
     bool no_dm = 0;
 
+#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);
@@ -161,6 +171,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");
@@ -174,6 +185,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++)
@@ -182,6 +194,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);
@@ -220,6 +237,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");
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index afd93de..15a9046 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -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
diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 810aed8..0851411 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -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,
                         libxl__domain_build_state *state,
                         struct xc_dom_image *dom)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 61fc08e..234d994 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -548,6 +548,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,
 {
     int rc;
 
+    BUILD_BUG_ON(GUEST_MAX_VCPUS < MAX_VIRT_CPUS);
     d->arch.relmem = RELMEM_not_started;
 
     /* Idle domains do not need this setup */
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 4b4c959..1bef2ee 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -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
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-09-02  2:55 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  2:55 [PATCH v5 00/16] Xen ARM DomU ACPI support Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 01/16] tools/libxl: Add an unified configuration option for ACPI Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-02  2:55 ` [PATCH v5 02/16] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
2016-09-02 14:29   ` Wei Liu
2016-09-12 14:41   ` Julien Grall
2016-09-02  2:55 ` Shannon Zhao [this message]
2016-09-02 14:29   ` [PATCH v5 03/16] libxl/arm: Generate static ACPI DSDT table Wei Liu
2016-09-12 14:44   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 04/16] libxl/arm: Estimate the size of ACPI tables Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 05/16] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-09-12 14:58   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 06/16] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-09-12 15:05   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 07/16] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-09-12 15:08   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 08/16] libxl/arm: Factor MPIDR computing codes out as a helper Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 09/16] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-09-12 15:09   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-09-12 15:10   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 11/16] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-09-12 15:13   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 12/16] libxl/arm: Factor finalise_one_memory_node as a gerneric function Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 13/16] libxl/arm: Add ACPI module Shannon Zhao
2016-09-02  2:55 ` [PATCH v5 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI Shannon Zhao
2016-09-02  6:18   ` Jan Beulich
2016-09-02  7:23     ` Shannon Zhao
2016-09-02  8:17       ` Jan Beulich
2016-09-02  2:55 ` [PATCH v5 15/16] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-09-12 15:14   ` Julien Grall
2016-09-02  2:55 ` [PATCH v5 16/16] libxl/arm: Add the size of ACPI tables to maxmem Shannon Zhao
2016-09-12 15:18   ` Julien Grall
2016-09-13  7:03     ` Shannon Zhao
2016-09-13 10:38       ` Julien Grall
2016-09-15 10:46         ` Wei Liu
2016-09-19 14:53         ` Ian Jackson
2016-09-02 14:31 ` [PATCH v5 00/16] Xen ARM DomU ACPI support Wei Liu
2016-09-12 15:22 ` Julien Grall
2016-09-13  6:30   ` Shannon Zhao
2016-09-13 11:56 ` Julien Grall
2016-09-13 13:06   ` Shannon Zhao
2016-09-13 15:17     ` Julien Grall
2016-09-13 15:18       ` Julien Grall
2016-09-14  0:56       ` Shannon Zhao
2016-09-14  1:06         ` Stefano Stabellini
2016-09-14  7:14           ` Julien Grall
2016-09-14  7:32             ` Shannon Zhao
2016-09-14  7:40               ` Julien Grall
2016-09-14  8:01                 ` Shannon Zhao
2016-09-14 20:48             ` Stefano Stabellini
2016-09-14 21:26               ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472784939-14404-4-git-send-email-zhaoshenglong@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=shannon.zhao@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.