From patchwork Tue Mar 8 23:59:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 8538491 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 6DD9EC0553 for ; Wed, 9 Mar 2016 00:02:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F7D820204 for ; Wed, 9 Mar 2016 00:02:28 +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 805A92015E for ; Wed, 9 Mar 2016 00:02:27 +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 1adRYg-0007Qv-I4; Wed, 09 Mar 2016 00:00:58 +0000 Received: from mail-pa0-x243.google.com ([2607:f8b0:400e:c03::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1adRYA-0006vT-Jg for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2016 00:00:28 +0000 Received: by mail-pa0-x243.google.com with SMTP id 1so2095889pal.3 for ; Tue, 08 Mar 2016 16:00:06 -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=H6tfIapPJWrb/81LU+WkUwCinTi1Fs9YaOK1GTWOdMC2445i31Yz8lExhKgwHO2FVe 1nGUvcCWBvGpjBCtYgAuutN2iN0eaeU/KxK95ovxZv+gMt8oqW1V2/4O4QX7yxkH2Kkz Lpi8j7WSFler1+5jrFMpIsbFqkr1/GzCpgApS+SwI/+1Sewrv+mXQXHrUkPuoHd0E9yy 8bLFizYu+rAoPBAvvRqqOpYvS8rTjKFS+8q6rbJ/3+JB0aBdMqW9zcbmU9B9nVn6FHeF 8dwEU9vAI3uUXcBICmBDE+A2lV0mBc6qqatYnWlndayk9zww74SxZj7QhEYqqf8JkxPW b7VA== 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=Lapjdy1ifm+bzT5dxXO6gKOYUoPtqZ1kqXzt3H037cXqxBpUvBchCZ3bG5WvyWqGOU C+JT2opgAfbfkGse9nCDs8yhBTiCLz++lj8No0z0nl/jqQ0qX6Sl7H2IopPTR+Ft+I2e JBOBZ6szb5YLvjy20ABNSR5GDzNrChu0HmBdFYmb1QfEW7idhMRFtp1sBNzlhmyXVtW8 do3OJ0lpZ9XrzeRFNlamDZGSksV1koByeD8GTe6Y7R/uNXNQPym1labnRTSXvdJLe5Ie z8fDPtiD2cFhbU9pbyVwkgnojHpmkygeuxrtuPx20uSM4OYWEE5P4vzTrETjixwh+l/y vZ6g== X-Gm-Message-State: AD7BkJJe0W028jQrgdlzQk+wfHWMjtUx+BX463lsTqGYC2XGVQFFov5q0lXG//ozK9Bqow== X-Received: by 10.67.7.197 with SMTP id de5mr45807385pad.105.1457481605929; Tue, 08 Mar 2016 16:00:05 -0800 (PST) Received: from dl.caveonetworks.com ([64.2.3.194]) by smtp.gmail.com with ESMTPSA id p26sm7403036pfi.84.2016.03.08.15.59.59 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 Mar 2016 16:00:00 -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 u28Nxxux009032; Tue, 8 Mar 2016 15:59:59 -0800 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id u28NxwLW009031; Tue, 8 Mar 2016 15:59:58 -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 v15 4/6] arm64: Move unflatten_device_tree() call earlier. Date: Tue, 8 Mar 2016 15:59:45 -0800 Message-Id: <1457481587-8976-5-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1457481587-8976-1-git-send-email-ddaney.cavm@gmail.com> References: <1457481587-8976-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160308_160026_847564_C9DE047E X-CRM114-Status: GOOD ( 17.51 ) 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();