Received: by 10.192.165.148 with SMTP id m20csp4492022imm; Tue, 8 May 2018 09:15:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqD2hORkUG73eyNcpaj4qUJUAMgb4zgKnk1deErbQnrIEnxAfBYq6m7HjXC7G5WDy+5CE5C X-Received: by 2002:a17:902:74c9:: with SMTP id f9-v6mr42800514plt.385.1525796147667; Tue, 08 May 2018 09:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525796147; cv=none; d=google.com; s=arc-20160816; b=cbqJs/zrV+RHpBzDFYeSbMIrteFKDl5fPA2lsbA5LsLJk5YVovpLrU6O5VRzITrdT5 vcEQXPeXgmj6cP4fQlC1LowHmGEswxcE4C+9pgmYO4v9DcQ6xT6L8WGJZ6k/h61HZ3Vo Z+UstozsXEeCfBGwdDsuql6gK6RUcZ/AaEjwYXMiZJM1tkA3SAnsvFebBvXro04LDMWg vtnHIHnwwmzabPTSjC5pRQkcmKkcOcz6LEMtvGJoYAHyuNLOOvLTCYdOQ24Xf41tJPyf kXf6gIx6qZTJCnZi8xz99Fv8tI+yNHnLi2S76ZzeNb4zb3FUYGvfKhd/zbghsOhD7Rzj f5IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=J1QjbfdFBzoBpiqt5xqI3pGhAJSwEi3qFju55hTduXY=; b=VxHIcFmpfZB7GrA2WkpbhG/AJlRPHPeVeFn9MXq1Vs3HyC3Z7YeV8VGABx7dA9Viqm VahaOV50+TCC4tusotg05J/EUzR3Sf55Oa1oF08xHFPzoxnIgr3r7vjeH9Il3ecLrQfs oXv66osmNd2P5N2FOOmJOQ5qwmihJHiMKd9fYz932ZbrbeflorNcQyKwusBdH8VdRpK/ LY1uk0bD1amyZIjXo2G2KugGUgEUA6dtuYR4+6zVS+FKRbsSBujhEToluGcrTbPVR1yk cIVJh3dovjcVrHXq4BVFYE/L+jbQEdcfPwyFb6YwmJ4b1Fm1ujIbRwYpQ0qZPMZ3LMzY hZ+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=j/wesCk5; dkim=pass header.i=@codeaurora.org header.s=default header.b=JxnULKPH; 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 o63-v6si19729484pga.584.2018.05.08.09.15.32; Tue, 08 May 2018 09:15:47 -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=j/wesCk5; dkim=pass header.i=@codeaurora.org header.s=default header.b=JxnULKPH; 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 S1755297AbeEHQOh (ORCPT + 99 others); Tue, 8 May 2018 12:14:37 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:44274 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752763AbeEHQOe (ORCPT ); Tue, 8 May 2018 12:14:34 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 05D0660C55; Tue, 8 May 2018 16:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525796074; bh=1fIhplQEeOrXa6FsT8UZ8ifrHcwUYj4pFlIKmvAjhdI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=j/wesCk52oaKZR/VBPLWFm3d9Fhkor7343YCqrkfg6D/kgYzy/fpZk4mmggYX+mYG acUcE9Wv+mDXl253/aOfRxDoSN7JmrAZBya/6NYZRnvggQO6wYCGWcDx/HApY2LFsO h/TOQ093aJVXdzfGVADxSG8pfPplQwX5IvHBcIMA= 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 mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 5113660767; Tue, 8 May 2018 16:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525796073; bh=1fIhplQEeOrXa6FsT8UZ8ifrHcwUYj4pFlIKmvAjhdI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JxnULKPHDUy/WC3tQM8STY5QRTWKuWlRfhA2X/pWgLXgVzKhIerdjLvdySPPvR1rL ocUxTNI6UYNpkQSaKtWfb9W1ztUPeDpVj+UAgpJxshVY/QKMgcwAPZINKxN+H4a3NH BIwlq2Z1QNwxayTETR+XTuxhOj4qvROrB/2bIN9g= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 08 May 2018 10:14:33 -0600 From: ilina@codeaurora.org To: Matthias Kaehlcke Cc: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org Subject: Re: [PATCH v7 06/10] drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS In-Reply-To: <20180503220651.GB19594@google.com> References: <20180502193749.31004-1-ilina@codeaurora.org> <20180502193749.31004-7-ilina@codeaurora.org> <20180503220651.GB19594@google.com> Message-ID: <65db1bdd4cf9337337b41745179eb84b@codeaurora.org> X-Sender: ilina@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-05-03 16:06, Matthias Kaehlcke wrote: Hi Matthias, > Hi Lina, > > On Wed, May 02, 2018 at 01:37:45PM -0600, Lina Iyer wrote: >> Allow sleep and wake commands to be cleared from the respective TCSes, >> so that they can be re-populated. >> >> Signed-off-by: Lina Iyer >> --- >> >> Changes in v7: >> - Move bitmap_zero() outside the loop >> >> Changes in v6: >> - remove unnecessary locks around __tcs_invalidate >> - rename function to tcs_invaldiate >> >> Changes in v4: >> - refactored the rphm_rsc_invalidate() >> --- >> drivers/soc/qcom/rpmh-rsc.c | 45 >> +++++++++++++++++++++++++++++++++++++ >> 1 file changed, 45 insertions(+) >> >> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c >> index 4e2144a14c31..42aedf2d80fe 100644 >> --- a/drivers/soc/qcom/rpmh-rsc.c >> +++ b/drivers/soc/qcom/rpmh-rsc.c >> @@ -104,6 +104,51 @@ static struct tcs_group *get_tcs_of_type(struct >> rsc_drv *drv, int type) >> return &drv->tcs[type]; >> } >> >> +static int tcs_invalidate(struct rsc_drv *drv, int type) >> +{ >> + int m; > > nit: use tcs_id? > It's an iterator. Hence didn't change this. >> + struct tcs_group *tcs; >> + >> + tcs = get_tcs_of_type(drv, type); >> + if (IS_ERR(tcs)) >> + return PTR_ERR(tcs); >> + >> + spin_lock(&tcs->lock); >> + if (bitmap_empty(tcs->slots, MAX_TCS_SLOTS)) { >> + spin_unlock(&tcs->lock); >> + return 0; >> + } >> + >> + for (m = tcs->offset; m < tcs->offset + tcs->num_tcs; m++) { >> + if (!tcs_is_free(drv, m)) { >> + spin_unlock(&tcs->lock); >> + return -EAGAIN; >> + } >> + write_tcs_reg_sync(drv, RSC_DRV_CMD_ENABLE, m, 0); >> + } >> + bitmap_zero(tcs->slots, MAX_TCS_SLOTS); > > You didn't reply to (or address) my comment on v6: > > It could occur that one or more TCSes are disabled, then tcs_is_free() > returns false for the next TCS and the function returns without having > updated tcs->slots for the TCSes that have been disabled. How do you mean TCS are disabled? I think I asked that question in my mail. Sorry, if I forgot to ask. TCSes are either available for sending requests or they are busy sending requests. They cannot be disabled if they are present. Individual commands, however are enabled or disabled based on whether they have active requests or not. What we are trying to do here is to cleanup the TCSes of their existing requests. Generally, sleep and wake TCSes are not used to send active state requests, they are sent through AMC/Active TCS. So they will be free. However, in the case of the Display RSC, there is no explicit TCS available for sending active state requests. So we overload the wake TCS to send the active state requests. Even in that case, TCS would have finished and should be free when this function is called. The tcs_is_free() check is addition to make sure the requirement is not violated. Hope that clears it up. Thanks, Lina