public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: Pierre Gondois <Pierre.Gondois@arm.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: nd <nd@arm.com>
Subject: Re: [edk2-devel] [PATCH v6 1/1] DynamicTablesPkg: Exempt some _CPC field from checks
Date: Mon, 29 Jan 2024 14:31:44 +0000	[thread overview]
Message-ID: <87EA45F2-F707-4EC9-A03D-4DF80D97130C@arm.com> (raw)
In-Reply-To: <20240129120935.139976-1-pierre.gondois@arm.com>

Hi Pierre,

Thank you for this patch.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 29/01/2024, 12:09, "Pierre Gondois" <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>> wrote:


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


[1] Cf. non-optional fields in:
ACPI 6.5, s8.4.6.1 '_CPC (Continuous Performance Control)'


Signed-off-by: Pierre Gondois <pierre.gondois@arm.com <mailto:pierre.gondois@arm.com>>
---


Notes:
v6:
Do not warn if one of the following fields is missing:
- HighestPerformanceBuffer
- NominalPerformanceBuffer
An error code should just be returned.


.../Library/Common/AmlLib/AmlLib.inf | 3 ++
.../Common/AmlLib/CodeGen/AmlCodeGen.c | 28 ++++++++++++++++---
2 files changed, 27 insertions(+), 4 deletions(-)


diff --git a/DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf b/DynamicTablesPkg/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






+[FixedPcd]


+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdDevelopmentPlatformRelaxations


+


[BuildOptions]


*_*_*_CC_FLAGS = -DAML_HANDLE






diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index 6f3f46e3b1ed..22c2d598d0d8 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -3532,6 +3532,29 @@ AmlCreateCpcNode (
return EFI_INVALID_PARAMETER;


}






+ /// The following fields are theoretically mandatory, but not supported


+ /// by some platforms.


+ /// - PerformanceLimitedRegister


+ /// - ReferencePerformanceCounterRegister


+ /// - DeliveredPerformanceCounterRegister


+ /// Warn if BIT0 in PcdDevelopmentPlatformRelaxations is set, otherwise


+ /// return an error.


+ if (IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister) ||


+ IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister) ||


+ IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister))


+ {


+ if ((PcdGet64 (PcdDevelopmentPlatformRelaxations) & BIT0) != 0) {


+ 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 == 0)) ||


(IsNullGenericAddress (&CpcInfo->NominalPerformanceBuffer) &&


@@ -3540,10 +3563,7 @@ AmlCreateCpcNode (
(CpcInfo->LowestNonlinearPerformanceInteger == 0)) ||


(IsNullGenericAddress (&CpcInfo->LowestPerformanceBuffer) &&


(CpcInfo->LowestPerformanceInteger == 0)) ||


- IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister) ||


- IsNullGenericAddress (&CpcInfo->ReferencePerformanceCounterRegister) ||


- IsNullGenericAddress (&CpcInfo->DeliveredPerformanceCounterRegister) ||


- IsNullGenericAddress (&CpcInfo->PerformanceLimitedRegister))


+ IsNullGenericAddress (&CpcInfo->DesiredPerformanceRegister))


{


ASSERT (0);


return EFI_INVALID_PARAMETER;


-- 
2.25.1







-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114705): https://edk2.groups.io/g/devel/message/114705
Mute This Topic: https://groups.io/mt/104029707/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      parent reply	other threads:[~2024-01-29 14:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 12:09 [edk2-devel] [PATCH v6 1/1] DynamicTablesPkg: Exempt some _CPC field from checks PierreGondois
2024-01-29 12:13 ` PierreGondois
2024-01-29 14:31 ` Sami Mujawar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87EA45F2-F707-4EC9-A03D-4DF80D97130C@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox