From patchwork Thu Sep 29 01:18:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 9355533 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5486E6077A for ; Thu, 29 Sep 2016 01:22:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D8FB28E6B for ; Thu, 29 Sep 2016 01:22:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 320FA296CB; Thu, 29 Sep 2016 01:22:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78EC228E6B for ; Thu, 29 Sep 2016 01:22:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0h-0001Kv-Vc; Thu, 29 Sep 2016 01:19:39 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0g-0001Jj-5v for xen-devel@lists.xen.org; Thu, 29 Sep 2016 01:19:38 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 94/4E-13924-92C6CE75; Thu, 29 Sep 2016 01:19:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMfSOsa5Gzpt wg3srlCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oztTZdYCi5aVHw5sYOlgfGIfhcjF4eQwERG iVez1jGCOCwC85gl+vp/s4A4EgL9rBINTW1AGQ4gJ0Zi23+fLkZOILNS4tWj+6wgtpCAmsSyw wuZISY1MUnseX2THSTBJqAj8WLSTjYQW0RAWuLa58tgG5gFjjBK3Jp/khkkISzgIjHx0SQwm0 VAVWLm07VMIDavgLXEvMPHGCG2aUpMn/UarIZTwEbiQ8svZojN1hLLvm1mmcAosICRYRWjenF qUVlqka6JXlJRZnpGSW5iZo6uoYGpXm5qcXFiempOYlKxXnJ+7iZGYGgxAMEOxlt9zocYJTmY lER5OX3ehAvxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4L2SBZQTLEpNT61Iy8wBBjlMWoKDR0mE9 xVImre4IDG3ODMdInWK0Zhjy+9ra5k4tk29t5ZJiCUvPy9VSpz3KkipAEhpRmke3CBY9F1ilJ US5mUEOk2IpyC1KDezBFX+FaM4B6OSMO9rkCk8mXklcPteAZ3CBHTK0hMvQE4pSURISTUwhj/ 9cTn60sO1pTNrNk4pTjUUUWnKPzYvMkby26HpigrvZL5LN+9nU5ZIeGJbEvBQ6afaE2YxHYmI OSaWjPufZ9p9n8XhufSshOLXQjumeZ7fl9ev9Fh+eJvgWtkjqy53ONiF/L2bHL3LkW/bK3mtx 5equQ9P3mNi1y76bHv5e5uTkekJvTUGSizFGYmGWsxFxYkAHqn6xbkCAAA= X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-3.tower-206.messagelabs.com!1475111975!58491919!1 X-Originating-IP: [209.85.220.51] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 64352 invoked from network); 29 Sep 2016 01:19:36 -0000 Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by server-3.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Sep 2016 01:19:36 -0000 Received: by mail-pa0-f51.google.com with SMTP id qn7so21904327pac.3 for ; Wed, 28 Sep 2016 18:19:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aqCdOxxNkoomKON+iar3rH5MhJ4r8jyJr+I/debngUQ=; b=SA7BvG6ijIebqWdMwXjrsRn2n83b4JfvVQmP9kuffdOVox14xp+9n0UK6mnTIGz4v9 vMgx2ydREZTI2qeYNO3MwNBP2gIxTaDawmHm/fj0Wib1GTwNI6BA0wKCnLT+rxAxBXiR ucTzJ6Zlwvl5dPBHhAK/lbZbDgjSkZdVTJFT0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aqCdOxxNkoomKON+iar3rH5MhJ4r8jyJr+I/debngUQ=; b=C0NxYmPetPN9oF11pi6w6+KjphtefzjOjiSTqG0oWUjwibATuwW2lHf1GiZaLiAtrP hm/tTyfdcyQ+KElPiHz5fzLjNgHSIZ6pxWLT5fUjYiDG0wS+yFBzSsBuXSoXmY+XCGyw b5Si9aIJwYlpf3PEyjb6Gx0YQg7XMRSAMB8IuzDkU4P0LCHkLBHbirs2QKjt3cXBpaib LoXd3CI1jRPs56M1xDvkGHXQzlXi9BjbzR6WYsldrltbGJ9blJhrlsDZWjdK8mJSwmGR r+zenRWyCWYUmRDono1BQ62PcZCWcjh5hkyRcyhgjwhWt0VH0poiFPpYiKLCAiS3eo/A ltXA== X-Gm-Message-State: AE9vXwOzBmasRXpPU+kCE6uSKDvwLAZv8sZjpfkOOG4SrFJCrAejko1aGq2RAvwN3YjiqKoP X-Received: by 10.66.48.170 with SMTP id m10mr62207827pan.43.1475111974555; Wed, 28 Sep 2016 18:19:34 -0700 (PDT) Received: from HZA160860128-A.china.huawei.com ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id wd7sm15228744pab.2.2016.09.28.18.19.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 18:19:33 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Wed, 28 Sep 2016 18:18:49 -0700 Message-Id: <20160929011902.7784-4-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.10.0.windows.1 In-Reply-To: <20160929011902.7784-1-shannon.zhao@linaro.org> References: <20160929011902.7784-1-shannon.zhao@linaro.org> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, julien.grall@arm.com, Shannon Zhao , zhaoshenglong@huawei.com, boris.ostrovsky@oracle.com Subject: [Xen-devel] [PATCH v8 03/16] libxl/arm: Generate static ACPI DSDT table X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Julien Grall Acked-by: Wei Liu --- tools/configure.ac | 2 +- tools/libacpi/Makefile | 8 +++++++- 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, 47 insertions(+), 4 deletions(-) diff --git a/tools/configure.ac b/tools/configure.ac index 5724ace..794c615 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -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 diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile index 65a540e..2502d53 100644 --- a/tools/libacpi/Makefile +++ b/tools/libacpi/Makefile @@ -19,6 +19,7 @@ MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt C_SRC-$(GPL) = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_pvh.c $(C_SRC-y)) +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) # Suffix for temporary files. @@ -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) diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c index 8130cbd..4ae68bc 100644 --- a/tools/libacpi/mk_dsdt.c +++ b/tools/libacpi/mk_dsdt.c @@ -17,7 +17,11 @@ #include #include #include +#if defined(__i386__) || defined(__x86_64__) #include +#elif defined(__aarch64__) +#include +#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"); diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index d8cd5f9..c4e4117 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 5bf9396..06dff5f 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -29,6 +29,11 @@ typedef uint64_t u64; #include #include +_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) { diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index c3bf419..7e43691 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -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 */ diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h index 498d03d..bd974fb 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