From nobody Sun May 12 12:36:26 2024 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+111767+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+111767+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1701130522; cv=none; d=zohomail.com; s=zohoarc; b=EOKf/G4jBHdUKRJCfQLVr60cVLVvjeudY0W4lWIbhoCGv8ou0IJCe4ZeXR7UsSEC0c1Cd01yEqoeJdXoSYo5MbsDa82p3mz+eOWC3nG7WWz/DkvQoyAWStsr7daZjw5QNb9yakE4DGO5feDErKRLn3wXYv0EYTOpSZOnla+7pj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701130522; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=DfnReLUocTzMKqe/4urt2rvU7WTdtqPXjLqtYvkHrW4=; b=eqDbqmTDvgixBVcYCwV+FlncvJ2is9R9bg/OJQ+4bQEwrKgH7Ft2Z8MVY9IXdSB0ZSBTswQBwrtenIBwiMNArNPHFKRUWasKh6fjnmnbmPWGv/XSoSZy55p0WXIEcNxvD5ihSO9O7gLQCb+t2VcGO7DJQEwzzRW/Xkmrtp/d5Ow= 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+111767+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 1701130522507756.6570765251604; Mon, 27 Nov 2023 16:15:22 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=hHFYMtmuJ927mhpbaRmwAS0cpbwZzTBQlXxmhVYNq7I=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701130522; v=1; b=JD9ACrvDc+if7ulKOr9leFwk6n6bXDdKmSDhAor/510FQ0/uxsL62phUBhSERENRC+kA8MmT 7KHRfT78pAOsJnpK3ybzZQRYevg6VsZEeYcafFsZCOXF8dFmiVtMF8lIA8mVjglrKi/zD6MdQ43 L1acLI6KTjyUbiDPeie80O6A= X-Received: by 127.0.0.2 with SMTP id 3O8XYY1788612xrPONwNkB3m; Mon, 27 Nov 2023 16:15:22 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.348.1701130521518606790 for ; Mon, 27 Nov 2023 16:15:21 -0800 X-Received: from localhost.localdomain (unknown [47.201.241.198]) by linux.microsoft.com (Postfix) with ESMTPSA id 771E320B74C1; Mon, 27 Nov 2023 16:15:20 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 771E320B74C1 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Leif Lindholm , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH v1 1/2] ArmPkg/Drivers/CpuDxe: Explicitly cast table entry Date: Mon, 27 Nov 2023 19:14:59 -0500 Message-ID: <20231128001500.1107-2-mikuback@linux.microsoft.com> In-Reply-To: <20231128001500.1107-1-mikuback@linux.microsoft.com> References: <20231128001500.1107-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk 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,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: hjV5UrHraQxtNFv4Dz20CasKx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1701130524281000007 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki GetNextEntryAttribute() assigns a 64-bit integer to 32-bit integers. This change explicitly casts the assigned value as UINT32 to prevent the following Visual Studio compiler warning: '=3D': conversion from 'UINT64' to 'UINT32', possible loss of data Cc: Leif Lindholm Cc: Ard Biesheuvel Cc: Sami Mujawar Signed-off-by: Michael Kubacki --- ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AA= rch64/Mmu.c index e14eb47ce4c6..4555fdb5c2c8 100644 --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c @@ -195,8 +195,8 @@ GetNextEntryAttribute ( // the subsequent ones should be filled up for (Index =3D 0; Index < EntryCount; Index++) { Entry =3D TableAddress[Index]; - EntryType =3D Entry & TT_TYPE_MASK; - EntryAttribute =3D Entry & TT_ATTRIBUTES_MASK; + EntryType =3D (UINT32)(Entry & TT_TYPE_MASK); + EntryAttribute =3D (UINT32)(Entry & TT_ATTRIBUTES_MASK); =20 // If Entry is a Table Descriptor type entry then go through the sub-l= evel table if ((EntryType =3D=3D TT_TYPE_BLOCK_ENTRY) || --=20 2.42.0.windows.2 -=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 (#111767): https://edk2.groups.io/g/devel/message/111767 Mute This Topic: https://groups.io/mt/102842002/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- From nobody Sun May 12 12:36:26 2024 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+111768+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+111768+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1701130528; cv=none; d=zohomail.com; s=zohoarc; b=WPbwrPWsfLhnlQpRholqmDwCz8iKS9dQp7hXBt/p5Bu06sdivtJ5/b/VvN4HSx+88OdBzE1hI49kAMH3DBKalDfMYOhp4tlhM+WBo6GgMAZqGVaKsAiSRJpWjpH2MK947YrtKpABLWF+WQpLU5UftS38yf/cZ8KgSm+j6Zq8fRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701130528; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=lN1M1dLsHAGCM5wL1aHh+T20NgTt4s+7nFD3OKLeGYs=; b=SSRd5RUgcwjEY2tqSUAiKPl+tCB1PHCHNjcbce90ErhlYrgWBJtIAMRLPpD2kX5D/SgqWVYC9SQYcIjagRTcaLjkT9pfiWAqG+oFxlwTzIeZjNsuZLRTzATNMjgzJwNoaU93u8NVy9IE9WX0KNyjRAOY3vjEF5Y4qpcxgxT5eZs= 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+111768+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 1701130528249952.8839439671557; Mon, 27 Nov 2023 16:15:28 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=CIp2nCZSzHThWDiZgdjpc85aHBxd8UUR+YUia0wCyrg=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1701130527; v=1; b=JMO1gCHQc9+PZb/XVyX30nfMTpMQ98VYaKdTglWoGTUhkBibCrusG/+r//9dVj2uZbvopB3t 7GaJkJKkfvT2nwzIqRqCBOuJYIUKTun39pzHyYmdzI0Wn7j3qBX9rBLwkodRxDUmB+mATlnwPkq HlY2Vv2oLTBIkFI1qfcJB0Ww= X-Received: by 127.0.0.2 with SMTP id aPUcYY1788612xV9MAS0HnDN; Mon, 27 Nov 2023 16:15:27 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.354.1701130527282532212 for ; Mon, 27 Nov 2023 16:15:27 -0800 X-Received: from localhost.localdomain (unknown [47.201.241.198]) by linux.microsoft.com (Postfix) with ESMTPSA id 651A020B74C1; Mon, 27 Nov 2023 16:15:26 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 651A020B74C1 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar Subject: [edk2-devel] [PATCH v1 2/2] ArmPkg/Drivers/CpuDxe: Use lower and upper attributes Date: Mon, 27 Nov 2023 19:15:00 -0500 Message-ID: <20231128001500.1107-3-mikuback@linux.microsoft.com> In-Reply-To: <20231128001500.1107-1-mikuback@linux.microsoft.com> References: <20231128001500.1107-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Precedence: Bulk 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,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: dKFpfCG9IYWVTIQ8TYA3g4qKx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1701130530465000003 Content-Type: text/plain; charset="utf-8" From: Michael Kubacki GetNextEntryAttribute() is currently applying a 64-bit mask (TT_ATTRIBUTES_MASK) to a 32-bit descriptor value (EntryType). The original descriptor was 64 bits containing the upper and lower attributes which are included in TT_ATTRIBUTES_MASK. The PrevEntryAttribute parameter is also a UINT32, but passed to PageAttributeToGcdAttribute() for a UINT64 parameter where the function checks masks in the upper 32 bits of the integer value: PageAttributeToGcdAttribute (*PrevEntryAttribute) ... STATIC UINT64 PageAttributeToGcdAttribute ( IN UINT64 PageAttributes ) ... if ((PageAttributes & (TT_PXN_MASK | TT_UXN_MASK)) !=3D 0) { GcdAttributes |=3D EFI_MEMORY_XP; } ... #define TT_PXN_MASK BIT53 #define TT_UXN_MASK BIT54 // EL1&0 This change removes UINT32 intermediary values. For EntryType, eliminating an unncessary cast. For EntryAttribute, preserving the upper and lower attributes for evaluation in PageAttributeToGcdAttribute(). Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sami Mujawar Signed-off-by: Michael Kubacki --- ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AA= rch64/Mmu.c index 4555fdb5c2c8..ff14c2f814b2 100644 --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c @@ -13,7 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include "CpuDxe.h" =20 -#define INVALID_ENTRY ((UINT32)~0) +#define INVALID_ENTRY ((UINT64)~0) =20 #define MIN_T0SZ 16 #define BITS_PER_LEVEL 9 @@ -169,14 +169,14 @@ GetNextEntryAttribute ( IN UINTN EntryCount, IN UINTN TableLevel, IN UINT64 BaseAddress, - IN OUT UINT32 *PrevEntryAttribute, + IN OUT UINT64 *PrevEntryAttribute, IN OUT UINT64 *StartGcdRegion ) { UINTN Index; UINT64 Entry; - UINT32 EntryAttribute; - UINT32 EntryType; + UINT64 EntryAttribute; + UINT64 EntryType; EFI_STATUS Status; UINTN NumberOfDescriptors; EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap; @@ -195,8 +195,8 @@ GetNextEntryAttribute ( // the subsequent ones should be filled up for (Index =3D 0; Index < EntryCount; Index++) { Entry =3D TableAddress[Index]; - EntryType =3D (UINT32)(Entry & TT_TYPE_MASK); - EntryAttribute =3D (UINT32)(Entry & TT_ATTRIBUTES_MASK); + EntryType =3D Entry & TT_TYPE_MASK; + EntryAttribute =3D Entry & TT_ATTRIBUTES_MASK; =20 // If Entry is a Table Descriptor type entry then go through the sub-l= evel table if ((EntryType =3D=3D TT_TYPE_BLOCK_ENTRY) || @@ -271,7 +271,7 @@ SyncCacheConfig ( ) { EFI_STATUS Status; - UINT32 PageAttribute; + UINT64 PageAttribute; UINT64 *FirstLevelTableAddress; UINTN TableLevel; UINTN TableCount; --=20 2.42.0.windows.2 -=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 (#111768): https://edk2.groups.io/g/devel/message/111768 Mute This Topic: https://groups.io/mt/102842005/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-