From nobody Tue Feb 10 06:27:55 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+55604+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+55604+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1583511187; cv=none; d=zohomail.com; s=zohoarc; b=Il82hdRim+Ro7oc2+vD97NDjzsXzpyq4P+eHrLz7dz0h14LeSIH5UcHC934AX6VR+4SMcDJSNpgz1TpMh9pOsY+eQBKfYfiFwbtswTKEmrRGHAtcjLkzw2GU8/Ozg07ODFl34VisN/QRe0rkst5l43+R/4C9ldIHVuScO7lQWVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583511187; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=QMz55OA8WZPq+atqDYouEpqaG9Pc87c1+M2H4QxagmE=; b=hf3nUQLZ8CC3lAO6AoJT9yxY1qtKJTny7YjW0GX5t/nXxCNgoghVjxj1Pdib1ebNn5YeSfWLGo2p/95rYp95R1sg2Xxj3Xs2bjvKuhE+YFVbEUuRH9IrBD2AnBwTIvo0J19fSOYUV7pYojAsSxyGKmsHaLM5eymxebAxeHpjEEg= 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+55604+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 1583511187373490.3094850521079; Fri, 6 Mar 2020 08:13:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id h32UYY1788612xRBgPWipbfW; Fri, 06 Mar 2020 08:13:06 -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.web09.14942.1583511186276050110 for ; Fri, 06 Mar 2020 08:13:06 -0800 X-Received: by mail-wr1-f67.google.com with SMTP id v4so3020817wrs.8 for ; Fri, 06 Mar 2020 08:13:06 -0800 (PST) X-Gm-Message-State: GUua4yTHaIoLKs463HfbFy29x1787277AA= X-Google-Smtp-Source: ADFU+vtrQEllC+JaTtpu0D+5b/UURPPnVdKEehfEkA9TUBxrtvxxt8D+0ue9yxrqQ+KgKxzw6+TUSw== X-Received: by 2002:a5d:424e:: with SMTP id s14mr4983144wrr.226.1583511184400; Fri, 06 Mar 2020 08:13:04 -0800 (PST) X-Received: from e123331-lin.home ([2a01:cb1d:112:6f00:816e:ff0d:fb69:f613]) by smtp.gmail.com with ESMTPSA id f8sm6745287wmf.20.2020.03.06.08.13.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 08:13:02 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH v3 2/2] ArmPkg/ArmMmuLib AARCH64: invalidate page tables before populating them Date: Fri, 6 Mar 2020 17:12:46 +0100 Message-Id: <20200306161246.6392-3-ard.biesheuvel@linaro.org> In-Reply-To: <20200306161246.6392-1-ard.biesheuvel@linaro.org> References: <20200306161246.6392-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=1583511186; bh=E/Du2aU6vHBuh4vjK8rEzIWCZVZSvYQ1MDBdWKKe3cc=; h=Cc:Date:From:Reply-To:Subject:To; b=kQFjFBPmtnlb9P9owlIXiiTbEGniwEh79Blj0YdO+wsHdgThaC1Ogg3shQa1luvaP1+ QNIrzwd3SW0y0gJzmIR0FLtw9vFEkcdgOvNioh6KQnkpGlt3EH1aopSDjGxF57iItf6y3 X1Ncbsc38/+x4b0WDC5dfdfB5WaZVSCXcbI= 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 e36594fea3ad..10ca8bac6a3f 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c @@ -217,6 +217,14 @@ UpdateRegionMappingRec ( 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 @@ -581,6 +589,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 (#55604): https://edk2.groups.io/g/devel/message/55604 Mute This Topic: https://groups.io/mt/71776545/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-