From patchwork Mon Oct 29 19:00:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10660159 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 786EC13BF for ; Mon, 29 Oct 2018 19:25:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72FCC28A5B for ; Mon, 29 Oct 2018 19:25:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65EDC29F54; Mon, 29 Oct 2018 19:25: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 DAC2C28A5B for ; Mon, 29 Oct 2018 19:25:12 +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=6uYd5dGjipKPUy5kjZAL276ut3MjpyciukYA6D6rMZc=; b=JXKgCf0MnRJWztl/U6o8OQ4bK0 6YOQCD/We2TJpJlMq16mNvA4w5BPXTEe3CbuFeF8A9MTw5f7sOFch5bqYhf4xr1VUjm2M1MUcqG66 QB+NeseF8+xRpxy0bZNh516RiIcEOF9w+9+s4aAqQ/qAtsGGhxzefNE2omfQwbc15ruRGfkKeivcQ ak+6uhrjNGtBXkaXuR9Ji1fARvxTGzE8LaFcnA6QLH/KfkncLbAu5BXAEzaD8x+lZO/X8DRYESldM mWUFxOOUSzJQNIWwal/D/crsHBMRP9OYt8f7JwU2aI5hqnbrf8cuDuCiT6rOTCBniA0bh1cxP0ZiG TbCUdwAg==; 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 1gHD9u-00035c-PM; Mon, 29 Oct 2018 19:25:06 +0000 Received: from mail-yb1-xb42.google.com ([2607:f8b0:4864:20::b42]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHD8c-0002VO-02 for linux-arm-kernel@lists.infradead.org; Mon, 29 Oct 2018 19:23:56 +0000 Received: by mail-yb1-xb42.google.com with SMTP id g9-v6so3947182ybh.7 for ; Mon, 29 Oct 2018 12:23:33 -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=IHTYtlDQysopH/0k213hDNMRKYTEPiF5GpZvkqXkLyQ=; b=Hrpn5ZdKlJRLhFupDCCpMwHTAFQEz0zJ6xVM1l4ESQStAsj9QwF2Q+5pFiznntWV2P 8bPD88SwLYQbcRUsTxLqvXnX9Fuui4iDSbcMTGmCbdfMFfVVOBPoqP3dgHIN5II43CpN vohAWgB3X1jB4Vbme463Mec2t6cQvwZlEVEMZouVVRfcEgyO1tTDcLfDfeUIN0FF5KdF BgQuuW4xjjB2Q0Kpb3HtRt0RBmfpcY7q3TofXjBXgGpHcs2IfG7OuD0cUqla1jvZlbaa yrhiHuJdfeG5SW5I3dCJAKGRB07S1owLP7yue7SwFpJTVXla+FHTfdcAAD2ytMopOZmn lDFw== 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=IHTYtlDQysopH/0k213hDNMRKYTEPiF5GpZvkqXkLyQ=; b=cIRtOn3r7LBFVFoWiWxzNqh9vnIhBq8ViUg21xfsH+awYk2aHtFyKeNaWmw+VqpfOF HFZdB8V2I/4WxKr28/09o5aFwHmdH1DxuPX7jJ/Fl6ibkk1+0KACHDIL8q36aE6Z/f9H BIsTpoyXc08cTx86yDAR5XToHE1VEu7K4pcar1z7X3/yZEbW3EYrX0HJqmOvdDcd+Vjq pGU+7BqgibFKfiu+2hX21EZs13NXLtQjXddn1muvkeZMFqNUVY0kXiaFhyq8Qx7sF3qs qCGzNdfanYFfw5JZ/ablAFE2/0B9ueilq8DzHrwUnew0hhnnGYdJpuKG/HTZ0QJWPHjZ /PaQ== X-Gm-Message-State: AGRZ1gJGGWXU0b4P8roUKitdDBszPQg4zs5D9be1pG4OTG0nasAu/gKs XyebKjagnxmqX25eNvFQqMM= X-Google-Smtp-Source: AJdET5c0VsDtIxa10FRnWYrRAA+5kbaGIwFIXC9+c9puXVAKyWcvY/OAKYhQEKCTwrf2c+gIVYLV2g== X-Received: by 2002:a25:b43:: with SMTP id 64-v6mr15101073ybl.133.1540841012023; Mon, 29 Oct 2018 12:23:32 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id k85-v6sm5410014ywa.76.2018.10.29.12.23.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 12:23:30 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH 1/2 v5] arm64: Get rid of __early_init_dt_declare_initrd() Date: Mon, 29 Oct 2018 12:00:13 -0700 Message-Id: <20181029190014.6455-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181029190014.6455-1-f.fainelli@gmail.com> References: <20181029190014.6455-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181029_122346_085182_4D62E17D X-CRM114-Status: GOOD ( 21.14 ) 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 , Frank Rowand , Florian Fainelli , linux@armlinux.org.uk, Mike Rapoport , Andrey Ryabinin , Laura Abbott , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , Marc Zyngier , Andrey Konovalov , Kristina Martsenko , Russell King , Rob Herring , "moderated list:ARM64 PORT AARCH64 ARCHITECTURE" , 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 perform the virtual to physical conversion of these addresses in arm64_memblock_init() where relevant. Signed-off-by: Florian Fainelli Signed-off-by: Mike Rapoport --- arch/arm64/include/asm/memory.h | 8 ------- arch/arm64/mm/init.c | 42 +++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 23 deletions(-) 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..292570b08f85 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -62,6 +62,8 @@ s64 memstart_addr __ro_after_init = -1; phys_addr_t arm64_dma_phys_limit __ro_after_init; +static phys_addr_t phys_initrd_start, phys_initrd_end; + #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_end = start + size; } return 0; } @@ -364,6 +366,7 @@ static void __init fdt_enforce_memory_region(void) void __init arm64_memblock_init(void) { const s64 linear_region_size = -(s64)PAGE_OFFSET; + u64 __maybe_unused base, size; /* Handle linux,usable-memory-range property */ fdt_enforce_memory_region(); @@ -408,14 +411,25 @@ 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) && + (initrd_start || phys_initrd_start)) { /* * 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; + if (phys_initrd_start) { + /* Command line specified the initrd location */ + initrd_start = __phys_to_virt(phys_initrd_start); + initrd_end = __phys_to_virt(phys_initrd_end); + } else if (initrd_start) { + /* FDT specified the initrd location */ + phys_initrd_start = __pa(initrd_start); + phys_initrd_end = __pa(initrd_end); + } + + base = phys_initrd_start & PAGE_MASK; + size = PAGE_ALIGN(phys_initrd_end - phys_initrd_start); /* * We can only add back the initrd memory if we don't end up @@ -434,6 +448,13 @@ void __init arm64_memblock_init(void) memblock_remove(base, size); /* clear MEMBLOCK_ flags */ memblock_add(base, size); memblock_reserve(base, size); + + /* + * initrd_below_start_ok can be changed by + * __early_init_dt_declare_initrd(), set it back to what + * we want here. + */ + initrd_below_start_ok = 0; } } @@ -455,19 +476,10 @@ void __init arm64_memblock_init(void) } /* - * Register the kernel text, kernel data, initrd, and initial + * Register the kernel text, kernel data and initial * pagetables with memblock. */ 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); - } -#endif early_init_fdt_scan_reserved_mem(); From patchwork Mon Oct 29 19:00:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10660157 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 0FDCD13BF for ; Mon, 29 Oct 2018 19:24:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09D1A28C05 for ; Mon, 29 Oct 2018 19:24:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF36729F68; Mon, 29 Oct 2018 19:24: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=-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 88E8028C05 for ; Mon, 29 Oct 2018 19:24:25 +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=EajIXMLj7mNLnd9o/MbWqql9UA2/dIUEb2LPYSgJWvg=; b=EGpkU5HL307vOyOYLygmV6ezFK /ggL8jsi93JPrQMk1Qs5vXf1w37xrZ6kz5MGBolVmPSz09Ap0zE2JJgmVtuenBBWOryGnnQNrBkIq sts6Pp38BiVFauV0qINzgYglWN+HNQrvjOIDyd2ya/Xd+VGQPUkwpuvqcgYwwAdOAJtyU5/QW2EdS o8P0X94Q8lQ/b5/G4lL037u/l7dPxTU4MTXtJKmU1/Xp27l2f9bwqP1LfWbzB22SeVEz1ZJgI2/wQ iU9KvPLfQenYAoLSQGIdH5QLas4VMUP4A8eoaFkYj/AuCo4rk7cVKoZtK9Pg2lGLoct6yh650DYaP fccBv8kg==; 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 1gHD9B-0002mj-2X; Mon, 29 Oct 2018 19:24:21 +0000 Received: from mail-yw1-xc42.google.com ([2607:f8b0:4864:20::c42]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHD8d-0002W0-9e for linux-arm-kernel@lists.infradead.org; Mon, 29 Oct 2018 19:23:55 +0000 Received: by mail-yw1-xc42.google.com with SMTP id v199-v6so3874699ywg.1 for ; Mon, 29 Oct 2018 12:23:36 -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=YL0HdZkPCdw1CCL6gh+aOFZfOsDccPVqMbEblUSgKXk=; b=t3hWFQZXTa3gdT8u5roAeXBpOVMmucs7Sml7jofbKrNFaCyk3Wk07zYk2+RpOralEw YPeEPdMvHXTLGZkds4fJZgc8zKxDFkbHS06tZjP3oNOhRIHs1BEJOU0dHCAShOtsjjZo dAWaRZacS13+qj7UyhjfIaahpmiJ3RQKFLzhgcwBBmKIi4heAiPbT3Aknsw/G1ckMpLx jFVb4d3FL2ST4Pa/HUdQ6dFZ9M7Hbc0qW1oaD8WseJnD8N+X/XCoH8YxH7dv7HyvCN87 BXaBVGZGr1QAs/MIOEDq4bj2lVuUQDW0aHT/XcShKyxFjRF9gyU3VP156CU1elPTbhW9 DFZw== 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=YL0HdZkPCdw1CCL6gh+aOFZfOsDccPVqMbEblUSgKXk=; b=q1R25BC6R48WJxcwXGQkOtJLjzekP0dhj3ydtHwlZNBtpfyI9gNhcFFUELzkIB0QjC LSns+7RMJgzV0wscObfBUG/iNRCKrpL29N33z6i1Uqssuanh/Vb9J13AGUfgQqz0ZPIY 8iBYLR0nZvNRzlMd2JO5xTzx8736Lnp5K+94ZUjbSwcLxA0mACPEqHpiSni4WEJXfbyY 6p9bhLf/SuTCGfHyEXJbVCQCjWtQveA8ADkfUk9tzn3rxJtJdJadGsOTWqK4mowqA8QR c1p52NV6cMzuNuMzBNhWqkaA1UIXLuyT++oL/WzbGUsWfqzsh2zntx71nnPcMgAKVzVv 8/JA== X-Gm-Message-State: AGRZ1gJeEdolWDHtcFao/wPW2X/CQcXsTzWtGzUkW2rLK6QbRAtmwDQV taT8/09jSlFOLByYf3l8lzQ= X-Google-Smtp-Source: AJdET5cgRCqX84F0H+HUxaYu2M5Bp0gYI/v2sSKNjUsmqEqtruOiIQpOjlJ+xeWQt7SpUYFNQVYPWw== X-Received: by 2002:a0d:d205:: with SMTP id u5-v6mr15271650ywd.427.1540841015022; Mon, 29 Oct 2018 12:23:35 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id k85-v6sm5410014ywa.76.2018.10.29.12.23.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 12:23:33 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH 2/2 v5] of/fdt: Remove definition check for __early_init_dt_declare_initrd() Date: Mon, 29 Oct 2018 12:00:14 -0700 Message-Id: <20181029190014.6455-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181029190014.6455-1-f.fainelli@gmail.com> References: <20181029190014.6455-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181029_122347_388912_24806C0F X-CRM114-Status: GOOD ( 13.58 ) 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 , 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 , "moderated list:ARM64 PORT AARCH64 ARCHITECTURE" , 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 With the one and only architecture (ARM64) no longer defining a custom __early_init_dt_declare_initrd() function, just get rid of the check for that function being already defined. Signed-off-by: Florian Fainelli --- drivers/of/fdt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 76c83c1ffeda..0f6430265e4d 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -892,7 +892,6 @@ const void * __init of_flat_dt_match_machine(const void *default_match, } #ifdef CONFIG_BLK_DEV_INITRD -#ifndef __early_init_dt_declare_initrd static void __early_init_dt_declare_initrd(unsigned long start, unsigned long end) { @@ -900,7 +899,6 @@ static void __early_init_dt_declare_initrd(unsigned long start, initrd_end = (unsigned long)__va(end); initrd_below_start_ok = 1; } -#endif /** * early_init_dt_check_for_initrd - Decode initrd location from flat tree