Received: by 10.192.165.148 with SMTP id m20csp139591imm; Wed, 9 May 2018 10:04:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpagfGFp2BK0oB4ffRpXkBwrt1iP8O8C8T+ZsBmuW3shLY7DWYoiT2VzjS3q3qOl7czWWjI X-Received: by 2002:a17:902:bc49:: with SMTP id t9-v6mr21901084plz.109.1525885444442; Wed, 09 May 2018 10:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525885444; cv=none; d=google.com; s=arc-20160816; b=h6jo3Cn1Z+5cvFxMMdkbPG/5QWV1tDz1n0T0tDax3Gy7/neqQxsdtvz3UZSqbAU/SA BGj+pwXKUftllzW2NhicEk22Csq71Ipd9AuabHWhNeX0FnYFYoj972GKeW4PL7x7aPci YENm0hMehbgkaLJRI4i/92NLDfcSUMcZf6oLiof+XOwATmHOiId+Vu/cHcTc2vnr2+PM KR5cLLM0OqBvoqiTQFN6IC7n//FqWx2YT8slPi3u3qmFh47PKGnS/RSY9Fkn6YXQJVzg 0JNemQaPq15ne3MoH/TzCEx7HnGLv+sHMCOj5C0yRVi+JD7V9oUCRvjjaUP4RbS8kKkd BGow== 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:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=qR123ZgjIpwHoPa5Sh3r2BGLwlT9KFUJD2wAZq+cRmg=; b=KlkhEK4gYrapHJVBU6DhST7GX9dkgO4wLmoroZ79R/uJAoFUJJk4hISsn0kwJhI3Tx nsdeXkbQHjL8ON9PadDp7x4ao/MY678Z0WR/sEALelXmO27g7IZ9E3GJ7nmGgRANELrg cOaMu3eenhbKdVhw9FhqSoKMgyY7KMPpWy+TNFRRe+BKAsmcHU35V/gJ1qjvNmqygsZ/ +jcXOpwS2lCCZMbJAJ6Oi+PXrPOg4myw+568tgY0kL3HNX69nwfzMYGnFklzcWnRKOAz XasBnfluxNQAW3H+h8qY1WYAPr+UNkZ89deRJty938ktJYnuRtrRcCvEoKMENj+ftTh4 1cFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=OQ0173pm; dkim=pass header.i=@codeaurora.org header.s=default header.b=j6wBuzN7; 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 ay2-v6si11213004plb.210.2018.05.09.10.03.49; Wed, 09 May 2018 10:04:04 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=OQ0173pm; dkim=pass header.i=@codeaurora.org header.s=default header.b=j6wBuzN7; 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 S965745AbeEIRCW (ORCPT + 99 others); Wed, 9 May 2018 13:02:22 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57298 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965733AbeEIRCS (ORCPT ); Wed, 9 May 2018 13:02:18 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9066560767; Wed, 9 May 2018 17:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525885337; bh=JtZRk9urKZ+gPVzSuGZIfd2MNMuNAsDHCV5+HCKVmz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OQ0173pmBk+8OHYecDyUnUIkvHr+u1QRFq5hx7EgngzJGrpjMwAJ7rqyHBvXyZJh9 t+F8yq7hf00m+/+N6mr6S/c0cyk+orkytTZ+lhIew7W6ileFEuZgUPUtTZHfF1vDxR 7mtWMDERvFKvKhLe4oJIB9HlU3uMms9l0bJuNW7A= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C40B0601D9; Wed, 9 May 2018 17:02:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525885336; bh=JtZRk9urKZ+gPVzSuGZIfd2MNMuNAsDHCV5+HCKVmz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j6wBuzN7Fgx7NcBHqjU/YKbT5qIcs2p998P9zkgTNDtRkUmch+6QcRqKD2fVTvVmJ 4MP6cSM5bswekDcyViwpGZEfzxzf6szSj7CqRO1o3MC0mRSRKaJStjCQLqwRoTERbA faArSA16aTTQ/NOOyW9YL045sFHiwcfkmb2RHha8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C40B0601D9 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org From: Lina Iyer To: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org, mka@chromium.org, rplsssn@codeaurora.org, Lina Iyer Subject: [PATCH v8 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Date: Wed, 9 May 2018 11:01:59 -0600 Message-Id: <20180509170159.29682-11-ilina@codeaurora.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509170159.29682-1-ilina@codeaurora.org> References: <20180509170159.29682-1-ilina@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some RSCs may only have sleep and wake TCS, i.e, there is no dedicated TCS for active mode request, but drivers may still want to make active requests from these RSCs. In such cases re-purpose the wake TCS to send active state requests. The requirement for this is that the driver is aware that the wake TCS is being repurposed to send active request, hence the sleep and wake TCSes be invalidated before the active request is sent. Signed-off-by: Lina Iyer Reviewed-by: Matthias Kaehlcke --- drivers/soc/qcom/rpmh-rsc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 68c25ebbbe09..369b9b3eedc5 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -153,6 +153,7 @@ static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, const struct tcs_request *msg) { int type; + struct tcs_group *tcs; switch (msg->state) { case RPMH_ACTIVE_ONLY_STATE: @@ -168,7 +169,22 @@ static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, return ERR_PTR(-EINVAL); } - return get_tcs_of_type(drv, type); + /* + * If we are making an active request on a RSC that does not have a + * dedicated TCS for active state use, then re-purpose a wake TCS to + * send active votes. + * NOTE: The driver must be aware that this RSC does not have a + * dedicated AMC, and therefore would invalidate the sleep and wake + * TCSes before making an active state request. + */ + tcs = get_tcs_of_type(drv, type); + if (msg->state == RPMH_ACTIVE_ONLY_STATE && IS_ERR(tcs)) { + tcs = get_tcs_of_type(drv, WAKE_TCS); + if (!IS_ERR(tcs)) + rpmh_rsc_invalidate(drv); + } + + return tcs; } static const struct tcs_request *get_req_from_tcs(struct rsc_drv *drv, -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project