From patchwork Mon Oct 24 11:28: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: 9439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp479290wru; Mon, 24 Oct 2022 07:18:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM50ninoNivzZ+OBrrPM0+mCB5RBNJjAl7CwsCLJYVXsloVUQY701safeVX6RDMn9U2Bfcmt X-Received: by 2002:a05:6402:34cf:b0:461:a72c:7ada with SMTP id w15-20020a05640234cf00b00461a72c7adamr7756115edc.198.1666621130706; Mon, 24 Oct 2022 07:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666621130; cv=none; d=google.com; s=arc-20160816; b=LtuX+96xrB/vIPkQO5tHFh4WCjXPPpd1YUbNlbzVxlAen3IwIhOEnTaDncEok/FfJ+ NSvJiCZazkqh5Cf4R5I+dGyRfqPVtYkxuyiju3i/7AcgazABMtEpqVRbiwClFExO9uhZ 3YWBppsYuvIC1z+BHlJcpI+CLZHkPUCbnLiKI6F0O9MPnYoOkyNU+bQNSRiLI4rK2jLD Q0LqaAvh5lvff+DKzHqmIsTYymyl+C2LGGOxYh7Cz6N8Z65HCSpgGbnhcxQ2u2jTlzNi AMSTzWBI45loIyr9UCjswrMDpNjMPk95u5HxOw23whG3iILw6iuFnyUHx0whEy9FpauC lhrA== 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=AAw9n/iUE0IHLHPkTzW4/EpB6eSgGgUyoY+iTTbISFbgLQBHcZvjFt0agqTti76XmN UOPcqqWs5S7vvN++qiVog7MYRGoAOWlsMbyxI7hJXCV3kD4s/+i56Pozk2KACND6A71O ibTm7yb3TF7SdAbtBTrQN501ysphnORZZNkftJurhIwuIULoJ+k8AHUA4EqlUDeNlHBl Ddn9irq+jnZCRjafAPcsOGMk3QLnjKfsLtfIAE+UOERxW3FaPeZwEWsMwivVYb/FujCg N2npK/2bYVsHZd6XFXTwtT3Dy9pA60zkSLSRNuYMk9Utof+k7b+tfQ/AsGdg3dWBYsJv FGTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Q78RqW1U; 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 w13-20020a05640234cd00b00459f9c3d02bsi33281913edc.22.2022.10.24.07.18.18; Mon, 24 Oct 2022 07:18:50 -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=Q78RqW1U; 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 S231745AbiJXOQY (ORCPT + 99 others); Mon, 24 Oct 2022 10:16:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236983AbiJXOP1 (ORCPT ); Mon, 24 Oct 2022 10:15:27 -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 0BCD35073D; Mon, 24 Oct 2022 05:55:17 -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 D21E1B818E2; Mon, 24 Oct 2022 12:39:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39C4FC433C1; Mon, 24 Oct 2022 12:39:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666615156; bh=00HXMAn+/r8CSZi6lXNpibBGKfp4GOr5lj0UEYdGDG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q78RqW1UY05WfjkPV1NsbWQnV5ujfCsTxOm7K7QHJaDu+Um8Z0Z1nna03lWgT9F8p HX2qbJqZX57lnSTEN4k3i9WJQkdPkJVC+5W1iuasD7GnReyHDEOfXb2hyppEHDtIaZ h2dH4b/yxRVaARyEF9tc0uDoJerYdiR9n4jWenl8= 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.15 144/530] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Mon, 24 Oct 2022 13:28:08 +0200 Message-Id: <20221024113051.591241125@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@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?1747578918664928836?= X-GMAIL-MSGID: =?utf-8?q?1747578918664928836?= 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] = {