From nobody Tue Feb 10 02:44:05 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+55520+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+55520+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1583413159; cv=none; d=zohomail.com; s=zohoarc; b=hZgWOjR5m7UZOLi2HXcHV5H9PRUfbuCQ0jMIx1EvHXHPJc2qBjAU1yVLtnucN3U1ASu5A5rZTL0ZI4sBw8KxBgTyTEwNspcH02Pgz1V/MT89aJ5b6ZiJbJPIg8V4SQ1uG2Wej1TJidtm5HZyCZ/orYwtrZXr/159q1ZLbPgQjEI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583413159; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=6istVcPypUFEDqpduiiSxEvW3ELlnND1Xgq30awrKCI=; b=dTZai37OzI8bmAFTzamfCUBolJ5far/RVyB14hUxeiZpZ7te0nGDuOqSqI850iGHKFhZZ1zX3+L/YX4Ob3CmZ+JKDKZabMN56vbTcT+Ey78P0pJP4JuaQxiM9U9T8B/X/pnIlFFt3Lu/KXvScU+CECcZ5DS1IVxj3sTxWBysbjs= 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+55520+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 1583413159974935.035725520078; Thu, 5 Mar 2020 04:59:19 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3G9iYY1788612xIuhz9a94eE; Thu, 05 Mar 2020 04:59:19 -0800 X-Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web09.11907.1583413158640837158 for ; Thu, 05 Mar 2020 04:59:19 -0800 X-Received: by mail-wr1-f65.google.com with SMTP id 6so1472846wre.4 for ; Thu, 05 Mar 2020 04:59:18 -0800 (PST) X-Gm-Message-State: 2J0D4iTzXHFY8xVlS28wLdnnx1787277AA= X-Google-Smtp-Source: ADFU+vve+GwgOFujE+1GKm+ppwXu5XjgmONTRmJixoUSuIzM5bBfB6ER6coE/WiKClEKWiWujfowCA== X-Received: by 2002:adf:fd92:: with SMTP id d18mr10607843wrr.16.1583413156963; Thu, 05 Mar 2020 04:59:16 -0800 (PST) X-Received: from e123331-lin.home ([2a01:cb1d:112:6f00:816e:ff0d:fb69:f613]) by smtp.gmail.com with ESMTPSA id v8sm43019476wrw.2.2020.03.05.04.59.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 04:59:16 -0800 (PST) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH 1/2] ArmPkg/ArmMmuLib ARM: simplify assignment of TTBR0 system register Date: Thu, 5 Mar 2020 13:59:06 +0100 Message-Id: <20200305125907.13680-2-ard.biesheuvel@linaro.org> In-Reply-To: <20200305125907.13680-1-ard.biesheuvel@linaro.org> References: <20200305125907.13680-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=1583413159; bh=678ImIZT+NxZhnrrQbUqaewBYwfGhD988wRvSZqXZbI=; h=Cc:Date:From:Reply-To:Subject:To; b=pqrMzg1sOejbyctL5ceYNQt2diLkXj6GMCqvRpCqAVkaCA0F67MaTIKlIm3dm+CB7tZ Ct6jlUxnHJmh9h5VFCeoDIJ1E0RmaZbQvFytHkKtCyFHw/83thouaGTs/6ah1oo3vmJ2K Q2etiaeITIaY6N8Xdvht5BurWqHnZw4gHFM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The expression passed into ArmSetTTBR0 () in ArmConfigureMmu() is sub-optimal at several levels: - TranslationTable is already aligned, and if it wasn't, doing it here wouldn't help - TTBRAttributes is guaranteed not to have any bits set outside of the 0x7f mask, so the mask operation is pointless as well, - an additional (UINTN) cast for good measure is also not needed. So simplify the expression. Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/= ArmMmuLib/Arm/ArmMmuLibCore.c index 11a1e704beab..a6f44dbd5f21 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -392,7 +392,7 @@ ArmConfigureMmu ( } } =20 - ArmSetTTBR0 ((VOID *)(UINTN)(((UINTN)TranslationTable & ~TRANSLATION_TAB= LE_SECTION_ALIGNMENT_MASK) | (TTBRAttributes & 0x7F))); + ArmSetTTBR0 ((VOID *)((UINTN)TranslationTable | TTBRAttributes)); =20 // // The TTBCR register value is undefined at reset in the Non-Secure worl= d. --=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 (#55520): https://edk2.groups.io/g/devel/message/55520 Mute This Topic: https://groups.io/mt/71748690/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-