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=-4.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 72EB5C2BA19 for ; Wed, 15 Apr 2020 12:57:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46035206D5 for ; Wed, 15 Apr 2020 12:57:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="A6D5Q3/c"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="xIVxp/0H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46035206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zQO8uwfXN5XsMUf+Qd5euBlorweOi8c950Z+lp4aP6M=; b=A6D5Q3/c2POB1q YplaIifxSrx7d7C7oHxrO/8ixKuKqpvZAs5Wq5tpz3/EjfickEbJr18eACJg8b9g8lSk07qcsDgZn eZsshca42XzZp9+HHoWKsBSx/xGn3WXN6oVp0RgBILOCVwvIiwwTz1ubyUYVYrcYHYMTdgCDX5aa/ YWo/euS3Y09O5FllFMp39084iD2pJyruXluGnON9ZKtsODe6lvlW3TnzWEoNn4z385I+jN4O10EVT vmD9+jclVhn9cm49uTF3TLhY6keSqqVlKlojj0NsfHG5sq6ejBzPQe3+9908MgDI5uG9rPaj1POXR EtG27LCxjHMTzT3CTVwQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOhbw-0003sm-DS; Wed, 15 Apr 2020 12:57:48 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jOhbs-0003s9-Or for linux-arm-kernel@lists.infradead.org; Wed, 15 Apr 2020 12:57:46 +0000 Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C0B4208FE for ; Wed, 15 Apr 2020 12:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586955464; bh=prirf2k0vEOldQV3Q6B6roXSXcORQ3srsnX0/zX+nmU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=xIVxp/0HdsSClWD829oZovBMKHB4jC9NIrvCKjhinIZfV4+zl4Ky1yvRDnmveOkQW uHxJWo8VZxLo1Fpib47qKhwEmenqWN5cnErr4yxGVIMsoOEetuKr4lhgNzdStXjQqq Cn4NYvll+9Er7f+m3kktS9ilyXz9Sp4AJ5ijcnws= Received: by mail-io1-f52.google.com with SMTP id o127so17025826iof.0 for ; Wed, 15 Apr 2020 05:57:44 -0700 (PDT) X-Gm-Message-State: AGi0PuazUy81G6nPnojJ6yh7HEFLKWw0H4b/IJ2/612WAlwk2EwDV5+0 HOIKz7LJYgjl7AXiA0rB3vCX01BwHnVXwh4RXq8= X-Google-Smtp-Source: APiQypKy73qFjUlK2hkG7VDPPS2tn6u2GeHdjM9WffZnjcJ3WlNJ5Lbm/19dLEq4AuxLtvPzf6NnZMZ7X/nStea6z5k= X-Received: by 2002:a92:aa0f:: with SMTP id j15mr5222510ili.211.1586955461321; Wed, 15 Apr 2020 05:57:41 -0700 (PDT) MIME-Version: 1.0 References: <20200320144348.12865-1-geert+renesas@glider.be> In-Reply-To: From: Ard Biesheuvel Date: Wed, 15 Apr 2020 14:57:30 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4] ARM: boot: Obtain start of physical memory from DTB To: Geert Uytterhoeven X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200415_055744_851661_735F6D54 X-CRM114-Status: GOOD ( 24.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Nicolas Pitre , Russell King , Linux-Renesas , Chris Brandt , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Eric Miao , Dmitry Osipenko , linux-arm-kernel , Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 15 Apr 2020 at 14:45, Geert Uytterhoeven wrote: > > Hi Ard, > > On Tue, Apr 14, 2020 at 10:07 AM Ard Biesheuvel wrote: > > On Wed, 25 Mar 2020 at 17:40, Ard Biesheuvel wrote: > > > On Fri, 20 Mar 2020 at 15:43, 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 > > > > Tested-by: Marek Szyprowski > > > > --- > > > > v4: > > > > - Fix stack location after commit 184bf653a7a452c1 ("ARM: > > > > decompressor: factor out routine to obtain the inflated image > > > > size"), > > > > > > > > > > Apologies for the breakage. I was aware of the existence of this > > > patch, but I didn't realize it was accessing LC0 early on to find the > > > stack pointer value. > > > > > > Reviewed-by: Ard Biesheuvel > > > > OK, so one thing I did notice when playing with this code is that the > > phys/virt patching code requires that 'PHYS_OFFSET - PAGE_OFFSET' is a > > multiple of 16 MB, and so this needs to be taken into account by this > > change as well, given that PHYS_OFFSET is based on the placement of > > the uncompressed kernel in the physical address space. > > You mean fdt_get_mem_start() should round up the address to make sure > it is a multiple of 16 MiB (assumed PAGE_OFFSET is a multiple of 16 MiB, > too)? Yes. > Can PAGE_OFFSET actually be not a multiple of 16 MiB? ARM's Kconfig has config PAGE_OFFSET hex default PHYS_OFFSET if !MMU default 0x40000000 if VMSPLIT_1G default 0x80000000 if VMSPLIT_2G default 0xB0000000 if VMSPLIT_3G_OPT default 0xC0000000 which means that PHYS_OFFSET - PAGE_OFFSET is guaranteed to be 16 MB aligned if PHYS_OFFSET is 16 MB aligned. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel