From patchwork Wed Oct 19 08:25:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp211918wrs; Wed, 19 Oct 2022 02:06:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5PKe6FjfH2aa/xLrHk9XStnW8bBAfNKspDYM3NapQ4xGS2dqLFKRM6Nl8MkDfkMvneI83J X-Received: by 2002:a17:903:24f:b0:178:bf4f:fc7c with SMTP id j15-20020a170903024f00b00178bf4ffc7cmr7640627plh.124.1666170374370; Wed, 19 Oct 2022 02:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170374; cv=none; d=google.com; s=arc-20160816; b=qZrGGSV5wqW4QzkIL/1K68scIOoQ1t4idq41thpmEfBbASTtKPEPLv7CSZutwoJTdP UJ1psp2AuCbrD4yWN/ghKKtqAGiypt5VO9ku6mzeRB961kWKQWTlpWFCU72f38HFIolC xpNwk1zzvBHQjhvZbYmmRwc0xGVVR3X0gr6Vx5r41I3Mi7miGrVj+PEA8Vz+UlFz7B5X jzZadbQNt9aFfjnfdWiW2thrRPr6Z90iWVdF2s3BycPT6uSyb7HN635yhmq9+pdBwp5W kzPP+ZgaKeGIaM+61XBoPes1jnGz/R0E9oyuB5OuHM3v4VveKXylAUl4fG0ssyt9FhHw i9mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5hv6suXH6kBbpjF3/qQzm+vVLJI3OCglxi8kakzGYJ0=; b=BSjUvQqeGOxMhWgOn5FpJ6U2Tj12Rf2WMDbA7KTBt1APJbm3h7m1MdogRZi/35OBT1 HgbxGZGaPBUrIKQZ32aUqAhMIQPfTmpX3ks0T5LXUQP78LMTH1ia8WIhFYzmXVUT2Mw6 ojZSQM3ksVP0FIGUuldoDldBQL5MzSuMQcb6iE8FZ/prVOpA/eG0mo/nEigDpIKSsw0Q z/vvv2xPxvctfY1yA4Ymz3ursIwRkgBME1VsAItl0/uRpu0Arbd5iawba0VoxL4Rfk13 HJK8t8tItlGZkzK662eJM1YxIZ3xn2vuvii9aPZe55RmxcYdDzU1kwGTdDP+gXlCdsxt mT9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PixV2v6e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x6-20020a170902ea8600b001853ad3944dsi16649969plb.480.2022.10.19.02.05.52; Wed, 19 Oct 2022 02:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PixV2v6e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbiJSIws (ORCPT + 99 others); Wed, 19 Oct 2022 04:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231744AbiJSIv6 (ORCPT ); Wed, 19 Oct 2022 04:51:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BDDB6472; Wed, 19 Oct 2022 01:49:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 66854617E9; Wed, 19 Oct 2022 08:47:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E989C433D6; Wed, 19 Oct 2022 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169271; bh=mPyvoOxtu2z1TDELo2nST18RRq1LpFrHYrqoyOU5/Cg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PixV2v6e7kg4xrQ4lxktqT0nWjfn6WT+hCtqFXDbl1rKE+Gkah9UmYMn3d7eb9QfP E/udk5lxUWRMxXpZjjU1QzFN0abEnsZtW+/nOwKRUDrK0Gk2yyRwUugBiULI3/v/CT BS2ZN6AfK+rvBJrtPy//ltwM9dz5JQ+gCjAPS7q8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kefeng Wang , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 6.0 216/862] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Wed, 19 Oct 2022 10:25:03 +0200 Message-Id: <20221019083259.575544616@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106266299213388?= X-GMAIL-MSGID: =?utf-8?q?1747106266299213388?= From: Wang Kefeng [ Upstream commit 14ca1a4690750bb54e1049e49f3140ef48958a6e ] MT_MEMORY_RO is introduced by commit 598f0a99fa8a ("ARM: 9210/1: Mark the FDT_FIXED sections as shareable"), which is a readonly memory type for FDT area, but there are some different between ARM_LPAE and non-ARM_LPAE, we need to setup PMD_SECT_AP2 and L_PMD_SECT_RDONLY for MT_MEMORY_RO when ARM_LAPE enabled. non-ARM_LPAE 0xff800000-0xffa00000 2M PGD KERNEL ro NX SHD ARM_LPAE 0xff800000-0xffc00000 4M PMD RW NX SHD ARM_LPAE+fix 0xff800000-0xffc00000 4M PMD ro NX SHD Fixes: 598f0a99fa8a ("ARM: 9210/1: Mark the FDT_FIXED sections as shareable") Signed-off-by: Kefeng Wang Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin --- arch/arm/mm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index a49f0b9c0f75..463fc2a8448f 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -300,7 +300,11 @@ static struct mem_type mem_types[] __ro_after_init = { .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_XN | L_PTE_RDONLY, .prot_l1 = PMD_TYPE_TABLE, +#ifdef CONFIG_ARM_LPAE + .prot_sect = PMD_TYPE_SECT | L_PMD_SECT_RDONLY | PMD_SECT_AP2, +#else .prot_sect = PMD_TYPE_SECT, +#endif .domain = DOMAIN_KERNEL, }, [MT_ROM] = {