Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3023047lqo; Tue, 21 May 2024 04:49:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUlCgedZBH1r+uIo2LYaYrs+4OO0xFHVP6AktVHA9w5R6XQeWqrczdAy7wke0PFaxO9MvgBOeMIF14HEDtdN5uOMyKtchq/HaI/R318uw== X-Google-Smtp-Source: AGHT+IFtaoYkbPfqUBk7SKprtPBym0FUHVgpcHjAXjMCNe1Ws/5iuZhK13PxVRHzrhtDOSxr5XCl X-Received: by 2002:a05:6808:618c:b0:3c8:61b8:e518 with SMTP id 5614622812f47-3c9970cf15fmr31921567b6e.52.1716292181793; Tue, 21 May 2024 04:49:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716292181; cv=pass; d=google.com; s=arc-20160816; b=liNyGxUpJynVyXYxAiIg5daERvSF89ebsgv/IxNcOdEg9FQ+R1FNW/vsBMXb+Pa7wr vpAsPpZ9mNEqJZnM1Kx7N1jmpUeGZ38JeLlsJwtXRojW0YXQriUzAYPSiuGRuJgnGlG4 MvovKjxhHDGgOuJms1hoARjmAR2xO/2bPGASHtIu2tbNP3/sPaNH90TP58n+yodGf5/3 cQ4SQ2fW9XZMPq5TRbc9gzAwU3kNMYTlVIBFinZK/MvW6+nCvyEBrw4ej6UNwiU2c6uR tbU4ZT4U66fwjYzoSlkdOj7ER1cq3UePiQI9hOUQgX4pJlFZkyoVcv9cJy5vSxErZv/b xBjw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KrhY5+IXUY1q1Rops6fEj8P0VRbkM9gC4LVl5Q7HPdg=; fh=/tocBNknTX0CBdcxdKGUdCq+MQUhEmbYJSr49AVQ1Gk=; b=q98z7y0EKqe6e9HwtUQv/nat9BONrRhnYbnWXNvHFA+qecMnbF+66Yb6lBJnFeTExq zg/YKXwGYoUjNjCkybMw83IbOk0LcjiActST+Lk78TycZcjpxP45k2f3XwIURH6ASsEu Td933Ik8w0Mn9Zq69jphd8gg/3ewoQRHTPXDDeFjQp2KcqCpQICQnkTxqkbvQn1xTSmg 8rQHAM+Tl4v8M/XJwGTjb8z4ts30YRKflYfOMTI/QleCFjiqm+gK/JZXl+NtDiBzyO0/ CcBkI5irv/v6pCw3Cl0DRyzhVQ30SNbicl5ikhIwzvjObSY5PZPvtQxdvWPIExUxSQ10 bDHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JuFto51Y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-184900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df56c8e46si279013021cf.630.2024.05.21.04.49.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 04:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JuFto51Y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-184900-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 825631C22201 for ; Tue, 21 May 2024 11:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C1C877112; Tue, 21 May 2024 11:49:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JuFto51Y" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9634B74404 for ; Tue, 21 May 2024 11:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716292143; cv=none; b=fz4U1Ubbghy/x4smCHo4HNsZPs1Y0gGejzYW/bhN8rOnFeTToBY5krZuESUpbXJcXiamXkdORzHGgalOy4zXGUx/4Dpi2bJQogozvdDbcSJTVu0oMUqzTsqEcwNM+cBM8MbiqkxpVpGRRaAtNGOJQFFT3OQ2VSahXxHB+KZC8NY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716292143; c=relaxed/simple; bh=OVWdCLBgos2+PxBgxUayZBCsMHg1Thrc2DYHTXT9Xk8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=GbakgLtyxQ9CoAJMZwvuy98tQ8mgCASAyV1aeKQiD2AbAU8BlONgTP3JGl5sYdE3ImslELU20LvW7qBoHucihgT2oYS0H/JerpKjazI8MW55bWAxNRJudscpQkG0Uss/52aXqbiIYq8uSDj2gxYwjzTNNHTQyGovqWpxdC9Z2Ww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JuFto51Y; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A029C2BD11; Tue, 21 May 2024 11:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716292143; bh=OVWdCLBgos2+PxBgxUayZBCsMHg1Thrc2DYHTXT9Xk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JuFto51YhlnEYtIE5p7m81bgvn/FesIVCWWQrgta9FQ3B2VFM/MCwDRyv7PAP2PlM OcGLM/qjlm9yHvJ42jxE/UVj9EaiKy4E4zOVTD7Aea+fGMPCYzFxrVrBmSXy/h4HDF t926Rbef+QZc/5v6EBJZ92qopYPJAzrENcM/2kOdAKCneRJkyCJGk4uZ6XvWBnWTNY UE0khZMgvG8QpNoNPeaJxOTsVFSCWY8XS77MDoU002hcPtheNG1MeEYymcH5WPgVDs MmithN7NtP4w31zwP1/4w2/Ea+uNEwNZpSwC/G3ClsBE05NPIEj8Isbdxl0d8R08Xw kjhfVQUKhzJew== From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= To: Alexandre Ghiti , Albert Ou , David Hildenbrand , Palmer Dabbelt , Paul Walmsley , linux-riscv@lists.infradead.org, Oscar Salvador Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Andrew Bresticker , Chethan Seshadri , Lorenzo Stoakes , Santosh Mamila , Sivakumar Munnangi , Sunil V L , linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org Subject: [PATCH v3 4/9] riscv: mm: Refactor create_linear_mapping_range() for memory hot add Date: Tue, 21 May 2024 13:48:25 +0200 Message-Id: <20240521114830.841660-5-bjorn@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240521114830.841660-1-bjorn@kernel.org> References: <20240521114830.841660-1-bjorn@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Björn Töpel Add a parameter to the direct map setup function, so it can be used in arch_add_memory() later. Reviewed-by: Alexandre Ghiti Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador Signed-off-by: Björn Töpel --- arch/riscv/mm/init.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index c969427eab88..6f72b0b2b854 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -1227,7 +1227,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) } static void __meminit create_linear_mapping_range(phys_addr_t start, phys_addr_t end, - uintptr_t fixed_map_size) + uintptr_t fixed_map_size, const pgprot_t *pgprot) { phys_addr_t pa; uintptr_t va, map_size; @@ -1238,7 +1238,7 @@ static void __meminit create_linear_mapping_range(phys_addr_t start, phys_addr_t best_map_size(pa, va, end - pa); create_pgd_mapping(swapper_pg_dir, va, pa, map_size, - pgprot_from_va(va)); + pgprot ? *pgprot : pgprot_from_va(va)); } } @@ -1282,22 +1282,19 @@ static void __init create_linear_mapping_page_table(void) if (end >= __pa(PAGE_OFFSET) + memory_limit) end = __pa(PAGE_OFFSET) + memory_limit; - create_linear_mapping_range(start, end, 0); + create_linear_mapping_range(start, end, 0, NULL); } #ifdef CONFIG_STRICT_KERNEL_RWX - create_linear_mapping_range(ktext_start, ktext_start + ktext_size, 0); - create_linear_mapping_range(krodata_start, - krodata_start + krodata_size, 0); + create_linear_mapping_range(ktext_start, ktext_start + ktext_size, 0, NULL); + create_linear_mapping_range(krodata_start, krodata_start + krodata_size, 0, NULL); memblock_clear_nomap(ktext_start, ktext_size); memblock_clear_nomap(krodata_start, krodata_size); #endif #ifdef CONFIG_KFENCE - create_linear_mapping_range(kfence_pool, - kfence_pool + KFENCE_POOL_SIZE, - PAGE_SIZE); + create_linear_mapping_range(kfence_pool, kfence_pool + KFENCE_POOL_SIZE, PAGE_SIZE, NULL); memblock_clear_nomap(kfence_pool, KFENCE_POOL_SIZE); #endif -- 2.40.1