From nobody Mon Feb 9 15:30:21 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+93234+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+93234+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1662476815; cv=none; d=zohomail.com; s=zohoarc; b=YpUowBjFLFfe+hBvMLM6SIu3HFfBrSWXOZQpvRTmxc8HdlLA7b4fjiKS2rHMjM+TtD8QPlEpecgJ93xYTh+2z6NFW4bakfxD3TsCrXpMmTWhbsz0W2wq+Obj57E2Zcdf5dVATADGNtwj5i04c6QwOWe2ou8D7YNQ8nrn6kzNxjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662476815; 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=w8i6kDtxPoE62IJYzOW9OrjkSw1oDpqxdq+nQn4RlLg=; b=lGzLVsjLmTZwhkcZYLj9K9BC9i8Ux9g9Ap3JK1EyEbYuWZ1BS9hGVN+XTnBRpkShCcZ10RbeuES1iutIfH0K/IctCelb/1g9mmZSXGPd6osP/Q8wguzE1lq0uVRDmOss+7INBcTF6bZK1tB/buqXp7WCO0fQhC4+ReuaH/OeD4Q= 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+93234+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 1662476815438476.42511476425307; Tue, 6 Sep 2022 08:06:55 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id L9w3YY1788612xWAkbZ0P0sx; Tue, 06 Sep 2022 08:06:55 -0700 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.249.1662476813719122373 for ; Tue, 06 Sep 2022 08:06:53 -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 E440C61584; Tue, 6 Sep 2022 15:06:52 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B53A0C433B5; Tue, 6 Sep 2022 15:06:51 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, sami.mujawar@arm.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH v2 4/7] ArmPlatformPkg/PrePeiCore: permit entry with the MMU enabled Date: Tue, 6 Sep 2022 17:06:36 +0200 Message-Id: <20220906150639.157227-5-ardb@kernel.org> In-Reply-To: <20220906150639.157227-1-ardb@kernel.org> References: <20220906150639.157227-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: KW2YrqInbwWprqCeGxHcAB73x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662476815; bh=JynlRAIFK55/NUhBl8ikW7vnqdiqHLx5xyKxQXhIBDw=; h=Cc:Date:From:Reply-To:Subject:To; b=pDkMXeA+149E5cwryyIczG/gckyzjzPxsssNjXnCbKjM+8Vyz6MYAopWczBrLTNJRoX UVs/l1zDxGpfnuD9H/g56aFRqUhtYVzwK56u7XtgX92+0vnble2H6nYnssM8mlhgR5PcE t7qVnw+I9eoVCiAxbkw9+32cmos5//er4Gs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662476816242100013 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 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 (#93234): https://edk2.groups.io/g/devel/message/93234 Mute This Topic: https://groups.io/mt/93503042/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-