From patchwork Thu Mar 3 23:55:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8497221 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EB21EC0553 for ; Thu, 3 Mar 2016 23:59:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14911201CE for ; Thu, 3 Mar 2016 23:59:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39BB82026F for ; Thu, 3 Mar 2016 23:59:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1abd82-0007uK-Ry; Thu, 03 Mar 2016 23:57:58 +0000 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1abd6N-0006el-MD for linux-arm-kernel@lists.infradead.org; Thu, 03 Mar 2016 23:56:17 +0000 Received: by mail-pf0-x244.google.com with SMTP id q129so2169292pfb.3 for ; Thu, 03 Mar 2016 15:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/HZI9yTaoQuuGYGLOkUDhSVMEHYo55WWWitoDdjTAvI=; b=DZJAaX47JMr7nlV95tH6EekhhVkIf9y+jyE5wwMtVe/21yMnQ1onJkig9WxifOsjFK uFGD7oZz3pMcpcNKALuV3vSmmkhRCHuN0Z/stMY7ffMd2MsCdWgM0TOF92zKziSY2Glg fGxJvEIs7/T7J2STRNj/Dv+fBMxJuVMzk7EDCBHT+pSz4uTrKQAOjv+XKIPz8e4HtOYr GOv1CPrczovMUoB80jF4X1QFtTwjg/1chE5ul/fY4X6N5czeA0FV7+8ERewJ5wuvnGrv fo4+vcvg+Y8bhTKPsUAu41/YEsZORf6qONu5O36aZFnGInsVivkR3eKkeBAG3BVcuyU9 BKKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/HZI9yTaoQuuGYGLOkUDhSVMEHYo55WWWitoDdjTAvI=; b=bGqnueWvK0UKTE8yh7ax5taEihNeJK6AudveilynlfkrqxOshlgbGUHx3LHq3GMS1a ZrfckvrLTutq02M+rnuSYfvPfFG4EajOu9DAcldhtHugwIt2Nk32lOEE17OMpTP3Q8xl o0v7iq8MMxaZ+m+V6q10mCVok4mggywaXSoV4SnFmf+f9hNPEzitplQ6J8dklCchl0fQ BIpVwvSAkmwYYMPZuDK5iu5ZS88O6zhMG1tcERdZTwhDMr4hdAWiQUJyCBRiQpbCAZes aX+QC2KjJFY5hMGehJg0B/Eh6/33+vF36/TR4I7ujL6SKYJDp9LBYPU2HmnoNWOFCEZv gY3g== X-Gm-Message-State: AD7BkJJRXzZLZv0BnHskEfqnS3bLsvup0NEcMLSf918th3qYNq17MNSvKP7h2TnU9dCxKQ== X-Received: by 10.98.15.17 with SMTP id x17mr7764769pfi.52.1457049354697; Thu, 03 Mar 2016 15:55:54 -0800 (PST) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id vy6sm645655pac.38.2016.03.03.15.55.44 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 03 Mar 2016 15:55:46 -0800 (PST) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id u23NthKC023406; Thu, 3 Mar 2016 15:55:43 -0800 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u23NthXe023405; Thu, 3 Mar 2016 15:55:43 -0800 From: David Daney To: Will Deacon , linux-arm-kernel@lists.infradead.org, Rob Herring , Frank Rowand , Grant Likely , Pawel Moll , Ian Campbell , Kumar Gala , Ganapatrao Kulkarni , Robert Richter , Ard Biesheuvel , Matt Fleming , Mark Rutland , Catalin Marinas Subject: [PATCH v14 4/6] arm64: Move unflatten_device_tree() call earlier. Date: Thu, 3 Mar 2016 15:55:37 -0800 Message-Id: <1457049339-23351-5-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1457049339-23351-1-git-send-email-ddaney.cavm@gmail.com> References: <1457049339-23351-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160303_155615_876978_C973C8E0 X-CRM114-Status: GOOD ( 16.84 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, David Daney MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Daney In order to extract NUMA information from the device tree, we need to have the tree in its unflattened form. Split paging_init() into two pieces. The first piece maps memory so that unflatten_device_tree(), can allocate memory. The second piece containing the bootmem_init() call that will be patched in a follow-on patch to add NUMA handling. Move the unflatten_device_tree() call between the two new pieces. Signed-off-by: David Daney --- arch/arm64/include/asm/mmu.h | 3 ++- arch/arm64/kernel/setup.c | 15 ++++++++++----- arch/arm64/mm/mmu.c | 17 +++++++++++------ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index 990124a..e6e40ac 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -28,7 +28,8 @@ typedef struct { */ #define ASID(mm) ((mm)->context.id.counter & 0xffff) -extern void paging_init(void); +extern void paging_init_map_mem(void); +extern void paging_init_rest(void); extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt); extern void init_mem_pgprot(void); extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 8119479..753ae90 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -319,7 +319,13 @@ void __init setup_arch(char **cmdline_p) /* Parse the ACPI tables for possible boot-time configuration */ acpi_boot_table_init(); - paging_init(); + paging_init_map_mem(); + + if (acpi_disabled) + unflatten_device_tree(); + + paging_init_rest(); + relocate_initrd(); kasan_init(); @@ -328,12 +334,11 @@ void __init setup_arch(char **cmdline_p) early_ioremap_reset(); - if (acpi_disabled) { - unflatten_device_tree(); + if (acpi_disabled) psci_dt_init(); - } else { + else psci_acpi_init(); - } + xen_early_init(); cpu_read_bootcpu_ops(); diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 58faeaa..5c6dd0a 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -449,18 +449,23 @@ void fixup_init(void) } /* - * paging_init() sets up the page tables, initialises the zone memory - * maps and sets up the zero page. + * paging_init_map_mem() sets up the page tables so that memblock + * memory is usable. */ -void __init paging_init(void) +void __init paging_init_map_mem(void) { - void *zero_page; - map_mem(); fixup_executable(); +} +/* + * paging_init_rest() finishes setting up the page tables, initializes + * the zone memory maps and sets up the zero page. + */ +void __init paging_init_rest(void) +{ /* allocate the zero page. */ - zero_page = early_alloc(PAGE_SIZE); + void *zero_page = early_alloc(PAGE_SIZE); bootmem_init();