From patchwork Thu Jun 22 10:51:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Kiper X-Patchwork-Id: 9804005 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 0FADE60386 for ; Thu, 22 Jun 2017 10:54:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1DCA285A8 for ; Thu, 22 Jun 2017 10:54:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6368285C9; Thu, 22 Jun 2017 10:54:27 +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 28C19285EE for ; Thu, 22 Jun 2017 10:54:27 +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 1dNzim-000079-1g; Thu, 22 Jun 2017 10:52:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNzik-00006W-SS for xen-devel@lists.xenproject.org; Thu, 22 Jun 2017 10:52:18 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 72/14-03058-261AB495; Thu, 22 Jun 2017 10:52:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRWlGSWpSXmKPExsUyZ7p8oG7iQu9 Ig/2dmhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bPMztZCy5KV/ye0sLYwPhLpIuRi0NIYCKT xJKjJ9ghnL+MEi8vr2OBcDYySjx8uJEZwpnAKHH5+2K2LkZODjYBHYmLXx6CtYgIdDNKzJm5n BHEYRY4wijx994bIIeDQ1jAV+LYU16QBhYBVYm+k9tZQWxeAXeJHfcmsoDYEgKKEt3PJoAN5R TwkJi17guYLQRUc+vkAnaIGkOJzxuXMk9g5FvAyLCKUb04tagstUjXQi+pKDM9oyQ3MTNH19D ATC83tbg4MT01JzGpWC85P3cTIzBYGIBgB+Psy/6HGCU5mJREeTcXe0cK8SXlp1RmJBZnxBeV 5qQWH2KU4eBQkuB1XwCUEyxKTU+tSMvMAYYtTFqCg0dJhHdjF1Cat7ggMbc4Mx0idYpRUUqc9 8l8oIQASCKjNA+uDRYrlxhlpYR5GYEOEeIpSC3KzSxBlX/FKM7BqCTM2w+ynSczrwRu+iugxU xAi18c8QBZXJKIkJJqYDxg79etWL7vQDSfosLM70ZsP1xiJ8179yz/7Br1pk691c8XndEu3FE RefnDhhfsPK8v384qCJn7pzzE4nD5rLKWuP4ZEz7/tBVff+uK5HzbxWFvLXKeFETlbBOM7za9 GzblwJXyBVu8ZnUG/Zado6zTNqGo6jPH/wPfLn6cbrGVya/dRevHZ3MlluKMREMt5qLiRACcf cS9kAIAAA== X-Env-Sender: daniel.kiper@oracle.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1498128736!75034405!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 62626 invoked from network); 22 Jun 2017 10:52:17 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-8.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Jun 2017 10:52:17 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v5MApxfd031557 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Jun 2017 10:51:59 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v5MApwK1018255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Jun 2017 10:51:59 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v5MApvQI007692; Thu, 22 Jun 2017 10:51:57 GMT Received: from olila.local.net-space.pl (/10.175.242.62) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 22 Jun 2017 03:51:56 -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: Thu, 22 Jun 2017 12:51:37 +0200 Message-Id: <1498128697-12943-3-git-send-email-daniel.kiper@oracle.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1498128697-12943-1-git-send-email-daniel.kiper@oracle.com> References: <1498128697-12943-1-git-send-email-daniel.kiper@oracle.com> X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: jgross@suse.com, ard.biesheuvel@linaro.org, matt@codeblueprint.co.uk, andrew.cooper3@citrix.com, mingo@redhat.com, hpa@zytor.com, boris.ostrovsky@oracle.com, tglx@linutronix.de Subject: [Xen-devel] [PATCH v2 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 Reviewed-by: Boris Ostrovsky --- Align assignments to increase readability. Suggested by Ingo Molnar. --- 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..a18703b 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;