From patchwork Tue Jul 5 03:12:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 71369 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp91237qgy; Mon, 4 Jul 2016 20:16:58 -0700 (PDT) X-Received: by 10.107.28.13 with SMTP id c13mr10466229ioc.86.1467688618529; Mon, 04 Jul 2016 20:16:58 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e188si3268109ith.123.2016.07.04.20.16.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2016 20:16:58 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKGos-0008Ro-KL; Tue, 05 Jul 2016 03:14:42 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKGos-0008RE-1K for xen-devel@lists.xen.org; Tue, 05 Jul 2016 03:14:42 +0000 Received: from [193.109.254.147] by server-5.bemta-14.messagelabs.com id DA/EA-08132-1262B775; Tue, 05 Jul 2016 03:14:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBIsWRWlGSWpSXmKPExsVSPpHPSVdBrTr coK9Vw2LJx8UsDoweR3f/ZgpgjGLNzEvKr0hgzVjVPI2t4KtGxceP95kaGFsVuxi5OIQEzjBK 3Ok9xAzh7GaUuHFgN3sXIycHm4CuxMeNU8BsEQFZidVdc8BsZoEPjBKnZkuA2MICnhKdC/8xg tgsAioSp5e3MoPYvAIeEnfuPwCLSwhoSKzsncACYnMC1X+9CWELAdX0H1jPClEvKHFy5hMWiP kSEgdfvGCG6FWUaFt/kg3ClpQ4uOIGC8ihEgKnGCXu3V7MDpEwlfhy6xzzBEbBWUhmzUIyawE j0ypGjeLUorLUIl0jC72kosz0jJLcxMwcXUNDE73c1OLixPTUnMSkYr3k/NxNjMAQrWdgYNzB uO643yFGSQ4mJVHeV/+qwoX4kvJTKjMSizPii0pzUosPMcpwcChJ8IqqVocLCRalpqdWpGXmA KMFJi3BwaMkwqsEkuYtLkjMLc5Mh0idYlSUEucVBEkIgCQySvPg2mAReolRVkqYl5GBgUGIpy C1KDezBFX+FaM4B6OSMG8iyBSezLwSuOmvgBYzAS1mjS0HWVySiJCSamDcHmyVKcRwS+dKf9n +zUn5O+4xKlkYfORxNj0ScKgvZ6GX9rWFiXvVVlm9j+gy9w440/Hyj6d3iJxKXNc9k9BnAmEz 43z0+bweLeh+qJ6f0Txx9n9zia87JJ/MDWIxWfWuuWbmnro/Or0ypt+C8l6K8BTccd567QXHo 3sRLp4SZT0WszfvCVZiKc5INNRiLipOBADmfpZAywIAAA== X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1467688475!51892007!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59191 invoked from network); 5 Jul 2016 03:14:39 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-10.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 5 Jul 2016 03:14:39 -0000 Received: from 172.24.1.136 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.136]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CEI04832; Tue, 05 Jul 2016 11:14:05 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.235.1; Tue, 5 Jul 2016 11:13:56 +0800 From: Shannon Zhao To: Date: Tue, 5 Jul 2016 11:12:34 +0800 Message-ID: <1467688367-17320-5-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1467688367-17320-1-git-send-email-zhaoshenglong@huawei.com> References: <1467688367-17320-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.577B25FD.00E9, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 74071078fe8f57a3ff7a8f8b45ce1094 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: [Xen-devel] [PATCH v3 04/17] libxl/arm: prepare for constructing ACPI tables 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" From: Shannon Zhao It only constructs the ACPI tables for 64-bit ARM DomU when user enables acpi because 32-bit DomU doesn't support ACPI. Signed-off-by: Shannon Zhao --- tools/libxl/Makefile | 4 ++++ tools/libxl/libxl_arm.c | 19 ++++++++++++++- tools/libxl/libxl_arm.h | 33 ++++++++++++++++++++++++++ tools/libxl/libxl_arm_acpi.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 tools/libxl/libxl_arm.h create mode 100644 tools/libxl/libxl_arm_acpi.c diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile index 0cf9f6a..88ab4d2 100644 --- a/tools/libxl/Makefile +++ b/tools/libxl/Makefile @@ -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 diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 4a57dd7..7c522e1 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -1,6 +1,7 @@ #include "libxl_internal.h" #include "libxl_arch.h" #include "libxl_libfdt_compat.h" +#include "libxl_arm.h" #include #include @@ -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, diff --git a/tools/libxl/libxl_arm.h b/tools/libxl/libxl_arm.h new file mode 100644 index 0000000..1c01177 --- /dev/null +++ b/tools/libxl/libxl_arm.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2016 Linaro Ltd. + * + * Author: Shannon Zhao + * + * 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 + +_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: + */ diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c new file mode 100644 index 0000000..8c273f9 --- /dev/null +++ b/tools/libxl/libxl_arm_acpi.c @@ -0,0 +1,56 @@ +/* + * ARM DomU ACPI generation + * + * Copyright (C) 2016 Linaro Ltd. + * + * Author: Shannon Zhao + * + * 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 + +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +#include +#include + +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: + */