From patchwork Tue Feb 14 14:07:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13140226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C4F4C6379F for ; Tue, 14 Feb 2023 14:09:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233251AbjBNOJt (ORCPT ); Tue, 14 Feb 2023 09:09:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233244AbjBNOJs (ORCPT ); Tue, 14 Feb 2023 09:09:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EA6429419; Tue, 14 Feb 2023 06:09:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A219B615EA; Tue, 14 Feb 2023 14:07:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E66BFC433A0; Tue, 14 Feb 2023 14:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676383667; bh=hilxX2cQjknwppv7cWUkYn/TC2HNghGbRCGtPZUipXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fb1OpkD1Rcgt+yjx6j0dskJpmYd7Wcm79sGSRVdoifLSQVDsuflzPNK9L15x5pkRv lCXqi9/drSZIXX8jqhBIK6zQ2s7M82tSH7IVmllUviRrFkH9LQovRU98TBMC83lLMz 0gQVQRezqi1LsB9rh2ixY3CfTMSRMqnXqyYZZgn55tOVjr6AalSV851qW1rMEzN2vD 0gbR2lNgvjhFTyt6QFQQ+Wk0UPfnS6RMem7wYAiZchjU8qBEGsjYXSG9xXeSy5vCgy kG0arrNCXb/+ylN6xHu64RF8d0QYnn7414CBeGgFnQC5aXXlPTugLBq2WS4pZBf3J2 vV9SkD2uB11Aw== From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Geert Uytterhoeven , Greg Ungerer , Guenter Roeck , "Mike Rapoport (IBM)" , Rich Felker , Yoshinori Sato , linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mm@kvack.org, linux-sh@vger.kernel.org Subject: [PATCH 1/2] m68k/nommu: add missing definition of ARCH_PFN_OFFSET Date: Tue, 14 Feb 2023 16:07:28 +0200 Message-Id: <20230214140729.1649961-2-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230214140729.1649961-1-rppt@kernel.org> References: <20230214140729.1649961-1-rppt@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: "Mike Rapoport (IBM)" On m68k/nommu RAM does not necessarily start at 0x0 and when it does not pfn_valid() uses a wrong offset into the memory map which causes silent boot failures. Define ARCH_PFN_OFFSET to make pfn_valid() use the correct offset. Reported-by: Guenter Roeck Fixes: d82f07f06cf8 ("m68k: use asm-generic/memory_model.h for both MMU and !MMU") Signed-off-by: Mike Rapoport (IBM) Acked-by: Greg Ungerer Reviewed-by: David Hildenbrand --- arch/m68k/include/asm/page_no.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h index 43ff6b109ebb..060e4c0e7605 100644 --- a/arch/m68k/include/asm/page_no.h +++ b/arch/m68k/include/asm/page_no.h @@ -28,6 +28,8 @@ extern unsigned long memory_end; #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET) && \ ((unsigned long)(kaddr) < memory_end)) +#define ARCH_PFN_OFFSET PHYS_PFN(PAGE_OFFSET_RAW) + #endif /* __ASSEMBLY__ */ #endif /* _M68K_PAGE_NO_H */ From patchwork Tue Feb 14 14:07:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 13140255 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17913C05027 for ; Tue, 14 Feb 2023 14:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232214AbjBNOOb (ORCPT ); Tue, 14 Feb 2023 09:14:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232718AbjBNOO2 (ORCPT ); Tue, 14 Feb 2023 09:14:28 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A606A6F; Tue, 14 Feb 2023 06:13:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id D4CC3CE2065; Tue, 14 Feb 2023 14:07:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D563C4339B; Tue, 14 Feb 2023 14:07:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676383670; bh=OaKxI8asQTEjsEh6yfL74O5y0APlN8V2pOfAUwHuYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s9uEH0FY0E59Lne0jrBhkQf1M8apaJ4Q5qecHu2ul3FABQgIuCLiaX67MlXCfJKIP REV6oT63TsGh2uzEnR6pEqfoZS/Mv7zRh0jY/1seyA7HVtaFiEkwLPSSIQymvZhD5j vC2hiiI/90K3ubqTQezm+4Z8s6GsfriFu3fYHCGHgITD9g9h8cIqdv5DgxHYPrg1hg 7FkupLjpl02YxWT7EReno9nxekdM9ZnEy7IPxyjT7xBJ0MY/nWbprKqXaRz3c9bqGI J5CcAY5uJxb5lb/c/PCC4VM2plmW+gV10L7/SI1cUyuoL+hPjrQuQO771g7J/kD01N b4DjHYylyTrCw== From: Mike Rapoport To: Andrew Morton Cc: Arnd Bergmann , Geert Uytterhoeven , Greg Ungerer , Guenter Roeck , "Mike Rapoport (IBM)" , Rich Felker , Yoshinori Sato , linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mm@kvack.org, linux-sh@vger.kernel.org Subject: [PATCH 2/2] sh: initialize max_mapnr Date: Tue, 14 Feb 2023 16:07:29 +0200 Message-Id: <20230214140729.1649961-3-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230214140729.1649961-1-rppt@kernel.org> References: <20230214140729.1649961-1-rppt@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: "Mike Rapoport (IBM)" sh never initializes max_mapnr which is used by the generic implementation of pfn_valid(). Initialize max_mapnr with set_max_mapnr() in sh::paging_init(). Reported-by: Guenter Roeck Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM") Signed-off-by: Mike Rapoport (IBM) Acked-by: John Paul Adrian Glaubitz Reviewed-by: David Hildenbrand --- arch/sh/mm/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 506784702430..bf1b54055316 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -301,6 +301,7 @@ void __init paging_init(void) */ max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; min_low_pfn = __MEMORY_START >> PAGE_SHIFT; + set_max_mapnr(max_low_pfn - min_low_pfn); nodes_clear(node_online_map);