From patchwork Thu Sep 29 01:18:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 9355523 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 E6DAA6077A for ; Thu, 29 Sep 2016 01:22:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF6BE28E6B for ; Thu, 29 Sep 2016 01:22:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C43E029710; Thu, 29 Sep 2016 01:22:42 +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 69AF528E6B for ; Thu, 29 Sep 2016 01:22:41 +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 1bpQ0d-0001IT-50; Thu, 29 Sep 2016 01:19:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0c-0001IN-Ek for xen-devel@lists.xen.org; Thu, 29 Sep 2016 01:19:34 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 61/32-01957-52C6CE75; Thu, 29 Sep 2016 01:19:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRWlGSWpSXmKPExsVyMfTAGl3VnDf hBo1LuCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oz7xw6xFhy0rlg6axl7A+MF3S5GLg4hgUmM EjMfPWYDcVgE5jFL3Nkwn6WLkZNDQqCfVWL7ymoIO0bi8fb9TBB2pcStg21gNUICahLLDi9kh pjUxCRx5ulWRpAEm4COxItJO9lAbBEBaYlrny8zghQxCxxhlLg1/yQzSEJYIFji/qunYA0sAq oSLx79YAexeQWsJV4/PskIsU1TYvqs12D1nAI2Eh9afjFDbLaWWPZtM8sERoEFjAyrGDWKU4v KUot0jcz1kooy0zNKchMzc3QNDUz1clOLixPTU3MSk4r1kvNzNzECg6uegYFxB+PVLX6HGCU5 mJREeTl93oQL8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuD1ygbKCRalpqdWpGXmAMMcJi3BwaMkw vsqCyjNW1yQmFucmQ6ROsVozLHl97W1TBzbpt5byyTEkpeflyolznsVpFQApDSjNA9uECz+Lj HKSgnzMjIwMAjxFKQW5WaWoMq/YhTnYFQS5k0AuYcnM68Ebt8roFOYgE5ZeuIFyCkliQgpqQb GfO+KlgOXdA6KCR676M/9f/mdEG5V+VTTaIndDAFhn1KcE3ga7h1j3xjiyK7xyMMi429G41Wz VcuyH59eH7mpsfmrizhvb0hn6ms2L9lDhhqVqycf5+LbJ7lOdV92l5TQlVNf7+eq+ByceknXh VHWPWtjfdremwmCF+dnBDGpXnw6o2zp1fdKLMUZiYZazEXFiQD5R3FMugIAAA== X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-10.tower-206.messagelabs.com!1475111971!44938010!1 X-Originating-IP: [209.85.192.172] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3207 invoked from network); 29 Sep 2016 01:19:32 -0000 Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by server-10.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Sep 2016 01:19:32 -0000 Received: by mail-pf0-f172.google.com with SMTP id s13so22874832pfd.2 for ; Wed, 28 Sep 2016 18:19:32 -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=FNtnfpc+yMl0cK1nDAdk9nCmTm2BDaxNJXd9BMEgKKU=; b=Bozzec8iB1WYRHVlT11RkVpupU71kq7fKccXmycPJ2ahtyG+xMeHGMqceXC3ZpytAr lHLHdnNdGhR0alCQnhHyj01nFdvrxyMOA1aDg/qANZfq9zPJruSzxQ4lWwNGkvVAO/lC M7toncIwCXoFN4I+cXOtqfP2qxY1CdvbQUTd8= 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=FNtnfpc+yMl0cK1nDAdk9nCmTm2BDaxNJXd9BMEgKKU=; b=hkeSY6bZtbK5312bl8KX1lD1+aupTbX1BitjkG6VFdyrqDdbWd9i7JmMzqE/PlZfJN AeaxbwMSQgQ8eK6NU7Cg0fJ+f/pZU15eeKVBwtfy4FiegCinQpr79HXYQA0pS0Er0M4i SOmj1JfUpaegD8V/Tw+VVuOT1w7n8xnJ20g/5M/RnPlJVzjxgj3gTc9J0EUWFobmCQ+d aq0sh/AAp0LN1wSJJnGV6UpMawWi+hF0UfDs1AH2evDylu5FxwOztJLcemp+Ufg8vAJq V0LDo8Gk0cKXom89LlTB5IGSGCsrmnbHCmr1wyBpnLzbp1lmSUIuymdqDuv6Oz9PJMxj BWnQ== X-Gm-Message-State: AE9vXwOLvV5JUsyNNBB1fQ2GRYOLnCGu+7fN2GC4hWzfEbttQGBwfQivYcMVIhjswOObQHj4 X-Received: by 10.98.35.84 with SMTP id j81mr62573428pfj.166.1475111971277; Wed, 28 Sep 2016 18:19:31 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 18:19:30 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Wed, 28 Sep 2016 18:18:47 -0700 Message-Id: <20160929011902.7784-2-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 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 d8108e3..21b58bc 100644 --- a/docs/man/xl.cfg.pod.5.in +++ b/docs/man/xl.cfg.pod.5.in @@ -1249,6 +1249,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 b35f7b6..fff0554 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 0190baa..84493df 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -573,6 +573,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 cb43c00..1e93b1b 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);