Received: by 10.192.165.148 with SMTP id m20csp25737imm; Thu, 19 Apr 2018 15:18:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx48p+EnTGI/GZ5s9c3f63EvQlHIDm8vmV1aqTmFfaUG2TUPnX32TxlPdxlWEsLKDUaaFpPN/ X-Received: by 10.101.69.194 with SMTP id m2mr6469153pgr.433.1524176337734; Thu, 19 Apr 2018 15:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524176337; cv=none; d=google.com; s=arc-20160816; b=y5YPCoif9A3GxtJkxIiRm8FUkSOdGaKSKSnsZ0FBqW6xyAI4wAi1SXotHIEW+qzmbS DjOORiM5PmoyyHlkmonK1aLorL31DtXMxVZ8wVQroZ2zyXTl5rY4DGJyvALx7McYMatQ 9poPqEBDlqjTFDUokg9FLOOIokxvmZCQGE8/7r9DlEi1IjhCV3vkuzMjNpjybnCo3GoV 1B2ocN2XGeKYwPnEsiZouxNrrah5quoDoVxQ2nfcrRE2Uwqu4koiwfsmUs3EYw3Bw8sJ J1naG/N0xQdgk67zbmTiZm4zVGvKNR8vaMiS9AJhjzM/RfpNc7g4c+EgHzY/omwK7Y7z fDXw== 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=0YzuA0rY34W7jhddhVtT4GcrUIk7kyvE/mUgMHRqZP0=; b=xwkwC6Oo3TfVkarVDXimELRqaSYjoFkmJltji8G7xjgz7G0nz5a7+WVM11iyJvuqvr zNFrDZ7gth4w3zVBmSJ+2q95GPpd/BT7SQGtI3lVCejyJULbchbt6TuizwuPeS8z92Hl ECTlFbSpAeqV/pFmQF9Cd14QOiYeaEYvWZYNxBH9S3duIeDlXysmesPG45IXLAavE52f G/hxftULTKTmi+dEqCtQuZqv+mTHHnKf9nbXz/VISrNHHprgv0fT27jm6jNgRYvKxrIC QNFAyw+SrAQfRBFiVV2cJr6IGfO28HKDWQCERq21cI8AceVoy4i3v74HoO33aadqV4a3 M8OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=YCr/yK8y; dkim=pass header.i=@codeaurora.org header.s=default header.b=F4x0hQPP; 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 r1si3632392pgf.458.2018.04.19.15.18.43; Thu, 19 Apr 2018 15:18:57 -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=YCr/yK8y; dkim=pass header.i=@codeaurora.org header.s=default header.b=F4x0hQPP; 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 S1753984AbeDSWRR (ORCPT + 99 others); Thu, 19 Apr 2018 18:17:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57792 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753935AbeDSWRC (ORCPT ); Thu, 19 Apr 2018 18:17:02 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6764960FAA; Thu, 19 Apr 2018 22:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524176220; bh=bS0RfbemYKTEPULMJ3f0rflxcQYwSS+bNaJ5EwI7NgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCr/yK8yXU0n5U/QyrRkuhDwsJ1GvajdERQgnrp45UBHApUz/FsvNaL36538L9NtL zVcZ1Ryxbkz9K3SjM0ky6dX/zZ652uW4jM7DeBM5yJmMCKL1fERv8ut04QgjWWQoMC oxdRWPfZjaSqugoQCE3wARPU6IdgdY4XBNUnA+Vk= 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 2737560FEE; Thu, 19 Apr 2018 22:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524176216; bh=bS0RfbemYKTEPULMJ3f0rflxcQYwSS+bNaJ5EwI7NgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F4x0hQPPltuAjWdxzw7L9nFJVM796IOAMon/WpvWlE/UwGJ3iHqViw09VPcl5T4Vg fztfgoMOrhH2k6TxO+kphtjw60iSy9rQM4ZedAx7mpTBtlTdoVnt0r9fQCdKidf88u a9NXKlaDZ4qygC8XNU1ehntCeJDpgTyYTfrJRK70= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2737560FEE 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 v6 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Date: Thu, 19 Apr 2018 16:16:35 -0600 Message-Id: <20180419221635.17849-11-ilina@codeaurora.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180419221635.17849-1-ilina@codeaurora.org> References: <20180419221635.17849-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 --- 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 170d4a10275d..6a52100cd1e9 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -150,6 +150,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: @@ -165,7 +166,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, int m) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project