From patchwork Sat Oct 22 07:21:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7271 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1091948wrr; Sat, 22 Oct 2022 00:52:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64Enb7IarSLGGwJDGMxr3P6ygk1HXAVDt4tp6axk1XZOBjhwOL+4YQ+9TyEEjsZqP44kYj X-Received: by 2002:a63:5950:0:b0:459:35df:3014 with SMTP id j16-20020a635950000000b0045935df3014mr19268884pgm.325.1666425144641; Sat, 22 Oct 2022 00:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425144; cv=none; d=google.com; s=arc-20160816; b=vVVK00J9fxwkpIG+NdEdmbpxmux/olLnmKCoqobWSLB7GUom4xaiLb5/Y27hO6Vyu+ EpDfo8GFx+es7eKnmLK5R68gJB2Hh1/957oiLgqNE33ORXB9cntAetpiHrs2eBoWkyjg qazlL2EH0WvcdcoR7hDX00t93i7twiqu5CINmlRVBqWlLts5pS7KPnmGn5xaFpP5bz8P BHRccManlMdyV3+Hes2Gs8ELsxp8+p5EVDbom3vn3kY5aZSw7IR9PbS/dNHH4C47TzSR k8vGGUtsP65LcToVuTzPcSvepZGvbSniPLWU9eiuW1shnNVHIIOn1fMQTCFQCG1t8iO8 0YxQ== 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=i5lixvYVsdBlK0loifDO7ozXgCgIKMCzpPPt0bhwCUs=; b=J3tUTV21zQf/DFz9spKQ8tYHzuZPbjvXc1fAf0xf3NGS3sbZ7SN7Y3gznQ4TbkS5lc r8tMMTzjb7dRQWvd7zOhfx+bXYA4h+80CZrInwXl4v3pKeGUsGNRQZw0qPoQxls6kOyV XZ5UL7+nqjznPUybe1i2ut1rG13gtrxXi16xTl1KydsbGbTSY265tBp1sKkWHN3IoNIK fzb78Q2wZfe5dl/H0bGwYt0dhrLuLCv8+xlJhar/CoogBv6ay/Y06Z8QiY0tXTrX37zM mhSekI6tb1TEQ6sF/zyNfnKs6wGhRHQ94ZXrh2lWdg3BHhmCDMBjvk0Ppc3B9jgYj71t FMSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rdKqVC82; 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 h191-20020a6383c8000000b004620970e0e9si26437241pge.116.2022.10.22.00.52.12; Sat, 22 Oct 2022 00:52:24 -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=rdKqVC82; 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 S230483AbiJVHvo (ORCPT + 99 others); Sat, 22 Oct 2022 03:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231881AbiJVHte (ORCPT ); Sat, 22 Oct 2022 03:49:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA6529C4AF; Sat, 22 Oct 2022 00:45:54 -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 53B1960B94; Sat, 22 Oct 2022 07:42:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BAEDC433C1; Sat, 22 Oct 2022 07:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424554; bh=00HXMAn+/r8CSZi6lXNpibBGKfp4GOr5lj0UEYdGDG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rdKqVC82vtYC9Ye4hH7D5xp5dlQMp327P0l3egW633wgD+I10t7hcUYMEj1QaOmcJ haePQwzwF7dfQWiQVMsO+eYHMVIJqqEuobGyWjwaEtcYW2amMa8sjKUJwTELbh5Iwb yk5e80r2M9oFjIQvblHUfKMfXe5MycJK3J+glZuI= 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.19 189/717] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Sat, 22 Oct 2022 09:21:08 +0200 Message-Id: <20221022072449.041364364@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747373412311031390?= X-GMAIL-MSGID: =?utf-8?q?1747373412311031390?= 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 cd17e324aa51..83a91e0ab848 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] = {