From patchwork Thu Sep 28 13:11:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 114428 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp727787qgf; Thu, 28 Sep 2017 06:14:38 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBdgPfGVSXYT61GaUpKIm3NuEF1psbmjPR+YFklHarrW1vRzpR78cGwyXgDboXmvk/nXK3w X-Received: by 10.99.96.10 with SMTP id u10mr4300672pgb.70.1506604478839; Thu, 28 Sep 2017 06:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506604478; cv=none; d=google.com; s=arc-20160816; b=yLsQNiZY/eM90sCkDJJZBQ8F+f4O+2zwFaDLKr0wFmwXJ3DjGbto5bh2U49H1YvUqX emrDWzRI7nplx9g0WKOObUaqf8/RehvbkK6v/F+PbxJ2vx01i7UhLzbs0nisRLGnyNde LVrbmjMvNM2qYtSo6U35C96cDt+0MNIg4fLIhaaoNSL24QD2oB7ElDLdyK1AR218M517 A29g8tTAgP9up7pScZGxQLd3zI0GopLSgWeoaC0yy1wjM8/VP57VRf+7Wkjvk8GnnKwl x0KpHBbYEW5agvSmwRaAn6KS48FQJwQ8adJkIZcxznZRE0TDMa9qSLw83Sx56dl1d2r/ muZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=uIhS5bTGXpNjCOkMQ2swFpdoL4CysHk1mc0bTadSkfQ=; b=E1vxIK8G6FuieYu38nsWPtNwu7ib4/2AOLtoWtFiElRaWzhFjEhMazb5dJ3jvESvPI XwbJ+N2M0JDZTHHHiC2w0k6PFNxtWY4ZjFqXjYQS9R1fxiXc4vGXzZmk4STDEts/p2mQ SWXWXERzXQT5MowsJPy9GWuaZhru33z9i0pMqiR7jAVCMjBhBfICcqsxXMeDkEHxzp/e NPcywFyO7Xkrxf7uKYS7BFCcSsSsgcqhgyZMMJ3ABL4e9zSyd+/OOQkgK7gcDRDEqh7W KdSC8gTCzjcBzEfYSw1UPqMAxC3gUDd3bV4yJzjgmkPjKgC7M6VOJNo1Gv9kr+7NZbr7 KCKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q11si1378625pli.749.2017.09.28.06.14.38; Thu, 28 Sep 2017 06:14:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753359AbdI1NOg (ORCPT + 26 others); Thu, 28 Sep 2017 09:14:36 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57128 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753317AbdI1NOd (ORCPT ); Thu, 28 Sep 2017 09:14:33 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E49861435; Thu, 28 Sep 2017 06:14:32 -0700 (PDT) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CF2EB3F483; Thu, 28 Sep 2017 06:14:30 -0700 (PDT) From: Sudeep Holla To: ALKML , LKML , DTML Cc: Sudeep Holla , Roy Franz , Harb Abdulhamid , Nishanth Menon , Arnd Bergmann , Loc Ho , Alexey Klimov , Ryan Harkin , Jassi Brar Subject: [PATCH v3 12/22] firmware: arm_scmi: add option for polling based performance domain operations Date: Thu, 28 Sep 2017 14:11:36 +0100 Message-Id: <1506604306-20739-13-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506604306-20739-1-git-send-email-sudeep.holla@arm.com> References: <1506604306-20739-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to implement fast CPU DVFS switching, we need to perform all DVFS operations atomically. Since SCMI transfer already provide option to choose between pooling vs interrupt driven(default), we can opt for polling based transfers for set,get performance domain operations. This patch adds option to choose between polling vs interrupt driven SCMI transfers for set,get performance level operations. Cc: Arnd Bergmann Signed-off-by: Sudeep Holla --- drivers/firmware/arm_scmi/perf.c | 19 +++++++++++-------- include/linux/scmi_protocol.h | 8 ++++---- 2 files changed, 15 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 13d84d829201..334e8ec321ed 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -305,8 +305,8 @@ static int scmi_perf_limits_get(const struct scmi_handle *handle, u32 domain, return ret; } -static int -scmi_perf_level_set(const struct scmi_handle *handle, u32 domain, u32 level) +static int scmi_perf_level_set(const struct scmi_handle *handle, u32 domain, + u32 level, bool poll) { int ret; struct scmi_xfer *t; @@ -317,6 +317,7 @@ scmi_perf_level_set(const struct scmi_handle *handle, u32 domain, u32 level) if (ret) return ret; + t->hdr.poll_completion = poll; lvl = t->tx.buf; lvl->domain = cpu_to_le32(domain); lvl->level = cpu_to_le32(level); @@ -327,8 +328,8 @@ scmi_perf_level_set(const struct scmi_handle *handle, u32 domain, u32 level) return ret; } -static int -scmi_perf_level_get(const struct scmi_handle *handle, u32 domain, u32 *level) +static int scmi_perf_level_get(const struct scmi_handle *handle, u32 domain, + u32 *level, bool poll) { int ret; struct scmi_xfer *t; @@ -338,6 +339,7 @@ scmi_perf_level_get(const struct scmi_handle *handle, u32 domain, u32 *level) if (ret) return ret; + t->hdr.poll_completion = poll; *(__le32 *)t->tx.buf = cpu_to_le32(domain); ret = scmi_do_xfer(handle, t); @@ -445,21 +447,22 @@ static int scmi_dvfs_get_transition_latency(struct device *dev) } static int scmi_dvfs_freq_set(const struct scmi_handle *handle, u32 domain, - unsigned long freq) + unsigned long freq, bool poll) { struct perf_dom_info *dom = perf_info.dom_info + domain; - return scmi_perf_level_set(handle, domain, freq / dom->mult_factor); + return scmi_perf_level_set(handle, domain, freq / dom->mult_factor, + poll); } static int scmi_dvfs_freq_get(const struct scmi_handle *handle, u32 domain, - unsigned long *freq) + unsigned long *freq, bool poll) { int ret; u32 level; struct perf_dom_info *dom = perf_info.dom_info + domain; - ret = scmi_perf_level_get(handle, domain, &level); + ret = scmi_perf_level_get(handle, domain, &level, poll); if (!ret) *freq = level * dom->mult_factor; diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index 5e29394b5cc9..ac1a4a096314 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -99,15 +99,15 @@ struct scmi_clk_ops { struct scmi_perf_ops { int (*limits_set)(const struct scmi_handle *, u32, u32, u32); int (*limits_get)(const struct scmi_handle *, u32, u32 *, u32 *); - int (*level_set)(const struct scmi_handle *, u32, u32); - int (*level_get)(const struct scmi_handle *, u32, u32 *); + int (*level_set)(const struct scmi_handle *, u32, u32, bool); + int (*level_get)(const struct scmi_handle *, u32, u32 *, bool); int (*limits_notify_enable)(const struct scmi_handle *, u32, bool); int (*level_notify_enable)(const struct scmi_handle *, u32, bool); int (*device_domain_id)(struct device *); int (*get_transition_latency)(struct device *); int (*add_opps_to_device)(struct device *); - int (*freq_set)(const struct scmi_handle *, u32, unsigned long); - int (*freq_get)(const struct scmi_handle *, u32, unsigned long *); + int (*freq_set)(const struct scmi_handle *, u32, unsigned long, bool); + int (*freq_get)(const struct scmi_handle *, u32, unsigned long *, bool); }; /**