From patchwork Mon Nov 5 22:54:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10669305 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 67C0313BF for ; Mon, 5 Nov 2018 22:58:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B00F266F3 for ; Mon, 5 Nov 2018 22:58:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18BFA27480; Mon, 5 Nov 2018 22:58:25 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 A12C1266F3 for ; Mon, 5 Nov 2018 22:58:24 +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=HMhk4zozMXuDSOSPcbWaY+CIcF+a5pVK+QNw7O7uU3k=; b=B8V6ZIPW3cc5ud5zTmOJpqn+QT nUVcFFawfp+DiHYUoDUi+3590ByLHadzOFWFSGee0harclY5UR4J4IpLo/q/nqZG5+9sKvVXJ5S8P JdIj9RRlsNwNctFZkMi9a77NA9TrT0S5bamkfe9Q/IVouebRlfS0gyDSegcaMrytZJ7V62DXjW/Wj 88tEB3L2yy0A6CecIA+N0e+9EDSef1kuNPQgW5p3QktxyaSd8brD3xTBt9aVY2C1LKyQ80SBx3YXw lD6RQtRHaC7XA3+pQ4lE0CVlFK6TjwP/DVj1UwrI0NgS88BYALLPRFz7/HNHfu3VslffbY5PPHNTt sX5CM1hg==; 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 1gJnp7-0008Vz-Qv; Mon, 05 Nov 2018 22:58:21 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJnoq-0008DI-4P; Mon, 05 Nov 2018 22:58:05 +0000 Received: by mail-pf1-x441.google.com with SMTP id j22-v6so5152565pfh.3; Mon, 05 Nov 2018 14:57:59 -0800 (PST) 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=c8Lf7boHwRJXjni27D65zHCfVda/tTM6oSDLxd215Cs=; b=CyP0IHV4UZ15O/1av2PxKPc3fsM1dB9agK8a5/x5JbPuU8ehNbg93f2Z+H3p8P3exi AUysi1kvzZ/nzXqIkehj9x3Ty4dTQW1tZ2GiD9b1pDhZZhcQLbJBYft327OsaDdMCnda Ok0lC9+RrISTA0Gm2gsdkCQnOQ5EZc7azgT+1N9GydyYITmsfSwncHRfXsaMSz2+uGvc L2a8wReRvETau5kwO0UB9OCTE1M0zy8aFm9wXpj4c1y1OZ7bQkajvflID0pJmpJR9ruu /fO+Un/RWygfM+tHMG3jsuuVW0Dgp6S4GjVs77Y0YVYmTEH8FuFEH3t8NvQ2Sx5fU3mJ b6Yg== 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=c8Lf7boHwRJXjni27D65zHCfVda/tTM6oSDLxd215Cs=; b=lppHHQsrjjhdcd9etVkOSzxsaC7orBMkM53EOrUukzFSgVufnetyQOyPKSnrB+Wuyy /s7/verVo5ZvMcgCIFzskHpdNSIQnn0gED43BugfYzke/mYPDKaR9tif6jswxZVD2SOL SHcTl0qa52kvspsHc7I62wuzSjmX1zFsApOirEbgwuo1gC0YE7Vm5rm8DQwchSe8AY9H Jc7sHSOhIjGxsFtXV0cZIn0yVAyvW0Duvakq6HGhp3H5jbdKksiZcpYUwA/B/fhS+1vn M8uf1IzSHpcA+TsO+mxt9f1xHacaFayKmD9lfroPMz+t16KL+ngGdxiW9OOBtnCXIt/E N/Bw== X-Gm-Message-State: AGRZ1gJzpxCIjeidc4GB8CuEOibjkOXhNAyiE2i9A57Yf/JvrLDqUpan nXZqHDfu/ziwMhKbDUxESdY= X-Google-Smtp-Source: AJdET5dhuO49dXcbh8I0TtFMYPgWKi2MHznTTc59VzZ9ztIqA5GdnfEoAUgfNQ6fHDM39vsQv0cnNQ== X-Received: by 2002:a63:4c6:: with SMTP id 189mr21972247pge.391.1541458678847; Mon, 05 Nov 2018 14:57:58 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id q195sm12898479pgq.7.2018.11.05.14.57.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Nov 2018 14:57:58 -0800 (PST) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH v4 2/6] arch: Make phys_initrd_start and phys_initrd_size global variables Date: Mon, 5 Nov 2018 14:54:27 -0800 Message-Id: <20181105225431.24485-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181105225431.24485-1-f.fainelli@gmail.com> References: <20181105225431.24485-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_145804_201535_AC589631 X-CRM114-Status: GOOD ( 14.66 ) 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" , linux-snps-arc@lists.infradead.org, ard.biesheuvel@linaro.org, vgupta@synopsys.com, 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 Make phys_initrd_start and phys_initrd_size global variables declared in init/do_mounts_initrd.c such that we can later have generic code in drivers/of/fdt.c populate those variables for us. This requires both the ARM and unicore32 implementations to be properly guarded against CONFIG_BLK_DEV_INITRD, and also initialize the variables to the expected default values (unicore32). Signed-off-by: Florian Fainelli --- arch/arm/mm/init.c | 5 ++--- arch/unicore32/mm/init.c | 10 +++++++--- include/linux/initrd.h | 3 +++ init/do_mounts_initrd.c | 3 +++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 32e4845af2b6..438625764ccd 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -50,9 +50,7 @@ unsigned long __init __clear_cr(unsigned long mask) } #endif -static phys_addr_t phys_initrd_start __initdata = 0; -static unsigned long phys_initrd_size __initdata = 0; - +#ifdef CONFIG_BLK_DEV_INITRD static int __init early_initrd(char *p) { phys_addr_t start; @@ -89,6 +87,7 @@ static int __init parse_tag_initrd2(const struct tag *tag) } __tagtable(ATAG_INITRD2, parse_tag_initrd2); +#endif static void __init find_limits(unsigned long *min, unsigned long *max_low, unsigned long *max_high) diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c index cf4eb9481fd6..02aa2c0b295e 100644 --- a/arch/unicore32/mm/init.c +++ b/arch/unicore32/mm/init.c @@ -30,9 +30,7 @@ #include "mm.h" -static unsigned long phys_initrd_start __initdata = 0x01000000; -static unsigned long phys_initrd_size __initdata = SZ_8M; - +#ifdef CONFIG_BLK_DEV_INITRD static int __init early_initrd(char *p) { unsigned long start, size; @@ -48,6 +46,7 @@ static int __init early_initrd(char *p) return 0; } early_param("initrd", early_initrd); +#endif /* * This keeps memory configuration data used by a couple memory @@ -156,6 +155,11 @@ void __init uc32_memblock_init(struct meminfo *mi) memblock_reserve(__pa(_text), _end - _text); #ifdef CONFIG_BLK_DEV_INITRD + if (!phys_initrd_size) { + phys_initrd_start = 0x01000000; + phys_initrd_size = SZ_8M; + } + if (phys_initrd_size) { memblock_reserve(phys_initrd_start, phys_initrd_size); diff --git a/include/linux/initrd.h b/include/linux/initrd.h index 84b423044088..14beaff9b445 100644 --- a/include/linux/initrd.h +++ b/include/linux/initrd.h @@ -21,4 +21,7 @@ extern int initrd_below_start_ok; extern unsigned long initrd_start, initrd_end; extern void free_initrd_mem(unsigned long, unsigned long); +extern phys_addr_t phys_initrd_start; +extern unsigned long phys_initrd_size; + extern unsigned int real_root_dev; diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index d1a5d885ce13..45865b72f4ea 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -16,6 +16,9 @@ int initrd_below_start_ok; unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */ static int __initdata mount_initrd = 1; +phys_addr_t phys_initrd_start __initdata; +unsigned long phys_initrd_size __initdata; + static int __init no_initrd(char *str) { mount_initrd = 0;