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 23633AC193A for ; Thu, 25 Jan 2024 15:19:29 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=riy/fROI1TWKaNKv7/kvWO8bImRHutNfM+JMZqnvSlc=; c=relaxed/simple; d=groups.io; h=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=1706195968; v=1; b=kcGgnn/6Fapwq/IRub/c70LJwxw4XKNYlN6xYikZ5LthdtLIMu35/V/Vrjo8pQ1k/KzcJyOr qDmXfRS/O+SYNzE6ksE+Kx6z6E878sEHbd//r04ekaYUkIP8EnZVG2iBD9PtVYK1EGe3HLW7QtD K5GhGCvy3pDZbxFRXNRcpfJ0= X-Received: by 127.0.0.2 with SMTP id GD2gYY7687511xjrLJKPYkz3; Thu, 25 Jan 2024 07:19:28 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.20311.1706195968246674669 for ; Thu, 25 Jan 2024 07:19:28 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 58FB11476; Thu, 25 Jan 2024 07:20:12 -0800 (PST) X-Received: from e126645.arm.com (unknown [10.57.47.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9BE923F5A1; Thu, 25 Jan 2024 07:19:26 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Pierre Gondois Subject: [edk2-devel] [PATCH v5 11/11] DynamicTablesPkg: Exempt some _CPC field from checks Date: Thu, 25 Jan 2024 16:18:50 +0100 Message-Id: <20240125151850.620749-12-pierre.gondois@arm.com> In-Reply-To: <20240125151850.620749-1-pierre.gondois@arm.com> References: <20240125151850.620749-1-pierre.gondois@arm.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,pierre.gondois@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: HtNvk1xhFzhC4mTq346faG72x7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="kcGgnn/6"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (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 When generating _CPC objects, some fields are mandatory by spec [1]. Some fields cannot be supported by a the Juno platform, which is used to test the _CPC generation. Therefore, rely on the PcdDevelopmentPlatformRelaxations Pcd to either: - warn about the missing fields and and let the OS handle the missing information - consider the missing fields as an error _CPC fields that are exempted from checks when the Pcd is set: - PerformanceLimitedRegister - ReferencePerformanceCounterRegister - DeliveredPerformanceCounterRegister Also warn if one of the following optional fields is missing: - HighestPerformance[Buffer|Integer] - NominalPerformance[Buffer|Integer] [1] Cf. non-optional fields in: ACPI 6.5, s8.4.6.1 '_CPC (Continuous Performance Control)' Signed-off-by: Pierre Gondois --- .../Library/Common/AmlLib/AmlLib.inf | 3 ++ .../Common/AmlLib/CodeGen/AmlCodeGen.c | 36 ++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf b/DynamicTab= lesPkg/Library/Common/AmlLib/AmlLib.inf index 6d0aa6ff934c..f269691864d4 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf +++ b/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf @@ -71,6 +71,9 @@ [LibraryClasses] BaseLib=0D MemoryAllocationLib=0D =0D +[FixedPcd]=0D + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations=0D +=0D [BuildOptions]=0D *_*_*_CC_FLAGS =3D -DAML_HANDLE=0D =0D diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index 6f3f46e3b1ed..a04e652588d6 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -3532,6 +3532,28 @@ AmlCreateCpcNode ( return EFI_INVALID_PARAMETER;=0D }=0D =0D + /// The following fields are theoretically mandatory, but not supported= =0D + /// by some platforms.=0D + /// - PerformanceLimitedRegister=0D + /// - ReferencePerformanceCounterRegister=0D + /// - DeliveredPerformanceCounterRegister=0D + if (IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister) ||=0D + IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister)= ||=0D + IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister)= )=0D + {=0D + if (PcdGet64 (PcdDevelopmentPlatformRelaxations) & BIT0) {=0D + /// Just warn if DEVELOPMENT_PLATFORM_RELAXATIONS is set.=0D + DEBUG ((=0D + DEBUG_WARN,=0D + "Missing PerformanceLimited|ReferencePerformanceCounter|"=0D + "DeliveredPerformanceCounter field in _CPC object\n"=0D + ));=0D + } else {=0D + ASSERT (0);=0D + return EFI_INVALID_PARAMETER;=0D + }=0D + }=0D +=0D if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) &&=0D (CpcInfo->HighestPerformanceInteger =3D=3D 0)) ||=0D (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) &&=0D @@ -3540,13 +3562,19 @@ AmlCreateCpcNode ( (CpcInfo->LowestNonlinearPerformanceInteger =3D=3D 0)) ||=0D (IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) &&=0D (CpcInfo->LowestPerformanceInteger =3D=3D 0)) ||=0D - IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister) ||=0D - IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister)= ||=0D - IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister)= ||=0D - IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister))=0D + IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister))=0D {=0D ASSERT (0);=0D return EFI_INVALID_PARAMETER;=0D + } else if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) &&= =0D + (CpcInfo->HighestPerformanceInteger =3D=3D 0)) ||=0D + (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) &&= =0D + (CpcInfo->NominalPerformanceInteger =3D=3D 0)))=0D + {=0D + DEBUG ((=0D + DEBUG_WARN,=0D + "Missing Reference|Delivered performance field in _CPC object\n"=0D + ));=0D }=0D =0D CpcPackage =3D NULL;=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114421): https://edk2.groups.io/g/devel/message/114421 Mute This Topic: https://groups.io/mt/103955510/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-