Received: by 10.192.165.148 with SMTP id m20csp1018293imm; Wed, 2 May 2018 12:39:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrRPmzpClWVx530iqD7qLjO9ze3zZSPdCfaibKKhJsF7xAX2ZL5+2B6OGJsa/ER/CkJeGQk X-Received: by 2002:a17:902:9898:: with SMTP id s24-v6mr21248810plp.51.1525289944165; Wed, 02 May 2018 12:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525289944; cv=none; d=google.com; s=arc-20160816; b=w68As8LcLKtz1O8lA3nSl3/9PHjoFwQy+HtrOa6A4noQzDpM6oDvnGfuqtc4VTyrGs JdpEk7Qk4IoRI4Ze1M1tQOF2KaseWxppBGAmWcBgogW9nuYvfhaTya3L1VopgmIXG6Q+ znFMkKOusUA1E4VO1RrKxveORk5SWiJ5rPgQ1JCRevzLYw0bOn3DELcdMIwIo2xL+GiM SC+DkzF285saOiOvjt2bQtBn89a6+dlENkaFIpZpwYS0aWTc2U7qD/omyC0UXLRLeF/c 1vy27/gMPTRs1pZsBghGFjy6DXHuhuwEt7cbK8+g/j20kW8fAiTt3Rgt5c0nI1f3UfGw kIMw== 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=0zL6PYarJnDCdtxgbLGoviWPMcoJPjW4oggtgADDWhk=; b=tzREb5fa77Az78zYmaxdWmB9a9dtwhcX/eISge1Osell7b7ZNNGx4NSwytbTD1DOQy tLT3CorR1FaKN623QBf9mPXLT3i/Ni4iGJE6z5ls1W97tzVqzy6XdXdulGZENQfBZLYM airbUoOBtZEjdx8Y3fQCKdX8U4oQJpx6uHWzc11+n0dZ9jUEzNapnLeC/+lmIfmXeQCF DFhC5XE6tsBFME0LU3SxopM9OqapZXhpkhXuhMJv79HDxtYAfoZXji0GZ/z+idWvkRJJ acoDvFiDShdQNZRMb22HiV2Sy+u86c87wNH/1DHyVh0MSak9EYcWe75DlU3dxOP3pew3 9ieQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hyZdVnoW; dkim=pass header.i=@codeaurora.org header.s=default header.b=hyZdVnoW; 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 b32-v6si12734362pla.105.2018.05.02.12.38.50; Wed, 02 May 2018 12:39: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=hyZdVnoW; dkim=pass header.i=@codeaurora.org header.s=default header.b=hyZdVnoW; 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 S1751464AbeEBTiR (ORCPT + 99 others); Wed, 2 May 2018 15:38:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38910 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394AbeEBTiJ (ORCPT ); Wed, 2 May 2018 15:38:09 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C466960807; Wed, 2 May 2018 19:38:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525289888; bh=2i74guM25pCNB2w9eGmev9Qi9PIu7KzEIJ5YmeoCcqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyZdVnoWd/qQ9dEcrAp2mznJUi4oJVP2659mCwZ6CCCbSNdXBBNnIRXCYQFej/9ga F5ScyjFGHxXy5LlkY688g84xBgsif5FOqcLkcDQt7TtYgWicpBx7aBXSPrw7BauBtg 0/yoyPCx7UgA3ZNGOOiqElFMsXTFcj10jsu4HyUY= 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 D7A4960588; Wed, 2 May 2018 19:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525289888; bh=2i74guM25pCNB2w9eGmev9Qi9PIu7KzEIJ5YmeoCcqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hyZdVnoWd/qQ9dEcrAp2mznJUi4oJVP2659mCwZ6CCCbSNdXBBNnIRXCYQFej/9ga F5ScyjFGHxXy5LlkY688g84xBgsif5FOqcLkcDQt7TtYgWicpBx7aBXSPrw7BauBtg 0/yoyPCx7UgA3ZNGOOiqElFMsXTFcj10jsu4HyUY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D7A4960588 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, Lina Iyer Subject: [PATCH v7 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Date: Wed, 2 May 2018 13:37:49 -0600 Message-Id: <20180502193749.31004-11-ilina@codeaurora.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180502193749.31004-1-ilina@codeaurora.org> References: <20180502193749.31004-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 42aedf2d80fe..26549a31060a 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