Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1937916pxb; Fri, 5 Feb 2021 05:26:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzL9HDiSG1QGzLWikFuqgDX1lK+bxc5taLE4mf1GNqObDr4dJTgYDQ5P0CJzFSyvBZcE378 X-Received: by 2002:a17:906:5d0b:: with SMTP id g11mr4002018ejt.542.1612531579121; Fri, 05 Feb 2021 05:26:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612531579; cv=none; d=google.com; s=arc-20160816; b=e5qi3og1WhjrVy5f64TdlfN4CQVr2rczzQYDu0WwgJKr7eWE4ptz5dma5+GLS4hvKW abezB/j2DXv+3VvHg5Qtdr+m0wxWtMuUHld/qDDb4uzhy3c53E9jG4A5wiT82rOgA2rI lg6L+7t/7hM/r1e4quiK7BA2BSXkgyU38rCoGr3DhG4ZADqvQ27nvASplJITyGhtWc3n WqdYn1FcEcWn4JFHfuhPrp7h3xugFicxPo0r+vxdKLaE0mp4aE4doIltBpruuUUWp1LW cVF0wDJ+njwkPaAmdds72JXYM0FaS3PfhNQxI0R/XGO+Mv2qudZriyO9Uoz+om8eaa0t fU7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :authorized-sender; bh=8RACZGZk7dSuqoW4DZTJuunr/HE8krfJparDeafCxlc=; b=I+B5d7s0Lt4VNqu+ed3+ET5mlXwBqeNQm0lhOtlUBFXf+UCbKKLq7+6UiwF8vAeWv9 XMVJ6vN4GS4ZB0Y1QmijaCJ6Vu2HU9pWobazZVTleLlNTKLLFSHK626vWhbDL8IX5O4K GK+jC5NguhBk6gY3g5ZhGdcneO9Vq6OP+9IzF9TjXhCh4a31vQDVP03qHuvpp1Gpzo2q NBptsqTrgGKIKm0k6sFE8aHVE8MMLeqcA0HLEnmF8kdc1Ty+DTOR35MVesqnDGOLq3qe wTKLXU4/eiD63oI1ujkHfy2tS9SwHOqY5fZYItFwVuSvru2amCBVq64zHrO1zn/qYEu2 16jQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si5067911edu.340.2021.02.05.05.25.54; Fri, 05 Feb 2021 05:26:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229910AbhBENY6 (ORCPT + 99 others); Fri, 5 Feb 2021 08:24:58 -0500 Received: from bin-mail-out-06.binero.net ([195.74.38.229]:11757 "EHLO bin-mail-out-06.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbhBENV5 (ORCPT ); Fri, 5 Feb 2021 08:21:57 -0500 X-Halon-ID: f2a63d38-67b4-11eb-b73f-0050569116f7 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-03.atm.binero.net (Halon) with ESMTPA id f2a63d38-67b4-11eb-b73f-0050569116f7; Fri, 05 Feb 2021 14:20:47 +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 v2] sparc32: Limit memblock allocation to low memory Date: Fri, 5 Feb 2021 14:20:31 +0100 Message-Id: <20210205132031.25407-1-andreas@gaisler.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit cca079ef8ac29a7c02192d2bad2ffe4c0c5ffdd0 changed sparc32 to use memblocks instead of bootmem, but also made high memory available via memblock allocation which does not work together with e.g. phys_to_virt and can lead to kernel panic. 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 --- Changes, in commit message, since v1: - Added a missing "not" in "does not work" - Clarified crash to kernel panic. - Added Acked-by 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; } -- 2.17.1