From patchwork Tue Jun 20 20:14:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9800171 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 022A96038C for ; Tue, 20 Jun 2017 20:18:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBB7126861 for ; Tue, 20 Jun 2017 20:18:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFEFA284F9; Tue, 20 Jun 2017 20:18:00 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY 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 E08B126861 for ; Tue, 20 Jun 2017 20:17:58 +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 1dNPYO-0006GI-3Q; Tue, 20 Jun 2017 20:15:12 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNPYN-0006GC-1f for xen-devel@lists.xenproject.org; Tue, 20 Jun 2017 20:15:11 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 7B/53-02956-E4289495; Tue, 20 Jun 2017 20:15:10 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRWlGSWpSXmKPExsXSO6nOVde3yTP SoOumkcX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmvH35GXmgkeSFW1XL7A3MHaLdDFycQgJTGSS 2H3pJCuE841RYvGMf1DORkaJyafXskGVMUrcvf6FvYuRk4NNQEfi4peH7CAJEYFuRok5M5czg jjMAisZJT5vmMcEUiUs4CVx8dwHMJtFQFViwqdpjCA2r4CbxMFzvawgtoSAokT3swlsIDangL vE46kfweqFgGp2nPkIVWMocfrhNsYJjHwLGBlWMWoUpxaVpRbpGproJRVlpmeU5CZm5ugaGpj p5aYWFyemp+YkJhXrJefnbmIEBgwDEOxgvL4x4BCjJAeTkihvToVnpBBfUn5KZUZicUZ8UWlO avEhRhkODiUJ3sZGoJxgUWp6akVaZg4wdGHSEhw8SiK8K3KA0rzFBYm5xZnpEKlTjIpS4rwZI H0CIImM0jy4Nli8XGKUlRLmZQQ6RIinILUoN7MEVf4VozgHo5IwrwnIFJ7MvBK46a+AFjMBLX 5xxANkcUkiQkqqgTFy33W+7htla/xq9YQW3vLQ5NFad/XWXLWUIFYt5qnBsr57IsKkI/u8lK/ FNhvwf1/5Rk0oyb/grpov/7sw3bkF7LtX519Yr/tgxa47ZuYHzoVr7GG1DN6yQNn7e/qbzQKL JV8ai7q8fXXGXU7b+hnflwa35YEX3B7fTF3V3fGQ//9Vg7KQMCWW4oxEQy3mouJEAIjkp+uSA gAA X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1497989708!108361380!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55750 invoked from network); 20 Jun 2017 20:15:09 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-3.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Jun 2017 20:15:09 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v5KKEv2E013280 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Jun 2017 20:14:57 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v5KKEuHC019961 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 20 Jun 2017 20:14:56 GMT Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v5KKErdg019912; Tue, 20 Jun 2017 20:14:55 GMT Received: from olila.local.net-space.pl (/10.175.167.139) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 20 Jun 2017 13:14:53 -0700 From: Daniel Kiper To: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, stable@vger.kernel.org, xen-devel@lists.xenproject.org Date: Tue, 20 Jun 2017 22:14:28 +0200 Message-Id: <1497989668-6238-3-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1497989668-6238-1-git-send-email-daniel.kiper@oracle.com> References: <1497989668-6238-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Cc: jgross@suse.com, ard.biesheuvel@linaro.org, matt@codeblueprint.co.uk, mingo@redhat.com, hpa@zytor.com, boris.ostrovsky@oracle.com, tglx@linutronix.de Subject: [Xen-devel] [PATCH 2/2] x86/xen/efi: Init only efi struct members used by Xen 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 Current approach, wholesale efi struct initialization from efi_xen, is not good. Usually if new member is defined then it is properly initialized in drivers/firmware/efi/efi.c but not in arch/x86/xen/efi.c. As I saw it happened a few times until now. So, let's initialize only efi struct members used by Xen to avoid such issues in the future. Signed-off-by: Daniel Kiper Acked-by: Ard Biesheuvel --- arch/x86/xen/efi.c | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/arch/x86/xen/efi.c b/arch/x86/xen/efi.c index 30bb2e8..01b9faf 100644 --- a/arch/x86/xen/efi.c +++ b/arch/x86/xen/efi.c @@ -54,38 +54,6 @@ .tables = EFI_INVALID_TABLE_ADDR /* Initialized later. */ }; -static const struct efi efi_xen __initconst = { - .systab = NULL, /* Initialized later. */ - .runtime_version = 0, /* Initialized later. */ - .mps = EFI_INVALID_TABLE_ADDR, - .acpi = EFI_INVALID_TABLE_ADDR, - .acpi20 = EFI_INVALID_TABLE_ADDR, - .smbios = EFI_INVALID_TABLE_ADDR, - .smbios3 = EFI_INVALID_TABLE_ADDR, - .sal_systab = EFI_INVALID_TABLE_ADDR, - .boot_info = EFI_INVALID_TABLE_ADDR, - .hcdp = EFI_INVALID_TABLE_ADDR, - .uga = EFI_INVALID_TABLE_ADDR, - .uv_systab = EFI_INVALID_TABLE_ADDR, - .fw_vendor = EFI_INVALID_TABLE_ADDR, - .runtime = EFI_INVALID_TABLE_ADDR, - .config_table = EFI_INVALID_TABLE_ADDR, - .get_time = xen_efi_get_time, - .set_time = xen_efi_set_time, - .get_wakeup_time = xen_efi_get_wakeup_time, - .set_wakeup_time = xen_efi_set_wakeup_time, - .get_variable = xen_efi_get_variable, - .get_next_variable = xen_efi_get_next_variable, - .set_variable = xen_efi_set_variable, - .query_variable_info = xen_efi_query_variable_info, - .update_capsule = xen_efi_update_capsule, - .query_capsule_caps = xen_efi_query_capsule_caps, - .get_next_high_mono_count = xen_efi_get_next_high_mono_count, - .reset_system = xen_efi_reset_system, - .set_virtual_address_map = NULL, /* Not used under Xen. */ - .flags = 0 /* Initialized later. */ -}; - static efi_system_table_t __init *xen_efi_probe(void) { struct xen_platform_op op = { @@ -102,7 +70,18 @@ static efi_system_table_t __init *xen_efi_probe(void) /* Here we know that Xen runs on EFI platform. */ - efi = efi_xen; + efi.get_time = xen_efi_get_time; + efi.set_time = xen_efi_set_time; + efi.get_wakeup_time = xen_efi_get_wakeup_time; + efi.set_wakeup_time = xen_efi_set_wakeup_time; + efi.get_variable = xen_efi_get_variable; + efi.get_next_variable = xen_efi_get_next_variable; + efi.set_variable = xen_efi_set_variable; + efi.query_variable_info = xen_efi_query_variable_info; + efi.update_capsule = xen_efi_update_capsule; + efi.query_capsule_caps = xen_efi_query_capsule_caps; + efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; + efi.reset_system = xen_efi_reset_system; efi_systab_xen.tables = info->cfg.addr; efi_systab_xen.nr_tables = info->cfg.nent;