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 BBCAFAC13D2 for ; Thu, 26 Oct 2023 10:38:14 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=d+OwFRQRnhMuZGFLx2R1eyh9w22mUxUfnFJceSFAnxM=; c=relaxed/simple; d=groups.io; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition; s=20140610; t=1698316693; v=1; b=RtHYxjqPfHfEIxr+5zbTr2qMp/xDE3YdTeIDXP8oRI0KIVfTigOuibWH/3PvPvm69YSlYRWE /y1pe57K6vCIs4EIq1G9RRT3j1pol+xzGI7RDeDUHY9iv7NeW4idkRXcqD3/VlUbhTlIrqcC2VE YhL8gMLjHBfcbe+vFLSb4GQ8= X-Received: by 127.0.0.2 with SMTP id r4juYY7687511xEJ8DxeGK5F; Thu, 26 Oct 2023 03:38:13 -0700 X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web11.67545.1698316692925523454 for ; Thu, 26 Oct 2023 03:38:12 -0700 X-Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39QADLCW022762; Thu, 26 Oct 2023 10:38:03 GMT X-Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3txumskdy0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 10:38:02 +0000 X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39QAc20S026079 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 10:38:02 GMT X-Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Thu, 26 Oct 2023 03:38:00 -0700 Date: Thu, 26 Oct 2023 11:37:56 +0100 From: "Leif Lindholm" To: , CC: Sami Mujawar , Ard Biesheuvel , Michael D Kinney , Liming Gao Subject: Re: [edk2-devel] [PATCH v2 02/11] ArmPkg/ArmScmiDxe: Add PERFORMANCE_DESCRIBE_FASTCHANNEL support Message-ID: References: <20231025112540.1654844-1-pierre.gondois@arm.com> <20231025112540.1654844-3-pierre.gondois@arm.com> MIME-Version: 1.0 In-Reply-To: <20231025112540.1654844-3-pierre.gondois@arm.com> X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-GUID: E5p9WWU1wVD2O2etRi7PN9aMj_nYk4Ir X-Proofpoint-ORIG-GUID: E5p9WWU1wVD2O2etRi7PN9aMj_nYk4Ir 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,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: JxzM2wjRMPIRRx2hfKbuH7JNx7686176AA= Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=RtHYxjqP; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.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 Wed, Oct 25, 2023 at 13:25:31 +0200, PierreGondois wrote: > From: Pierre Gondois Sidebar: I think if you correct your name in your git config, the above tag will drop out. > 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 > > - Copyright (c) 2017-2021, Arm Limited. All rights reserved.
> + Copyright (c) 2017-2023, Arm Limited. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > - 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/ > + > **/ > > #include > @@ -416,6 +416,75 @@ PerformanceLevelGet ( > return EFI_SUCCESS; > } > > +/** Discover the attributes of the FastChannel for the specified > + performance domain and the specified message. > + > + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instance. > + @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 description. > + > + @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 == NULL) || > + (FastChannel == NULL)) > + { > + return EFI_INVALID_PARAMETER; > + } > + > + Status = ScmiCommandGetPayload (&MessageParams); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + *MessageParams++ = DomainId; > + *MessageParams = MessageId; > + > + Cmd.ProtocolId = ScmiProtocolIdPerformance; > + Cmd.MessageId = ScmiMessageIdPerformanceDescribeFastchannel; > + PayloadLength = sizeof (DomainId) + sizeof (MessageId); > + > + Status = 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 = { > PerformanceGetVersion, > @@ -425,7 +494,8 @@ STATIC CONST SCMI_PERFORMANCE_PROTOCOL PerformanceProtocol = { > PerformanceLimitsSet, > PerformanceLimitsGet, > PerformanceLevelSet, > - PerformanceLevelGet > + PerformanceLevelGet, > + DescribeFastchannel, > }; > > /** Initialize performance management protocol and install on a given Handle. > diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h > index 8e8e05d5a5f6..088182945a06 100644 > --- a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h > +++ b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h > @@ -14,7 +14,7 @@ > > #include > > -/// 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; > > +/// 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 register. > + UINT32 DoorbellSetMaskHigh; > + > + /// Mask of lower 32 bits to preserve when writing to the doorbell register. > + UINT32 DoorbellPreserveMaskLow; > + > + /// Mask of higher 32 bits to preserve when writing to the doorbell register. > + UINT32 DoorbellPreserveMaskHigh; > +} SCMI_PERFORMANCE_FASTCHANNEL; > + > +/// SCMI Message Ids for the Performance Protocol. > +typedef enum { > + ScmiMessageIdPerformanceDomainAttributes = 0x3, > + ScmiMessageIdPerformanceDescribeLevels = 0x4, > + ScmiMessageIdPerformanceLimitsSet = 0x5, > + ScmiMessageIdPerformanceLimitsGet = 0x6, > + ScmiMessageIdPerformanceLevelSet = 0x7, > + ScmiMessageIdPerformanceLevelGet = 0x8, > + ScmiMessageIdPerformanceDescribeFastchannel = 0xB, > +} SCMI_MESSAGE_ID_PERFORMANCE; 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. / Leif > + > #pragma pack() > > /** Return version of the performance management protocol supported by SCP. > @@ -238,6 +288,34 @@ EFI_STATUS > OUT UINT32 *Level > ); > > +/** Discover the attributes of the FastChannel for the specified > + performance domain and the specified message. > + > + @param[in] This A Pointer to SCMI_PERFORMANCE_PROTOCOL Instance. > + @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 description. > + > + @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; > > -typedef enum { > - ScmiMessageIdPerformanceDomainAttributes = 0x3, > - ScmiMessageIdPerformanceDescribeLevels = 0x4, > - ScmiMessageIdPerformanceLimitsSet = 0x5, > - ScmiMessageIdPerformanceLimitsGet = 0x6, > - ScmiMessageIdPerformanceLevelSet = 0x7, > - ScmiMessageIdPerformanceLevelGet = 0x8, > -} SCMI_MESSAGE_ID_PERFORMANCE; > - > #endif /* ARM_SCMI_PERFORMANCE_PROTOCOL_H_ */ > -- > 2.25.1 > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110089): https://edk2.groups.io/g/devel/message/110089 Mute This Topic: https://groups.io/mt/102175812/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-