From patchwork Mon Jul 23 01:57:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 10539509 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9FB9513BB for ; Mon, 23 Jul 2018 02:00:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 893C72848D for ; Mon, 23 Jul 2018 02:00:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86E9C28517; Mon, 23 Jul 2018 02:00:17 +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 2CD642848D for ; Mon, 23 Jul 2018 02:00:17 +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: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=zL5P2I1Eg3ypXhGL7qfub6Z4ZNcOpVHCRMGHUiQeRyM=; b=BSKKB85DGscrD5OB9/air6cllM UIvzy4ge8XZlNDJJufhtDR5Z4gNWqyhzkq8kEzPoIlXoxQmbyvVEQl7dKil9j7bmChu7bMUWmJaYs 0UW533L3QaEERPFtEC9+IzEJFuluD6/QPk3+M9ntSG8gzl8HtcAix7m0iDowBZNpc8FJFdE7DCP4x 5CM0jaMHbV3c22Olm41CBuM8DkB4duGD3cjgQvjK/AWVLDJO1gZwxno+B4d2/kUfjY4+o9dziyWlB xdXcLa+u0e5JSItdC2iBpd3zjtwjT2E9Lysfk5faAQTeRh6v1Sj8dN1ysRpzO2s4n1DVIKsh4p5Mo P6bq0/9w==; 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 1fhQ8w-0002Id-0n; Mon, 23 Jul 2018 02:00:10 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhQ8m-00021i-Ao for linux-arm-kernel@bombadil.infradead.org; Mon, 23 Jul 2018 02:00:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=erM0Z9H4UEy3rQv1/bN5wC7X6sLU17kati65NrFno1I=; b=zgCJlxTxrWVAlNas0pNJFWYys FlLl3ZSCzYCNvOY/FYVtP4riNkihm4pPDlQfc+srfuTLZhtxTuy2KpKkD0CML1W2EpHob6p8/ZDAC 6PZdLEVdYv8sgiEQwmxQbtuz1OI2W8D9ddYEW+8rO418fX+6609kg5/HZYl58LiYQVKjZiDDHrbwD ik3FxNMGcnLPE1Rea/E4tWL5KZOlD5j3hpvArHsDp+A+35QyfmIDC3gC157swjaoOjZ3fD+iTrAE/ 2agoG2aKjGT0KUkicjszx6ITt9Axx3lqm5Lz78z0EVakiQ+XPddtCAheBl+x/uejnbJPfWXPSDKOY hh5/CmCnA==; Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fhQ8i-0002ls-1D for linux-arm-kernel@lists.infradead.org; Mon, 23 Jul 2018 01:59:58 +0000 Received: by mail-pl0-x241.google.com with SMTP id 6-v6so7550309plb.0 for ; Sun, 22 Jul 2018 18:59:38 -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:in-reply-to:references; bh=erM0Z9H4UEy3rQv1/bN5wC7X6sLU17kati65NrFno1I=; b=TBTOJQLkajO3HY6BXZarrvI5rygueAf02u7zvXLiL8oTEfyaCJiEWTAKkFQD5siKva mwaNxKr1ko7O/hpoL0Yf46+dJ/Gmq4FUsvC+B1nuuSBCRmjKi15MRKmf61rtoDX8JMnh nAAee1TLGfgJeNxcajORbEOx9nj83BlAi5ICU= 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=erM0Z9H4UEy3rQv1/bN5wC7X6sLU17kati65NrFno1I=; b=MH5lgDJNlMSGNpwSsK8APNGYn3I97qbGPfEYtztFqb+t4k8ucSMn3QX3WViNQiNyNh NwXQsE48aNHunv2pAGwLd2u6FGaXbY5wmp2LGm56D2YuLV7cR7LRvSUBgftuiCicFZL9 0luTRmFsOA8LEFvTr73hVjjFIbI4DSqD0BPk7qHQfGzsV37hYE5eNQadp0QxQnJcPv1G o1lyRegN6ftezIo2CfzOp+72I4wbKeQhjRmGsfSV454qT3xc0ouZrqwr2cEQu9AznGNe sqjfULxdDVnd8edVldsTxgkq4xCV940TEakgSyoITmMua/3A3+ivApu7Fxcqps5jOueq ovPg== X-Gm-Message-State: AOUpUlEieRaLpeMZJ7WTsCG5rTQupeQtC3ZTuHn3qIAqrVdmQGGguCIh nVvrOGUOjNjAD6aObJ49NQ+RLA== X-Google-Smtp-Source: AAOMgpcSpIUIcUkR3QCXsLSSr+NEIoUVNT6LpOgFCnbyOdGoKRDptWin1nb676nh1J6ZGLVtbaziSA== X-Received: by 2002:a17:902:583:: with SMTP id f3-v6mr11083324plf.115.1532311176843; Sun, 22 Jul 2018 18:59:36 -0700 (PDT) Received: from linaro.org ([121.95.100.191]) by smtp.googlemail.com with ESMTPSA id h190-v6sm15115682pge.85.2018.07.22.18.59.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 18:59:36 -0700 (PDT) From: AKASHI Takahiro To: catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, ard.biesheuvel@linaro.org Subject: [PATCH v4 3/5] efi/arm: preserve early mapping of UEFI memory map longer for BGRT Date: Mon, 23 Jul 2018 10:57:30 +0900 Message-Id: <20180723015732.24252-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723015732.24252-1-takahiro.akashi@linaro.org> References: <20180723015732.24252-1-takahiro.akashi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180722_215956_109095_E5A9E9CB X-CRM114-Status: GOOD ( 16.74 ) 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: mark.rutland@arm.com, lorenzo.pieralisi@arm.com, graeme.gregory@linaro.org, al.stone@linaro.org, bhsharma@redhat.com, tbaicar@codeaurora.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, hanjun.guo@linaro.org, sudeep.holla@arm.com, dyoung@redhat.com, linux-arm-kernel@lists.infradead.org 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 From: Ard Biesheuvel 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 b5214c143fee..388a929baf95 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;