From patchwork Fri Mar 10 09:45:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13169064 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F33B4C6FD19 for ; Fri, 10 Mar 2023 09:48:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 91A236B0072; Fri, 10 Mar 2023 04:48:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8CA4B6B0074; Fri, 10 Mar 2023 04:48:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76B726B0075; Fri, 10 Mar 2023 04:48:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 666426B0072 for ; Fri, 10 Mar 2023 04:48:50 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 36F13C09E8 for ; Fri, 10 Mar 2023 09:48:50 +0000 (UTC) X-FDA: 80552514420.25.779C805 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by imf28.hostedemail.com (Postfix) with ESMTP id 6825DC0006 for ; Fri, 10 Mar 2023 09:48:48 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=nEDaPnA8; spf=pass (imf28.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678441728; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tGavHCNEAmB3AhZu0LKzFHubCv5xCdNflVD0ekR4UY0=; b=pSB05gCRH/YpdHCv6qEE/pDirhcxRBAXQFKfszzb4RoM3OMIBHQV35uXmPFfTkoke8Zc2M pqirhDnHqziBQaq1clRFQyLmk+lIHeP6+u/mz+FhCHNdaBDf35uYF/2Ac7TY/jftX60T7e XlqBtc9FL6oq9WNLJzIa6zr4XrVKanw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=nEDaPnA8; spf=pass (imf28.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678441728; a=rsa-sha256; cv=none; b=xfWWgEpd6eU7jUz/zogy1EGBYtMrvYQ9fL5A1g9rNPfDWEngNDtasMAel1I0paNNyroFrj 7/eoGKblAjitah2FLVlg/N3SrGsgk+t5b2qgLfsVZzCWViKRRERUDgmyzmJxnJG7tGY7QC X75S+ag4v229CHDq6BdWJqWewgJOaPE= Received: by mail-wm1-f44.google.com with SMTP id l7-20020a05600c1d0700b003eb5e6d906bso2987285wms.5 for ; Fri, 10 Mar 2023 01:48:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; t=1678441727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tGavHCNEAmB3AhZu0LKzFHubCv5xCdNflVD0ekR4UY0=; b=nEDaPnA8Ty4PvBzODbwL6B2sTto11mRsb4Jzs2H7G9p6A7ZKSNrhnk3x4BOWFO5NAM I/78Se50og1itnoiMPakGj3AveG31x2j6/j/50CVZh8lwbX6MQDYxcf8yYxVJoMofzOn So11W4KjPW25NSlFIH8QkPFlfV0uo7dzOyl980DN9KkNz+cd36ioi6QDF2EBD7bd5PyU POxxiU/fHG2HLQE58X+B7ZTBTf7m1Ez0P/WNGhmIjfMIHPth9RdlR4D0u/Oxg4pQMLp3 2eK+lEAa5joep7xYw4om/Il1YLWfTzdepO6+BmZdGMIWNwLKWLRg8ZeFmMq9uBF+PfuR 4knQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678441727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tGavHCNEAmB3AhZu0LKzFHubCv5xCdNflVD0ekR4UY0=; b=hOEcCVEtCbdpsOt0JSlReJQKRIuT0p0zuAXG5WT5ko/pKpaBI1Szg7ufchelwVxEgf 6WgxTGTzoB1esVEyp787LDAXX16rN3JUvs5/LYnHzvZZI4jGfK3HTUtpKEADku5TMwxy TSiRzK0/UXrvkKeUAYkOFrgotuCGLlOHyFRD7UwToQDV3nj/q4FnO+2Cwjn3P6w9H/jw dVdWNgjGtSzL7AvJKCLzye/EZH63h5a7xFbWl1ACXJ9VwS2dFmjBnad71q75I3t5255v 4e+dRJWYNNdFuRvoCc7bqWQf9RQ4lwlAFqXmzjIO/90QFkJNP8Gs8C2a9f/gSLQaD6rS hF5A== X-Gm-Message-State: AO0yUKVuaI0uCkXSDVtmPFL1mduiIHXtc3C7KPhCtHP/HdlprY7FUmhS 3poP7nm0YgFHewi3r9AWEOzL2Q== X-Google-Smtp-Source: AK7set+y/rX3YhT007UnAYJB6sfLfhyhEqqnKFykNxvLHTsOstaKSQULB4uzAM12oQybO0ImSo5iuQ== X-Received: by 2002:a05:600c:b8a:b0:3eb:578d:ded3 with SMTP id fl10-20020a05600c0b8a00b003eb578dded3mr1976475wmb.35.1678441727129; Fri, 10 Mar 2023 01:48:47 -0800 (PST) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id m21-20020a7bcb95000000b003dc5b59ed7asm1572826wmi.11.2023.03.10.01.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 01:48:46 -0800 (PST) From: Alexandre Ghiti To: Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Frank Rowand , Mike Rapoport , Andrew Morton , Anup Patel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-mm@kvack.org Cc: Alexandre Ghiti Subject: [PATCH v7 3/4] arm64: Make use of memblock_isolate_memory for the linear mapping Date: Fri, 10 Mar 2023 10:45:38 +0100 Message-Id: <20230310094539.764357-4-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230310094539.764357-1-alexghiti@rivosinc.com> References: <20230310094539.764357-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6825DC0006 X-Rspam-User: X-Stat-Signature: fnahnxy4bymw8ijwnaerrs5kn4bofpo8 X-HE-Tag: 1678441728-23034 X-HE-Meta: U2FsdGVkX1+NFhJ22Wxnylzjfw4R/utkdtSZKnp5xTYNYKW8X4vkE0rfmIeKrWhRIB+ppJQaaxwJP1MKD2HVJ0ngnRD/Pplcc3psXW+0Q+mzsBNHBb9yCJW4uu6JrcE9UfoprM+TMLxF+t9+8hVaYD53hPAIkDhYPdWyOsy6mKPyeHwG6mauMbXmjZhmljxqeG31f3E92YvuLZ3eUfsdcx8Yq4nQphMAuOCMvffTSBdp/IwZK6gdd5YbpngwOR1tOB36c+frA05/xmIzI3GAV1F81vt7THe2pvREk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qBKk06tgiMUSbYwuD804dBA+o74mx7/iO78jEDIdmXtp7sgRFMuQWdoVsncwWeYfjnquh6CvB309Q+rmG0MPGB4x/TfrPHlbmo+0c4pzxJ8a08R3X4r0xEAAYhiLwrzJ6RDOn4xtg7bACFUFuqJ1+XKtt1lV9ncp7n8OJyzW24V4nq6HI8hQXSKbsl0OF4cuCi2slPMznzcdO67QCYA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In order to isolate the kernel text mapping, we used some sort of hack to isolate the kernel text range which consisted in marking this region as not mappable with memblock_mark_nomap. Simply use the newly introduced memblock_isolate_memory function which does exactly the same but does not uselessly mark the region as not mappable. Signed-off-by: Alexandre Ghiti --- arch/arm64/mm/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 6f9d8898a025..408dc852805c 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -552,7 +552,7 @@ static void __init map_mem(pgd_t *pgdp) * So temporarily mark them as NOMAP to skip mappings in * the following for-loop */ - memblock_mark_nomap(kernel_start, kernel_end - kernel_start); + memblock_isolate_memory(kernel_start, kernel_end - kernel_start); #ifdef CONFIG_KEXEC_CORE if (crash_mem_map) { @@ -568,6 +568,7 @@ static void __init map_mem(pgd_t *pgdp) for_each_mem_range(i, &start, &end) { if (start >= end) break; + /* * The linear map must allow allocation tags reading/writing * if MTE is present. Otherwise, it has the same attributes as @@ -589,7 +590,6 @@ static void __init map_mem(pgd_t *pgdp) */ __map_memblock(pgdp, kernel_start, kernel_end, PAGE_KERNEL, NO_CONT_MAPPINGS); - memblock_clear_nomap(kernel_start, kernel_end - kernel_start); /* * Use page-level mappings here so that we can shrink the region