From patchwork Fri Oct 26 22:39:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10657929 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 51C3613B5 for ; Fri, 26 Oct 2018 22:41:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4267C2C7FB for ; Fri, 26 Oct 2018 22:41:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 367B82CA17; Fri, 26 Oct 2018 22:41:10 +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 A10EF2C9FD for ; Fri, 26 Oct 2018 22:41:09 +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=mumMdGTud2aDGOW8PCzXY8sa8ApyiPm1uwEGXPlNJkk=; b=j/8+Ov+mLvviMWF91Mmk5embaI WWL0CZ5HBgXaQ17XDtwfXsypQYeDDeqL9mmIrX3xeIai+M1whwEmXkUVpUYBhNFhudg821tFFJmE6 qip/zCYWx17l2OFdqFStAwrNi1g1dDHgFMOJmzXC+694+tunKIHPOAuKuTVdgRn4+56ur9Jt4YJ1O Px7E4XutllmLvP6WQus3B9yC8KEa5Y7YoQFHqVhGJPPoEwyd0+u1PPepbmXGZzjQbCErwPYkD6XY1 HP7Y43/ZxN3cGrpqEoFnKa3Yf3H4IcWCXt3MUWthvVF3+mJHWIAjevbGopOrDOmNn8uNZm3d3C6Ro vR8WhZZA==; 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 1gGAmu-0005Et-Ko; Fri, 26 Oct 2018 22:41:04 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gGAmK-0004yy-UG for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 22:40:30 +0000 Received: by mail-pf1-x444.google.com with SMTP id a19-v6so1205220pfo.8 for ; Fri, 26 Oct 2018 15:40:18 -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=ajLeZHbXlraLlHu/vc18f241KhI3uvW5mJ0MvkSXLxU=; b=blN82QXNjSo0G+D078OWEQnw+uf/ibJjIbW5pVeKIESpOhFGCT/wWDwWOsKqOs1+cT rA1LVBwUlaBEpixZ5AH0NTImEfIqhOfNTkWvjlGxNUntz/YChQyS7KwnPZGEYsDbMLmp F8EcjLRpVnqB6o2MzccIdTHMTJEU0IxPqZO3igQkJGjJXinS+YEFaebC3eJkSefDPrPh SByr34Ft0AabUVVPhcgqyKYycQ9nPaTlvXC86ZAG9oun/l/b1Riu88Wre0MgDnVrSPoz VxU+VUKcLhx4bwaFXZ5gA2xW0kQqvLetvtYQgZ39/TzgFkSEO6IsJvgxDzRKi45Aqu8l rN1Q== 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=ajLeZHbXlraLlHu/vc18f241KhI3uvW5mJ0MvkSXLxU=; b=lc2whZQx/qCaZ1m6IO2Ms3F46KjwJuQQPg61sgnqtrWaZppWXNmav6S7+tzzMQ9LsN NiTq43beweD61L6pYcE1//NvRsUUSTGqesqZf3SLiaDwgMMhCrkrHPVQ0aHH/TwDffu5 r/HaTrcB2P+iPUo28yCXnhp/mVch78/teETMRRUF3FRALkB9luyADwbd38j+LJ7gzL6j x7B2Z6ca8CTh83kMnG4FWE0VHAKZ7d6g5jmjCkkgWJJUSJZEmLVON9DldOs3JWERRtAk GgMwEFxYA61rS6LZ61C3XV4oFTLbqYzlY01Y55t5A5Ty1w+Tv0yCAgvgIQM+zWwQnB3/ OToQ== X-Gm-Message-State: AGRZ1gJmStgzWk+77eUIxC1DsglMlAJgj/dCJCPUEemQzkQJoDZb5Wgr biiB632gn6QCFag9BRZDHxs= X-Google-Smtp-Source: AJdET5d9FOPg22MaXmTiIwoILCL//VIiMtUqoeckcPvGhb6+EbiQHHquNGbkz8SZflHmRsrCQgJYbg== X-Received: by 2002:a63:9845:: with SMTP id l5mr5217527pgo.142.1540593617801; Fri, 26 Oct 2018 15:40:17 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id t9-v6sm3665536pgl.37.2018.10.26.15.40.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 15:40:16 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH v4 1/2] arm64: Get rid of __early_init_dt_declare_initrd() Date: Fri, 26 Oct 2018 15:39:50 -0700 Message-Id: <20181026223951.30936-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181026223951.30936-1-f.fainelli@gmail.com> References: <20181026223951.30936-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181026_154029_008206_D1EB9167 X-CRM114-Status: GOOD ( 18.56 ) 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 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: Florian Fainelli Signed-off-by: Mike Rapoport --- arch/arm64/include/asm/memory.h | 8 -------- arch/arm64/mm/init.c | 26 ++++++++++++++++---------- 2 files changed, 16 insertions(+), 18 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..98ff0f7a0f7a 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -364,6 +364,9 @@ static void __init fdt_enforce_memory_region(void) void __init arm64_memblock_init(void) { const s64 linear_region_size = -(s64)PAGE_OFFSET; + unsigned long __maybe_unused phys_initrd_size; + u64 __maybe_unused phys_initrd_start; + u64 __maybe_unused base, size; /* Handle linux,usable-memory-range property */ fdt_enforce_memory_region(); @@ -414,8 +417,11 @@ void __init arm64_memblock_init(void) * 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; + phys_initrd_start = __pa(initrd_start); + phys_initrd_size = __pa(initrd_end) - phys_initrd_start; + + base = phys_initrd_start & PAGE_MASK; + size = PAGE_ALIGN(phys_initrd_size); /* * We can only add back the initrd memory if we don't end up @@ -459,15 +465,15 @@ void __init arm64_memblock_init(void) * 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); + if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_start) { + memblock_reserve(phys_initrd_start, phys_initrd_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; } -#endif early_init_fdt_scan_reserved_mem();