From nobody Mon Feb 9 07:23:12 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+93232+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+93232+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1662476810; cv=none; d=zohomail.com; s=zohoarc; b=k+dIB1TeODfvq+a7ifFd5E/5Xr+YMzAKLbiGczdcWhxTaar/2PnmeXV+geJ2hW2F3SpSj07UTsqOVtqn8Tk4S81Y5cK57ta1UOpHuG7ED7/LGV/lybUErIeossjrCmG7bwzizRvSVFhMIxZmUqTmPV9Ckr5kPzWVLworaKvVC18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662476810; 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=Oz88aZ4GMYUQMLTjKyaVPy35b8aCdEPgFnYABek1sOM=; b=OP+BvE/2OaJqWOn3AWy86PzFhXIQHPi8ywNeAPJmkvvvf9rXBp2Ie4qb3fTn3hoK4sIrZyOby0+vl6C8qXm+f+5v/kghz/Pt/kcp+NbYSQ2y3wmWs4M8sJRtlliHWcSamghz8RUD6uFEJ67V51wnaVNkFNfpReGJMyTlYjWWeeo= 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+93232+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 166247681052142.66250110623639; Tue, 6 Sep 2022 08:06:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id cKHpYY1788612xcoRSSlQbRz; Tue, 06 Sep 2022 08:06:50 -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.248.1662476809473562870 for ; Tue, 06 Sep 2022 08:06:49 -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 00FF261561; Tue, 6 Sep 2022 15:06:49 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE80C433C1; Tue, 6 Sep 2022 15:06:47 +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 1/7] ArmPkg/ArmMmuLib: don't replace table entries with block entries Date: Tue, 6 Sep 2022 17:06:33 +0200 Message-Id: <20220906150639.157227-2-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: DSWprLSHKE1f1rrs8L8vbuYFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662476810; bh=0732GoGqyrabaHeVYeIE+o9A+6ruRfyL4GnU75rbENw=; h=Cc:Date:From:Reply-To:Subject:To; b=C44nllVTDcLOJmBjQ117YQd7tgzedtq7BYrWYtV6A2Iq8TKHGsFfXmCq6XT4Q8SDAng nlEiqFoyAPjueJBx7ZUqSWMGz17pTpwNbEfUBVYSdQghokeHkVNES5nx8EXSfCPndiW8A FHTwlNlPJ5Auy0DkM98cPbgVd7hpBeYLs6c= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662476812199100005 Content-Type: text/plain; charset="utf-8" Drop the optimization that replaces table entries with block entries and frees the page tables in the subhierarchy that is being replaced. This rarely occurs in practice anyway, and will require more elaborate TLB maintenance once we switch to a different approach when running at EL1, where we no longer disable the MMU and nuke the TLB entirely every time we update a descriptor in a way that requires break-before-make (BBM). Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c b/ArmPkg/Libr= ary/ArmMmuLib/AArch64/ArmMmuLibCore.c index e5ecc7375153..34f1031c4de3 100644 --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c @@ -197,12 +197,9 @@ UpdateRegionMappingRecursive ( // than a block, and recurse to create the block or page entries at // the next level. No block mappings are allowed at all at level 0, // so in that case, we have to recurse unconditionally. - // If we are changing a table entry and the AttributeClearMask is non-= zero, - // we cannot replace it with a block entry without potentially losing - // attribute information, so keep the table entry in that case. // if ((Level =3D=3D 0) || (((RegionStart | BlockEnd) & BlockMask) !=3D 0= ) || - (IsTableEntry (*Entry, Level) && (AttributeClearMask !=3D 0))) + IsTableEntry (*Entry, Level)) { ASSERT (Level < 3); =20 @@ -294,20 +291,7 @@ UpdateRegionMappingRecursive ( EntryValue |=3D (Level =3D=3D 3) ? TT_TYPE_BLOCK_ENTRY_LEVEL3 : TT_TYPE_BLOCK_ENTRY; =20 - if (IsTableEntry (*Entry, Level)) { - // - // We are replacing a table entry with a block entry. This is only - // possible if we are keeping none of the original attributes. - // We can free the table entry's page table, and all the ones below - // it, since we are dropping the only possible reference to it. - // - ASSERT (AttributeClearMask =3D=3D 0); - TranslationTable =3D (VOID *)(UINTN)(*Entry & TT_ADDRESS_MASK_BLOC= K_ENTRY); - ReplaceTableEntry (Entry, EntryValue, RegionStart, TRUE); - FreePageTablesRecursive (TranslationTable, Level + 1); - } else { - ReplaceTableEntry (Entry, EntryValue, RegionStart, FALSE); - } + ReplaceTableEntry (Entry, EntryValue, RegionStart, FALSE); } } =20 --=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 (#93232): https://edk2.groups.io/g/devel/message/93232 Mute This Topic: https://groups.io/mt/93503038/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-