From patchwork Mon Oct 24 11:29:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp458904wru; Mon, 24 Oct 2022 06:38:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ShrCeb59nZ4/1e8V3skZIqLMsAUZ4a5cxon9ICMUcMv/S7OK9YU+yQR/fnCOupEpNrfVS X-Received: by 2002:a05:6402:35d1:b0:45d:3661:567e with SMTP id z17-20020a05640235d100b0045d3661567emr31444133edc.343.1666618710071; Mon, 24 Oct 2022 06:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618710; cv=none; d=google.com; s=arc-20160816; b=SeuktflB3OYWeOddtx7Q/RSur5aEHStqrtqMVNg/MedlkUWkSosgmG7K7h7IXUA/7p tu2F4REnqoKTLeoZ4i6CkYoBjBpYo+9DEC9CkMQQCCTzfSYDAuYO/JFvJqCi3YPPJvla mENtLMpjMJ/IR9L0FWZGV9s+V4UwqLODxWJ/Kfqn9dF3GzXwBsbrLKpP4AfOS0TzI9FR lFi5Vr9L/RNx8UVmZbtn/Qzo3BIsitSuJwsd4ps+I9jPlen2PXxdFUV8GPyuZxNtm3Te QFIqfl8SwmEhch3nanymJj+2ABwpj16grCLpkGIjrsMwOVLmp5oJpPKfRLW++mB0eoYG ZNew== 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=BXsn2ZLA9PcwxRQNv2v6gjqsLT0z8PXWQLClY5wE75I=; b=yNK+do5/O0mxdrcHNOb8S6nBxfnuT7X48LNax4ex4Lrek8oYYpjlBHUYyPCKXyVgv0 FThXXt8FuNE7VL+LFes6YBvCYeIeLI8/CMfhGqgl18dIf1N6wEo7cvk1G29dNHlDNuPn gXOb1jH/AhbgKJqF0maK+wkpJ94a4DtAaahb83urRfBZIrX+TcNYXJTKDffvYX1hlk+p voVsD+nwqs5OK21D+v3geQGkhklSklTGq1PFRIGLkljdYlTPgnIPENfR2HM6NtEdpNJ1 eW/pbxeEzdbzvzovrGPEND1WtmXUtYHIFbgf6x16Q6GQCqH0+nHrC/7HIkhvUb3BGQUt viFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="r+gL/QiF"; 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 v12-20020a056402348c00b004619cbd9055si5947900edc.366.2022.10.24.06.37.48; Mon, 24 Oct 2022 06:38:30 -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="r+gL/QiF"; 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 S232893AbiJXNXP (ORCPT + 99 others); Mon, 24 Oct 2022 09:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233097AbiJXNWK (ORCPT ); Mon, 24 Oct 2022 09:22:10 -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 32D3A2D1F3; Mon, 24 Oct 2022 05:29:39 -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 AB765B81331; Mon, 24 Oct 2022 12:08:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BB2BC433D6; Mon, 24 Oct 2022 12:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613316; bh=y839G3eWhqbFg+CH70M0j3cZIXcSKYZtss7cD99g68g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+gL/QiFhnEa0b16YIqf+yT5+u8scvHb4hrp17GJrm+Gjunb+P/upyJQH2FvQ8Jtf 603K9FGwVgtKMusU8Cf6luTQlaDoRFYPOe7rTfxQ9x0MQQkQQM9qjeaTtideIpnlbN SeSEPNy9c4jm08u2j33VFRZJ3AvVJVpOF33NBmXk= 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.4 061/255] ARM: 9247/1: mm: set readonly for MT_MEMORY_RO with ARM_LPAE Date: Mon, 24 Oct 2022 13:29:31 +0200 Message-Id: <20221024113004.533977981@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747576380792714307?= X-GMAIL-MSGID: =?utf-8?q?1747576380792714307?= 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 463cbb0631be..5becec790379 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -320,7 +320,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] = {