From patchwork Tue Oct 30 23:07:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10661809 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 8FD4314DE for ; Tue, 30 Oct 2018 23:09:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F3402A6DD for ; Tue, 30 Oct 2018 23:09:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72B732A6F7; Tue, 30 Oct 2018 23:09:13 +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 134CE2A6DD for ; Tue, 30 Oct 2018 23:09:13 +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=aqJPtRRpBj5D4yQhgOihfVj4j2ii2pL5ARU/EipbRxQ=; b=r71doe/UcaXCZAde4tLiDr5n3R 5HFTVsKcdNcFqtjvlWxpXrkFjp4XZ78VbAL3zdkOpuxDez0YHJOpTzlKkEICpeJIw5r07aBDHVSKq LDiIRQi8wvSk6oHKTFLSDVx9h4/bGtTUhdO7Pxpme4+NVzL2TfzTB091OMN1w92NCrPF7dIHSInnG d/tp/AopJqteqz/4oGZPdtum92NGdZvwNnz0dOiXGZ04Iks1KZTpvMxHRkFKMau4GARCc7KGr0NTI Vw15p0xNaKUlIqQ5Waw6LULAhtLCQqvpuPZUVxgsvRimbD+XCAe17zdHvs7H7xBOJ7uKoTSW69k6h itv/sqNQ==; 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 1gHd8J-0004KE-Lx; Tue, 30 Oct 2018 23:09:11 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHd7E-0002wb-IP; Tue, 30 Oct 2018 23:08:08 +0000 Received: by mail-pl1-x641.google.com with SMTP id b5-v6so5672963pla.6; Tue, 30 Oct 2018 16:07:54 -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=CteUHCiT3bh5b73LsUL36lgcSDw4lEHSbSt99SlriBg=; b=UUXhujGfL14NRDqPfKn6FSvhZSCfkSHNuSb5jfvBJnOc0CLZptOttqXRuyXYZg2bMd 7rj6ddzD+CbrCTySSyyZzBwZoBP/QKiK7yU0bxDG5+vIHY+OX0ecE83Yl/qeIYA3az1f y9RBbutQnQaMojkxq1YZSJUxRQWhDoJnyZeo1czpiEbFe8K9prQ5RmosLxexxJkH6MJ7 56Aq9Ic81IH1sCbTEPIBvrCY8yJXlTyob+r0xkB+g/K6pxUgDvn9WefsWoE4CBcW5hBC oaVUKTab5Zn17XsO9uVcyKnoV+2Y9QiAmGFc9CVGigSw4tRmSOo8xFUGd8S/Jt5SS5Xb 1Pmg== 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=CteUHCiT3bh5b73LsUL36lgcSDw4lEHSbSt99SlriBg=; b=hJT9hZmlDpAyQbUmk19wmZEnV+jTzzatoZCleUWRH0tCvj42fKX7QLq8xOGcAEADAN x0ewxyep1a4Nm/Y+74oo5bKQBGeMXemm5KyU+Nn3q4/06GTr+0MoWOmybsMaMjpm5V8V BoKkSHgMHcm1RhZZBi9l2Dzv1Gh65JXybw7S40FOWxuv3znZcI9kQ1qtMSswvw/ajZ6D 267YmqE1FNxscc1fSih6D5YGP/PtSXl17tKGZl8Wxo0StBPYZ8ddGOwjqjEZdpCYFKoL S0OijnI01N+jiINSi8aJwTgyl1kmCt6zMAJ3sRuXVWDtjz1+JJrNuz03MJ0gLDulJJcL C8zg== X-Gm-Message-State: AGRZ1gI/rjLflwB8aCp0zDpBJuVJ/lDwSlucZBf2T18+dSb6IdtPxS7h CPu9z7l1h0DkMPA8PbKozp4= X-Google-Smtp-Source: AJdET5cyVn4hnvlH85D46Mi/A/vW1eO9/OyDjm75+wkdTfFT/BuaZ4CkNtuXASETZY9tMFK4wqN2ig== X-Received: by 2002:a17:902:8bc6:: with SMTP id r6-v6mr728986plo.0.1540940873633; Tue, 30 Oct 2018 16:07:53 -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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 16:07:52 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH v2 4/6] arm64: Utilize phys_initrd_start/phys_initrd_size Date: Tue, 30 Oct 2018 16:07:19 -0700 Message-Id: <20181030230721.28429-5-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_160804_976512_3EF7A31B X-CRM114-Status: GOOD ( 16.45 ) 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 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 we can leverage drivers/of/fdt.c populating phys_initrd_start/phys_initrd_size to populate those variables for us. Signed-off-by: Florian Fainelli --- arch/arm64/mm/init.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 3cf87341859f..e95cee656a55 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -72,8 +72,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 +408,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 +460,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();