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 5ECE7740045 for ; Wed, 25 Oct 2023 11:25:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=UJGW24vODT+anZoYXYc90C2fXxRqij40wt6VOOU9LbA=; 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=1698233156; v=1; b=gSIHJ/CrKU7oNndj2mBh5DtAgCpc+M1FCVhE/rZG68M6DuUIz35vNqi/m+eUpxpxC69pACDn rJr3KZ52TKWW+1bUzodlUTQCax257MMYMfnJRAE4srbYlRKTTO/417l00RhTbcuJxRS2nC9egxe bxxdBG73nxofNV88g1rxAY2k= X-Received: by 127.0.0.2 with SMTP id PC4NYY7687511xOKHH9g9bQ4; Wed, 25 Oct 2023 04:25:56 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.170922.1698233155204636935 for ; Wed, 25 Oct 2023 04:25:55 -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 4ECAC139F; Wed, 25 Oct 2023 04:26:36 -0700 (PDT) X-Received: from cam-smtp0.cambridge.arm.com (e126645.nice.arm.com [10.34.100.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A3EDB3F738; Wed, 25 Oct 2023 04:25:53 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Sami Mujawar , Leif Lindholm , Ard Biesheuvel , Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH v2 02/11] ArmPkg/ArmScmiDxe: Add PERFORMANCE_DESCRIBE_FASTCHANNEL support Date: Wed, 25 Oct 2023 13:25:31 +0200 Message-Id: <20231025112540.1654844-3-pierre.gondois@arm.com> In-Reply-To: <20231025112540.1654844-1-pierre.gondois@arm.com> References: <20231025112540.1654844-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: 26AKflmXC3Lq2HIhwqToILqSx7686176AA= 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="gSIHJ/Cr"; 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 From: Pierre Gondois 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/ArmPkg= /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 Instanc= e. + @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 descripti= on. + + @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 PerformancePr= otocol =3D { PerformanceLimitsSet, PerformanceLimitsGet, PerformanceLevelSet, - PerformanceLevelGet + PerformanceLevelGet, + DescribeFastchannel, }; =20 /** Initialize performance management protocol and install on a given Ha= ndle. diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h b/ArmPk= g/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 register= . + UINT32 DoorbellSetMaskLow; + + /// Mask of higher 32 bits to set when writing to the doorbell registe= r. + UINT32 DoorbellSetMaskHigh; + + /// Mask of lower 32 bits to preserve when writing to the doorbell reg= ister. + UINT32 DoorbellPreserveMaskLow; + + /// Mask of higher 32 bits to preserve when writing to the doorbell re= gister. + 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; + #pragma pack() =20 /** Return version of the performance management protocol supported by S= CP. @@ -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 Instanc= e. + @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 descripti= on. + + @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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110038): https://edk2.groups.io/g/devel/message/110038 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] -=-=-=-=-=-=-=-=-=-=-=-