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 X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD79BC76194 for ; Mon, 22 Jul 2019 21:29:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A2E9F2199C for ; Mon, 22 Jul 2019 21:29:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tYSbK0VO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="vi+PFRFA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2E9F2199C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:From:To:Subject: References:In-Reply-To:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=syKWO3l/pNdBKcX57Ydwabc3YK1nDsWOdQbY08Nhq80=; b=tYSbK0VO3gUq11 csgA4rspsF3EE6o9tuqImMgXvlLf7Y4iMblW18eB8B3u/lQTjrD+bOjak4XztRUiNwjeIoy6MRon/ gx9HlgYiIefOs4cp1d4EBfpBOkVp7+hsZP9fkZqnhClq3TuW90p1jyvmToMbgmNbOjlKeNlSkmziv 7qiukLmhCRAjUAc4teJzzdSB6MlqMfnOgba/0hpqUVRk+nU4CmxMDQLurUtiIo7TQqugCUTiiouRN EN9EUoQDQk6GWgwm9eGvkeDIXvz0vhVByNFxMuP+7WdhvxUDmi7l5tS6C/I3zNH9QuJ1vHoDxIDiw nrImEi0vct+s8qOazOnA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hpfsc-0002qX-1M; Mon, 22 Jul 2019 21:29:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpfsY-0002q3-VX for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 21:29:56 +0000 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8924D21900; Mon, 22 Jul 2019 21:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563830994; bh=uwW/oEQ+rIP16Of2YhnZmjQcbaZjB5O2kBkr+rxXs1U=; h=In-Reply-To:References:Subject:To:Cc:From:Date:From; b=vi+PFRFA1apzHXdVjo0FACtPiFs4OVaEL17wILxIWu1gRrdOwIjm8hBwZRC0KB4LC FL8NaVB/nJXJpgswnHzjueltqt4wsv0guwau4Ro1NDQ9KTA3+AtGQpx9EgA+OzgZ4X Kt0E/skGc+3ypSEy5Ub8MLMpHBWZFsVmWWWh7qOc= MIME-Version: 1.0 In-Reply-To: <20190708154730.16643-12-sudeep.holla@arm.com> References: <20190708154730.16643-1-sudeep.holla@arm.com> <20190708154730.16643-12-sudeep.holla@arm.com> Subject: Re: [PATCH 11/11] firmware: arm_scmi: Use asynchronous CLOCK_RATE_SET when possible To: Sudeep Holla , linux-arm-kernel@lists.infradead.org From: Stephen Boyd User-Agent: alot/0.8.1 Date: Mon, 22 Jul 2019 14:29:53 -0700 Message-Id: <20190722212954.8924D21900@mail.kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_142955_043976_A1F4FBD6 X-CRM114-Status: GOOD ( 15.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Fan , linux-kernel@vger.kernel.org, Bo Zhang , Jim Quinlan , Sudeep Holla , Volodymyr Babchuk Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Quoting Sudeep Holla (2019-07-08 08:47:30) > CLOCK_PROTOCOL_ATTRIBUTES provides attributes to indicate the maximum > number of pending asynchronous clock rate changes supported by the > platform. If it's non-zero, then we should be able to use asynchronous > clock rate set for any clocks until the maximum limit is reached. > > Keeping the current count of pending asynchronous clock set rate > requests, we can decide if we can you asynchronous request for the This last part of the sentence doesn't read properly. Please rewrite. > incoming/new request. > > Signed-off-by: Sudeep Holla > --- > drivers/firmware/arm_scmi/clock.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/firmware/arm_scmi/clock.c b/drivers/firmware/arm_scmi/clock.c > index dd215bd11a58..70044b7c812e 100644 > --- a/drivers/firmware/arm_scmi/clock.c > +++ b/drivers/firmware/arm_scmi/clock.c > @@ -221,21 +222,35 @@ static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id, > u64 rate) > { > int ret; > + u32 flags = 0; > struct scmi_xfer *t; > struct scmi_clock_set_rate *cfg; > + struct clock_info *ci = handle->clk_priv; > > ret = scmi_xfer_get_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK, > sizeof(*cfg), 0, &t); > if (ret) > return ret; > > + if (ci->max_async_req) { > + if (atomic_inc_return(&ci->cur_async_req) < ci->max_async_req) > + flags |= CLOCK_SET_ASYNC; > + else > + atomic_dec(&ci->cur_async_req); Can this be combined with the atomic_dec() below and done after either transfer? > + } > + > cfg = t->tx.buf; > - cfg->flags = cpu_to_le32(0); > + cfg->flags = cpu_to_le32(flags); > cfg->id = cpu_to_le32(clk_id); > cfg->value_low = cpu_to_le32(rate & 0xffffffff); > cfg->value_high = cpu_to_le32(rate >> 32); > > - ret = scmi_do_xfer(handle, t); > + if (flags & CLOCK_SET_ASYNC) { > + ret = scmi_do_xfer_with_response(handle, t); > + atomic_dec(&ci->cur_async_req); > + } else { > + ret = scmi_do_xfer(handle, t); > + } I mean putting the atomic_dec() here. > > scmi_xfer_put(handle, t); > return ret; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel