From nobody Sun Feb 8 21:33:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91038+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91038+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1656957200; cv=none; d=zohomail.com; s=zohoarc; b=BCzltVt2gY+olA7wZbl3xSHtoW4kuvbdKG0WM8uo6yUxARcFzN6fJE+46hiGwoG4DwckTGE5hTU5nspgKO2WVsKOp/2jEb1f+xqAHyTnvjNtmptLkVWf9gRVJLJu2cN7hnl67oiZ8iuOzIpewifXrfRPxraShBJOE5ITEjov/1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656957200; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=v6En44U89LdZJMBurLBI0tq3Tfi8P/2QSZcY+3Z3Fu0=; b=WjSvLAY1ZDmVPlepsPyyS6t4oOMB/9eEmIPRDsllHSwZmKlDdBkYb3nrmElpHfE4q743/MNRrpDSktrv+Z0ZFwjiIlMqwXzD39MY1U9T2J8fbaGKPtAHI6/4mt8zOrJc5Bp/8/xDH+o55KMiP2ZxZZ4ar+Ft/BconV0GuRt0r7Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91038+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 165695720097962.37146919882332; Mon, 4 Jul 2022 10:53:20 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id tctHYY1788612xOaPs5rIVRf; Mon, 04 Jul 2022 10:53:19 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web10.75328.1656957198518255551 for ; Mon, 04 Jul 2022 10:53:18 -0700 X-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 10825615F4; Mon, 4 Jul 2022 17:53:18 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AB22C341CB; Mon, 4 Jul 2022 17:53:16 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, sami.mujawar@arm.com, Ard Biesheuvel , Marc Zyngier , Alexander Graf Subject: [edk2-devel] [PATCH 4/7] ArmPlatformPkg/PrePeiCore: permit entry with the MMU enabled Date: Mon, 4 Jul 2022 19:52:49 +0200 Message-Id: <20220704175252.4015120-5-ardb@kernel.org> In-Reply-To: <20220704175252.4015120-1-ardb@kernel.org> References: <20220704175252.4015120-1-ardb@kernel.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ardb@kernel.org X-Gm-Message-State: hFEEnaAA603Ubl45oSHeZwmQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1656957199; bh=oHNA45857vpevsSKhRsHuqqtIBabnSfDB1JHKjJVUMM=; h=Cc:Date:From:Reply-To:Subject:To; b=H1TDY+qFyP5F+RzvCtrPdbS9t9FV01pjqIgYcnshnDPA16UkRhcsziq/kJ9U4lM+8Fk bHBtlzF4dLbmh4EjXRc5JwcwiUTMF93JQXLymoN4CmaK7tpBm904/0/puk+mKPE4zA2v8 zE4AM+Rbt0mHmsByRMLqozxbXjJ49MyucpY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1656957202888100005 Content-Type: text/plain; charset="utf-8" Some platforms may set up a preliminary ID map in flash and enter EFI with the MMU and caches enabled, as this removes a lot of the complexity around cache coherency. Let's take this into account, and avoid touching the MMU controls or perform cache invalidation when the MMU is enabled at entry. Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/PrePeiCore/PrePeiCore.c | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c b/ArmPlatformPkg/PrePei= Core/PrePeiCore.c index 6dd9bcdea24f..d56918365f71 100644 --- a/ArmPlatformPkg/PrePeiCore/PrePeiCore.c +++ b/ArmPlatformPkg/PrePeiCore/PrePeiCore.c @@ -58,17 +58,19 @@ CEntryPoint ( IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint ) { - // Data Cache enabled on Primary core when MMU is enabled. - ArmDisableDataCache (); - // Invalidate instruction cache - ArmInvalidateInstructionCache (); - // Enable Instruction Caches on all cores. - ArmEnableInstructionCache (); + if (!ArmMmuEnabled ()) { + // Data Cache enabled on Primary core when MMU is enabled. + ArmDisableDataCache (); + // Invalidate instruction cache + ArmInvalidateInstructionCache (); + // Enable Instruction Caches on all cores. + ArmEnableInstructionCache (); =20 - InvalidateDataCacheRange ( - (VOID *)(UINTN)PcdGet64 (PcdCPUCoresStackBase), - PcdGet32 (PcdCPUCorePrimaryStackSize) - ); + InvalidateDataCacheRange ( + (VOID *)(UINTN)PcdGet64 (PcdCPUCoresStackBase), + PcdGet32 (PcdCPUCorePrimaryStackSize) + ); + } =20 // // Note: Doesn't have to Enable CPU interface in non-secure world, --=20 2.35.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#91038): https://edk2.groups.io/g/devel/message/91038 Mute This Topic: https://groups.io/mt/92170205/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-