Received: by 10.223.185.116 with SMTP id b49csp2310064wrg; Thu, 15 Feb 2018 09:37:22 -0800 (PST) X-Google-Smtp-Source: AH8x2265CxnTOeYvxcIkPZW49C4x76LugOBTVIRlmfS5XqOHApiYBov58Jtd3lSVA7P49fyQDBgx X-Received: by 2002:a17:902:2881:: with SMTP id f1-v6mr3146702plb.439.1518716242344; Thu, 15 Feb 2018 09:37:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518716242; cv=none; d=google.com; s=arc-20160816; b=cLXRSD83xcDyAd7njHcu7llrbcArvOPf5RNXOASCfaPa8Rc7Le3lLLrZdQb0KPKoZG QzDFwNB9Idg+qny58K4SsaC40HKPR4S/dEwy8Hr2ZjKlGCLS0BBbmk5MMoSQJ8nMTJMU e1sK7RCoZ0hao6g1UlPZrERJzQTY6Ow50vCkXW9CI4pPJctWnA+o4xWoDi211L+M2SPa enx5/C8XJt11lloPvM1EiTZZM5Scqo9jfKvS4rAERKlfycRG112hoZ7dZRrJDjso1EMf 90vzBGjyGtKg2uTQ9J1AEco7NrGTJg3B86WJWnBjpEWaOF16pfbekyC+zkN4kppaI2Ot uY+w== 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=wUMOeIlbL9ugD6d4PtrYh11uA0eTDRkqQ80xDz8ELMo=; b=soxjrfvbWYOvSVUSodq+gDXPAqgF7A+ZOMQSXD81nEINyE2ezIF+zJa+cBklGGCFrp EFqa9oUvUsxN+G6dURqj0fuSfntPKnYy7ZUYHKknNX1S9qeALXl89UI7Pja2eaDH7s8e DHTk3T4MJJQR8txLptWUgvTubEIRzjFJYwxdhw5+0X0FfmHEFdiyQI/huPIJ0rFvEdBQ LmXJsp0WWWP2pqOnDZytAs2oJfF7EPtjONI+sMG262CR/G79uZll0/0SD7OTHyPIC3YN 0oYnCuU6V2Py7Z0AxVLWB+7tCz6Eouxzoi/W01/wl3tYX8GKTBp10Z7aKbz3+DYx9TjM sOqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=pJ/2sV9m; dkim=pass header.i=@codeaurora.org header.s=default header.b=pJ/2sV9m; 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 o28si379049pfa.209.2018.02.15.09.37.07; Thu, 15 Feb 2018 09:37:22 -0800 (PST) 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=pJ/2sV9m; dkim=pass header.i=@codeaurora.org header.s=default header.b=pJ/2sV9m; 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 S1427455AbeBORgB (ORCPT + 99 others); Thu, 15 Feb 2018 12:36:01 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:43574 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1427416AbeBORf3 (ORCPT ); Thu, 15 Feb 2018 12:35:29 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7DBDE60B67; Thu, 15 Feb 2018 17:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1518716128; bh=OomEXEW4XSluVxnh1eISZ3GrowaR/zT96Ne/CDj+bzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJ/2sV9mxVLOO9YderGsegr1JUliaSrGboLroEvsb9+sTUlcw3Ol0hqhkgyhcVUK1 KE7GNzbPnKLbTYjK2d/3sInMvhvSZFw4wDmIADE4YFzLP7zbKZH18AHTLrGaOWTK14 3BSSE6kGbZ+SRj1uyJC0/ikouts0QhfqtJZYPKBs= 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 7FB1D6079C; Thu, 15 Feb 2018 17:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1518716128; bh=OomEXEW4XSluVxnh1eISZ3GrowaR/zT96Ne/CDj+bzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJ/2sV9mxVLOO9YderGsegr1JUliaSrGboLroEvsb9+sTUlcw3Ol0hqhkgyhcVUK1 KE7GNzbPnKLbTYjK2d/3sInMvhvSZFw4wDmIADE4YFzLP7zbKZH18AHTLrGaOWTK14 3BSSE6kGbZ+SRj1uyJC0/ikouts0QhfqtJZYPKBs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7FB1D6079C 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, Lina Iyer Subject: [PATCH v2 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Date: Thu, 15 Feb 2018 10:35:07 -0700 Message-Id: <20180215173507.10989-11-ilina@codeaurora.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215173507.10989-1-ilina@codeaurora.org> References: <20180215173507.10989-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 951b797a8cc7..e13abf9ad8fd 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -220,6 +220,7 @@ static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, struct tcs_request *msg) { int type; + struct tcs_group *tcs; switch (msg->state) { case RPMH_ACTIVE_ONLY_STATE: @@ -235,7 +236,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