All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: xen-devel@lists.xen.org
Cc: hangaohuai@huawei.com, 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 v3 05/17] libxl/arm: Generate static ACPI DSDT table
Date: Tue, 5 Jul 2016 11:12:35 +0800	[thread overview]
Message-ID: <1467688367-17320-6-git-send-email-zhaoshenglong@huawei.com> (raw)
In-Reply-To: <1467688367-17320-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.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 tools/libacpi/Makefile        | 15 ++++++++++++-
 tools/libacpi/mk_dsdt.c       | 51 ++++++++++++++++++++++++++++++++-----------
 tools/libxl/Makefile          |  5 ++++-
 tools/libxl/libxl_arm_acpi.c  |  5 +++++
 xen/include/public/arch-arm.h |  3 +++
 5 files changed, 64 insertions(+), 15 deletions(-)

diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index 4068d9a..0401810 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -22,6 +22,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
 # Sources to be generated
 C_SRC = $(ACPI_BUILD_DIR)/dsdt_anycpu.c $(ACPI_BUILD_DIR)/dsdt_15cpu.c 
 C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.c $(ACPI_BUILD_DIR)/dsdt_pvh.c
+C_SRC += $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c
 H_SRC = $(ACPI_BUILD_DIR)/ssdt_s3.h $(ACPI_BUILD_DIR)/ssdt_s4.h $(ACPI_BUILD_DIR)/ssdt_pm.h $(ACPI_BUILD_DIR)/ssdt_tpm.h
 
 vpath iasl $(PATH)
@@ -35,7 +36,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}' $< > $@
@@ -69,6 +70,18 @@ $(ACPI_BUILD_DIR)/dsdt_pvh.c: iasl $(ACPI_BUILD_DIR)/dsdt_pvh.asl
 	rm -f $*.aml $*.hex
 	cd $(CURDIR)
 
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
+	printf "DefinitionBlock (\"DSDT.aml\", \"DSDT\", 3, \"XenARM\", \"Xen DSDT\", 1)\n{" > $@
+	$(MK_DSDT) --debug=$(debug) --arch arm >> $@
+
+$(ACPI_BUILD_DIR)/dsdt_anycpu_arm.c: iasl $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl
+	cd $(ACPI_BUILD_DIR)
+	iasl -vs -p $* -tc $(ACPI_BUILD_DIR)/$*.asl
+	sed -e 's/AmlCode/$*/g' $*.hex >$@
+	echo "int $*_len=sizeof($*);" >>$@
+	rm -f $*.aml $*.hex
+	cd $(CURDIR)
+
 iasl:
 	@echo
 	@echo "ACPI ASL compiler (iasl) is needed"
diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
index 1322510..1d3ed0f 100644
--- a/tools/libacpi/mk_dsdt.c
+++ b/tools/libacpi/mk_dsdt.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <xen/hvm/hvm_info_table.h>
+#include <xen/arch-arm.h>
 
 static unsigned int indent_level;
 static bool debug = false;
@@ -87,6 +88,7 @@ static struct option options[] = {
     { "dm-version", 1, 0, 'q' },
     { "debug", 1, 0, 'd' },
     { "no-dm", 0, 0, 'n' },
+    { "arch", 1, 0, 'a' },
     { 0, 0, 0, 0 }
 };
 
@@ -94,7 +96,7 @@ int main(int argc, char **argv)
 {
     unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS;
     dm_version dm_version = QEMU_XEN_TRADITIONAL;
-    bool no_dm = 0;
+    bool no_dm = 0, arch_is_arm = false;
 
     for ( ; ; )
     {
@@ -133,6 +135,10 @@ int main(int argc, char **argv)
         case 'n':
             no_dm = 1;
             break;
+        case 'a':
+            if (strcmp(optarg, "arm") == 0)
+                arch_is_arm = true;
+            break;
         case 'd':
             if (*optarg == 'y')
                 debug = true;
@@ -142,6 +148,9 @@ int main(int argc, char **argv)
         }
     }
 
+    if (arch_is_arm)
+        max_cpus = GUEST_MAX_VCPUS;
+
     /**** DSDT DefinitionBlock start ****/
     /* (we append to existing DSDT definition block) */
     indent_level++;
@@ -149,19 +158,21 @@ int main(int argc, char **argv)
     /**** Processor start ****/
     push_block("Scope", "\\_SB");
 
-    /* MADT checksum */
-    stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
-    push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
-    indent(); printf("MSU, 8\n");
-    pop_block();
+    if (!arch_is_arm) {
+        /* MADT checksum */
+        stmt("OperationRegion", "MSUM, SystemMemory, \\_SB.MSUA, 1");
+        push_block("Field", "MSUM, ByteAcc, NoLock, Preserve");
+        indent(); printf("MSU, 8\n");
+        pop_block();
 
-    /* Processor object helpers. */
-    push_block("Method", "PMAT, 2");
-    push_block("If", "LLess(Arg0, NCPU)");
-    stmt("Return", "ToBuffer(Arg1)");
-    pop_block();
-    stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
-    pop_block();
+        /* Processor object helpers. */
+        push_block("Method", "PMAT, 2");
+        push_block("If", "LLess(Arg0, NCPU)");
+        stmt("Return", "ToBuffer(Arg1)");
+        pop_block();
+        stmt("Return", "Buffer() {0, 8, 0xff, 0xff, 0, 0, 0, 0}");
+        pop_block();
+    }
 
     /* Define processor objects and control methods. */
     for ( cpu = 0; cpu < max_cpus; cpu++)
