From patchwork Mon Jun 18 07:41:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10469475 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 69E486020C for ; Mon, 18 Jun 2018 07:42:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A63D28763 for ; Mon, 18 Jun 2018 07:42:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F65F288FD; Mon, 18 Jun 2018 07:42:33 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F108628763 for ; Mon, 18 Jun 2018 07:42:32 +0000 (UTC) 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: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:In-Reply-To: References:List-Owner; bh=Oa+u/uXbr+EO8kG0MEmav8ZydYS3MWEUS7R9XRX2q6k=; b=CXh txZ9634hwkLokDTOIXk7utuJ+MBd4bcskAB5ev1OnWLdzooqzLSF59vIExzTReRinE4/tqhhrvWfd XLUAQ37jUFgm+HHvXKQ7jUBAk1XLjoNHQl/R3FuaN9X1UW8HwTPcTdzMbfJin25gTFY6gTdI86QgZ 4WxJRp4SV6aXpGmebAE52aGxUaAKnYZY8AAvyiWyHZ3GYdyx2iKvHsyJuiIGMDSGXJ0nxAxSbzwur 3LVbDsOjWqj4kn+muPlaU6h2gN8bMd5a6O1Q9cP0/Qw3gIgTpK67GTbZrd0mThREy8tOwTd44aRfD R9mJz5pDTsBgFWPQfitzWqtR+g2pOaQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUony-00018A-FP; Mon, 18 Jun 2018 07:42:26 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fUonu-000175-Bx for linux-arm-kernel@lists.infradead.org; Mon, 18 Jun 2018 07:42:23 +0000 Received: by mail-wr0-x244.google.com with SMTP id e18-v6so15691069wrs.5 for ; Mon, 18 Jun 2018 00:42:12 -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; bh=FbbPhT5YtgDGNRFgr2XqpG57NuhGTYVLNIoaGans8uo=; b=UrnDGUtzG3bxZ2z2JvTEDE+JAgt4k8fGwTp6anaJ99SJCE+PPDM4TcFgr8TIOmzNzL WapLXp82rMebDW8GNWeEo3lsi03almmgAt1PEZ8zxFY1OufwWidCl/QAiO857huNr/AN yTJ7+cxGkR8wRehyJhQVUmdPmqFW7hn/8DvVg= 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; bh=FbbPhT5YtgDGNRFgr2XqpG57NuhGTYVLNIoaGans8uo=; b=J2JUdtPSNqiczqXYmfz5yMMVF7Me5fJImVtpOqw7Yop/hHDG4C9147ygHUiY2dVg84 OGWJP7i7us+O7gpC5C3pW2VDDg+sAfJcRmmAJiXAAjoIotaw/TOTpDH4OxNfYzVKBEDb manY1ifpgFwibJSIM4i+CzR2ugtroCfOX6VhEv0UMoO0KoYtSI3ep1aVJeCEHpCa07rr A/zpBJZGAPG3bZme7UQ6btaH3W0oUk33NghR4NICX/tytz1Xc2/y41mswzDAUhnUyKlh S2+EEfE/lMT/f3gzmTOdNsN63dSC27UzIF4IHEOBnG5ImkA6xo72WfMQjY7sPL+YAJml Q9cw== X-Gm-Message-State: APt69E1wuAx6v1TJy2PLIA8ouZALP8AxDTJAEas+8cUN82/LTWDghCwo PgqRSkzfD9iZNBW0+KVW7G9o8A== X-Google-Smtp-Source: ADUXVKIlDIFnwiQw7vwppj3EjW0l3aGnDOjHT1fAn3ceiskAqigN3Ad22KKk3vyySjzAMJVcZhNtwg== X-Received: by 2002:adf:a801:: with SMTP id l1-v6mr8832525wrc.201.1529307730727; Mon, 18 Jun 2018 00:42:10 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:50d8:cb10:b6d:abf0]) by smtp.gmail.com with ESMTPSA id g4-v6sm12326233wrq.32.2018.06.18.00.42.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 00:42:09 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Subject: [PATCH] efi/arm: preserve early mapping of UEFI memory map longer for BGRT Date: Mon, 18 Jun 2018 09:41:57 +0200 Message-Id: <20180618074157.28716-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180618_004222_435311_867C98F9 X-CRM114-Status: GOOD ( 13.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hdegoede@redhat.com, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The BGRT code validates the contents of the table against the UEFI memory map, and so it expects it to be mapped when the code runs. On ARM, this is currently not the case, since we tear down the early mapping after efi_init() completes, and only create the permanent mapping in arm_enable_runtime_services(), which executes as an early initcall, but still leaves a window where the UEFI memory map is not mapped. So move the call to efi_memmap_unmap() from efi_init() to arm_enable_runtime_services(). Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 1 - drivers/firmware/efi/arm-runtime.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index 80d1a885def5..a7c522eac640 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -259,7 +259,6 @@ void __init efi_init(void) reserve_regions(); efi_esrt_init(); - efi_memmap_unmap(); memblock_reserve(params.mmap & PAGE_MASK, PAGE_ALIGN(params.mmap_size + diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c index 5889cbea60b8..59a8c0ec94d5 100644 --- a/drivers/firmware/efi/arm-runtime.c +++ b/drivers/firmware/efi/arm-runtime.c @@ -115,6 +115,8 @@ static int __init arm_enable_runtime_services(void) return 0; } + efi_memmap_unmap(); + if (efi_runtime_disabled()) { pr_info("EFI runtime services will be disabled.\n"); return 0;