Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp233288lqr; Wed, 5 Jun 2024 04:42:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXtGj3afrt1ddaKHsHPGppzO3IOWxL+oAtXFZzTgx/IbjuXArarwwgxW3dXn9ymtsc0/pEKK5JKnGjN+ODbRhwiP45GlVRl5RyH8uZVKg== X-Google-Smtp-Source: AGHT+IGP+2ArcqpI4zcN4PDi8CZaS0NFVuHAVEPr66aPlZvV4rt3r+ITfKizYfKMBmLMhIEsrCJX X-Received: by 2002:a05:620a:8018:b0:792:c2b7:5fd6 with SMTP id af79cd13be357-79523fbea78mr269425885a.50.1717587742970; Wed, 05 Jun 2024 04:42:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717587742; cv=pass; d=google.com; s=arc-20160816; b=IuXKlMM+oUu3dWOGnc9k+yAWhLFeiU+Gj/UbEpV3hTOPtqQWn5ayWbnf8h47M29Tzw 8N4Vt1puQfbkRU7Tav0cAJE5wXFCTuHlJBnReBBcVJsz+3DaPMYR+t6B3m8/XkrFnZ0C fBWtH0ztzMg0LBl5yy2PEVqOZhunnvRf8ucwHiMEbHU1pKOJzxdCY0XaZCgrJxPO4dbp bITtQSiyf3+o1wWPbCjUD3wVSV4r/b5kArQWUzHa/ClGKpxYq/fc4cfnqJ33zly51sK6 JwrY/5fOQVlMgtzUki6zwiY2Fcu5PfCaqkdJ1FZTGPnIfCiLcSNev20n+s4g5NJNonnv vbvw== 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=5yqQKHsij5ltLGwG3UfRMlBSaIkdxRzyUrveUE7IYpk=; fh=/tocBNknTX0CBdcxdKGUdCq+MQUhEmbYJSr49AVQ1Gk=; b=DlrB2Kz38wyvXLueM6ZozbIC+Mm+fkGlJinhTrm6P9vHqyM6NDistFPPylxj5ZDjZo ttNOY7q17Cuwbr7MNHl2sBK3dUXlUEAuXSiLA8SCS+ocTe+4F4KJvonMqNA8A8WTiLfT Flv5tpVfLrkymApGJi4ZtWTWoxH4vAxGqAn5ts/JbmqXbEgUsO4PB78w1AWAT8TGQ+WH sDxOTnyAO6S/DfakxFenjuuVYHDsi+WtszFFu2t6ijTj9tOusKuRmviy7KZWrrrYEwUY Z6oKYSq0aB+HMQrHvQu9BAWaeJTbRhqOLda9jPlUhnQrcKbo9LJOAd7qGcmMnczHUWiA eOYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p39Mrvw8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202278-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202278-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-43ff23d90f7si122890251cf.164.2024.06.05.04.42.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 04:42:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202278-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=p39Mrvw8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202278-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202278-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 AEEDE1C22847 for ; Wed, 5 Jun 2024 11:42:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C2C91922CC; Wed, 5 Jun 2024 11:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p39Mrvw8" 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 43A6F19148B for ; Wed, 5 Jun 2024 11:41:33 +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=1717587694; cv=none; b=HNyIpVHs1XNRZTq9jotkDgHPxZhIx8jUkMBHjbwb4KmTXC5nbKJMTYoj+rnY+Uv4FplEim3uG0LMMGgeRFPUvx6ft6cWOrWxevn21fLVtfiwqiK7Slj0NpqrbkXr9YQ4ARCjQIk3zm3g3E6g6HkKsLgZcPVbT7YbQs0XwrVlyrY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717587694; c=relaxed/simple; bh=MENbBPiOyzG6FBgO0rCD/3ta5d0qLTF/n4fv5DxVET4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Sln6LGJ+/C4XdCcwbwI8JCHgEVVK5ELNVZvRF3yrBhdTERlIZHsPHDTPzYiPbVIUgaSCyfLbKzOQOOrGXXF+kiaxpTBgC8XoHlHSAyhGspokQGCmz5rtDwtUwuO75kZIolIBvzRdd+PqgHehRm8OA3t/OdY5APGPR8avPWGz0iA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p39Mrvw8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53260C32781; Wed, 5 Jun 2024 11:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717587693; bh=MENbBPiOyzG6FBgO0rCD/3ta5d0qLTF/n4fv5DxVET4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p39Mrvw8AJVDKum0Jwg2kb6k87OxJJJ6NrzWSjUUAw1HBTx0uMsmH4QIVLXMIQSjh gGHpGG50o4vxjchkAer0QNCnDkBV9o8kftuixBD9zQDfl1A74EwF3vGFGAOgdDUt3J jhltzpH8+ixqmF4cy66BaweUitmK0U5TaHrrG7i0qbCCCYYDxf1H7GcZfuSiv3PEH5 ODfv8fk9v6erj4Ljcbke3zr58EffgPQNPBd1xbKrR/e1Bfw5dXLk5FkLcBVflIxCHI Bc0UHKuPkQS00F3mFuO5iPHr7YzBmcdN+Gt/nFL77/pTRGZDMKBxiaC+EFfD06kZCo 9XJgH9lq5cqLw== 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 v4 04/11] riscv: mm: Refactor create_linear_mapping_range() for memory hot add Date: Wed, 5 Jun 2024 13:40:47 +0200 Message-ID: <20240605114100.315918-5-bjorn@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605114100.315918-1-bjorn@kernel.org> References: <20240605114100.315918-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 0dd04cedc0d2..1f7e7c223bec 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -1232,7 +1232,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; @@ -1243,7 +1243,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)); } } @@ -1287,22 +1287,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.43.0