@@ -170,6 +181,12 @@ int main(int argc, char **argv)
 
         stmt("Name", "_HID, \"ACPI0007\"");
 
+        if (arch_is_arm) {
+            stmt("Name", "_UID, %d", cpu);
+            pop_block();
+            continue;
+        }
+
         /* Name this processor's MADT LAPIC descriptor. */
         stmt("OperationRegion", 
              "MATR, SystemMemory, Add(\\_SB.MAPA, %d), 8", cpu*8);
@@ -208,6 +225,14 @@ int main(int argc, char **argv)
         pop_block();
     }
 
+    if (arch_is_arm) {
+        pop_block();
+        /**** Processor end ****/
+        pop_block();
+        /**** DSDT DefinitionBlock end ****/
+        return 0;
+    }
+
     /* 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 88ab4d2..a398c8e 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
-LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_acpi.o
+LIBXL_OBJS-$(CONFIG_ARM) += libxl_arm_acpi.o dsdt_anycpu_arm.o
+
+dsdt_anycpu_arm.c:
+	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(shell pwd)
 
 libxl_arm_acpi.o: libxl_arm_acpi.c
 	$(CC) -c $(CFLAGS) -I../../xen/include/ -o $@ libxl_arm_acpi.c
diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index 8c273f9..d1c066d 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -28,6 +28,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/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 870bc3b..4a49254 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -431,6 +431,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-07-05  3:12 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-05  3:12 [PATCH v3 00/17] Xen ARM DomU ACPI support Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 01/17] libxl/arm: Factor out codes for generating DTB Shannon Zhao
2016-07-07 15:41   ` Wei Liu
2016-07-07 15:48     ` Boris Ostrovsky
2016-07-07 16:06       ` Julien Grall
2016-07-07 16:09         ` Wei Liu
2016-07-07 16:12         ` Boris Ostrovsky
2016-07-07 16:15           ` Julien Grall
2016-07-07 16:16           ` Wei Liu
2016-07-07 16:08       ` Wei Liu
2016-07-05  3:12 ` [PATCH v3 02/17] libxc: Add placeholders for ACPI tables blob and size Shannon Zhao
2016-07-07 15:42   ` Wei Liu
2016-07-05  3:12 ` [PATCH v3 03/17] libxl/arm: Add a configuration option for ARM DomU ACPI Shannon Zhao
2016-07-07 15:48   ` Wei Liu
2016-07-05  3:12 ` [PATCH v3 04/17] libxl/arm: prepare for constructing ACPI tables Shannon Zhao
2016-07-07 15:50   ` Wei Liu
2016-07-12  7:05     ` Shannon Zhao
2016-07-05  3:12 ` Shannon Zhao [this message]
2016-07-07 15:52   ` [PATCH v3 05/17] libxl/arm: Generate static ACPI DSDT table Wei Liu
2016-07-12  3:50     ` Shannon Zhao
2016-07-12 11:38       ` Wei Liu
2016-07-12 14:49         ` Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 06/17] libxl/arm: Estimate the size of ACPI tables Shannon Zhao
2016-07-07 16:07   ` Wei Liu
2016-07-07 16:39     ` Julien Grall
2016-07-08 10:45       ` Wei Liu
2016-07-05  3:12 ` [PATCH v3 07/17] libxl/arm: Construct ACPI RSDP table Shannon Zhao
2016-07-07 22:43   ` Boris Ostrovsky
2016-07-08  3:31     ` Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 08/17] libxl/arm: Construct ACPI XSDT table Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 09/17] libxl/arm: Construct ACPI GTDT table Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 10/17] libxl/arm: Factor MPIDR computing codes out as a helper Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 11/17] libxl/arm: Construct ACPI MADT table Shannon Zhao
2016-07-07 16:11   ` Wei Liu
2016-07-07 16:46     ` Julien Grall
2016-07-05  3:12 ` [PATCH v3 12/17] libxl/arm: Construct ACPI FADT table Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 13/17] libxl/arm: Construct ACPI DSDT table Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 14/17] libxl/arm: Factor finalise_one_memory_node as a gerneric function Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 15/17] libxl/arm: Add ACPI module Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 16/17] libxc/xc_dom_core: Copy ACPI tables to guest space Shannon Zhao
2016-07-05  3:12 ` [PATCH v3 17/17] libxl/arm: Initialize domain param HVM_PARAM_CALLBACK_IRQ Shannon Zhao
2016-07-07 16:15   ` Wei Liu
2016-07-07 16:57     ` Julien Grall
2016-07-08  3:41       ` Shannon Zhao
2016-07-08 10:47       ` Wei Liu
2016-07-05 10:32 ` [PATCH v3 00/17] Xen ARM DomU ACPI support Julien Grall
2016-07-05 14:09   ` Shannon Zhao

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=1467688367-17320-6-git-send-email-zhaoshenglong@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=hangaohuai@huawei.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.