Received: by 10.213.65.68 with SMTP id h4csp650426imn; Fri, 16 Mar 2018 14:34:50 -0700 (PDT) X-Google-Smtp-Source: AG47ELvmRaREeRSNHWn3qD/huInu4/hI/4ZjYoxDslYJtPLb47oUDUlc8aq5Ot/qpsOLzssoXZav X-Received: by 10.101.82.69 with SMTP id q5mr2597209pgp.259.1521236090306; Fri, 16 Mar 2018 14:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521236090; cv=none; d=google.com; s=arc-20160816; b=djTWc3JLUez9n5j/PHwW+AQO+JLvKHdxnePJi0umegPC9VJw6H81cYdUaM6LHof/CR 2wr89YjCctxv5xWE/I6XgbWUX/rR3lAnRaAH4GxDfnH5yNMN4OH0Cl78JQ6N7kLTN4sU 9TTBDCg4qMFF87Aa+ftGXZkEJQyQ7rU387TuqZQFEfUbsEKOCS9No/o/Oy8pjMoXvygR qHLZzendSWOxioty1Wjxcck+eJNWcl9pqi221V3gzAE107lbk/R5+CDs//VwTJMgOMyO l3O1RBFeJjH7SZB2ZqgUGyi8OJR6bs9vkqEq00ZehgVQQfYHLpXyZcuHiKIWEtLL1C/7 CSng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ZNhZ74DUU6WWlBbgWsEZ7WELi/sHHphRoq9gJ0I3qrQ=; b=JLoif7l93It2IWR6qCcEaPUBakvNBjvGTcf7RyQOJRqIDqLYzwYMftgAvSYebcgyX/ CcSd+OUzJFdXOjOwC9h6mWC2vCmgkfCNGEchJzCfd+gA6IuI3sJKQmZcCyJGKNg8dXWI ogn6q+eBlDngwcLh8TvB4o/23uVcs7wT9GDz+tbLHl2SCmE3sOjoMDi1osOMQpsxj2c3 sDDwC1y1800OUwGQZYPfxId/eiYn77zD0OenVu1CnSmd60+k2dt38Dysl/zMThyFty/p zWIOSAFIl/iotW6qCJSK54o+zdrMEp0iAA450jAbOPFN6aTX3eOrjP5BI/jxk2iuatPR mONw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a34-v6si7054765pld.8.2018.03.16.14.34.35; Fri, 16 Mar 2018 14:34:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752048AbeCPVdP (ORCPT + 99 others); Fri, 16 Mar 2018 17:33:15 -0400 Received: from mail-ot0-f193.google.com ([74.125.82.193]:45398 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751944AbeCPVdM (ORCPT ); Fri, 16 Mar 2018 17:33:12 -0400 Received: by mail-ot0-f193.google.com with SMTP id q5-v6so1126215oth.12 for ; Fri, 16 Mar 2018 14:33:12 -0700 (PDT) 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; bh=ZNhZ74DUU6WWlBbgWsEZ7WELi/sHHphRoq9gJ0I3qrQ=; b=igdpuq5s66rYyrgM9twReeZOtjTQ9RLpOl68gV4D4hJpcV0Pam7tIZJZgRsnrlq2jY Ip6EUJ2aDyayG+p0ArYGfepYLIodQPkB+DeakD7m3OU4copJ6BYXgeDHr3l0zohXz7ig dPfzcS8rtuOvGWMLXI/XWmdpH04esmz5bhzK1JIfmomWUEgWk2+qxUSUZzfzXoarzT4v Dj5tAKHTWNXF5r2V4wq5ygtGBQEJB1QIULwAkkxjvO/zgQx4+aiaVsrUu0FktUHxX+SJ +HEU0fwRb8JQSp08J4qoYNy2HKYARTm/Hj++cy3ZLg8kE+eljvZS8wAlTgnsDGqBk+k3 Ybxw== X-Gm-Message-State: AElRT7G/S2SkmVdlgc05M5mtp5uwU1XS2JUG12mLWZSDaR4qU3n9BKT1 BkgUrIWVsubVH4b1XRgQmJd6NhQ= X-Received: by 2002:a9d:6182:: with SMTP id g2-v6mr2332131otk.82.1521235991893; Fri, 16 Mar 2018 14:33:11 -0700 (PDT) Received: from localhost.localdomain (24-223-123-72.static.usa-companies.net. [24.223.123.72]) by smtp.googlemail.com with ESMTPSA id u203sm4544038oie.24.2018.03.16.14.33.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 14:33:11 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org, Yoshinori Sato Cc: uclinux-h8-devel@lists.sourceforge.jp Subject: [PATCH] h8300: switch to NO_BOOTMEM Date: Fri, 16 Mar 2018 16:33:06 -0500 Message-Id: <20180316213306.20424-1-robh@kernel.org> X-Mailer: git-send-email 2.14.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc") inadvertently switched the DT unflattening allocations from memblock to bootmem which doesn't work because the unflattening happens before bootmem is initialized. Swapping the order of bootmem init and unflattening could also fix this, but removing bootmem is desired. So enable NO_BOOTMEM on h8300 like other architectures have done. Fixes: 0fa1c579349f ("of/fdt: use memblock_virt_alloc for early alloc") Cc: Yoshinori Sato Cc: uclinux-h8-devel@lists.sourceforge.jp Signed-off-by: Rob Herring --- I haven't seen any reports, but 4.16 is likely broken. This is compile tested only. Moving unflattening after bootmem_init should also work if a smaller change for 4.16 is desired. Rob arch/h8300/Kconfig | 1 + arch/h8300/kernel/setup.c | 36 ++++++++---------------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 091d6d04b5e5..efc602634064 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -16,6 +16,7 @@ config H8300 select OF_IRQ select OF_EARLY_FLATTREE select HAVE_MEMBLOCK + select NO_BOOTMEM select TIMER_OF select H8300_TMR8 select HAVE_KERNEL_GZIP diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c index a4d0470c10a9..33ed980e7aea 100644 --- a/arch/h8300/kernel/setup.c +++ b/arch/h8300/kernel/setup.c @@ -71,10 +71,6 @@ void __init h8300_fdt_init(void *fdt, char *bootargs) static void __init bootmem_init(void) { - int bootmap_size; - unsigned long ram_start_pfn; - unsigned long free_ram_start_pfn; - unsigned long ram_end_pfn; struct memblock_region *region; memory_end = memory_start = 0; @@ -88,33 +84,17 @@ static void __init bootmem_init(void) if (!memory_end) panic("No memory!"); - ram_start_pfn = PFN_UP(memory_start); - /* free_ram_start_pfn is first page after kernel */ - free_ram_start_pfn = PFN_UP(__pa(_end)); - ram_end_pfn = PFN_DOWN(memblock_end_of_DRAM()); + /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */ + min_low_pfn = PFN_UP(memory_start); + max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); + max_pfn = max_low_pfn; - max_pfn = ram_end_pfn; + memblock_reserve(__pa(_stext), _end - _stext); - /* - * give all the memory to the bootmap allocator, tell it to put the - * boot mem_map at the start of memory - */ - bootmap_size = init_bootmem_node(NODE_DATA(0), - free_ram_start_pfn, - 0, - ram_end_pfn); - /* - * free the usable memory, we have to make sure we do not free - * the bootmem bitmap so we then reserve it after freeing it :-) - */ - free_bootmem(PFN_PHYS(free_ram_start_pfn), - (ram_end_pfn - free_ram_start_pfn) << PAGE_SHIFT); - reserve_bootmem(PFN_PHYS(free_ram_start_pfn), bootmap_size, - BOOTMEM_DEFAULT); + early_init_fdt_reserve_self(); + early_init_fdt_scan_reserved_mem(); - for_each_memblock(reserved, region) { - reserve_bootmem(region->base, region->size, BOOTMEM_DEFAULT); - } + memblock_dump_all(); } void __init setup_arch(char **cmdline_p) -- 2.14.1