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 593CE7803CC for ; Tue, 21 Nov 2023 16:50:34 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=4FWZrGXPMlcVThI2r4VasOhFH2GgL3MAWDTCfSGpXIg=; 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=1700585433; v=1; b=EjqawoMn2jI1qyXj94v92cTuTRC5RFxuTs4ZoCJVt3EHaGeVhbLOcVAApIDFkfb+3+l4QRpM nb5gk7VCVB/Uz8q0XU7N5QRXMyypo2KjezzY+9icZLsCCDxm2aQD8TaJ/IP4EZOcZHzd9OrZ3qa 32oFQYzgTLe3wEl1ghNqNwdk= X-Received: by 127.0.0.2 with SMTP id LQ6iYY7687511xYaqs4Bo6XL; Tue, 21 Nov 2023 08:50:33 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.46861.1700585432361858624 for ; Tue, 21 Nov 2023 08:50:32 -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 94E30169C; Tue, 21 Nov 2023 08:51:18 -0800 (PST) X-Received: from e126645.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AB5933F6C4; Tue, 21 Nov 2023 08:50:30 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH v3 02/11] ArmPkg/ArmScmiDxe: Add PERFORMANCE_DESCRIBE_FASTCHANNEL support Date: Tue, 21 Nov 2023 17:49:58 +0100 Message-Id: <20231121165007.1546858-3-pierre.gondois@arm.com> In-Reply-To: <20231121165007.1546858-1-pierre.gondois@arm.com> References: <20231121165007.1546858-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: CR8v45VrFQuy8eoZ4YWyOIogx7686176AA= 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=EjqawoMn; 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 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. Also move SCMI_MESSAGE_ID_PERFORMANCE enum definition up in the file to use it in SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL function declaration. Reviewed-by: Leif Lindholm Signed-off-by: Pierre Gondois --- .../ArmScmiDxe/ScmiPerformanceProtocol.c | 80 +++++++++++++++-- .../Protocol/ArmScmiPerformanceProtocol.h | 88 +++++++++++++++++-- 2 files changed, 154 insertions(+), 14 deletions(-) diff --git a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c b/ArmPkg/D= rivers/ArmScmiDxe/ScmiPerformanceProtocol.c index 0f89808fbdf9..91efce4bf22d 100644 --- a/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c +++ b/ArmPkg/Drivers/ArmScmiDxe/ScmiPerformanceProtocol.c @@ -1,12 +1,12 @@ /** @file=0D =0D - Copyright (c) 2017-2021, Arm Limited. All rights reserved.
=0D + Copyright (c) 2017-2023, Arm Limited. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D - System Control and Management Interface V1.0=0D - http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/=0D - DEN0056A_System_Control_and_Management_Interface.pdf=0D + System Control and Management Interface V3.2, latest version at:=0D + - https://developer.arm.com/documentation/den0056/latest/=0D +=0D **/=0D =0D #include =0D @@ -416,6 +416,75 @@ PerformanceLevelGet ( return EFI_SUCCESS;=0D }=0D =0D +/** Discover the attributes of the FastChannel for the specified=0D + performance domain and the specified message.=0D +=0D + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instance.= =0D + @param[in] DomainId Identifier for the performance domain.=0D + @param[in] MessageId Message Id of the FastChannel to discover.=0D + Must be one of:=0D + - PERFORMANCE_LIMITS_SET=0D + - PERFORMANCE_LIMITS_GET=0D + - PERFORMANCE_LEVEL_SET=0D + - PERFORMANCE_LEVEL_GET=0D + @param[out] FastChannel If success, contains the FastChannel description= .=0D +=0D + @retval EFI_SUCCESS Performance level got successfully.=0D + @retval EFI_DEVICE_ERROR SCP returns an SCMI error.=0D + @retval EFI_INVALID_PARAMETER Invalid parameter.=0D + @retval EFI_TIMEOUT Time out.=0D + @retval EFI_UNSUPPORTED Unsupported.=0D +**/=0D +EFI_STATUS=0D +DescribeFastchannel (=0D + IN SCMI_PERFORMANCE_PROTOCOL *This,=0D + IN UINT32 DomainId,=0D + IN SCMI_MESSAGE_ID_PERFORMANCE MessageId,=0D + OUT SCMI_PERFORMANCE_FASTCHANNEL *FastChannel=0D + )=0D +{=0D + EFI_STATUS Status;=0D + SCMI_COMMAND Cmd;=0D + UINT32 PayloadLength;=0D + UINT32 *ReturnValues;=0D + UINT32 *MessageParams;=0D +=0D + if ((This =3D=3D NULL) ||=0D + (FastChannel =3D=3D NULL))=0D + {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Status =3D ScmiCommandGetPayload (&MessageParams);=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + *MessageParams++ =3D DomainId;=0D + *MessageParams =3D MessageId;=0D +=0D + Cmd.ProtocolId =3D ScmiProtocolIdPerformance;=0D + Cmd.MessageId =3D ScmiMessageIdPerformanceDescribeFastchannel;=0D + PayloadLength =3D sizeof (DomainId) + sizeof (MessageId);=0D +=0D + Status =3D ScmiCommandExecute (=0D + &Cmd,=0D + &PayloadLength,=0D + &ReturnValues=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D +=0D + CopyMem (=0D + FastChannel,=0D + ReturnValues,=0D + sizeof (SCMI_PERFORMANCE_FASTCHANNEL)=0D + );=0D +=0D + return Status;=0D +}=0D +=0D // Instance of the SCMI performance management protocol.=0D STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceProtocol =3D {=0D PerformanceGetVersion,=0D @@ -425,7 +494,8 @@ STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceProt= ocol =3D { PerformanceLimitsSet,=0D PerformanceLimitsGet,=0D PerformanceLevelSet,=0D - PerformanceLevelGet=0D + PerformanceLevelGet,=0D + DescribeFastchannel,=0D };=0D =0D /** Initialize performance management protocol and install on a given Hand= le.=0D diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h b/ArmPkg/= Include/Protocol/ArmScmiPerformanceProtocol.h index a28f0f766e37..c69efe7408e1 100644 --- a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h +++ b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h @@ -79,8 +79,58 @@ typedef struct { UINT32 RangeMin;=0D } SCMI_PERFORMANCE_LIMITS;=0D =0D +/// Doorbell Support bit.=0D +#define SCMI_PERF_FC_ATTRIB_HAS_DOORBELL BIT0=0D +=0D +/// Performance protocol describe fastchannel=0D +typedef struct {=0D + /// Attributes.=0D + UINT32 Attributes;=0D +=0D + /// Rate limit.=0D + UINT32 RateLimit;=0D +=0D + /// Lower 32 bits of the FastChannel address.=0D + UINT32 ChanAddrLow;=0D +=0D + /// Higher 32 bits of the FastChannel address.=0D + UINT32 ChanAddrHigh;=0D +=0D + /// Size of the FastChannel in bytes.=0D + UINT32 ChanSize;=0D +=0D + /// Lower 32 bits of the doorbell address.=0D + UINT32 DoorbellAddrLow;=0D +=0D + /// Higher 32 bits of the doorbell address.=0D + UINT32 DoorbellAddrHigh;=0D +=0D + /// Mask of lower 32 bits to set when writing to the doorbell register.= =0D + UINT32 DoorbellSetMaskLow;=0D +=0D + /// Mask of higher 32 bits to set when writing to the doorbell register.= =0D + UINT32 DoorbellSetMaskHigh;=0D +=0D + /// Mask of lower 32 bits to preserve when writing to the doorbell regis= ter.=0D + UINT32 DoorbellPreserveMaskLow;=0D +=0D + /// Mask of higher 32 bits to preserve when writing to the doorbell regi= ster.=0D + UINT32 DoorbellPreserveMaskHigh;=0D +} SCMI_PERFORMANCE_FASTCHANNEL;=0D +=0D #pragma pack()=0D =0D +/// SCMI Message Ids for the Performance Protocol.=0D +typedef enum {=0D + ScmiMessageIdPerformanceDomainAttributes =3D 0x3,=0D + ScmiMessageIdPerformanceDescribeLevels =3D 0x4,=0D + ScmiMessageIdPerformanceLimitsSet =3D 0x5,=0D + ScmiMessageIdPerformanceLimitsGet =3D 0x6,=0D + ScmiMessageIdPerformanceLevelSet =3D 0x7,=0D + ScmiMessageIdPerformanceLevelGet =3D 0x8,=0D + ScmiMessageIdPerformanceDescribeFastchannel =3D 0xB,=0D +} SCMI_MESSAGE_ID_PERFORMANCE;=0D +=0D /** Return version of the performance management protocol supported by SCP= .=0D firmware.=0D =0D @@ -238,6 +288,34 @@ EFI_STATUS OUT UINT32 *Level=0D );=0D =0D +/** Discover the attributes of the FastChannel for the specified=0D + performance domain and the specified message.=0D +=0D + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instance.= =0D + @param[in] DomainId Identifier for the performance domain.=0D + @param[in] MessageId Message Id of the FastChannel to discover.=0D + Must be one of:=0D + - PERFORMANCE_LIMITS_SET=0D + - PERFORMANCE_LIMITS_GET=0D + - PERFORMANCE_LEVEL_SET=0D + - PERFORMANCE_LEVEL_GET=0D + @param[out] FastChannel If success, contains the FastChannel description= .=0D +=0D + @retval EFI_SUCCESS Performance level got successfully.=0D + @retval EFI_DEVICE_ERROR SCP returns an SCMI error.=0D + @retval EFI_INVALID_PARAMETER Invalid parameter.=0D + @retval EFI_TIMEOUT Time out.=0D + @retval EFI_UNSUPPORTED Unsupported.=0D +**/=0D +typedef=0D +EFI_STATUS=0D +(EFIAPI *SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL)(=0D + IN SCMI_PERFORMANCE_PROTOCOL *This,=0D + IN UINT32 DomainId,=0D + IN SCMI_MESSAGE_ID_PERFORMANCE MessageId,=0D + OUT SCMI_PERFORMANCE_FASTCHANNEL *FastChannel=0D + );=0D +=0D typedef struct _SCMI_PERFORMANCE_PROTOCOL {=0D SCMI_PERFORMANCE_GET_VERSION GetVersion;=0D SCMI_PERFORMANCE_GET_ATTRIBUTES GetProtocolAttributes;=0D @@ -247,15 +325,7 @@ typedef struct _SCMI_PERFORMANCE_PROTOCOL { SCMI_PERFORMANCE_LIMITS_GET LimitsGet;=0D SCMI_PERFORMANCE_LEVEL_SET LevelSet;=0D SCMI_PERFORMANCE_LEVEL_GET LevelGet;=0D + SCMI_PERFORMANCE_DESCRIBE_FASTCHANNEL DescribeFastchannel;=0D } SCMI_PERFORMANCE_PROTOCOL;=0D =0D -typedef enum {=0D - ScmiMessageIdPerformanceDomainAttributes =3D 0x3,=0D - ScmiMessageIdPerformanceDescribeLevels =3D 0x4,=0D - ScmiMessageIdPerformanceLimitsSet =3D 0x5,=0D - ScmiMessageIdPerformanceLimitsGet =3D 0x6,=0D - ScmiMessageIdPerformanceLevelSet =3D 0x7,=0D - ScmiMessageIdPerformanceLevelGet =3D 0x8,=0D -} SCMI_MESSAGE_ID_PERFORMANCE;=0D -=0D #endif /* ARM_SCMI_PERFORMANCE_PROTOCOL_H_ */=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111569): https://edk2.groups.io/g/devel/message/111569 Mute This Topic: https://groups.io/mt/102732017/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-