From patchwork Fri Aug 28 19:47:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 248660 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1371189ilg; Fri, 28 Aug 2020 12:50:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU53Zhf0xHCRgJfbDu9jl07VPiaHnzmgFZEx5/xcXpKF4gHY5NjWc3kzOLieSbJ+VzRlde X-Received: by 2002:a17:906:7f0b:: with SMTP id d11mr358120ejr.116.1598644219707; Fri, 28 Aug 2020 12:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598644219; cv=none; d=google.com; s=arc-20160816; b=SYuNmzXVGj3usAtpHlAdpE7IeHrWjyasB4YXSFl6Bo2WsntvFm6YJkB0dm5kTglhEh Wmz/Q/un5aYMIUCpYRUlYeQVV2+3qt77iJUdtpcriQrlz4iULE/FfhH9jmO35/SBDeuP epZJcWI1Dkkmcmf+EgtIOfJylkuRTBEsKxwVAq8V44Q6Ht0XXlLGMruF8n9Pxo3H8PI3 sqyhX3Vi4MqPMmOK6QjNecTYfyTEHHQsKxbbQhjxP8QK3Ibxkqn4UMaSrzTjps6FXcOb X1PFEqXpB2gc6wExDAtnUOodmZcHQW6W8T4y4IuHoanWO8oVv1QA6zQkLkzU71HFyiNB Duug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=vbIIjyy0+gn0n2X9TiJQpz4eUCR6WtvrRvThehyjv/k=; b=mlPDupBfy58Ms+wACXUPTLk6no+Nyv2FzNaJIvjZ6rJ82t5x0NaOQu8xjPo8q6jHmq dxBwmebSRUooAMd5geS6uGQf8mg50zhdskQC4VyFV5A8DxFYfS8H4StewXnSPTYKv0TV /Rzdj3mRBPVsH8DekrtxiyALa7YsWUcYzGvqKyTFfTnTOOtWjKJPALJ1kJ+4VasESNP9 z149M2IKn+MoTqukIACisf4mLjjuCGeHwVzVBkSIh5O0tWpHPzxrgE2Og105mBA/lYPh +JQRWlAoKVDTU/2Xdjha1CSQWhGC3LT4KijrHkd89Y3UgjRzGBqWOZ64/4XNuwbhzJ3H B+nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MP3iFUsz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id w25si383362ejy.124.2020.08.28.12.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 12:50:19 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MP3iFUsz; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 72D4482221; Fri, 28 Aug 2020 21:50:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="MP3iFUsz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D8E3821FF; Fri, 28 Aug 2020 21:47:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8980780422 for ; Fri, 28 Aug 2020 21:47:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=maxim.uvarov@linaro.org Received: by mail-lj1-x243.google.com with SMTP id i10so157730ljn.2 for ; Fri, 28 Aug 2020 12:47:46 -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=vbIIjyy0+gn0n2X9TiJQpz4eUCR6WtvrRvThehyjv/k=; b=MP3iFUszEEIlcyfujkiHQphz+Wy/q/dYNG4ZZjg7wE01ZhGYyo+y0rXp8aEngsNAqB cRNszRp92xQgUyu0dh0BkTi5Q41WLcE45fmQVaQSEcojw/rDHbOmkevMrtiSWsoGl3xL CD6gZrXs2icNJBrDCqfT/4fIGzExpoSEo2XYHCpLSxbgs3SrccW/gnweGkfoM/vDKmkZ zEjYcJdHX1/EZ+zPrLNyvyZ2I4MnpNGixoR7tP+YyNpfaaWLcEkyXTVYj1yFOzzGAShJ 9GruxbvPrzfs0yGkk/bQVAaz3604hpwlenmk1dldbd5XVBoYBLRo5z6eZ8m1Mcq6TIYV H4TQ== 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=vbIIjyy0+gn0n2X9TiJQpz4eUCR6WtvrRvThehyjv/k=; b=gvLtPG4VBHnetktbgqgIdCTOXf97ZxyRXv8uaMFvdqpNQyvNGvPtqhwKI150OWBBfZ NEwt4pAzM9qWYiPTuKsl2o671DLymUr25AM78sU0+9hUhvkyn6F1Ms3lpgCT9X+xXmln O4IL0Ui+P4kFcjS5Zq3EGW7q9o1KOQy5MV+281mn8jGH5gPSiGLJzaCCruj8SpTwA+Kj 1y/+2ERfUXA9a5FKiiOa1EoSm+Dxas7L9xnuxuk650WOjd9cFSUFxccs0m1oW61oryl0 cHGc97/IaYS1VQaABNLmysQYgVweS+vF7Ncm8PS0Tr2mCb0jUBv5WP9P9HMnMLqvVZd3 NE+w== X-Gm-Message-State: AOAM5321HaL60Z4Lz3wxc/tq/9e3jas62dYeBqgHdHnB5fg3nGAfazo4 cLevbSWLEL1MaLgEuhu0czyQ9deQiItNFA== X-Received: by 2002:a05:651c:1050:: with SMTP id x16mr146560ljm.457.1598644065379; Fri, 28 Aug 2020 12:47:45 -0700 (PDT) Received: from localhost.localdomain ([176.59.41.134]) by smtp.gmail.com with ESMTPSA id t205sm71117lff.8.2020.08.28.12.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 12:47:44 -0700 (PDT) From: Maxim Uvarov To: u-boot@lists.denx.de Cc: Maxim Uvarov Subject: [RFC PATCH 1/2] efi: arm: do not overlap non ram memory on efi allocation Date: Fri, 28 Aug 2020 22:47:40 +0300 Message-Id: <20200828194741.7497-1-maxim.uvarov@linaro.org> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Fri, 28 Aug 2020 21:50:01 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean This commit fixes qemu boot of armv7 where reserving memory for fdt is failed due to reserving region outside of the system RAM. => bdinfo boot_params = 0x00000000 DRAM bank = 0x00000000 -> start = 0x40000000 -> size = 0x40000000 memstart = 0x40000000 memsize = 0x40000000 flashstart = 0x04000000 flashsize = 0x04000000 flashoffset = 0x00000000 baudrate = 115200 bps relocaddr = 0x7ff57000 reloc off = 0x1ff57000 Build = 32-bit current eth = virtio-net#32 ethaddr = 52:52:52:52:52:52 IP addr = fdt_blob = 0x7ef35f20 new_fdt = 0x7ef35f20 fdt_size = 0x00001fa0 ERROR: reserving fdt memory region failed (addr=7fe00000 size=200000) lmb_dump_all: memory.cnt = 0x1 memory.size = 0x0 memory.reg[0x0].base = 0x40000000 .size = 0x40000000 reserved.cnt = 0x2 reserved.size = 0x0 reserved.reg[0x0].base = 0xe100000 .size = 0xf00000 reserved.reg[0x1].base = 0x7ef34d04 .size = 0x10cb2fc arch_number = 0x00000000 TLB addr = 0x7fff0000 irq_sp = 0x7ef35f10 sp start = 0x7ef35f00 Early malloc usage: 1fc / 400 => efidebug memmap Type Start End Attributes -- 2.17.1 ================ ================ ================ ========== RESERVED 000000000e100000-000000000f000000 WB <---- outside of RAM CONVENTIONAL 0000000040000000-0000000047f00000 WB ACPI RECLAIM MEM 0000000047f00000-0000000047f05000 WB CONVENTIONAL 0000000047f05000-000000007d475000 WB RESERVED 000000007d475000-000000007d477000 WB CONVENTIONAL 000000007d477000-000000007df17000 WB LOADER DATA 000000007df17000-000000007df18000 WB Signed-off-by: Maxim Uvarov --- I'm really not sure that this is correct way to fix. Current code state is that uboot fails to boot kernel on armv7 if memory was reserved at 0xe100000. I.e. in current code it does not work. Qemu target has memory started at 0x40000000 and this chunk is outside that memory. Flag overlap_only_ram had very confusing naming, I corrected it in separate path. This patch fixes booting with removing region from efi memmap. I send this as RFC for now. BR, Maxim. lib/efi_loader/efi_memory.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 7be756e370..637c6c67ed 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -360,11 +360,15 @@ static efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type) { u64 pages; + bool overlap_only_ram = false; pages = efi_size_in_pages(size + (start & EFI_PAGE_MASK)); start &= ~EFI_PAGE_MASK; - - return efi_add_memory_map_pg(start, pages, memory_type, false); +#if defined(CONFIG_ARM) + overlap_only_ram = true; +#endif + return efi_add_memory_map_pg(start, pages, memory_type, + overlap_only_ram); } /**