From patchwork Mon Aug 31 06:47:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 1354140 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=AYc+POly; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=default header.b=y7aR/1qb; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bg13M5cBVz9sTg for ; Mon, 31 Aug 2020 16:47:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vtKTIlcF/7O6Fn6MbWg2JKP0oe/0YbkxEwjeCQxHkm0=; b=AYc+POlyG6CUVbomSmkYOtosn HJ/4B80cah926NFpNxBySZC9lSESJgdKSxwgS32ZtNJRnSgMtAZl7pcDnVYFEAHIZcqJ2OGpU5RCx YA1UYnWopUpqOblGUw5zfgJveoL/q30NzAVPMAfsUn1WVXWxmjRWRNbEhZq2fVob3YYgSY9zmP5L3 z0hvHovCWduB23agTXcu+FkpGjTwX0xoCYReB73cPaxwnqX1daLEkkozz8PUveSWIQFd/hZ6ybjdC IbZ6v3GP2TywYm2U0b9kmwwyy7+zprM7iKbTGY8szFIOh3pMtzxhreMNqwt9KOIWPKH3kEWiTDcba p9oGgvi+Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCdbA-0005Zi-Pp; Mon, 31 Aug 2020 06:47:24 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCdb9-0005ZI-0p for linux-snps-arc@lists.infradead.org; Mon, 31 Aug 2020 06:47:23 +0000 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9EF5B208DB; Mon, 31 Aug 2020 06:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598856442; bh=4aWGNgBJAoBl8QYtMHd09gshebtS7Lgr8i8tu8FJl+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y7aR/1qbGDGINVnJAGUUaJmKKGEEbvywsT3prxYzuYju2Io/LF+83Bajiw7XrmKM9 c0zNRhHO+DMV6/iLGtGPsbYvKILf3YPC+FoZuQsaOEEbHtgYtGFlSdJ5R3t2gnQohM KdJjXRmbbj0xXpB/fDr7ggSdBeETwSeE230j65zo= From: Mike Rapoport To: Vineet Gupta Subject: [RFC/RFT PATCH v3 1/1] arc: add sparsemem support Date: Mon, 31 Aug 2020 09:47:14 +0300 Message-Id: <20200831064714.16562-2-rppt@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200831064714.16562-1-rppt@kernel.org> References: <20200831064714.16562-1-rppt@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200831_024723_156756_63F35A60 X-CRM114-Status: GOOD ( 15.18 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [198.145.29.99 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-snps-arc@lists.infradead.org, Eugeniy Paltsev , linux-kernel@vger.kernel.org, Mike Rapoport , Mike Rapoport Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Mike Rapoport Signed-off-by: Mike Rapoport --- arch/arc/Kconfig | 10 ++++++++++ arch/arc/include/asm/sparsemem.h | 13 +++++++++++++ arch/arc/mm/init.c | 6 +++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 arch/arc/include/asm/sparsemem.h diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index ba00c4e1e1c2..2e3c02e9b657 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig @@ -48,6 +48,7 @@ config ARC select PCI_SYSCALL if PCI select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32 + select SPARSEMEM_STATIC if SPARSEMEM config ARCH_HAS_CACHE_LINE_SIZE def_bool y @@ -67,8 +68,15 @@ config GENERIC_CSUM config ARCH_DISCONTIGMEM_ENABLE def_bool n +config ARCH_SPARSEMEM_ENABLE + def_bool n + config ARCH_FLATMEM_ENABLE def_bool y + depends on !HIGHMEM + +config ARCH_SELECT_MEMORY_MODEL + def_bool n config MMU def_bool y @@ -508,6 +516,8 @@ config LINUX_RAM_BASE config HIGHMEM bool "High Memory Support" select ARCH_DISCONTIGMEM_ENABLE + select ARCH_SPARSEMEM_ENABLE + select ARCH_SELECT_MEMORY_MODEL help With ARC 2G:2G address split, only upper 2G is directly addressable by kernel. Enable this to potentially allow access to rest of 2G and PAE diff --git a/arch/arc/include/asm/sparsemem.h b/arch/arc/include/asm/sparsemem.h new file mode 100644 index 000000000000..1156b9934c74 --- /dev/null +++ b/arch/arc/include/asm/sparsemem.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_ARC_SPARSEMEM_H +#define _ASM_ARC_SPARSEMEM_H + +#ifdef CONFIG_ARC_HAS_PAE40 +#define MAX_PHYSMEM_BITS 40 +#define SECTION_SIZE_BITS 32 +#else +#define MAX_PHYSMEM_BITS 32 +#define SECTION_SIZE_BITS 27 +#endif + +#endif /* _ASM_ARC_SPARSEMEM_H */ diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index 3a35b82a718e..60e3808a4e19 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c @@ -153,7 +153,11 @@ void __init setup_arch_memory(void) * DISCONTIGMEM in turns requires multiple nodes. node 0 above is * populated with normal memory zone while node 1 only has highmem */ +#ifdef CONFIG_DISCONTIGMEM node_set_online(1); +#elif defined(CONFIG_SPARSEMEM) + sparse_init(); +#endif min_high_pfn = PFN_DOWN(high_mem_start); max_high_pfn = PFN_DOWN(high_mem_start + high_mem_sz); @@ -162,7 +166,7 @@ void __init setup_arch_memory(void) high_memory = (void *)(min_high_pfn << PAGE_SHIFT); kmap_init(); -#endif +#endif /* CONFIG_HIGHMEM */ free_area_init(max_zone_pfn); }