From patchwork Tue Oct 30 23:07:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 991175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UruhlX/8"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="b0sSpAaX"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42l6bt0dqPz9sCm for ; Wed, 31 Oct 2018 10:09:14 +1100 (AEDT) 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=Lgh1aX/6C0O4L+OZnXQIZoprcSmCqPeSXDkC0thfZLo=; b=UruhlX/8UE4P/zNT/LnAYbhszC L98y3hG/FdjMQTaQJB9kOCtnz9SAsRwYn6JWRwgSeomhp4rQYU5D0RG30lNr8Bq1lm1/yDXbINoai oTWbBD3XZ21+i8eSpEk+K2A9HuWL3CyU5fxDkh8Z8Fg65Vj5KvN3/ezDCxCjIy+3NQvP2vs1aywrb bfBRtyXx26CegTlTe/zx71fvgs7Q4yqxgsyhmfaUFnWrCuob+bFsO9GDAg78KXrVCWn4JYj1jGA/N HT3zje5Hcoz5rLh2Rdo3gfL0DRdReMl1n+jGCqE/ETTak18ofRcS20iVS73fiqHKu+gmm/7Xw/P0E PV2QwGPw==; 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 1gHd8I-0004Jc-Sn; Tue, 30 Oct 2018 23:09:10 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHd79-0002yw-OU; Tue, 30 Oct 2018 23:08:04 +0000 Received: by mail-pl1-x642.google.com with SMTP id s5-v6so4636036plq.11; Tue, 30 Oct 2018 16:07:59 -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=7vZ19uPI3mKDruwtH4hU5/wYDf7iys0covNZuN4RSWo=; b=b0sSpAaXkV+xyGM/W1Dq7x6l7i0iLY0M7JtiE3/s6y5TUBH+cGaQtDtOf93jahVdTD oHL1TVOyTgX86GsDq8LUIF0rgG32sT1DUbSy9encWrmXzJL67dodIxnKZSuu0NhjzDhv Q4sL/vKzhJ/Hd7Z3YIESj66/39l9rbOXK9dcH1Hl0qpebYme9SM1d+bJGDzh7zQbE1TC uBKgNoEdFV8goBbm0j6gKye5vA/9TfvH6NThX98aaqss9Tv/bHhZCLHcW0n1uXyG0SHx We98aLGRQmim90uKOWeIG2eEFr64WCV+lVFiTE7dms5EPnCe0tZibhjhmXmgQolatwXM tVuw== 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=7vZ19uPI3mKDruwtH4hU5/wYDf7iys0covNZuN4RSWo=; b=cI2EbZeMFpomrrnLYbIfwDy8Rz0ikW+uXjGhKfdcRYIbWjtP+hh4utzfqOrdt1DFhK j01l1gE8P8RJNHBwCyWXLqFtyWCSRlwV/BmcoUM8eKRuaBHnzcwfca2vXbi83SBmstR/ h+NVaEL16PerbJUtXcn01zjyF9He2O2qcWg9gWG7RtslcfUbWmkdKDu+M/naEeBgkVLO qII+uC1f9nXpu5ypg3yJznpxVMsD6iWBwtqrx1L4eiZJ+uwVc5KmQFLFY7mr7rakpNoW /WhnvbTMa/GSzmwsuN1jgD927ynAU/hXpYHjSpVizuMZKgNe8Nn1Y3NNxi+TKMynUFg+ kLyQ== X-Gm-Message-State: AGRZ1gLj4F7F2IO+nuR7i901LNoXg9qJCvKyV9LumPiUux2bTIxlzMCL KBiZkrcLNpIjx3jayg8Y9oY= X-Google-Smtp-Source: AJdET5eviuElsLX8rPl6Mz0asQbMeCOFXEQ6YBKHFU4VYo0dfi/kdR8jNLu5Vd+mraOxhHnBsbScag== X-Received: by 2002:a17:902:4165:: with SMTP id e92-v6mr681021pld.209.1540940878369; Tue, 30 Oct 2018 16:07:58 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id f14-v6sm3431689pgr.87.2018.10.30.16.07.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 16:07:57 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] arch: Move initrd= parsing into do_mounts_initrd.c Date: Tue, 30 Oct 2018 16:07:21 -0700 Message-Id: <20181030230721.28429-7-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181030230721.28429-1-f.fainelli@gmail.com> References: <20181030230721.28429-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181030_160800_208535_539461E8 X-CRM114-Status: GOOD ( 15.15 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:642 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (f.fainelli[at]gmail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors 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-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org ARC, ARM, ARM64 and Unicore32 are all capable of parsing the "initrd=" command line parameter to allow specifying the physical address and size of an initrd. Move that parsing into init/do_mounts_initrd.c such that we no longer duplicate that logic. Signed-off-by: Florian Fainelli --- arch/arc/mm/init.c | 25 +++++-------------------- arch/arm/mm/init.c | 17 ----------------- arch/arm64/mm/init.c | 18 ------------------ arch/unicore32/mm/init.c | 18 ------------------ init/do_mounts_initrd.c | 17 +++++++++++++++++ 5 files changed, 22 insertions(+), 73 deletions(-) diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index ba145065c579..369d3d699929 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c @@ -79,24 +79,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) base, TO_MB(size), !in_use ? "Not used":""); } -#ifdef CONFIG_BLK_DEV_INITRD -static int __init early_initrd(char *p) -{ - unsigned long start, size; - char *endp; - - start = memparse(p, &endp); - if (*endp == ',') { - size = memparse(endp + 1, NULL); - - initrd_start = (unsigned long)__va(start); - initrd_end = (unsigned long)__va(start + size); - } - return 0; -} -early_param("initrd", early_initrd); -#endif - /* * First memory setup routine called from setup_arch() * 1. setup swapper's mm @init_mm @@ -141,8 +123,11 @@ void __init setup_arch_memory(void) memblock_reserve(low_mem_start, __pa(_end) - low_mem_start); #ifdef CONFIG_BLK_DEV_INITRD - if (initrd_start) - memblock_reserve(__pa(initrd_start), initrd_end - initrd_start); + if (phys_initrd_size) { + memblock_reserve(phys_initrd_start, phys_initrd_size); + initrd_start = __va(phys_initrd_start); + initrd_end = initrd_start + phys_initrd_size; + } #endif early_init_fdt_reserve_self(); diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 4bfa08e27319..58ec68709606 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -52,23 +52,6 @@ unsigned long __init __clear_cr(unsigned long mask) #endif #ifdef CONFIG_BLK_DEV_INITRD -static int __init early_initrd(char *p) -{ - phys_addr_t start; - unsigned long size; - char *endp; - - start = memparse(p, &endp); - if (*endp == ',') { - size = memparse(endp + 1, NULL); - - phys_initrd_start = start; - phys_initrd_size = size; - } - return 0; -} -early_param("initrd", early_initrd); - static int __init parse_tag_initrd(const struct tag *tag) { pr_warn("ATAG_INITRD is deprecated; " diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index e95cee656a55..9045afacd10b 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -62,24 +62,6 @@ s64 memstart_addr __ro_after_init = -1; phys_addr_t arm64_dma_phys_limit __ro_after_init; -#ifdef CONFIG_BLK_DEV_INITRD -static int __init early_initrd(char *p) -{ - unsigned long start, size; - char *endp; - - start = memparse(p, &endp); - if (*endp == ',') { - size = memparse(endp + 1, NULL); - - phys_initrd_start = start; - phys_initrd_size = size; - } - return 0; -} -early_param("initrd", early_initrd); -#endif - #ifdef CONFIG_KEXEC_CORE /* * reserve_crashkernel() - reserves memory for crash kernel diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c index f2f815d46846..99acdb829a7e 100644 --- a/arch/unicore32/mm/init.c +++ b/arch/unicore32/mm/init.c @@ -31,24 +31,6 @@ #include "mm.h" -#ifdef CONFIG_BLK_DEV_INITRD -static int __init early_initrd(char *p) -{ - unsigned long start, size; - char *endp; - - start = memparse(p, &endp); - if (*endp == ',') { - size = memparse(endp + 1, NULL); - - phys_initrd_start = start; - phys_initrd_size = size; - } - return 0; -} -early_param("initrd", early_initrd); -#endif - /* * This keeps memory configuration data used by a couple memory * initialization functions, as well as show_mem() for the skipping diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 45865b72f4ea..732d21f4a637 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -27,6 +27,23 @@ static int __init no_initrd(char *str) __setup("noinitrd", no_initrd); +static int __init early_initrd(char *p) +{ + phys_addr_t start; + unsigned long size; + char *endp; + + start = memparse(p, &endp); + if (*endp == ',') { + size = memparse(endp + 1, NULL); + + phys_initrd_start = start; + phys_initrd_size = size; + } + return 0; +} +early_param("initrd", early_initrd); + static int init_linuxrc(struct subprocess_info *info, struct cred *new) { ksys_unshare(CLONE_FS | CLONE_FILES);