Received: by 10.213.65.68 with SMTP id h4csp2124523imn; Thu, 5 Apr 2018 09:21:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Ds2En8TV6yV8ZK5qlFPECO++ZTAC/H1f6QeESrcGoJy3PbhTrFz1FdOdlddeXE9K8GzeM X-Received: by 2002:a17:902:bc45:: with SMTP id t5-v6mr23466153plz.343.1522945286875; Thu, 05 Apr 2018 09:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522945286; cv=none; d=google.com; s=arc-20160816; b=ScWEtJbEsrE6VctyOCyG9scXCl+W68icANUaD8we+q/2Ywnc1WqdMrMx+kDdcqdH/a l+seWCuyIwt6coH1xBuut1gkrDfLrUGMeTfICMlowJRdz+xHNnQtZBB6VDQr65FMoOlo 0h5LQu1d2AmkpFvP3q/f2i4rAdMn0yDpB4G5DnEcZcQEQtZHx+NALTIibGUX6Gw3joVV kaG03uB6EELfBAhqmhHENebTv9KoPwcivSRAdFCKmHKQP9FlE7eKxPJIlJDa5guN9CSD wEwbDK9PFyibaEUaDbQ1vjJQ94gVzPddUIOJrEt7vNVcODEun2AbccsEgQD6PWN2J0i5 qLwg== 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=P8/RBV7kmaSNiZrvpBsTfevZ/rJY5v75Vqexq/8qHu8=; b=J7Lgl50bgsrqa23hvs5RZdapq+GiHesKg/XgvnoUpiSIhHa/da/DvAvai/NRdnn3PW Tb8P3otayYkke/muI0kQMT/u8hxloOMuAkelulsJoHwUw5Gj0T91zk58Yn0NTMHKN+aF wvYhJ2hqNsxnc4Hf1JfJoEixCgSyAUSiK4E4NmrUk9OX1NdZRGvRYmhqh7Fw4yg3trgG 5yvnG/oIVqrHUFrj69xw/+fEDF05VKuF3w4cSnXcqOB2nUB3K3xQEaHy8V2XVUg57exW vmlMZhDHCIgekKdnkZxYVxMaXIEe2dtaRDxgZK1MFn3lDIYOipkS148+wM3f2XmHwWZA +bsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=brigLhhu; dkim=pass header.i=@codeaurora.org header.s=default header.b=HTtoTVG6; 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 c1-v6si6354113plk.611.2018.04.05.09.21.13; Thu, 05 Apr 2018 09:21:26 -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=brigLhhu; dkim=pass header.i=@codeaurora.org header.s=default header.b=HTtoTVG6; 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 S1752240AbeDEQTE (ORCPT + 99 others); Thu, 5 Apr 2018 12:19:04 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42060 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751465AbeDEQS6 (ORCPT ); Thu, 5 Apr 2018 12:18:58 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 10F8E60F6B; Thu, 5 Apr 2018 16:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522945137; bh=bo73knlsa38rpDMzodcMv1X2/+inTVdUF9X4y86tqMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=brigLhhu4BhcnzcZCo5lrEaz3yvSAQwi2g9I6lrVvLReSxfych0diI/fUz7/lbyTg 2RY73FE8jeh+BhcPCjNj14ipke61H8TYy+epcqr5UFgfE1JfGh3CW206MBzw0riyDU xRz7udf3moX5T3o1eVDmqF3SlwQOjOBNabT0Hn1s= 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 1F47460F94; Thu, 5 Apr 2018 16:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522945133; bh=bo73knlsa38rpDMzodcMv1X2/+inTVdUF9X4y86tqMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HTtoTVG6QC350fev733AqU7pgeBVx6liOBfAK1bwOEkwOsxSPcLkye/rohk69PjSg a5z3nLs95bK9vWhkCHn8glKEq+q1NRCAoHjSTjp/TEoAa5QPdWgwpVfV0ucoL+su9Y MVwTDSt3d83fOJ+ys4475kt6oyTE9sx4gOvcwvnA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1F47460F94 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 v5 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Date: Thu, 5 Apr 2018 10:18:34 -0600 Message-Id: <20180405161834.3850-11-ilina@codeaurora.org> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180405161834.3850-1-ilina@codeaurora.org> References: <20180405161834.3850-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 1dbccc4d0605..c1a460a8d955 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -214,6 +214,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: @@ -229,7 +230,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 void send_tcs_response(struct tcs_response *resp) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project