From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 06DC07803D8 for ; Tue, 28 Nov 2023 17:45:14 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=I5T+XAdc6YKaa69ausQq3ZR1ivq5EOa8BEmzyAZ6hCs=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1701193513; v=1; b=w3lrSh+UeqtdI9ucIvA56VB9rA2YyIVkZX2vZuILx9SmzbwHdWD+EMuwIOcOE/asALP4rW6+ WpBvJujxxh847AwEU6m90Cm1bSDdUePXzVvS7MVndtW+ECNCFlW/7YZgGTKWqGSkPd9jG8U20CU 92ZzVgCVbFTwe0e0CSIwIvBU= X-Received: by 127.0.0.2 with SMTP id BLfxYY7687511x29j3XFtvR7; Tue, 28 Nov 2023 09:45:13 -0800 X-Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.40396.1701193513034050130 for ; Tue, 28 Nov 2023 09:45:13 -0800 X-Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 571C5617F0 for ; Tue, 28 Nov 2023 17:45:12 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04B8FC433CA for ; Tue, 28 Nov 2023 17:45:11 +0000 (UTC) X-Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2c9947f488fso47265011fa.2 for ; Tue, 28 Nov 2023 09:45:11 -0800 (PST) X-Gm-Message-State: AsX6HqGcdRJlAfPxPfLhvFHpx7686176AA= X-Google-Smtp-Source: AGHT+IGLyosCZ6bgd9tQhrd+JdQeEGXj/O70UBhrEGo2vXfxHsGgc5LSalnqoJheCjicFBNRB27XZnY/UzGie1YWbTE= X-Received: by 2002:a2e:9b51:0:b0:2c9:afbc:767a with SMTP id o17-20020a2e9b51000000b002c9afbc767amr2027257ljj.35.1701193510228; Tue, 28 Nov 2023 09:45:10 -0800 (PST) MIME-Version: 1.0 References: <20231128171154.1349-1-mikuback@linux.microsoft.com> <20231128171154.1349-2-mikuback@linux.microsoft.com> In-Reply-To: <20231128171154.1349-2-mikuback@linux.microsoft.com> From: "Ard Biesheuvel" Date: Tue, 28 Nov 2023 18:44:59 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [PATCH v2 1/1] ArmPkg/Drivers/CpuDxe: Use lower and upper attributes To: mikuback@linux.microsoft.com Cc: devel@edk2.groups.io, Ard Biesheuvel , Leif Lindholm , Sami Mujawar 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,ardb@kernel.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=w3lrSh+U; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Tue, 28 Nov 2023 at 18:12, wrote: > > 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)) != 0) { > GcdAttributes |= 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(). > > This also resolves the following compiler warning previously present > on Visual Studio for the assignment to the previously 32-bit local > variables. > > '=': conversion from 'UINT64' to 'UINT32', possible loss of data > > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Cc: Sami Mujawar > Signed-off-by: Michael Kubacki Reviewed-by: Ard Biesheuvel Queued up now - thanks. > --- > ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c > index e14eb47ce4c6..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" > > -#define INVALID_ENTRY ((UINT32)~0) > +#define INVALID_ENTRY ((UINT64)~0) > > #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; > @@ -271,7 +271,7 @@ SyncCacheConfig ( > ) > { > EFI_STATUS Status; > - UINT32 PageAttribute; > + UINT64 PageAttribute; > UINT64 *FirstLevelTableAddress; > UINTN TableLevel; > UINTN TableCount; > -- > 2.42.0.windows.2 > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111819): https://edk2.groups.io/g/devel/message/111819 Mute This Topic: https://groups.io/mt/102854549/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-