From patchwork Mon Oct 29 23:52:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10660397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4EBBF14E2 for ; Mon, 29 Oct 2018 23:57:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3649928CD0 for ; Mon, 29 Oct 2018 23:57:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2307129238; Mon, 29 Oct 2018 23:57:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B2AE28CD0 for ; Mon, 29 Oct 2018 23:57:17 +0000 (UTC) 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0jywFFKAFmnNmeYfDpB37kF0wyrVAz7eTf2b3zuXCR0=; b=h9hYFW8Ao7jVnWZXmwMqoil2CT +efDMGX1KKYgrt/p5XQ+2lEIbcHlRRXefdgnz/BHOglIKPi0D/xhMfzFmuvonPosv+0XdXV2N1O5V nCr3Bun5WrgXM84xy7kTPI83o8WIcIaDSIfItxT69g+7j5cyix665npGgkbvNvOulwsA/nb68KIob YBtQ60KDuhROWG0KLr19/wuNvwriAxhDGvoNgiBr4xsOAZnoUbDlZlAy/0hzo9mGD9KxkrzCAvbag /p+sk80aiZCMOG0nGmWBHai/VYT2sG9eG/92Q0CZ9zJQ0vXF6juyXfpdMhwJFVgVCO8zqEl59XiQJ /pZwrQtw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHHP3-00073u-Le; Mon, 29 Oct 2018 23:57:01 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHHL4-00043m-NO for linux-arm-kernel@lists.infradead.org; Mon, 29 Oct 2018 23:53:19 +0000 Received: by mail-pg1-x543.google.com with SMTP id c10-v6so4683964pgq.4 for ; Mon, 29 Oct 2018 16:52:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fU/03j6hWRyu9xAaSEpO9kPy+MSb5qCckFcBZmMx+bY=; b=hTaMoOvk6uRPCTs5sir3RKYA+OAF3jlRfZAq1m48fxSAozlUi6oQ3gnEbmRn/ZcYRm 2OZlfoLmw3YCaywb8j0+J9xpkRWhCe/wabDZzikx5R4JtOgRY7QNN7FlRSn9lZ2PEWDu djKWE9N3lU8qVfoEFixfA8mYhSz3sGk1o8XoGmHkfr4eMuwVKgRTYspKKjcWNQT6BWdf Mi0EzAfxGcrD3CWHsm49Ai74l3F8Hg3Fqlq9c+ja9NLKM7s6jsozk4FtMAex7KGGc3wC 6rRKaaqZ11hgwfGanhmwznFzD7dvqD5wTEsIqVw8ETgGdo/8hw7TuskIbgdKZtzu9hd2 DVAw== 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:in-reply-to :references; bh=fU/03j6hWRyu9xAaSEpO9kPy+MSb5qCckFcBZmMx+bY=; b=XGQ5OwaEp1F341HTJMh9mAsZ1Aq2tA7DIZ60paIx93FKb7YyVtviuo3ij3ZSuOPRZV +S6HjY7sjJ7jVeWm6b7PLUPHEtFQMTQAIs01ljnBfSZq2M1WEi0M2kx6t/hItXW6f6SM qMsT48CSwPyAiRrQfapQCjTNhMjnnmG2rOH1MXKL2NgvF3eDoNXJyFzwal5lwOb7ktag RjboF4FrjrkFMHu4kLNFUSpGm+EZGBsysNe3JWzTFPVEeFnW+YWQUJQcSIJQdURPNCx6 k2vRDKLsoAvHJmsheUdned7aQZI5br4z3x+lFjotm0wwdZhHFTGRUY0h5v/ZvaRZN17r SRaw== X-Gm-Message-State: AGRZ1gIJ5BH95Estf69LEaeGTvIuw6l+E1RCjN9Vy30FQ4ib2cOzucNq srKKZTUzUA+1DfJPNMt0rVI= X-Google-Smtp-Source: AJdET5eHSYsttLAS3SM9hiiHEDvnZ6ilH9qmF6+vipuY0cF622QYjwqgrSyt8Uha2YUYRx0M29GeKw== X-Received: by 2002:a62:8c93:: with SMTP id m141-v6mr460947pfd.239.1540857163842; Mon, 29 Oct 2018 16:52:43 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id k13-v6sm22537981pff.30.2018.10.29.16.52.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 16:52:42 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH 5/6] arm64: Utilize ARCH_HAS_PHYS_INITRD Date: Mon, 29 Oct 2018 16:52:05 -0700 Message-Id: <20181029235206.30060-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181029235206.30060-1-f.fainelli@gmail.com> References: <20181029235206.30060-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181029_165254_881985_955C923C X-CRM114-Status: GOOD ( 20.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: CHANDAN VN , Catalin Marinas , Will Deacon , Stefan Agner , Masahiro Yamada , deanbo422@gmail.com, Frank Rowand , Florian Fainelli , linux@armlinux.org.uk, rppt@linux.ibm.com, Andrey Ryabinin , Laura Abbott , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , Marc Zyngier , Andrey Konovalov , Kristina Martsenko , Russell King , Rob Herring , green.hu@gmail.com, gxt@pku.edu.cn, "moderated list:ARM64 PORT AARCH64 ARCHITECTURE" , ard.biesheuvel@linaro.org, Johannes Weiner , Andrew Morton , Robin Murphy , Greg Hackmann MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP ARM64 is the only architecture that re-defines __early_init_dt_declare_initrd() in order for that function to populate initrd_start/initrd_end with physical addresses instead of virtual addresses. Instead of having an override, just get rid of that implementation and select ARCH_HAS_PHYS_INITRD which would do that for us. Signed-off-by: Florian Fainelli --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/memory.h | 8 -------- arch/arm64/mm/init.c | 23 +++++++++++------------ 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 964f682a2b7b..302fb721d412 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -21,6 +21,7 @@ config ARM64 select ARCH_HAS_GIGANTIC_PAGE if (MEMORY_ISOLATION && COMPACTION) || CMA select ARCH_HAS_KCOV select ARCH_HAS_MEMBARRIER_SYNC_CORE + select ARCH_HAS_PHYS_INITRD select ARCH_HAS_PTE_SPECIAL select ARCH_HAS_SET_MEMORY select ARCH_HAS_SG_CHAIN diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index b96442960aea..dc3ca21ba240 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -168,14 +168,6 @@ #define IOREMAP_MAX_ORDER (PMD_SHIFT) #endif -#ifdef CONFIG_BLK_DEV_INITRD -#define __early_init_dt_declare_initrd(__start, __end) \ - do { \ - initrd_start = (__start); \ - initrd_end = (__end); \ - } while (0) -#endif - #ifndef __ASSEMBLY__ #include diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 3cf87341859f..fef9eb7fdb50 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -61,6 +61,8 @@ */ s64 memstart_addr __ro_after_init = -1; phys_addr_t arm64_dma_phys_limit __ro_after_init; +phys_addr_t phys_initrd_start __initdata; +unsigned long phys_initrd_size __initdata; #ifdef CONFIG_BLK_DEV_INITRD static int __init early_initrd(char *p) @@ -72,8 +74,8 @@ static int __init early_initrd(char *p) if (*endp == ',') { size = memparse(endp + 1, NULL); - initrd_start = start; - initrd_end = start + size; + phys_initrd_start = start; + phys_initrd_size = size; } return 0; } @@ -408,14 +410,14 @@ void __init arm64_memblock_init(void) memblock_add(__pa_symbol(_text), (u64)(_end - _text)); } - if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) { + if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && phys_initrd_size) { /* * Add back the memory we just removed if it results in the * initrd to become inaccessible via the linear mapping. * Otherwise, this is a no-op */ - u64 base = initrd_start & PAGE_MASK; - u64 size = PAGE_ALIGN(initrd_end) - base; + u64 base = phys_initrd_start & PAGE_MASK; + u64 size = PAGE_ALIGN(phys_initrd_size); /* * We can only add back the initrd memory if we don't end up @@ -460,13 +462,10 @@ void __init arm64_memblock_init(void) */ memblock_reserve(__pa_symbol(_text), _end - _text); #ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start) { - memblock_reserve(initrd_start, initrd_end - initrd_start); - - /* the generic initrd code expects virtual addresses */ - initrd_start = __phys_to_virt(initrd_start); - initrd_end = __phys_to_virt(initrd_end); - } + /* the generic initrd code expects virtual addresses */ + initrd_start = __phys_to_virt(phys_initrd_start); + initrd_end = initrd_start + phys_initrd_size; + initrd_below_start_ok = 0; #endif early_init_fdt_scan_reserved_mem();