From patchwork Fri Sep 4 15:50:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 254237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8704C2D0A7 for ; Fri, 4 Sep 2020 15:50:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CE002078E for ; Fri, 4 Sep 2020 15:50:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=gmx.net header.i=@gmx.net header.b="BoOoqmq8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727965AbgIDPum (ORCPT ); Fri, 4 Sep 2020 11:50:42 -0400 Received: from mout.gmx.net ([212.227.15.15]:46143 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727784AbgIDPul (ORCPT ); Fri, 4 Sep 2020 11:50:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599234634; bh=jUo1rcy8Vk2NuZDY7J5rwMK5KzvoLjBx6pfXZJ2n7Ts=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=BoOoqmq8X8mImNpc2Qxhh4W3343M4PBod5v0WS+79D/YHOu+NJ4lLK/39D8GnUj/2 r1e+otD0HUauwi/LH0zgZPM0rKX7tlS8VlRqdEASUnnmE5GkorbhYzCCXC4UKirpKP ffX7LEJb7SSy8JAmUnKD0CNAzHF/TAL6gfXQE0k8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation4.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx005 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MWRRZ-1k2s6s3RPP-00Xqnv; Fri, 04 Sep 2020 17:50:33 +0200 From: Heinrich Schuchardt To: Ard Biesheuvel Cc: Ingo Molnar , Arvind Sankar , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Maxim Uvarov , Jens Wiklander , Heinrich Schuchardt Subject: [PATCH 1/1] efi/libstub: DRAM base calculation Date: Fri, 4 Sep 2020 17:50:25 +0200 Message-Id: <20200904155025.55718-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:doqmB75RmQWNmTYciFl4XKtt9DbYeZi24qbKJZtWpVckGRC+xkp C2aj+6lhw2Csq6CtdQGvwNc+69X52a4l1JQwun8QOcPFy0GNT5S5QwYuzneTFVYLS/vEF0H Eo0a6wOvY/caOT+e4sEvnG7/k3gQGvVYiFjewgJa5WD2ABQ45NipTekj2F1fsSfOyIOC0AF TzrRlmSMs4kbfTUyshv5A== X-UI-Out-Filterresults: notjunk:1; V03:K0:SWwrOPPkoRk=:q29LpSorYGyKX0iflRUA06 JME5mWcahjucKCi3cUm2cmJX1qdWbg6CSmFLtWLhbGAfru5lGpLIqtW3txlBltKZh2qAab0OB ODstMPG+W2T5lwXalzZEghXAl646l4pinyacgC/8tnWkw4zE3u7Xm0+RkRB/pmfBpQe8VkGh3 GfnHmVgVmElH3zQm9VwejUOlYwT2NeU7ST/Rt8xQOxI9G2wYoOuOgJF2FU2Fw7cYsp5LuMXyr 5sssYuAxtVPgsBDDldR+i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vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org In the memory map the regions with the lowest addresses may be of type EFI_RESERVED_TYPE. The reserved areas may be discontinuous relative to the rest of the memory. So for calculating the maximum loading address for the device tree and the initial ramdisk image these reserved areas should not be taken into account. Signed-off-by: Heinrich Schuchardt --- drivers/firmware/efi/libstub/efi-stub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.28.0 diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c index c2484bf75c5d..13058ac75765 100644 --- a/drivers/firmware/efi/libstub/efi-stub.c +++ b/drivers/firmware/efi/libstub/efi-stub.c @@ -106,7 +106,8 @@ static unsigned long get_dram_base(void) map.map_end = map.map + map_size; for_each_efi_memory_desc_in_map(&map, md) { - if (md->attribute & EFI_MEMORY_WB) { + if (md->attribute & EFI_MEMORY_WB && + md->type != EFI_RESERVED_TYPE) { if (membase > md->phys_addr) membase = md->phys_addr; }