From nobody Mon Sep 16 19:31:55 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+114421+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+114421+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1706195969; cv=none; d=zohomail.com; s=zohoarc; b=KXlJKQDRoO1y0lCC95g5W6f2aW+CLIZDbW5I3wjcaz+x+bXc/Vpa1ns1/+tjRMIELZoD1yKfvCcXuFV068ipYnZwCyEnsJ6NjXiCwYAQCq+khAklbyf1NQA+LS1UHsnAna/EaCt2fE1BZZ2ENdvvJ+p7DaDEDg3N0GkF3LcgqWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706195969; 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=GL31vC9OqFYssEDAiOg7cYDIBwUriHQBFCMpVN8vTzM=; b=Wy2BUJPSkmTK4lMuR1MYVqwskNvwy+ZYKbJT4/Po6QQaRCCjmVLA/lMKM3Ub3sCaW2Z8iN61wm/dmfrEOtkCnr0b2Lat3DiTxJd5PpNxQ4yzh9hW7JROR4paZgUjXndmuosW0rTWuzVr7IbC748GurdJ/h8vE06gyMdCAP5Ss/4= 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+114421+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 1706195969294286.27009830319173; Thu, 25 Jan 2024 07:19:29 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=yQDWstECrcTvBcgdbYzcXFoD3KDgPbRpASHGyvY2riM=; 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=PRuMiE+8hY4ZFCbUrA0ZtkyDLG1sKL1qp9duXim6RrkYsPGaP/Oy2Ov0W7xEj8PF6599v1Wi TGgK6GGbFlL6+ZX9kgXrqfuW/oXonMvqHNxq/P0BXNftUW4Sy85O5PayDGK/DqLV7VbnezoboeY TEjE9llhf4d52yATJrx/WGGQ= X-Received: by 127.0.0.2 with SMTP id kJxiYY1788612xtSujOfH2X9; 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: pVMVF5KjFxnUbyYihKbBxONdx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706195970681100003 Content-Type: text/plain; charset="utf-8" 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 MemoryAllocationLib =20 +[FixedPcd] + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations + [BuildOptions] *_*_*_CC_FLAGS =3D -DAML_HANDLE =20 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; } =20 + /// The following fields are theoretically mandatory, but not supported + /// by some platforms. + /// - PerformanceLimitedRegister + /// - ReferencePerformanceCounterRegister + /// - DeliveredPerformanceCounterRegister + if (IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister) || + IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister)= || + IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister)) + { + if (PcdGet64 (PcdDevelopmentPlatformRelaxations) & BIT0) { + /// Just warn if DEVELOPMENT_PLATFORM_RELAXATIONS is set. + DEBUG (( + DEBUG_WARN, + "Missing PerformanceLimited|ReferencePerformanceCounter|" + "DeliveredPerformanceCounter field in _CPC object\n" + )); + } else { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + } + if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) && (CpcInfo->HighestPerformanceInteger =3D=3D 0)) || (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) && @@ -3540,13 +3562,19 @@ AmlCreateCpcNode ( (CpcInfo->LowestNonlinearPerformanceInteger =3D=3D 0)) || (IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) && (CpcInfo->LowestPerformanceInteger =3D=3D 0)) || - IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister) || - IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister)= || - IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister)= || - IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister)) + IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister)) { ASSERT (0); return EFI_INVALID_PARAMETER; + } else if ((IsNullGenericAddress (&CpcInfo->HighestPerformanceBuffer) && + (CpcInfo->HighestPerformanceInteger =3D=3D 0)) || + (IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) && + (CpcInfo->NominalPerformanceInteger =3D=3D 0))) + { + DEBUG (( + DEBUG_WARN, + "Missing Reference|Delivered performance field in _CPC object\n" + )); } =20 CpcPackage =3D NULL; --=20 2.25.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 (#114421): https://edk2.groups.io/g/devel/message/114421 Mute This Topic: https://groups.io/mt/103955510/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-