From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07124C433EF for ; Thu, 28 Apr 2022 13:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347692AbiD1NxI (ORCPT ); Thu, 28 Apr 2022 09:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbiD1NxG (ORCPT ); Thu, 28 Apr 2022 09:53:06 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2BC85B3C47 for ; Thu, 28 Apr 2022 06:49:52 -0700 (PDT) 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 E905D1477; Thu, 28 Apr 2022 06:49:51 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AEB0A3F5A1; Thu, 28 Apr 2022 06:49:50 -0700 (PDT) Date: Thu, 28 Apr 2022 14:49:48 +0100 From: Cristian Marussi To: Sudeep Holla Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.quinlan@broadcom.com, Jonathan.Cameron@huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com Subject: Re: [PATCH 22/22] firmware: arm_scmi: Add SCMIv3.1 PERFORMANCE_LIMITS_SET checks Message-ID: References: <20220330150551.2573938-1-cristian.marussi@arm.com> <20220330150551.2573938-23-cristian.marussi@arm.com> <20220428131357.mbj5pksrnt5auotb@bogus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220428131357.mbj5pksrnt5auotb@bogus> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 28, 2022 at 02:13:57PM +0100, Sudeep Holla wrote: > On Wed, Mar 30, 2022 at 04:05:51PM +0100, Cristian Marussi wrote: > > Starting with SCMIv3.1, the PERFORMANCE_LIMITS_SET command allows a user > > to request only one between max and min ranges to be changed, while leaving > > the other untouched if set to zero in the request; anyway SCMIv3.1 states > > also explicitly that you cannot leave both of those unchanged (zeroed) when > > issuing such command: add a proper check for this condition. > > > > Signed-off-by: Cristian Marussi > > --- > > drivers/firmware/arm_scmi/perf.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > > index 65ffda5495d6..8f4051aca220 100644 > > --- a/drivers/firmware/arm_scmi/perf.c > > +++ b/drivers/firmware/arm_scmi/perf.c > > @@ -423,6 +423,9 @@ static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph, > > struct scmi_perf_info *pi = ph->get_priv(ph); > > struct perf_dom_info *dom = pi->dom_info + domain; > > > > + if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf) > > + return -EINVAL; > > + > > Do we really need the version check here ? I agree it was explicitly added > in v3.1, but it makes sense on any version really. No ? Indeed seemed a silly patch also to me but given that only in v3.1 it is explicitly stated that you cannot issue this command with both min and max ZEROED I though this could have broken older fw that allowed setting PERF_LIMITS_SET max=0 min=0 ....maybe overthought ... Thanks, Cristian From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66FCCC433F5 for ; Thu, 28 Apr 2022 14:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Yotir0qjQEnHC4xIn/gJG+6EozENv6HBY5G0HhM9PXU=; b=IO1Tqn+8ttqRFy ATseXOsR5rs2j07zdgM//y3Nre3T9r6eLpDx1QxqSB74ZrwXC2GtC6td62V6ZdmgQrggno5Ew47nq aijIZ6pSsUvkCOQCgrlLczpMvRXVy1yEA3P4oD9jFJfOXT4lrzADgEuUQsiVDQk9iiWNlMk6bMpf2 ZNhsZ3Twn+u5OHrBnkYaOOOQsZjq/UQw8/fFQFb1dXfIDwrSbvmZQmmW3vfmKUOaGE5afiGzRJrTN 8w2Jtd03bnUBB7Rtf66+hgsrpaSTEYdzT6SWKd7Pf3833H7nYbMR+DgWaSg0BKIA5tfAskxG+rIJB 4h2imu4/BaeP5FFVp2jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nk4i9-007Hr8-P6; Thu, 28 Apr 2022 14:01:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nk4Wn-007CJ0-2Y for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2022 13:49:54 +0000 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 E905D1477; Thu, 28 Apr 2022 06:49:51 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AEB0A3F5A1; Thu, 28 Apr 2022 06:49:50 -0700 (PDT) Date: Thu, 28 Apr 2022 14:49:48 +0100 From: Cristian Marussi To: Sudeep Holla Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.quinlan@broadcom.com, Jonathan.Cameron@huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com Subject: Re: [PATCH 22/22] firmware: arm_scmi: Add SCMIv3.1 PERFORMANCE_LIMITS_SET checks Message-ID: References: <20220330150551.2573938-1-cristian.marussi@arm.com> <20220330150551.2573938-23-cristian.marussi@arm.com> <20220428131357.mbj5pksrnt5auotb@bogus> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220428131357.mbj5pksrnt5auotb@bogus> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220428_064953_189669_BD7C7777 X-CRM114-Status: GOOD ( 21.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Apr 28, 2022 at 02:13:57PM +0100, Sudeep Holla wrote: > On Wed, Mar 30, 2022 at 04:05:51PM +0100, Cristian Marussi wrote: > > Starting with SCMIv3.1, the PERFORMANCE_LIMITS_SET command allows a user > > to request only one between max and min ranges to be changed, while leaving > > the other untouched if set to zero in the request; anyway SCMIv3.1 states > > also explicitly that you cannot leave both of those unchanged (zeroed) when > > issuing such command: add a proper check for this condition. > > > > Signed-off-by: Cristian Marussi > > --- > > drivers/firmware/arm_scmi/perf.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > > index 65ffda5495d6..8f4051aca220 100644 > > --- a/drivers/firmware/arm_scmi/perf.c > > +++ b/drivers/firmware/arm_scmi/perf.c > > @@ -423,6 +423,9 @@ static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph, > > struct scmi_perf_info *pi = ph->get_priv(ph); > > struct perf_dom_info *dom = pi->dom_info + domain; > > > > + if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf) > > + return -EINVAL; > > + > > Do we really need the version check here ? I agree it was explicitly added > in v3.1, but it makes sense on any version really. No ? Indeed seemed a silly patch also to me but given that only in v3.1 it is explicitly stated that you cannot issue this command with both min and max ZEROED I though this could have broken older fw that allowed setting PERF_LIMITS_SET max=0 min=0 ....maybe overthought ... Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel