From patchwork Thu Feb 4 16:20:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Larsson X-Patchwork-Id: 1436076 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=sparclinux-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4DWkNM0Ksgz9sXb for ; Fri, 5 Feb 2021 03:22:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237046AbhBDQWJ (ORCPT ); Thu, 4 Feb 2021 11:22:09 -0500 Received: from bin-mail-out-06.binero.net ([195.74.38.229]:36903 "EHLO bin-mail-out-06.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237087AbhBDQV7 (ORCPT ); Thu, 4 Feb 2021 11:21:59 -0500 X-Halon-ID: fae01693-6704-11eb-a076-005056917f90 Authorized-sender: andreas@gaisler.com Received: from andreas.got.gaisler.com (h-98-128-223-123.na.cust.bahnhof.se [98.128.223.123]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id fae01693-6704-11eb-a076-005056917f90; Thu, 04 Feb 2021 17:21:09 +0100 (CET) From: Andreas Larsson To: David Miller , sparclinux@vger.kernel.org Cc: Mike Rapoport , Sam Ravnborg , linux-kernel@vger.kernel.org, software@gaisler.com Subject: [PATCH] sparc32: Limit memblock allocation to low memory Date: Thu, 4 Feb 2021 17:20:53 +0100 Message-Id: <20210204162053.3954-1-andreas@gaisler.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 changed sparc32 to use memblocks instead of bootmem, but also made high memory available via memblock allocation which does work together with e.g. phys_to_virt and leads to crashes. This changes back to only low memory being allocatable in the early stages, now using memblock allocation. Signed-off-by: Andreas Larsson Acked-by: Mike Rapoport --- arch/sparc/mm/init_32.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c index eb2946b1df8a..6139c5700ccc 100644 --- a/arch/sparc/mm/init_32.c +++ b/arch/sparc/mm/init_32.c @@ -197,6 +197,9 @@ unsigned long __init bootmem_init(unsigned long *pages_avail) size = memblock_phys_mem_size() - memblock_reserved_size(); *pages_avail = (size >> PAGE_SHIFT) - high_pages; + /* Only allow low memory to be allocated via memblock allocation */ + memblock_set_current_limit(max_low_pfn << PAGE_SHIFT); + return max_pfn; }