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 0816C7803D9 for ; Thu, 2 Nov 2023 10:19:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=jckXrxU1hOohe4GlFR6Xp8uOjFTvu0VKoICgYEdWrDU=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:From:Subject:To:Cc:References:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1698920398; v=1; b=DQVWNeqCfuUb3r5vLqifhW6j85EkpG0fVKSSUUu2d2HobwPAZ6RNezRYKpqPa/8lWmn1g3MQ qrAe0VcNaJHgEBOdHFPlsOMKLoSmNo+IaUmZ6poRo63Xj8Xuij3NtQbg8DMapZ9i7ikuaeEpd1i TWp5J3GyPqG0R9tlr/TyXi1g= X-Received: by 127.0.0.2 with SMTP id vqdvYY7687511xx5FPjicd7v; Thu, 02 Nov 2023 03:19:58 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.27680.1698920397989286113 for ; Thu, 02 Nov 2023 03:19:58 -0700 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 163AC2F4; Thu, 2 Nov 2023 03:20:39 -0700 (PDT) X-Received: from [10.34.100.114] (e126645.nice.arm.com [10.34.100.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 080193F67D; Thu, 2 Nov 2023 03:19:55 -0700 (PDT) Message-ID: <731fa125-5a47-40d2-8062-d2ff8011cc23@arm.com> Date: Thu, 2 Nov 2023 11:19:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: "PierreGondois" Subject: Re: [edk2-devel] [PATCH v2 02/11] ArmPkg/ArmScmiDxe: Add PERFORMANCE_DESCRIBE_FASTCHANNEL support To: Leif Lindholm , devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Michael D Kinney , Liming Gao References: <20231025112540.1654844-1-pierre.gondois@arm.com> <20231025112540.1654844-3-pierre.gondois@arm.com> In-Reply-To: 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: qJLxeFpQFlVgEhjUJfdFNouVx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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=DQVWNeqC; 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 On 10/26/23 12:37, Leif Lindholm wrote: > On Wed, Oct 25, 2023 at 13:25:31 +0200, PierreGondois wrote: >> From: Pierre Gondois >=20 > Sidebar: I think if you correct your name in your git config, the > above tag will drop out. Ok I will check. >=20 >> The PERFORMANCE_DESCRIBE_FASTCHANNEL Scmi command is available >> since SCMI v2.0 and allows to query information about the supported >> fast-channels of the Scmi performance protocol. >> Add support for this command. >> >> Signed-off-by: Pierre Gondois >> --- >> .../ArmScmiDxe/ScmiPerformanceProtocol.c | 80 +++++++++++++++-- >> .../Protocol/ArmScmiPerformanceProtocol.h | 90 ++++++++++++++++--- >> 2 files changed, 155 insertions(+), 15 deletions(-) >> >> diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c b/ArmPk= g/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c >> index 0f89808fbdf9..1d87339209fd 100644 >> --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c >> +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c >> @@ -1,12 +1,12 @@ >> /** @file >> =20 >> - Copyright (c) 2017-2021, Arm Limited. All rights reserved.
>> + Copyright (c) 2017-2023, Arm Limited. All rights reserved.
>> =20 >> SPDX-License-Identifier: BSD-2-Clause-Patent >> =20 >> - System Control and Management Interface V1.0 >> - http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/ >> - DEN0056A_System_Control_and_Management_Interface.pdf >> + System Control and Management Interface, latest version: >> + - https://developer.arm.com/documentation/den0056/latest/ >> + >> **/ >> =20 >> #include >> @@ -416,6 +416,75 @@ PerformanceLevelGet ( >> return EFI_SUCCESS; >> } >> =20 >> +/** Discover the attributes of the FastChannel for the specified >> + performance domain and the specified message. >> + >> + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instan= ce. >> + @param[in] DomainId Identifier for the performance domain. >> + @param[in] MessageId Message Id of the FastChannel to discover. >> + Must be one of: >> + - PERFORMANCE_LIMITS_SET >> + - PERFORMANCE_LIMITS_GET >> + - PERFORMANCE_LEVEL_SET >> + - PERFORMANCE_LEVEL_GET >> + @param[out] FastChannel If success, contains the FastChannel descript= ion. >> + >> + @retval EFI_SUCCESS Performance level got successfully. >> + @retval EFI_DEVICE_ERROR SCP returns an SCMI error. >> + @retval EFI_INVALID_PARAMETER Invalid parameter. >> + @retval EFI_TIMEOUT Time out. >> + @retval EFI_UNSUPPORTED Unsupported. >> +**/ >> +EFI_STATUS >> +DescribeFastchannel ( >> + IN SCMI_PERFORMANCE_PROTOCOL *This, >> + IN UINT32 DomainId, >> + IN SCMI_MESSAGE_ID_PERFORMANCE MessageId, >> + OUT SCMI_PERFORMANCE_FASTCHANNEL *FastChannel >> + ) >> +{ >> + EFI_STATUS Status; >> + SCMI_COMMAND Cmd; >> + UINT32 PayloadLength; >> + UINT32 *ReturnValues; >> + UINT32 *MessageParams; >> + >> + if ((This =3D=3D NULL) || >> + (FastChannel =3D=3D NULL)) >> + { >> + return EFI_INVALID_PARAMETER; >> + } >> + >> + Status =3D ScmiCommandGetPayload (&MessageParams); >> + if (EFI_ERROR (Status)) { >> + return Status; >> + } >> + >> + *MessageParams++ =3D DomainId; >> + *MessageParams =3D MessageId; >> + >> + Cmd.ProtocolId =3D ScmiProtocolIdPerformance; >> + Cmd.MessageId =3D ScmiMessageIdPerformanceDescribeFastchannel; >> + PayloadLength =3D sizeof (DomainId) + sizeof (MessageId); >> + >> + Status =3D ScmiCommandExecute ( >> + &Cmd, >> + &PayloadLength, >> + &ReturnValues >> + ); >> + if (EFI_ERROR (Status)) { >> + return Status; >> + } >> + >> + CopyMem ( >> + FastChannel, >> + ReturnValues, >> + sizeof (SCMI_PERFORMANCE_FASTCHANNEL) >> + ); >> + >> + return Status; >> +} >> + >> // Instance of the SCMI performance management protocol. >> STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceProtocol =3D { >> PerformanceGetVersion, >> @@ -425,7 +494,8 @@ STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceP= rotocol =3D { >> PerformanceLimitsSet, >> PerformanceLimitsGet, >> PerformanceLevelSet, >> - PerformanceLevelGet >> + PerformanceLevelGet, >> + DescribeFastchannel, >> }; >> =20 >> /** Initialize performance management protocol and install on a given = Handle. >> diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h b/ArmP= kg/Include/Protocol/ArmScmiPerformanceProtocol.h >> index 8e8e05d5a5f6..088182945a06 100644 >> --- a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h >> +++ b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h >> @@ -14,7 +14,7 @@ >> =20 >> #include >> =20 >> -/// Arm Scmi performance protocol versions. >> +/// Arm SCMI performance protocol versions. >> #define PERFORMANCE_PROTOCOL_VERSION_V1 0x10000 >> #define PERFORMANCE_PROTOCOL_VERSION_V2 0x20000 >> #define PERFORMANCE_PROTOCOL_VERSION_V3 0x30000 >> @@ -79,6 +79,56 @@ typedef struct { >> UINT32 RangeMin; >> } SCMI_PERFORMANCE_LIMITS; >> =20 >> +/// Doorbell Support bit. >> +#define SCMI_PERF_FC_ATTRIB_HAS_DOORBELL BIT0 >> + >> +/// Performance protocol describe fastchannel >> +typedef struct { >> + /// Attributes. >> + UINT32 Attributes; >> + >> + /// Rate limit. >> + UINT32 RateLimit; >> + >> + /// Lower 32 bits of the FastChannel address. >> + UINT32 ChanAddrLow; >> + >> + /// Higher 32 bits of the FastChannel address. >> + UINT32 ChanAddrHigh; >> + >> + /// Size of the FastChannel in bytes. >> + UINT32 ChanSize; >> + >> + /// Lower 32 bits of the doorbell address. >> + UINT32 DoorbellAddrLow; >> + >> + /// Higher 32 bits of the doorbell address. >> + UINT32 DoorbellAddrHigh; >> + >> + /// Mask of lower 32 bits to set when writing to the doorbell registe= r. >> + UINT32 DoorbellSetMaskLow; >> + >> + /// Mask of higher 32 bits to set when writing to the doorbell regist= er. >> + UINT32 DoorbellSetMaskHigh; >> + >> + /// Mask of lower 32 bits to preserve when writing to the doorbell re= gister. >> + UINT32 DoorbellPreserveMaskLow; >> + >> + /// Mask of higher 32 bits to preserve when writing to the doorbell r= egister. >> + UINT32 DoorbellPreserveMaskHigh; >> +} SCMI_PERFORMANCE_FASTCHANNEL; >> + >> +/// SCMI Message Ids for the Performance Protocol. >> +typedef enum { >> + ScmiMessageIdPerformanceDomainAttributes =3D 0x3, >> + ScmiMessageIdPerformanceDescribeLevels =3D 0x4, >> + ScmiMessageIdPerformanceLimitsSet =3D 0x5, >> + ScmiMessageIdPerformanceLimitsGet =3D 0x6, >> + ScmiMessageIdPerformanceLevelSet =3D 0x7, >> + ScmiMessageIdPerformanceLevelGet =3D 0x8, >> + ScmiMessageIdPerformanceDescribeFastchannel =3D 0xB, >> +} SCMI_MESSAGE_ID_PERFORMANCE; >=20 > This struct appears to move in the code at the same time as having an > entry added to it. This seems superficially unmotivated. > However it is also moved to inside the pack(1) block, which makes no > sense for an enum. Yes right, I will move it out of the pack(1) section. The reason to move the SCMI_MESSAGE_ID_PERFORMANCE definition up in the fil= e was that the SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL interface added in this patch takes a SCMI_MESSAGE_ID_PERFORMANCE parameter as an argument, so the enum needs to be defined before. I can add a comment about this in the commit message. Regards, Pierre >=20 > / > Leif >=20 >> + >> #pragma pack() >> =20 >> /** Return version of the performance management protocol supported by= SCP. >> @@ -238,6 +288,34 @@ EFI_STATUS >> OUT UINT32 *Level >> ); >> =20 >> +/** Discover the attributes of the FastChannel for the specified >> + performance domain and the specified message. >> + >> + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instan= ce. >> + @param[in] DomainId Identifier for the performance domain. >> + @param[in] MessageId Message Id of the FastChannel to discover. >> + Must be one of: >> + - PERFORMANCE_LIMITS_SET >> + - PERFORMANCE_LIMITS_GET >> + - PERFORMANCE_LEVEL_SET >> + - PERFORMANCE_LEVEL_GET >> + @param[out] FastChannel If success, contains the FastChannel descript= ion. >> + >> + @retval EFI_SUCCESS Performance level got successfully. >> + @retval EFI_DEVICE_ERROR SCP returns an SCMI error. >> + @retval EFI_INVALID_PARAMETER Invalid parameter. >> + @retval EFI_TIMEOUT Time out. >> + @retval EFI_UNSUPPORTED Unsupported. >> +**/ >> +typedef >> +EFI_STATUS >> +(EFIAPI *SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL)( >> + IN SCMI_PERFORMANCE_PROTOCOL *This, >> + IN UINT32 DomainId, >> + IN SCMI_MESSAGE_ID_PERFORMANCE MessageId, >> + OUT SCMI_PERFORMANCE_FASTCHANNEL *FastChannel >> + ); >> + >> typedef struct _SCMI_PERFORMANCE_PROTOCOL { >> SCMI_PERFORMANCE_GET_VERSION GetVersion; >> SCMI_PERFORMANCE_GET_ATTRIBUTES GetProtocolAttributes; >> @@ -247,15 +325,7 @@ typedef struct _SCMI_PERFORMANCE_PROTOCOL { >> SCMI_PERFORMANCE_LIMITS_GET LimitsGet; >> SCMI_PERFORMANCE_LEVEL_SET LevelSet; >> SCMI_PERFORMANCE_LEVEL_GET LevelGet; >> + SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL DescribeFastchannel; >> } SCMI_PERFORMANCE_PROTOCOL; >> =20 >> -typedef enum { >> - ScmiMessageIdPerformanceDomainAttributes =3D 0x3, >> - ScmiMessageIdPerformanceDescribeLevels =3D 0x4, >> - ScmiMessageIdPerformanceLimitsSet =3D 0x5, >> - ScmiMessageIdPerformanceLimitsGet =3D 0x6, >> - ScmiMessageIdPerformanceLevelSet =3D 0x7, >> - ScmiMessageIdPerformanceLevelGet =3D 0x8, >> -} SCMI_MESSAGE_ID_PERFORMANCE; >> - >> #endif /* ARM_SCMI_PERFORMANCE_PROTOCOL_H_ */ >> --=20 >> 2.25.1 >> >> >> >>=20 >> >> -=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 (#110513): https://edk2.groups.io/g/devel/message/110513 Mute This Topic: https://groups.io/mt/102175812/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-