From patchwork Tue Dec 3 20:14:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masayoshi Mizuma X-Patchwork-Id: 11271873 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01986930 for ; Tue, 3 Dec 2019 20:15:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55808206EC for ; Tue, 3 Dec 2019 20:15:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="DinFsaXr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rr8Px1+P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55808206EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=7UuQvzn3zaQYa8JeB5D28yyKSdDT/v4jDFdwVsU8QBQ=; b=DinFsaXrI7v7/ZAkvVkAraFHi5 FXpiDRmpBU7/Q8eqTCuvLf85GYPLl7UiSNdf9h2zbN7kkDGtm2cUunG8LELsGPUCvTjq1Uiz075vc f2U+lP14q3HTaNauLul3j4KAoT/q6vMfKH4F9lN6Flib12p+HCz/FiMfg1dwVrXUeVS6+7pvADv6W fJGauMaEDM62HwckvRFjHrqmyuK8Ftjc70svibSGsV2Y4QzLuzen7L+yEjkpDUfzFs97gabsp1A8A hgjZkEW7cH3CtU5+lGnZIH8pBlSlJI0tyE0xZUDdvVU+ptvn8vfUe5fvZ/EWLXt+WqAInVRqehokn mnSXzk3w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1icEZW-0002D3-Re; Tue, 03 Dec 2019 20:14:58 +0000 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1icEZF-0001vo-GU; Tue, 03 Dec 2019 20:14:42 +0000 Received: by mail-qv1-xf42.google.com with SMTP id t9so2087282qvh.13; Tue, 03 Dec 2019 12:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bm5k8zQpgAmJX5WQch8jWZs9UGjvpkTxdBtgDKGujPw=; b=Rr8Px1+PnYNeAUdxUPfn+MJ12/5cvatkF40H/w7qFPZyM9q/+/3r9EBWgso4D6A/zS gMWC4aC9LCFOHmy9QqlhooMIR2KF0S3+0+TQrctIkumfx/JKcSvLob7ffgzRzauz9Pmr gL7lc7YHOrxDX8LGyvTHufa9nkHPBsM/A1fOZbP5SsWh23sqzFlcBMQeKq2aUpIKLb43 KyyBTrq7BafTEzmpiDZ8Y8rIeSDmEop3wqs9VWn0l2231ClS6pPhNBuK1VZb1DMEzdZA g8EgjoUgPSadz49jpZYU0mQh5gOli2yqqRCzgOPz6H6d086w9swpGaQDp/xXy3DFbN1H AJNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bm5k8zQpgAmJX5WQch8jWZs9UGjvpkTxdBtgDKGujPw=; b=je+VIu8bntuPPeDjRYoqBT/yY36Bo7wVL9y0pxe2HiKIqIrz07b6TV6hs++k4Ae6s4 /4dgzv3EixM1LqZiHFX/k7X5fI6l/RTIEcHSw8IRMX3pVD737HT6/FhqxmfrvgdWSixs ScQWNb7aqHDMK0uTqlS3f6qi8/PwgJkNKAp/+Uw89fvNXx0KpNPCSrD0Q4MPg+2ws1N3 Wx9grKEXtKWr7BlG4nzRrFwjca+9OJIHD8dKaF3WFwgSFD/auME2st/Rb8kiv/jHDCNt w6l24kc0xBmJlUr4c0xnc7LKK4yQs9jeAdsY3oQTZqXSCNsK89wu3b4/aYh6bSKwqDi5 yvbg== X-Gm-Message-State: APjAAAWiSm+roo8QHs/4qFuTb+xSC5sv9N5fpi75ez5OW62AtumZzKpV QHMYYqdB3XtCxiwQVFNrmQ== X-Google-Smtp-Source: APXvYqxG6NRh8Mwfq13GzmsRH4miOdxwm088FfOdpCEqPNeMTwLiuS9YjJADGVY5pvc3GZI5br4xMA== X-Received: by 2002:ad4:4e34:: with SMTP id dm20mr7183818qvb.163.1575404080368; Tue, 03 Dec 2019 12:14:40 -0800 (PST) Received: from gabell.cable.rcn.com (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id l34sm2437104qtd.71.2019.12.03.12.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 12:14:39 -0800 (PST) From: Masayoshi Mizuma To: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org Subject: [PATCH v2 1/2] efi: add /proc/efi directory Date: Tue, 3 Dec 2019 15:14:09 -0500 Message-Id: <20191203201410.28045-2-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203201410.28045-1-msys.mizuma@gmail.com> References: <20191203201410.28045-1-msys.mizuma@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191203_121441_550865_1553BCB0 X-CRM114-Status: GOOD ( 11.74 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (msys.mizuma[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masayoshi Mizuma , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Eric Biederman , Matthias Brugger , Masayoshi Mizuma , d.hatayama@fujitsu.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Masayoshi Mizuma Add /proc/efi directory to show some efi internal information. Signed-off-by: Masayoshi Mizuma --- drivers/firmware/efi/efi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index d101f072c..d8157cb34 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -325,6 +325,22 @@ static __init int efivar_ssdt_load(void) static inline int efivar_ssdt_load(void) { return 0; } #endif +#ifdef CONFIG_PROC_FS +static struct proc_dir_entry *proc_efi; +static int __init efi_proc_init(void) +{ + proc_efi = proc_mkdir("efi", NULL); + if (!proc_efi) { + pr_err("/proc/efi: Cannot create /proc/efi directory.\n"); + return 1; + } + + return 0; +} +#else +static inline int efi_proc_init(void) { return 0; } +#endif /* CONFIG_PROC_FS */ + /* * We register the efi subsystem with the firmware subsystem and the * efivars subsystem with the efi subsystem, if the system was booted with @@ -381,6 +397,12 @@ static int __init efisubsys_init(void) goto err_remove_group; } + error = efi_proc_init(); + if (error) { + sysfs_remove_mount_point(efi_kobj, "efivars"); + goto err_remove_group; + } + return 0; err_remove_group: From patchwork Tue Dec 3 20:14:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masayoshi Mizuma X-Patchwork-Id: 11271875 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A57DE14B7 for ; Tue, 3 Dec 2019 20:15:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 69C132073C for ; Tue, 3 Dec 2019 20:15:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hmuZu/xz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EH5ZUeyf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69C132073C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=G8kpqIeySNBv1rDZJKTLEAV5WT+Kv+TT7qgAPQaYbf0=; b=hmuZu/xzgjOAIqhPa7mObCVoQ5 GuBRLbxk2XRq/njM8VEMHSwxeqS4oHfdXRtwqqRzM/DsGoldDe1RBB8WLvsgyB1rOInsYXdbYxb4V XA86L2F5PIWF8Bo/iSICAV73IM6pIteFQaNffLYyR72iSPgOf1/ddTXrJVFokvYIYuyCCpraXb2ng xwUavmN1zxzXREgrqE4Oiy1SkvGxHMWwNHY59vsTbCr34QLlRSVNiKJXSWYdE6TA1/CyzDwCDhdTz ddglu5CC16DQhJiktnBY5T+EKlrodisCm3TSWZkEw7hJVOHG6qDA0uG9yvWIi7yi0qt2HGW9I91eN VtldTksQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1icEa5-0003mU-P2; Tue, 03 Dec 2019 20:15:33 +0000 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1icEZG-0001z7-J5; Tue, 03 Dec 2019 20:14:44 +0000 Received: by mail-qv1-xf43.google.com with SMTP id c2so2093401qvp.12; Tue, 03 Dec 2019 12:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=e39PPmDB1hLhTj1mcvYV8QS1l9HhaGJEr3w3upRH5oo=; b=EH5ZUeyfyIINg7bLAPpoNTnBt8gnP1BzNlTE1snYybmxey/T+St/+lCyyL4y4Q/HWe XORmuuvxEFHQbUzwlWc5BFzfGO4y3nBr5frCFxXkaI5ULR3ZUZLqTC6XVrrdMrlu9fpc WSXiCJfBapng2KV7nTAS5L/LwIsT1am/xlbQfMRz6X1CjauIyDL9ld+nHDAiUmvpVaXI H9UI1frQfXtiH+ojRGtrknI18Z8o/KEeviralLp/sOcImVLYAdpIDMv2nFH4XfDbBlb8 eweKcdnBVNzJURWl1PGaATgKF5IXkTYjEI9i4/kiKXgsipHzIgZI7r7zdE1WV39pmg7D iyvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=e39PPmDB1hLhTj1mcvYV8QS1l9HhaGJEr3w3upRH5oo=; b=cEANV+fHASbmNy4y6q5cM/OJYf9pkNX7Mr/R6Ld9yhcNWrvvH5jLKK3bS8xXKKmWce 6YxeyTGau4DuyXJWkNLqewziNs8I7J4HLaAW8Yf2Qspq0woaw8qrApMr/9j96wylqUWc 3xrayDCfthtmBlG/Lo1V5RVDC2fWZA1WSJ8qBfgnTqwQoM2kQn5ZdWwZo2ADOqTnfsyz 4r5+rKMqmsGtbnhyfQpfQkSj+lTAHJ618v2VI7NvhmPuHiWgnWu4DwOgVxrK2xp7w/mr /p9DbIco9XgHUvyDa1agScFwg4Px922ID/HIvRpj28mWd3+5U4r5SGF80FXDyhyTAUKa nEOA== X-Gm-Message-State: APjAAAUp9qIhl3fwMVR+8KhFjlwdR2QwEXtPxfxfmQKQmL2KKJQ+y9a3 SSdnwWq1Bg3WY6U3FpoKCQ== X-Google-Smtp-Source: APXvYqzJycZq/XaJ37MLYoJWXN2T6RawatpKUirnrpPgEmyhHbnSxFHsAVI3vd8hYFqL0cJuvnJe6Q== X-Received: by 2002:ad4:55ec:: with SMTP id bu12mr7150738qvb.107.1575404081478; Tue, 03 Dec 2019 12:14:41 -0800 (PST) Received: from gabell.cable.rcn.com (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id l34sm2437104qtd.71.2019.12.03.12.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 12:14:41 -0800 (PST) From: Masayoshi Mizuma To: Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org Subject: [PATCH v2 2/2] efi: arm64: Introduce /proc/efi/memreserve to tell the persistent pages Date: Tue, 3 Dec 2019 15:14:10 -0500 Message-Id: <20191203201410.28045-3-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191203201410.28045-1-msys.mizuma@gmail.com> References: <20191203201410.28045-1-msys.mizuma@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191203_121442_628870_46C1CE0F X-CRM114-Status: GOOD ( 14.95 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (msys.mizuma[at]gmail.com) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masayoshi Mizuma , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Eric Biederman , Matthias Brugger , Masayoshi Mizuma , d.hatayama@fujitsu.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Masayoshi Mizuma kexec reboot stops in early boot sequence because efi_config_parse_tables() refers garbage data. We can see the log with memblock=debug kernel option: efi: ACPI 2.0=0x9821790014 PROP=0x8757f5c0 SMBIOS 3.0=0x9820740000 MEMRESERVE=0x9820bfdc58 memblock_reserve: [0x0000009820bfdc58-0x0000009820bfdc67] efi_config_parse_tables+0x228/0x278 memblock_reserve: [0x0000000082760000-0x00000000324d07ff] efi_config_parse_tables+0x228/0x278 memblock_reserve: [0xcc4f84ecc0511670-0x5f6e5214a7fd91f9] efi_config_parse_tables+0x244/0x278 memblock_reserve: [0xd2fd4144b9af693d-0xad0c1db1086f40a2] efi_config_parse_tables+0x244/0x278 memblock_reserve: [0x0c719bb159b1fadc-0x5aa6e62a1417ce12] efi_config_parse_tables+0x244/0x278 ... That happens because 0x82760000, struct linux_efi_memreserve, is destroyed. 0x82760000 is pointed from efi.mem_reseve, and efi.mem_reserve points the head page of LPI pending table and LPI property table which are allocated by gic_reserve_range(). The destroyer is kexec. kexec locates the initrd to the area: ]# kexec -d -l /boot/vmlinuz-5.4.0-rc7 /boot/initramfs-5.4.0-rc7.img --reuse-cmdline ... initrd: base 82290000, size 388dd8ah (59301258) ... From dynamic debug log. initrd is located in segment[1]: machine_kexec_prepare:70: kexec kimage info: type: 0 start: 85b30680 head: 0 nr_segments: 4 segment[0]: 0000000080480000 - 0000000082290000, 0x1e10000 bytes, 481 pages segment[1]: 0000000082290000 - 0000000085b20000, 0x3890000 bytes, 905 pages segment[2]: 0000000085b20000 - 0000000085b30000, 0x10000 bytes, 1 pages segment[3]: 0000000085b30000 - 0000000085b40000, 0x10000 bytes, 1 pages kexec searches the memory region to locate initrd through "System RAM" in /proc/iomem. The pending tables are included in "System RAM" because they are allocated by alloc_pages(), so kexec destroys the LPI pending tables. Introduce /proc/efi/memreserve to tell the pages pointed by efi.mem_reserve so that kexec can avoid the area to locate initrd. Signed-off-by: Masayoshi Mizuma --- drivers/firmware/efi/efi.c | 75 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index d8157cb34..80bbe0b3e 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -325,17 +325,87 @@ static __init int efivar_ssdt_load(void) static inline int efivar_ssdt_load(void) { return 0; } #endif +static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init; + #ifdef CONFIG_PROC_FS static struct proc_dir_entry *proc_efi; +#ifdef CONFIG_KEXEC +static int memreserve_show(struct seq_file *m, void *v) +{ + struct linux_efi_memreserve *rsv; + phys_addr_t start, end; + unsigned long prsv; + int count, i; + + if ((efi_memreserve_root == (void *)ULONG_MAX) || + (!efi_memreserve_root)) + return -ENODEV; + + for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) { + rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB); + if (!rsv) { + pr_err("Could not map efi_memreserve\n"); + return -ENOMEM; + } + count = atomic_read(&rsv->count); + for (i = 0; i < count; i++) { + start = rsv->entry[i].base; + end = start + rsv->entry[i].size - 1; + + seq_printf(m, "%pa-%pa\n", &start, &end); + } + memunmap(rsv); + } + + return 0; +} + +static int memreserve_open(struct inode *inode, struct file *filp) +{ + return single_open(filp, memreserve_show, NULL); +} + +static const struct file_operations memreserve_fops = { + .owner = THIS_MODULE, + .open = memreserve_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init efi_proc_memreserve(void) +{ + struct proc_dir_entry *pde; + + if ((efi_memreserve_root == (void *)ULONG_MAX) || + (!efi_memreserve_root)) + return 0; + + pde = proc_create("memreserve", 0444, proc_efi, &memreserve_fops); + if (!pde) { + pr_err("/proc/efi: Cannot create /proc/efi/memreserve file.\n"); + return 1; + } + + return 0; +} +#else +static inline int efi_proc_memreserve(void) { return 0; } +#endif /* CONFIG_KEXEC */ + static int __init efi_proc_init(void) { + int error = 1; + proc_efi = proc_mkdir("efi", NULL); if (!proc_efi) { pr_err("/proc/efi: Cannot create /proc/efi directroy.\n"); - return 1; + return error; } - return 0; + error = efi_proc_memreserve(); + + return error; } #else static inline int efi_proc_init(void) { return 0; } @@ -986,7 +1056,6 @@ int efi_status_to_err(efi_status_t status) } static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock); -static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init; static int __init efi_memreserve_map_root(void) {