From patchwork Mon Oct 24 11:28:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9649 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp533292wru; Mon, 24 Oct 2022 09:09:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ibQC7ysccx+13YFm+DM7CW4D7tv17rrtZTV9cDo3JOckxwAU+MMPPCu5LGJilZ+Z7wpQl X-Received: by 2002:a05:6402:e87:b0:456:c93c:5361 with SMTP id h7-20020a0564020e8700b00456c93c5361mr30653669eda.88.1666627758494; Mon, 24 Oct 2022 09:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666627758; cv=none; d=google.com; s=arc-20160816; b=uaa4Qn98fmczzcRpXI13E0s12bupzaQd6RsIFAyRz35e+6z20Yf/MioSYheAij2XYR iaksdIuWglJ7U/dftw7oFvfEThap6cm+yeRMNoF27593DoyKcxtPKO3n3ohU1s/mtiAt vgA++3B2xcMk6p4Uwjzf3FGAFn5ZZY6MNq6169vURVX+12QUzWblZU8hLEI62iaGh159 arFnGgqjOKMKz+wNlptxisqzbk+4G+zzhFRPNJdGgPFpFmgR8IiFCMiQE5hL+llOAwmG xVAazu+MQl4ck3WYlq6uSM8hWaIhSmeB3acdJeilyE6Raqq50dDS/IFBuG/vCna9cYj4 GgaA== 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=6WJpchAnm2AYDrbuAGdQpuZFt7lkJfrI2YvMtIEo/cc=; b=SWrfbOF/OLKSFTATWmkuSIZulLu29pxeDaQ81Sd1hU/UdkxejiEuFKHokjRVsq5MOF 6BBn4gAuNJKvXIZvXt4yWAMoM+PxH7ddnthiwMsnd1JLGDDB06NNDZr8qQhtB16zGaik dOG5LnHTlLrGzRwH4RoAp//saBvxxYX2V75yG7XauuAykVtVxLXbtPzbnQwxYtW3PdT0 dqCwWJ/jUsf0UIXgnqiu2sEn6i6dBb6y/ETrPE/6Kx1zZ/DbAt3bGrJrBM/hRPWyiE2k 9967/k3hWPQlGk8w7kDVqJKuXn/G41c+VZJLkzR0PO5hqM9nqIbsOu8EMANU6M4i8joi ixyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MARKIkgJ; 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 r10-20020a50aaca000000b0045cdea002e4si166064edc.66.2022.10.24.09.08.50; Mon, 24 Oct 2022 09:09:18 -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=MARKIkgJ; 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 S233417AbiJXQIF (ORCPT + 99 others); Mon, 24 Oct 2022 12:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233284AbiJXQE0 (ORCPT ); Mon, 24 Oct 2022 12:04:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 134AF11875B; Mon, 24 Oct 2022 07:57:05 -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 ams.source.kernel.org (Postfix) with ESMTPS id 50D62B8164F; Mon, 24 Oct 2022 12:20:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A68C433D6; Mon, 24 Oct 2022 12:20:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614006; bh=CifxF7W0vyRSTNa9fDJ55Z8Vyy7rXSy4F/Ob9GWNSg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MARKIkgJbpZnoyM84G8+F0KpZwMF1VYfu9Ph95ubmsaUBJUepxkMMjnF8a49zBGzk 0l8l06GL8e8pGIiZHhAvqgaylvtx195yXSazOZ6egjFhJy3YM8l5jjJ5X4kzzGfqGd df+3tvaoJPBuvWU4UnNq6HZjCedGjj/VFOvlYzBE= 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 5.10 097/390] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Mon, 24 Oct 2022 13:28:14 +0200 Message-Id: <20221024113026.786635168@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 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?1747585868336964435?= X-GMAIL-MSGID: =?utf-8?q?1747585868336964435?= 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 86f213f1b44b..0d0c3bf23914 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] = {