From nobody Tue Feb 10 12:58:24 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+94333+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+94333+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1664180735; cv=none; d=zohomail.com; s=zohoarc; b=U30HUBgU/9oCPrvmL0gYf+KrCgySCvXyIpKg2ugcVf84yJAwSgeInyLqU++zS43hio7PP8bbiU1GeC9iWjQcwBZA3TeRtFyCnIDIXRFRXTvRwv6v5TcD6SKhgtOk1baVri9NReCaLO1V1mH3Gy4gB94o3V1ooHzhgquGfqG0qUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664180735; 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=30IRruMtYHOcxTPn4umH4+k1WwSejBcp0OtpbzZAF44=; b=ikpjLYUHPFKbU12HHDbMVnAgHFapkWNqugtpK9pfqfFYjOi71QN3EFY/ZHerjTlVYEV44y8ye6XeuaSTaXVCht+AqV9KFqbS+ukzIu9Ymi5wc8lyjMfYjXcnQiAEtpCK7dlo76XUabTpsoYR02j917TC5+31BcXPWvK30nsWKuc= 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+94333+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 1664180735010796.6505865091232; Mon, 26 Sep 2022 01:25:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id r9bBYY1788612xTProHv75ln; Mon, 26 Sep 2022 01:25:34 -0700 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web08.25932.1664180733681558031 for ; Mon, 26 Sep 2022 01:25:34 -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 ams.source.kernel.org (Postfix) with ESMTPS id 23473B819A0; Mon, 26 Sep 2022 08:25:32 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC1C2C433C1; Mon, 26 Sep 2022 08:25:29 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Alexander Graf Subject: [edk2-devel] [PATCH v3 09/16] ArmPlatformPkg/PrePeiCore: permit entry with the MMU enabled Date: Mon, 26 Sep 2022 10:25:04 +0200 Message-Id: <20220926082511.2110797-10-ardb@kernel.org> In-Reply-To: <20220926082511.2110797-1-ardb@kernel.org> References: <20220926082511.2110797-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: E0j0Z7ZZ8FsPbUUJpd9y3RGYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1664180734; bh=Tmszfjnxh3+2hQoyGKTbW25nseDQdO4AIKrnue+j9Bk=; h=Cc:Date:From:Reply-To:Subject:To; b=mgiPzkXBZ3OaI89KH3ldei8T9pmHv4d57sx/4eIZvVf6p06yvOWeTuDSNKozfIEfkdf cH1O+6xcTCHB6XM8TemceE/RR5OfSH2EGnkGK1pSoZl+TGiBC2ur89U6peXAc7BS7g8MA MG+wiJE+MLKpQ2NriIqsNf1ltBvDpOlkzik= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1664180736370100006 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 Reviewed-by: Leif Lindholm --- 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 9c4b25df953d..8b86c6e69abd 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 (#94333): https://edk2.groups.io/g/devel/message/94333 Mute This Topic: https://groups.io/mt/93922700/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-