From nobody Tue Feb 10 05:45:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55637+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55637+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1583570340; cv=none; d=zohomail.com; s=zohoarc; b=MKikhlZzZ6aB8KpyiythzVDab6M8nMTJCaeXGnqztVMVICLA2vHdX+tBzpdnLk+jyoXZnTNEwbA8e+eyCL2KsFss9SM0LyHq0OpEDfD7Kc6VMKZg4f0gVQgzKZL9XZF9zNtsAUrU5RVHjvob2/balxYArE+Nrbe8Qa7FGkI5b1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583570340; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=f/O4TGv/DcT6/0kC3EKiGGbjZZq29r32Nh1QjNeFp9Y=; b=cydrG3vIFzsW1FHC3EELubtXbSJJD+bO7qJjCH5N5B0GqR8+/BeFSZJaSB7N2pSCVOp7hL7fJilRnapRUOnOzhVcA62CrPf7hXm2YYgF52kRgq9H1AgDsaG41L6HDYC7k9gs37EdaX6ZMQ4jqRGNSjAk0st4/ja7jE8SX29KypA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55637+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1583570340979838.2254092612139; Sat, 7 Mar 2020 00:39:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4CBMYY1788612xYScwH1rcfw; Sat, 07 Mar 2020 00:39:00 -0800 X-Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web12.10671.1583570340035458881 for ; Sat, 07 Mar 2020 00:39:00 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id y17so5029706wrn.6 for ; Sat, 07 Mar 2020 00:38:59 -0800 (PST) X-Gm-Message-State: 1DAAJjHldPCLvl9ADpARhDFhx1787277AA= X-Google-Smtp-Source: ADFU+vt58F3rW4AGctGx3vnA0vW4I4jStSTvDgXbiOf+yO5xxgZyCPFvnCyAv0yNYXD+a9+LVoJWoA== X-Received: by 2002:adf:f4c9:: with SMTP id h9mr8823746wrp.168.1583570338228; Sat, 07 Mar 2020 00:38:58 -0800 (PST) X-Received: from e123331-lin.home ([2a01:cb1d:112:6f00:816e:ff0d:fb69:f613]) by smtp.gmail.com with ESMTPSA id t14sm20430953wrp.63.2020.03.07.00.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Mar 2020 00:38:57 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH v4 2/2] ArmPkg/ArmMmuLib AARCH64: invalidate page tables before populating them Date: Sat, 7 Mar 2020 09:38:49 +0100 Message-Id: <20200307083849.8940-3-ard.biesheuvel@linaro.org> In-Reply-To: <20200307083849.8940-1-ard.biesheuvel@linaro.org> References: <20200307083849.8940-1-ard.biesheuvel@linaro.org> Precedence: Bulk List-Unsubscribe: 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,ard.biesheuvel@linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583570340; bh=suBoAMjaR2LiRdmEAM0cwLTEUJfk8/WCdq8wMNpMoko=; h=Cc:Date:From:Reply-To:Subject:To; b=cV1P/hpFw2C70ntmqtec1x9kGMS6R9dOwgHVCerYv1gGFNwshaEDiZ9VoCTIH5oSSDv PTJHR/zerZv3Fas0R9kf3fze0oK2io3aej4+tzn+pz9iejVR/HBinfNpJqIPEdnWkIrVL SBv1lJ5Cl1PVqYWhSPrIXq0N66ijX6TOyYk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As it turns out, ARMv8 also permits accesses made with the MMU and caches off to hit in the caches, so to ensure that any modifications we make before enabling the MMU are visible afterwards as well, we should invalidate page tables right after allocation like we do now on ARM, if the MMU is still disabled at that point. Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Libr= ary/ArmMmuLib/AArch64/ArmMmuLibCore.c index 00a38bc31d0a..221175ca6535 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c @@ -204,6 +204,14 @@ UpdateRegionMappingRecursive ( return EFI_OUT_OF_RESOURCES; } =20 + if (!ArmMmuEnabled ()) { + // + // Make sure we are not inadvertently hitting in the caches + // when populating the page tables. + // + InvalidateDataCacheRange (TranslationTable, EFI_PAGE_SIZE); + } + if ((*Entry & TT_TYPE_MASK) =3D=3D TT_TYPE_BLOCK_ENTRY) { // // We are splitting an existing block entry, so we have to popul= ate @@ -602,6 +610,12 @@ ArmConfigureMmu ( *TranslationTableSize =3D RootTableEntryCount * sizeof(UINT64); } =20 + // + // Make sure we are not inadvertently hitting in the caches + // when populating the page tables. + // + InvalidateDataCacheRange (TranslationTable, + RootTableEntryCount * sizeof(UINT64)); ZeroMem (TranslationTable, RootTableEntryCount * sizeof(UINT64)); =20 TranslationTableAttribute =3D TT_ATTR_INDX_INVALID; --=20 2.17.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 (#55637): https://edk2.groups.io/g/devel/message/55637 Mute This Topic: https://groups.io/mt/71792242/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-