From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.1 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 1D5F6C433E1 for ; Tue, 19 May 2020 12:27:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0F5D20835 for ; Tue, 19 May 2020 12:27:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="m3qWdMR6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728845AbgESM1t (ORCPT ); Tue, 19 May 2020 08:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726196AbgESM1t (ORCPT ); Tue, 19 May 2020 08:27:49 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C735C08C5C0; Tue, 19 May 2020 05:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To: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=gpxgZE1WFOAA3USSRGpS7gL30qkfqbIwl8FUPWp2p+I=; b=m3qWdMR6jSUKVXFYt3bcZ3AM+ 1gzgGHifUKhfdqriZNFuIRjJftXo3RkK5mZW0yHqlWjNV/Mhnlantm5xiuI8D5t9vXPWjzicYmUvM oux8K2FN76KGorGbDm46c8qhC6wCqVgHhw/8ll91CpW0mJBfe6HZMluI72cdynfwSUFUQPHocHbva Vhgprv2CIlnBk4mLLJ9Fty0ne9pWfCvz0sPb186ZbqHM0HdJxSwAFIQsFBhp28m1rJ/8jwFNVe1Xj NFfDH2fzDEUnrj6/xHtLfdrknIGCeEDVaoOawN3b5i3tNOa/vxT/O6FxgMy7CxbF4vnQGU7XfzcH5 ri6ToOMdQ==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:42234) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jb1Kz-0005M2-Jn; Tue, 19 May 2020 13:27:18 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1jb1Ks-0005is-Pw; Tue, 19 May 2020 13:27:06 +0100 Date: Tue, 19 May 2020 13:27:06 +0100 From: Russell King - ARM Linux admin To: Lukasz Stelmach Cc: Geert Uytterhoeven , Dmitry Osipenko , Nicolas Pitre , Arnd Bergmann , Eric Miao , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Masahiro Yamada , Ard Biesheuvel , Marek Szyprowski , Chris Brandt , Linux ARM , Linux-Renesas , Linux Kernel Mailing List , Bartlomiej Zolnierkiewicz , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Rob Herring , Grant Likely Subject: Re: [PATCH v6] ARM: boot: Obtain start of physical memory from DTB Message-ID: <20200519122706.GC1551@shell.armlinux.org.uk> References: <20200519114329.GB1551@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2020 at 02:20:25PM +0200, Lukasz Stelmach wrote: > It was <2020-05-19 wto 12:43>, when Russell King - ARM Linux admin wrote: > > On Tue, May 19, 2020 at 01:21:09PM +0200, Geert Uytterhoeven wrote: > >> On Tue, May 19, 2020 at 11:46 AM Russell King - ARM Linux admin > >> wrote: > >> > On Tue, May 19, 2020 at 11:44:17AM +0200, Geert Uytterhoeven wrote: > >> > > On Tue, May 19, 2020 at 10:54 AM Lukasz Stelmach wrote: > >> > > > It was <2020-04-29 śro 10:21>, when Geert Uytterhoeven wrote: > >> > > > > Currently, the start address of physical memory is obtained by masking > >> > > > > the program counter with a fixed mask of 0xf8000000. This mask value > >> > > > > was chosen as a balance between the requirements of different platforms. > >> > > > > However, this does require that the start address of physical memory is > >> > > > > a multiple of 128 MiB, precluding booting Linux on platforms where this > >> > > > > requirement is not fulfilled. > >> > > > > > >> > > > > Fix this limitation by obtaining the start address from the DTB instead, > >> > > > > if available (either explicitly passed, or appended to the kernel). > >> > > > > Fall back to the traditional method when needed. > >> > > > > > >> > > > > This allows to boot Linux on r7s9210/rza2mevb using the 64 MiB of SDRAM > >> > > > > on the RZA2MEVB sub board, which is located at 0x0C000000 (CS3 space), > >> > > > > i.e. not at a multiple of 128 MiB. > >> > > > > > >> > > > > Suggested-by: Nicolas Pitre > >> > > > > Signed-off-by: Geert Uytterhoeven > >> > > > > Reviewed-by: Nicolas Pitre > >> > > > > Reviewed-by: Ard Biesheuvel > >> > > > > Tested-by: Marek Szyprowski > >> > > > > Tested-by: Dmitry Osipenko > >> > > > > --- > >> > > > > >> > > > [...] > >> > > > > >> > > > Apparently reading physical memory layout from DTB breaks crashdump > >> > > > kernels. A crashdump kernel is loaded into a region of memory, that is > >> > > > reserved in the original (i.e. to be crashed) kernel. The reserved > >> > > > region is large enough for the crashdump kernel to run completely inside > >> > > > it and don't modify anything outside it, just read and dump the remains > >> > > > of the crashed kernel. Using the information from DTB makes the > >> > > > decompressor place the kernel outside of the dedicated region. > >> > > > > >> > > > The log below shows that a zImage and DTB are loaded at 0x18eb8000 and > >> > > > 0x193f6000 (physical). The kernel is expected to run at 0x18008000, but > >> > > > it is decompressed to 0x00008000 (see r4 reported before jumping from > >> > > > within __enter_kernel). If I were to suggest something, there need to be > >> > > > one more bit of information passed in the DTB telling the decompressor > >> > > > to use the old masking technique to determain kernel address. It would > >> > > > be set in the DTB loaded along with the crashdump kernel. > >> > > > >> > > Shouldn't the DTB passed to the crashkernel describe which region of > >> > > memory is to be used instead? > >> > > >> > Definitely not. The crashkernel needs to know where the RAM in the > >> > machine is, so that it can create a coredump of the crashed kernel. > >> > >> So the DTB should describe both ;-) > >> > >> > > Describing "to use the old masking technique" sounds a bit hackish to me. > >> > > I guess it cannot just restrict the /memory node to the reserved region, > >> > > as the crashkernel needs to be able to dump the remains of the crashed > >> > > kernel, which lie outside this region. > >> > > >> > Correct. > >> > > >> > > However, something under /chosen should work. > >> > > >> > Yet another sticky plaster... > >> > >> IMHO the old masking technique is the hacky solution covered by > >> plasters. > > > > One line of code is not "covered by plasters". There are no plasters. > > It's a solution that works for 99.99% of people, unlike your approach > > that has had a stream of issues over the last four months, and has > > required many reworks of the code to fix each one. That in itself > > speaks volumes about the suitability of the approach. > > As I have been working with kexec code (patches soon) I would like to > defend the DT approach a bit. It allows to avoid zImage relocation when > a decompressed kernel is larger than ~128MiB. In such case zImage isn't > small either and moving it around takes some time. ... which is something that has been supported for a very long time, before the days of DT. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC for 0.8m (est. 1762m) line in suburbia: sync at 13.1Mbps down 424kbps up