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: 138855 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3640883lji; Mon, 18 Jun 2018 00:42:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIIyg9Py19LDmIlLTUUDaqEvmSImX5sf4Z6P29yVAMm9CKdHKiJRy2zVrUyG1X1UQr5o2yF X-Received: by 2002:a17:902:7e07:: with SMTP id b7-v6mr12866367plm.230.1529307733336; Mon, 18 Jun 2018 00:42:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529307733; cv=none; d=google.com; s=arc-20160816; b=c1Gha2q+q4CkEcrge/MW/1YcuiINqat3MNY1jAxgEWej7e5AGJsasFnyH/bxxngrsP 2DV1DMcCvDF8OgrZym5EgvY0vpCcYP4hWluv/Rvq8JKImt2A7AiFZewzAmpICtmSL4gX bOTGN4Hjvk1lhw418IadikF8nkwt+llVhKIwmZJCyrHNRMk14QZCtw/qFy7Pfsfn+snU KBUHacNTr0YZa7WqZxFTQko3QgDUZawSu3XkezlQ84EXiFXeOag4Wc4EhdhmmsI4Csug B2fY/NUBpiCGsmFYbwgjXFBlF6pYZPaliHLmW413QZvdRa6UnQ8a5KIWknQC/xzY9ayP VbVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=0+p8Ia2nMNs+y8Gr0jx1lY3ejQo6JNk+lMW5s63zbb4=; b=MAyNIXQbOLfAOuTCbR70UTpunsbno8lYvWXWwg4oilDAJt47kRV7rjyAc5QUrG9W6P JS+N0JWoRTreH3dttFsvCZEzqMxr6UrfNUdsfTJWOQlJRh9sZADZnn5YOIvGNyU0vR/w ZfJGufeacJ4jhu3d7HxJZ1CVDjK7G8WAaCctEy6wPh0smr4hgZ7lg0vURAXqPeJQngy3 3BCsewN8e1BWYyf/+iReWCtJbY5z8KauyFM2y/VxsUxK19MdIakUmIHh22n3R1PmLcO0 EcnKv5s0R18c4f+y6TafITf0qtilSpLH+/WdcXKL3ZekpbqBLz4qVvbsJ3dM5rmAc3sd GmqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UrnDGUtz; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5-v6si11320914pgp.269.2018.06.18.00.42.13; Mon, 18 Jun 2018 00:42:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UrnDGUtz; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754721AbeFRHmM (ORCPT + 2 others); Mon, 18 Jun 2018 03:42:12 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46528 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754908AbeFRHmM (ORCPT ); Mon, 18 Jun 2018 03:42:12 -0400 Received: by mail-wr0-f195.google.com with SMTP id v13-v6so15639807wrp.13 for ; Mon, 18 Jun 2018 00:42:11 -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=RdIoxarUJLB89RDnegeh6zJ/lsOVxBYt3rcNG3qvZYs1/Ag2gSAZ+vtJFvkch0mWyW Kwbd+u91WcBx8SO6CFlOUmz+uxFdNH+Yc4kAuT6WuQtP4H0E5ODjtiSt/HFgJnXrs6ic GWieGrc7/6cU/VfOPrMSiA+/R1qkslXXiL224IeNex+YBfix0FAb842V7GcvBpRbSfbq gW4n7Fl0CBKwESXwxGm12G54mNw/MypCgZsu8+mtRVpZsbTJM51dw6XzUSWyv/M8TdUU fZrsfc9lKFbj828CttaO+/NasNghkiNLaFtXLFKzvQmXdhGh/4VCypfX8+5qw85Z9q5C tD0A== X-Gm-Message-State: APt69E3k/ZprrH+2pWBpyGLMl1wmU9A+SxxX8ikS3Rh/MYn+VLbDRsrI wDx1q2ltV8fGoTawoDZH9Oo9aFdHe3Q= 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 Cc: linux-arm-kernel@lists.infradead.org, hdegoede@redhat.com, Ard Biesheuvel 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 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;