From nobody Mon Feb 9 03:13:47 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+99703+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+99703+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1675722080; cv=none; d=zohomail.com; s=zohoarc; b=hD8naXcqXlAxMonS/lrVXfVXiRGlnz1rU/A3ykDI8W5/97ycZsl1JOk/kN0PcvTv3MbtrykOr3rRVR9ywSrKPfUcAeIWmBvAJdYQSi365tp8+NFfQUcPQay28vtFhgbSIf5cgw0L3QhsFayLtmxWF8+A4L1+d/U+MsnZ0nuF8Tg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675722080; 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=7ejazRBbyU7k6F9ZjdPlmcYl20vYNhg9hBHUPDnWq3M=; b=erm6KUzacXWxTscNW7zLNFqp0h1HrSuV9DcIWranUi3T7ISIxM7ADC4xRWwalTw4sMwEY0XqEOehJVpQiXeE5sSqTDQHk9rfe52h4xZwySq4H0QzQE2yhY7FQJaF+2aia0InApI8e4GD9uEdUYNLJGOGm9w27JSSMQSi5KvRZjM= 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+99703+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 1675722080118476.38717700472466; Mon, 6 Feb 2023 14:21:20 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id O10rYY1788612xVY0QBd1lbj; Mon, 06 Feb 2023 14:21:19 -0800 X-Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.68653.1675722078763380361 for ; Mon, 06 Feb 2023 14:21:19 -0800 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 ams.source.kernel.org (Postfix) with ESMTPS id 01516B81633; Mon, 6 Feb 2023 22:21:17 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87624C433EF; Mon, 6 Feb 2023 22:21:13 +0000 (UTC) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael Kinney , Liming Gao , Jiewen Yao , Michael Kubacki , Sean Brogan , Rebecca Cran , Leif Lindholm , Sami Mujawar , Taylor Beebe Subject: [edk2-devel] [PATCH v3 3/5] ArmPkg/CpuDxe: Expose unified region-to-EFI attribute conversion Date: Mon, 6 Feb 2023 23:20:58 +0100 Message-Id: <20230206222100.411169-4-ardb@kernel.org> In-Reply-To: <20230206222100.411169-1-ardb@kernel.org> References: <20230206222100.411169-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: SK5PvMTz6WkWFcSxA1yDZfhZx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1675722079; bh=YkuxeVuZXJp925QSp8S6pRwGiyQdvkovBm6TZcobXWI=; h=Cc:Date:From:Reply-To:Subject:To; b=Hbj7G8zB5gJJ87QgT2HqM8LnJCS+NPGxK9v8ZYGzEgA7sdn3hJZzmB7ldS1jG/YIfSe J/MYX2hIvsr0JxRGeCjvtWuKGu4CQ6zmcE4NIvd0VvYHNI6YTLkaF3MvSryawoWnUQDK2 66BAwJT3XTuOt+qjdbOYSv0xwKnTKhzS8CE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1675722080427100010 Content-Type: text/plain; charset="utf-8" In preparation for introducing an implementation of the EFI memory attributes protocol that is shared between ARM and AArch64, unify the existing code that converts a page table descriptor into a EFI_MEMORY_xxx bitfield, so it can be called from the generic code. Signed-off-by: Ard Biesheuvel --- ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 8 ++++++++ ArmPkg/Drivers/CpuDxe/Arm/Mmu.c | 13 +++++++++++++ ArmPkg/Drivers/CpuDxe/CpuDxe.h | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AA= rch64/Mmu.c index 8bb33046e707..a4bde2034fa0 100644 --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c @@ -79,6 +79,14 @@ PageAttributeToGcdAttribute ( return GcdAttributes; } =20 +UINT64 +RegionAttributeToGcdAttribute ( + IN UINTN PageAttributes + ) +{ + return PageAttributeToGcdAttribute (PageAttributes); +} + STATIC UINT64 GetFirstPageAttribute ( diff --git a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c b/ArmPkg/Drivers/CpuDxe/Arm/Mm= u.c index e7acd84b8af9..a3a7fde9a872 100644 --- a/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c +++ b/ArmPkg/Drivers/CpuDxe/Arm/Mmu.c @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include "CpuDxe.h" =20 +STATIC EFI_STATUS SectionToGcdAttributes ( IN UINT32 SectionAttributes, @@ -77,6 +78,18 @@ SectionToGcdAttributes ( return EFI_SUCCESS; } =20 +UINT64 +RegionAttributeToGcdAttribute ( + IN UINTN PageAttributes + ) +{ + UINT64 Result; + + SectionToGcdAttributes (PageAttributes, &Result); + return Result; +} + +STATIC EFI_STATUS PageToGcdAttributes ( IN UINT32 PageAttributes, diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.h b/ArmPkg/Drivers/CpuDxe/CpuDxe.h index ff672390ce51..5a9f1ef1f969 100644 --- a/ArmPkg/Drivers/CpuDxe/CpuDxe.h +++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.h @@ -126,4 +126,9 @@ SetGcdMemorySpaceAttributes ( IN UINT64 Attributes ); =20 +UINT64 +RegionAttributeToGcdAttribute ( + IN UINTN PageAttributes + ); + #endif // CPU_DXE_H_ --=20 2.39.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 (#99703): https://edk2.groups.io/g/devel/message/99703 Mute This Topic: https://groups.io/mt/96795077/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-