From nobody Sun Feb 8 12:38:48 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+91035+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+91035+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1656957195; cv=none; d=zohomail.com; s=zohoarc; b=Rf/pwuH6Rtd6kMFE9+jA08wkW/U+yGrCYXMUyo50KayMp/kD/Io0dWq9/zQP+j0mPGI8n9tQQqvPWt7C1lWQQAU1yW35t6zQnWXdaA/fZQtA3tlSdCJcz0u0tpNnhKbj9qmmDea6erRbSjHpletcp+hTE8gUkC9aoF/Mia1x/po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656957195; 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=AhRNw/Td74gR+EDVxWgnY6v08r9ijT6njAtQ3jwWcqg=; b=nsr7U93rhKCpRd4d4+EcdOt6LarE/8Xs49HZAcTtWQclXIabbqYIh+dCC11hVPWkJ9KrSm4tVYg7P8pVcx3/xJoeyV8La7WJN5TEUGBdGVululE1E/YKKRLJ/00Gowx8fR/yY1aWjdYpFexMkRruyYM6168manbE2/EvEqGCC80= 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+91035+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 1656957195531773.0526511468381; Mon, 4 Jul 2022 10:53:15 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 24jwYY1788612x0oRVzOlYdZ; Mon, 04 Jul 2022 10:53:14 -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.74762.1656957193825092966 for ; Mon, 04 Jul 2022 10:53:14 -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 116EB6152C; Mon, 4 Jul 2022 17:53:13 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 156F6C341CE; Mon, 4 Jul 2022 17:53:10 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, sami.mujawar@arm.com, Ard Biesheuvel , Marc Zyngier , Alexander Graf Subject: [edk2-devel] [PATCH 1/7] ArmPkg/ArmMmuLib: don't replace table entries with block entries Date: Mon, 4 Jul 2022 19:52:46 +0200 Message-Id: <20220704175252.4015120-2-ardb@kernel.org> In-Reply-To: <20220704175252.4015120-1-ardb@kernel.org> References: <20220704175252.4015120-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: sdrnEkp2BX703WY4aXNXAq1sx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1656957194; bh=4IvDdgFLuV7RyYEnj3uYRtq+5cnR1UpsE7RhsUaluoY=; h=Cc:Date:From:Reply-To:Subject:To; b=UhBq6kOwxCfHbOpIGJAcGvlEosz2R5u830OHgzx/ZYsaP37M7OKohujqU65lO4ieysA bYlKoQqMFao9wJ2QLQ2nQrL6gnSPmpTtLe+3jwZrODALNuUu3ZxMeXBFxGIIfcJzDq0fQ 85fOyQf0PDmXnNXHAoVT75J8UDlSlOYc1Tw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1656957196909100001 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 4a0513392a75..b85ae5a30768 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 (#91035): https://edk2.groups.io/g/devel/message/91035 Mute This Topic: https://groups.io/mt/92170201/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-