From patchwork Thu Sep 22 12:52:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 76783 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp14850qgf; Thu, 22 Sep 2016 05:55:36 -0700 (PDT) X-Received: by 10.107.28.65 with SMTP id c62mr2749654ioc.154.1474548936057; Thu, 22 Sep 2016 05:55:36 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y135si1795302ioy.209.2016.09.22.05.55.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Sep 2016 05:55:36 -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 1bn3VX-0004Cb-S3; Thu, 22 Sep 2016 12:53:43 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bn3VW-0004BH-PY for xen-devel@lists.xen.org; Thu, 22 Sep 2016 12:53:42 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id F4/4B-27438-654D3E75; Thu, 22 Sep 2016 12:53:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVSPpHPSTf0yuN wg8lbpSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxps/sZC55aV6zqX8vYwPhOt4uRi0NI4BSj xPknb5i7GDmBnD2MEid2FYHYbAJaEuen/2AHsUUEZCVWd81hB2lgFrjOKHHn/TbWLkYODmGBY ImuI74gNSwCqhJXXuxmBbF5BTwkJnYvZwOxJQQ0JFb2TmABsTkFPCUmHFnPCrHLQ2LllYVQ9Y ISJ2c+AathFpCQOPjiBTNEr6JE2/qTUHMkJQ6uuMECcoMEyNFvNy1lgUiYSnyddZJ5AqPgLCS zZiGZtYCRaRWjenFqUVlqka6xXlJRZnpGSW5iZo6uoYGZXm5qcXFiempOYlKxXnJ+7iZGYHgy AMEOxo5/TocYJTmYlER5L/Q/DhfiS8pPqcxILM6ILyrNSS0+xCjDwaEkwZtwGSgnWJSanlqRl pkDjBSYtAQHj5IIbzFImre4IDG3ODMdInWKUVFKnLcOJCEAksgozYNrg0XnJUZZKWFeRqBDhH gKUotyM0tQ5V8xinMwKgnzHgOZwpOZVwI3/RXQYiagxVt+PgBZXJKIkJJqYBQ+9djNYHGGWde 1gMdzt8XmuESH5PPzz9OsZ50Y0xgd90u7W0zB1j+oZ5Zfamg4jzJvwad1p+Nj7kdu2PtUzbrr TXTnldB2/+Al4qe49i90v9rc8e+Yg6viw5SeGKGykgXXhJ8vXr5PZBmf+t7D96WyjAztm889f WPB1fM+KrfkwNHQaeHflViKMxINtZiLihMBaCNPxMkCAAA= X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-6.tower-27.messagelabs.com!1474548814!60851008!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.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31600 invoked from network); 22 Sep 2016 12:53:40 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-6.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 22 Sep 2016 12:53:40 -0000 Received: from 172.24.1.47 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CIG48121; Thu, 22 Sep 2016 20:53:01 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Thu, 22 Sep 2016 20:52:49 +0800 From: z00226004 To: Date: Thu, 22 Sep 2016 20:52:18 +0800 Message-ID: <1474548753-12596-2-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1474548753-12596-1-git-send-email-zhaoshenglong@huawei.com> References: <1474548753-12596-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.0A020202.57E3D42E.0289, 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: 1c1030d500dded6f45f5c36f798b9871 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: [Xen-devel] [PATCH v6 01/16] tools/libxl: Add an unified configuration option for ACPI 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 Since the existing configuration option "u.hvm.acpi" is x86 specific and we want to reuse it on ARM as well, add a unified option "acpi" for x86 and ARM, and for ARM it's disabled by default. Signed-off-by: Shannon Zhao Acked-by: Wei Liu --- docs/man/xl.cfg.pod.5.in | 1 + tools/libxl/libxl_arch.h | 4 ++++ tools/libxl/libxl_arm.c | 6 ++++++ tools/libxl/libxl_create.c | 4 +++- tools/libxl/libxl_dm.c | 4 ++-- tools/libxl/libxl_internal.h | 6 ++++++ tools/libxl/libxl_types.idl | 4 ++++ tools/libxl/libxl_x86.c | 6 ++++++ tools/libxl/xl_cmdimpl.c | 2 +- 9 files changed, 33 insertions(+), 4 deletions(-) diff --git a/docs/man/xl.cfg.pod.5.in b/docs/man/xl.cfg.pod.5.in index 77a1be3..db71fca 100644 --- a/docs/man/xl.cfg.pod.5.in +++ b/docs/man/xl.cfg.pod.5.in @@ -1239,6 +1239,7 @@ the virtual firmware to the guest Operating System. ACPI is required by most modern guest Operating Systems. This option is enabled by default and usually you should omit it. However it may be necessary to disable ACPI for compatibility with some guest Operating Systems. +This option is true for x86 while it's false for ARM by default. =item B diff --git a/tools/libxl/libxl_arch.h b/tools/libxl/libxl_arch.h index 7a70b01..8cb9ba7 100644 --- a/tools/libxl/libxl_arch.h +++ b/tools/libxl/libxl_arch.h @@ -62,6 +62,10 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc, uint32_t domid, struct xc_dom_image *dom); +_hidden +void libxl__arch_domain_build_info_acpi_setdefault( + libxl_domain_build_info *b_info); + #if defined(__i386__) || defined(__x86_64__) #define LAPIC_BASE_ADDRESS 0xfee00000 diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index bd3d611..8ec5cd5 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -985,6 +985,12 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc, return 0; } +void libxl__arch_domain_build_info_acpi_setdefault( + libxl_domain_build_info *b_info) +{ + libxl_defbool_setdefault(&b_info->acpi, false); +} + /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 07b2b4b..d986cd2 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -215,6 +215,8 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, if (!b_info->event_channels) b_info->event_channels = 1023; + libxl__arch_domain_build_info_acpi_setdefault(b_info); + switch (b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: if (b_info->shadow_memkb == LIBXL_MEMKB_DEFAULT) @@ -454,7 +456,7 @@ int libxl__domain_build(libxl__gc *gc, localents = libxl__calloc(gc, 9, sizeof(char *)); i = 0; localents[i++] = "platform/acpi"; - localents[i++] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0"; + localents[i++] = libxl__acpi_defbool_val(info) ? "1" : "0"; localents[i++] = "platform/acpi_s3"; localents[i++] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0"; localents[i++] = "platform/acpi_s4"; diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index e3bf28f..ad366a8 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -583,7 +583,7 @@ static int libxl__build_device_model_args_old(libxl__gc *gc, if (b_info->u.hvm.soundhw) { flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL); } - if (libxl_defbool_val(b_info->u.hvm.acpi)) { + if (libxl__acpi_defbool_val(b_info)) { flexarray_append(dm_args, "-acpi"); } if (b_info->max_vcpus > 1) { @@ -1204,7 +1204,7 @@ static int libxl__build_device_model_args_new(libxl__gc *gc, if (b_info->u.hvm.soundhw) { flexarray_vappend(dm_args, "-soundhw", b_info->u.hvm.soundhw, NULL); } - if (!libxl_defbool_val(b_info->u.hvm.acpi)) { + if (!libxl__acpi_defbool_val(b_info)) { flexarray_append(dm_args, "-no-acpi"); } if (b_info->max_vcpus > 1) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index a8fb23e..f1ba473 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -4292,6 +4292,12 @@ _hidden int libxl__read_sysfs_file_contents(libxl__gc *gc, #define LIBXL_QEMU_USER_PREFIX "xen-qemuuser" #define LIBXL_QEMU_USER_BASE LIBXL_QEMU_USER_PREFIX"-domid" #define LIBXL_QEMU_USER_SHARED LIBXL_QEMU_USER_PREFIX"-shared" + +static inline bool libxl__acpi_defbool_val(const libxl_domain_build_info *b_info) +{ + return libxl_defbool_val(b_info->acpi) && + libxl_defbool_val(b_info->u.hvm.acpi); +} #endif /* diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 98bfc3a..a02446f 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -494,11 +494,15 @@ libxl_domain_build_info = Struct("domain_build_info",[ # Note that the partial device tree should avoid to use the phandle # 65000 which is reserved by the toolstack. ("device_tree", string), + ("acpi", libxl_defbool), ("u", KeyedUnion(None, libxl_domain_type, "type", [("hvm", Struct(None, [("firmware", string), ("bios", libxl_bios_type), ("pae", libxl_defbool), ("apic", libxl_defbool), + # The following acpi field is deprecated. + # Please use the unified acpi field above + # which works for both x86 and ARM. ("acpi", libxl_defbool), ("acpi_s3", libxl_defbool), ("acpi_s4", libxl_defbool), diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index d10b04b..f69f3c2 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -571,6 +571,12 @@ out: return rc; } +void libxl__arch_domain_build_info_acpi_setdefault( + libxl_domain_build_info *b_info) +{ + libxl_defbool_setdefault(&b_info->acpi, true); +} + /* * Local variables: * mode: C diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 62237d0..6a01801 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -1550,6 +1550,7 @@ static void parse_config_data(const char *config_source, b_info->cmdline = parse_cmdline(config); xlu_cfg_get_defbool(config, "driver_domain", &c_info->driver_domain, 0); + xlu_cfg_get_defbool(config, "acpi", &b_info->acpi, 0); switch(b_info->type) { case LIBXL_DOMAIN_TYPE_HVM: @@ -1579,7 +1580,6 @@ static void parse_config_data(const char *config_source, xlu_cfg_get_defbool(config, "pae", &b_info->u.hvm.pae, 0); xlu_cfg_get_defbool(config, "apic", &b_info->u.hvm.apic, 0); - xlu_cfg_get_defbool(config, "acpi", &b_info->u.hvm.acpi, 0); xlu_cfg_get_defbool(config, "acpi_s3", &b_info->u.hvm.acpi_s3, 0); xlu_cfg_get_defbool(config, "acpi_s4", &b_info->u.hvm.acpi_s4, 0); xlu_cfg_get_defbool(config, "nx", &b_info->u.hvm.nx, 0);