Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4342178imm; Mon, 11 Jun 2018 10:39:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLc1qqEiDbMfAnqkr3k5rC9FEkPEm6BLexF5zXylbXjmxUxGICC9PZkhx1W2dSCwWoFv/Vo X-Received: by 2002:a17:902:8d98:: with SMTP id v24-v6mr155924plo.250.1528738791229; Mon, 11 Jun 2018 10:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528738791; cv=none; d=google.com; s=arc-20160816; b=RqVcMPhPgll8/Kilq5WdNvnTRcYSBX6O2QnRl53jjK5a1bOOg41M+uBcr0AT8vayI9 T2EDQgXbWzvnL4mnmX4hSpOW+zszXNgrJqhf71WbeIoJx+ING6Yt7Q5/E/Endj9LfF98 B1dz8h5nOsHDI/tA/ZeUiZwUbUsBNWsB0eGu/W21C6mOOQVaejQZTNNpX5qwa3rawtMT BgVrrbHRn96PSK4qYkFcBR/nZ19tcJ1kKchNUiDbOxhWwHOU6STvHT+PybKiZekDGMNH cvZfxy8BA9qIyyQCdF2vq67s9oiHAvtnU4wyp+vu6mqvmrbDAGcKpn+2lo8OI6REBDim vkxA== 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=EIQ66I/CN7sgNuTBwvDw8DjXMBxvkeYuYBLynW9JEmY=; b=JnlZNT5kjqrTVNSM5NdFbnJYW+8DAuep4syVmDJs9gfeA4dH6uqCw9ma4so/ycoNPa RyNJ/7+hSWk+jzPtiTWV933Kq3IfB+VaFqBLfH6D3neXtp+U4+sLjNcD/qZaBeqU2vBB GT7aCgPa9IfRCgd6NMBhcoX3iXeIgn4q7BWNJGfUkigqlEVXrSgc+WWUILYnQvCP4g0q GJ4dTYvKDGLv6JsL68oiH5Z+ARSe7CcMvKvgXqR9p51b6tR3WG9BfO6lztQgVyt8WLvJ eFUSDOhU10ZFlMYisDVNbZVV6EdsaW3hpnx50hI4h7gqvHQqNj9QhyUCj+6B8nMNdO0Z 2QwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=YZMqR5QF; dkim=pass header.i=@codeaurora.org header.s=default header.b=bqZz3mXx; 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 f10-v6si16873502pgn.0.2018.06.11.10.39.07; Mon, 11 Jun 2018 10:39:51 -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=YZMqR5QF; dkim=pass header.i=@codeaurora.org header.s=default header.b=bqZz3mXx; 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 S934351AbeFKR1N (ORCPT + 99 others); Mon, 11 Jun 2018 13:27:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:53064 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934318AbeFKR1J (ORCPT ); Mon, 11 Jun 2018 13:27:09 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1891B607BB; Mon, 11 Jun 2018 17:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528738029; bh=8uaIx4yjtC/KZ2kKF2NmYzqoW9pMOmZQl91cRN5N3AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YZMqR5QFRCPELWmT0G1EDsEPQ9saE+s4A22MxNKkiiq3QyzrLilHaBSsoK7T6MOxl 9dUr+G+TIVaOTgX7N+8Sa1237Qrhy1JXb6Csl1v/BebPHS2vQlNI+TNThwH3RAclQk pOTa60mfqUtSOviT5jJPXKSPtbjq/qsz3eeUqOsc= 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.3 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,FROM_LOCAL_NOVOWEL,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from rplsssn-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D2665607E4; Mon, 11 Jun 2018 17:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1528738028; bh=8uaIx4yjtC/KZ2kKF2NmYzqoW9pMOmZQl91cRN5N3AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqZz3mXxPW1cpqdZxZNv6PR9Ect5fe1oGvBSIu+TYWv6hp3y3oglQ+8c8Lpkj6GLd tU+rcul3oGseJcmh3LuvHaVvmX1OijzlphzsuqzV/L+FTpYTR8c2FjyeDDH7sUE1On iVrUxbtCkOws8+hKECjsgGtajnv4Mq0poBCxyITM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D2665607E4 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=rplsssn@codeaurora.org From: Raju P L S S S N 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, ilina@codeaurora.org, "Raju P.L.S.S.S.N" Subject: [PATCH v10 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Date: Mon, 11 Jun 2018 22:55:49 +0530 Message-Id: <1528737949-17495-11-git-send-email-rplsssn@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1528737949-17495-1-git-send-email-rplsssn@codeaurora.org> References: <1528737949-17495-1-git-send-email-rplsssn@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lina Iyer 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 Signed-off-by: Raju P.L.S.S.S.N Reviewed-by: Matthias Kaehlcke --- Changes in v10: - return ERR_PTR if invalidate fails Changes in v9: - invalidate again if -EAGAIN is returned by rpmh_rsc_invalidate --- drivers/soc/qcom/rpmh-rsc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index a68dcd1..c4f12fa 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -148,7 +148,8 @@ int rpmh_rsc_invalidate(struct rsc_drv *drv) static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, const struct tcs_request *msg) { - int type; + int type, ret; + struct tcs_group *tcs; switch (msg->state) { case RPMH_ACTIVE_ONLY_STATE: @@ -164,7 +165,25 @@ 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)) { + ret = rpmh_rsc_invalidate(drv); + if (ret) + return ERR_PTR(ret); + } + } + + 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,\na Linux Foundation Collaborative Project