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(); From patchwork Fri Oct 26 22:39:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10657931 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 4172B13B5 for ; Fri, 26 Oct 2018 22:41:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34DBC2CA24 for ; Fri, 26 Oct 2018 22:41:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28EF32CA4D; Fri, 26 Oct 2018 22:41:51 +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 B810F2CA24 for ; Fri, 26 Oct 2018 22:41:50 +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=QEo9z5MqWhMfIAodYlE6h6r+SK2We8uEp8HqA8VPsIE=; b=GgPrlP3hOQtxURSY/LTsX7izNc usql2VqyYfizxNj5UqXlXWZ8MwdPrkZWz27wHNuZAIe53PdAL/zO2wVbTYMYgnjwDjDYvV86Byb0i HkC5M0yIiOKVTZDbYBp/WNzVNkNYQAjwiydE35HHzhfcalqKdaVe0n2Z8mT5o7wbZIIlFgvgwqQpD mz3XhL0MHRPcneMHYDaKDhS7gAbZmqK6amQ6hzNiX+k6P6CU2gi1jjM8dXzzpFf5uRw3OB/eOZ1uo /kHw6GNsNkTRmxC48AQzMNndR/AHw3dIdHT2TFIdsoKCnfykKa2XKAGhHRrwduT4AboXh+iqEBR2q K0llReWg==; 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 1gGAnZ-0005YC-Lw; Fri, 26 Oct 2018 22:41:45 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gGAmN-0004zE-43 for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 22:40:36 +0000 Received: by mail-pg1-x544.google.com with SMTP id r9-v6so1165239pgv.6 for ; Fri, 26 Oct 2018 15:40:20 -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=s9oKvIT0NBM4/QkLDCZzAlsB4eCuoBdrv+ulGIgxa6g=; b=ZEelfSNMbOLzf7iIe/u36NptjUa3Rs/vDqHNXDTR/SPFGcJqqhS1aWSQKJxY2Y7R47 POYNNV2SDUYAeOwPV4NXGJwuPn82yxbWk/6gzhEKP4mgxNmeIqhXRoxI6iGvyVAxyjgd B+LXcZoBWTSQG7dZzF6HQ+0/U3TwR8HuOcjlzCTFKYPwxuvlmgyH+yRmhPVIJ1QrTcFI CRVISLp6s97luxj7QXuI+p2DnxjXhrP4CRkXH/w3kTA1+xd16tw9Q9twQGqGwZl18rg4 ibXDTclGyo98JTbo77b5c9VaCdO39WxWnkfP9HL/+Q6qlriNGENeahsVStLaUJ35c2YY NADA== 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=s9oKvIT0NBM4/QkLDCZzAlsB4eCuoBdrv+ulGIgxa6g=; b=da3YNSZxhu45+4O1hCoUVTzIOJ+tDxCP/1PD1EwUvaa3O/vB0+DOkuLxzp/DcNBqpM gFF7kvWK6RIxHHQbvcn7R7l9FobTJPYUUV9a6bUtCpx7bQkl9mOx/+Bd7y82PbME7ze/ 3kYDGi4kB8jYnKY5l836tE/tsgl1yV+4QM0+VuIizIJQIS8V+OLdczAYtPFT+oM69B9e XI4uQkEtMt2RJmNelpkrAIWottMNdZT5waK8kGYM2ewpbz0eiE4CBBV+Wpywl2xrMmd7 pNguUCbVGfDavMLS+Gsi9ijKPNI89h+aM2OO+xFsc7Nh05MJd491aV5gQ3DgfVcn4e06 mLzQ== X-Gm-Message-State: AGRZ1gKo/bldMVQBOiLzFPOK4K5ZS5/b92Y1Hy+5oR+cg38xH2MSF/Xw Mnkhl0ROvz21UHtDV7DJW5k= X-Google-Smtp-Source: AJdET5fyHjPokgv+7kYchOd03fhrhfg0lLcM5fb5tLBIlzi/WVx1W55PqjbJOx4D22iJv3uwzQo8VA== X-Received: by 2002:a63:ce14:: with SMTP id y20-v6mr5342817pgf.248.1540593620029; Fri, 26 Oct 2018 15:40:20 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 15:40:18 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Subject: [PATCH v4 2/2] of/fdt: Remove definition check for __early_init_dt_declare_initrd() Date: Fri, 26 Oct 2018 15:39:51 -0700 Message-Id: <20181026223951.30936-3-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_154031_206554_522A2315 X-CRM114-Status: GOOD ( 13.13 ) 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 800ad252cf9c..797c9e2d6d57 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