Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp653757lqo; Wed, 8 May 2024 10:31:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXIP6BG32IUxHrjXdnZdDHF6zITJgOozKWMMAszNGJcWH9L2sM/dedZv50P0B2I9VeUQu03OraW9OyfjuDlO3aPNAIR07krvfMIiYA5+w== X-Google-Smtp-Source: AGHT+IGOyO1T8AbYgbLXrk4GstCldVIw0Lmh9nsbSMNu+Cg9xvUk/qdiYyp0RadrQFBMnjLlBd31 X-Received: by 2002:ad4:5741:0:b0:699:206c:2db1 with SMTP id 6a1803df08f44-6a15145ab52mr42582726d6.16.1715189493469; Wed, 08 May 2024 10:31:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715189493; cv=pass; d=google.com; s=arc-20160816; b=h/zcveShwAliP5GpiNG3RaLCozQxeUlCBWwhvK/rJI6qbY72Mm/iynQ8E8ujD1Id1t XneFrdJdRm0V0biHClDq8aMEyVxCH5q9HSbEEW6VxA1Ttkbr1I1kuHurj+66n78qGLTW hVHNotkf0YjMGEmpEi4ygrgi5tidR/AbMlyMZZTUr2xDvWw2fmDcB/5jSu64+rVk/goP LjZLYjPJScQlDl2/hQb/jJ97PKVmi51/3UHK8kVvl7bwLRRrYHaW7R9CO8GkL48iLFMl FXhqF8tt8Z9nqBUr5GihhB5iuPOnydSGV3H2013RUBGqKQeKt47i2PTg8YFWic8fnuH0 0SnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to :dkim-signature:dkim-signature:from; bh=e0C2Sa+Ice2dYwvVccSs+oEF61GNXb4TH0cOy9XvlW8=; fh=QMiQTRJe6h1qb+x9zzkgSPWtNWIDPdl73CyOArU6qfs=; b=0P93fNU4mivlKjZLbGunsQa5NvBkXFlk2GLbIMVXcoivHBEBW5wA4SH99VbNIbDrHr 7RAp+01hXSsM01ombixnftUg/iWUbtnZvBZhp+2UxnAf3KLhbZ9Jm22qD1F/pueH8q8L dflyHEhJ7sCKT3so+bz1KJmK0f3SnDsJFKUcQSw/3IHKijw+FVMI88pk4flDN7eieW+P LQInt0zwoH9AAPhiatETNQRAIatATxidR07iEb26GiH/fpSQGogRTxXhKxPNn8M/L3ZI 6RnKnBfOLDQ2JwkFagD2OFkdpYeoDnEAEsxZLOnQXAZ4HHs/tm9XTv1KSbXysARCQLQj xgMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vVy8qvlN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-173630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q1-20020ad45ca1000000b006a0c5959e3dsi11724905qvh.333.2024.05.08.10.31.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 10:31:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=vVy8qvlN; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-173630-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173630-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 306871C21C1B for ; Wed, 8 May 2024 17:31:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADCBF128818; Wed, 8 May 2024 17:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vVy8qvlN"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="TsFzMXTa" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 683A12E3E8 for ; Wed, 8 May 2024 17:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715189480; cv=none; b=rHv9062GMxf81KajK4hpuXWAJQz1y1+S0tdaLNOj93KMq3u0is9HMf+g0hUqHCmEXXeR7viZiBGmse/uPgZknYe3HnW8oUcBAmfmHOp/ET8RjzsAqrjdKPzBFAW/p9G74gPViIQfX6PFVr74pNjSJhuAciiGXmKZmNmcFi/ZCrk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715189480; c=relaxed/simple; bh=EGSLti6hDZCZp3+9aWSRBrwaYaLNuhgib5RIQ9946Jc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=TFFROJncO3EbghvRW+StwfRrAr2kFGEEKODmiM9vW7Y8qPJB0c8Qh0XTbplkYD2JAJxHK60P0YGcAkCL1200b0MVCoa5ChSDkcnKMBSd89CfwJa4zx8lMNTAcHVr4ooM/TJ3nRHU7ta1xea7Nd2BfOaSAqo1sFTwFzr9EGNIAtg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vVy8qvlN; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=TsFzMXTa; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1715189477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=e0C2Sa+Ice2dYwvVccSs+oEF61GNXb4TH0cOy9XvlW8=; b=vVy8qvlNC9U0HL2SlYgzFblLB2M/X/P8pfzpzJ4LpdWDbp8//PosSd/F2PXXMRXrBe1Wzg 1LzA3td9kat51Jc8GuvETVYD2+qoYYR+PWHAPKzK3s4NAm1kUhE8eaQmTwvcKm+YQNt1M4 YX6O0ulNQL1LZ5ajog5ZCR+K02uUZXDo/+56v/oN87trdlC9iT6ns2LEymm83jybi9z5AT fBPwPZrZyey/9Kl228nQMrabMjg1xTTlKkACNpgUTtb+XMM7a7Q4yD7Iuji7oXzimqOH5I tligCfg9qTbOSK/tkQI06N50S60LiUjf+0UVhWvoZEfSUf8T+jCCiAB9FBVAeA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1715189477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=e0C2Sa+Ice2dYwvVccSs+oEF61GNXb4TH0cOy9XvlW8=; b=TsFzMXTanDnoOVXl77mMiaef1NFwhltDqMAasvptpJf/7jgoCJeeoEHVkKnclZxfZry7Yc pLz85r9eP42S+yDQ== To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] riscv: Don't use hugepage mappings for vmemmap if it's not supported Date: Wed, 8 May 2024 19:31:16 +0200 Message-Id: <20240508173116.2866192-1-namcao@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit ff172d4818ad ("riscv: Use hugepage mappings for vmemmap") broke XIP kernel, because huge pages are not supported on XIP kernel. Only use hugepage mapping if it is supported. Fixes: ff172d4818ad ("riscv: Use hugepage mappings for vmemmap") Signed-off-by: Nam Cao Cc: Alexandre Ghiti Cc: --- arch/riscv/mm/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 968761843203..c081e7d349b1 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -1414,6 +1414,8 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node, int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, struct vmem_altmap *altmap) { + if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) + return vmemmap_populate_basepages(start, end, node, NULL); /* * Note that SPARSEMEM_VMEMMAP is only selected for rv64 and that we * can't use hugepage mappings for 2-level page table because in case of -- 2.39.2