From patchwork Mon Feb 1 11:16:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 374231 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp1171896jah; Mon, 1 Feb 2021 03:17:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsXnSU1r+3HlYCukbLTHsoxKDzVwD89SCm1z860Wqdip5kTWie+k8GZCGf8BUCjz2yuwGG X-Received: by 2002:a17:906:719:: with SMTP id y25mr10274181ejb.180.1612178220516; Mon, 01 Feb 2021 03:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612178220; cv=none; d=google.com; s=arc-20160816; b=MuBBQdFz2cDi6+EsUnZZz2lqs/kav6G01ObQCIX4gmGCPysdBZeInTU6TVR77Gya3m 1kJyLdgmc1BLO8A4LQHlbWWg2c+dsk6WNLANZUmYvzTiXdAFoqJ/UtOxniTD6wQ9DuXM 0v6FZVh28kal+P3wW1Op3ezQuKjx6tP/S6hgkDCEF10roJm7mlqGyGE+lG94k6JOaI1s uRSkE8JWMG0yMRNaozY/xaJR6pRmqOckLoVhhfH8ZQKeYYJ3H7gVMm8YcRqQ1Onh437m zJAf+l1Mgv/dbjptEpbiPxMm3cCcwvC/zm5eftVRgWqTgqes2QLYL5H6ay/UOrrQitXw thkg== 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:references:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=QLzEo8i28myN2Wz4EcuLPVeRldM9iJyMElUxeVY9sXg=; b=JjezjD76O0KmkFWDZ+JB15D08Yk0Rzbk0/ue/yRdENim9tC1WwNZkJgTnr2t2qbn9d OsUuUmnI8wvFTB5EKAjduElyR0Wge861mJ44vS4u9EaozMgP6tM2W3LBQx/IoCVX8U7Z XEoLojHOLdqeF9XAzGpu2UazCcLJls204qzmfFsz+qDGKy5kN9bxNOUglgi4ehPLpQC5 j4ESa0EVOXIe7hRoLNrMzTAmwrYnI3KoB14SS5Gy4+Yrm9eEmf5R3MDX8Z6GR6mOb94L Jgq21B6KP5xEV3iHUS6tsJcsWX9FxcNw//zGVk2w4wfPasBashKLskDVmJbPi9zjJ8Qr emow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=eTdfSBxW; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id l6si2151313edv.68.2021.02.01.03.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 03:17:00 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=eTdfSBxW; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F10C82690; Mon, 1 Feb 2021 12:16:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="eTdfSBxW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6A61282699; Mon, 1 Feb 2021 12:16:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5EFD682673 for ; Mon, 1 Feb 2021 12:16:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20210201111650euoutp028e802577d3d0bfe2d6f6e9087214cbfc~fm4pkNe_u0311603116euoutp02a for ; Mon, 1 Feb 2021 11:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20210201111650euoutp028e802577d3d0bfe2d6f6e9087214cbfc~fm4pkNe_u0311603116euoutp02a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1612178210; bh=QLzEo8i28myN2Wz4EcuLPVeRldM9iJyMElUxeVY9sXg=; h=From:To:Cc:Subject:Date:References:From; b=eTdfSBxWcwgrolapPebBXCNLri4Tz4rRIkcr+HkdpzZGYfGQ6oii0snmSPZICR3r+ 6j8hImVNcEbasKNIK0fhKRsXMpk7Rg3im97L38XkhfwgcXUywKY4MD7WOStLsq4L0l h2EmJ2Di3qhmc8fUIHR5se6bU5QLdnQJIRYmxBMo= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20210201111649eucas1p2d516585ac3e5755024d7a865fe198286~fm4pQHjBh0908209082eucas1p28; Mon, 1 Feb 2021 11:16:49 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id BA.A7.27958.123E7106; Mon, 1 Feb 2021 11:16:49 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20210201111649eucas1p2c7d30c4d2687f57d0992cf951465ed4f~fm4o5vuN51333113331eucas1p2b; Mon, 1 Feb 2021 11:16:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20210201111649eusmtrp1a80907d214c0dd59c0003d7375528c48~fm4o5FdUg2876928769eusmtrp1b; Mon, 1 Feb 2021 11:16:49 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-c5-6017e3218f23 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 7A.57.21957.123E7106; Mon, 1 Feb 2021 11:16:49 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20210201111649eusmtip224b255c745f2181438fad2f8d41f32c0~fm4ocdm_Z1126011260eusmtip2W; Mon, 1 Feb 2021 11:16:49 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Matthias Brugger , Nicolas Saenz Julienne , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH] rpi: limit size of the RAM to the multiple of the MMU_SECTION_SIZE Date: Mon, 1 Feb 2021 12:16:33 +0100 Message-Id: <20210201111633.9771-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Br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-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrPLMWRmVeSWpSXmKPExsVy+t/xe7qKj8UTDDq3KlhsnLGe1eLGrzZW i7VH7rJbLJj8hNVi26zlbBZv93ayO7B5nL2zg9Gjb8sqRo/1W66yeGw+XR3AEqVnU5RfWpKq kJFfXGKrFG1oYaRnaGmhZ2RiqWdobB5rZWSqpG9nk5Kak1mWWqRvl6CXcWfefOaC7xwVK5cs YmxgXMzexcjJISFgIvG9uYW1i5GLQ0hgKaPE/Y2noRIyEienNbBC2MISf651sUEUfWKUmNX6 FCzBJmAo0fUWJMHJISIgIfGr/yojSBGzwBtGicldmxlBEsICwRIvGmYwgdgsAqoSC1YvYgGx eQVsJH7+PscCsUFeYvWGA8wTGHkWMDKsYhRJLS3OTc8tNtQrTswtLs1L10vOz93ECAy5bcd+ bt7BOO/VR71DjEwcjIcYJTiYlUR4T00SSxDiTUmsrEotyo8vKs1JLT7EaAq0byKzlGhyPjDo 80riDc0MTA1NzCwNTC3NjJXEebfOXRMvJJCeWJKanZpakFoE08fEwSnVwOSb4LjNyevClGyJ 5kOOSRcEYturG7s8N/b6vns/8ebb9O8rBDv9pEu/Xn/qxNJ4Yw6n5Yrzzl3nP6x8EqaYmP/I X7eG2bEhaWJPwSPJE/acB8WPev7VP8G66BLfEv079wq8i866yOnaTk6YO0ErVXgf4+Mw0Qkn plwPqDv3ouBHpPK3py/s1dK4st8Ecp7ZwicQcce/4Wr1nxNr+RvaT5z2f7jtu8W5x70cKZob ZSM7b675xLhwJ0/BIpYDFgo9j7x31cSf137F93pp1+PDwn9W3bCZ/uBaNMd9/7cBmQoCSzrW 57Xv3L+mrl+PTTCbo/7M08oA7rOVzNqVuUZJxQV7Zf6+2uc486F/saXOVCWW4oxEQy3mouJE ADlcnHPCAgAA X-CMS-MailID: 20210201111649eucas1p2c7d30c4d2687f57d0992cf951465ed4f X-Msg-Generator: CA X-RootMTR: 20210201111649eucas1p2c7d30c4d2687f57d0992cf951465ed4f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20210201111649eucas1p2c7d30c4d2687f57d0992cf951465ed4f References: 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 When RPi4 is booted from USB Mass Storage, the firmware reports 947MiB of the ARM memory (948 in case of the standard SD-card boot). This value is not MMU_SECTION_SIZE aligned, so the dram_bank_mmu_setup() skips mapping of the last 1MiB. This later causes u-boot in ARM 32bit mode to freeze, because it relocated itself into that unmapped memory and fails to execute. Fix this by limiting the size of the first bank to the multiple of MMU_SECTION_SIZE. Signed-off-by: Marek Szyprowski --- board/raspberrypi/rpi/rpi.c | 7 +++++++ 1 file changed, 7 insertions(+) -- 2.17.1 Reviewed-by: Nicolas Saenz Julienne Tested-by: Jaehoon Chung Reviewed-by: Jaehoon Chung diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 6b1fa5fc14..83ccd3e3fc 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -268,6 +268,13 @@ int dram_init(void) gd->ram_size = msg->get_arm_mem.body.resp.mem_size; + /* + * In some configurations the memory size returned by VideoCore + * is not aligned to the section size, what is mandatory for + * the u-boot's memory setup. + */ + gd->ram_size &= ~MMU_SECTION_SIZE; + return 0; }