Received: by 10.192.165.148 with SMTP id m20csp931806imm; Fri, 27 Apr 2018 09:45:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQJnturU4MHeodl3LWHrANjHapNOFDCg9kyptFw6mIff28+X7oZWISvvis2gecJXkOl7qY X-Received: by 2002:a65:4244:: with SMTP id d4-v6mr2714363pgq.234.1524847551322; Fri, 27 Apr 2018 09:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524847551; cv=none; d=google.com; s=arc-20160816; b=xuLeaEzdQcAqp+YtYuJMwW99FGyhYQ5ZFwnbwX1rGcP4fqS2RQf21d7nNyVeEVOeoc WX8XNpVzyeFMdr2IcNRWeqg7Kbzv2o6O0hG2gVoCqaO90yULbpokJJxd9/F2GRvr8TVr WvduGFGjjXdf8pksuoKrKEPd0KOBYygZBYRYkx5SjOC69XQB8pnbXpg6zPRLhwpDxOKz W/AsupFUOtQp5WPa8vQA0RsYjiG9CvOt45JD6cLLWjKKz5Z0ZHbGvUgr9jkeCHoQoGb/ cJodmHS4pXqcyglvWd+dpZ7RO53fjUsF3OsdIjHbE/0gRpN7MMKe29fsIgMeaMpHpWkT 1CjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=LL4O3FGATP5ouAgSX2nohhKW7GZ9WU1XVI8mwImydjQ=; b=Gdij27SRI8noWKLlKmSYF09V0duncdTyw8rqLLWiiTRONBdozmN/PSl0FbUuje3HLb dfQlCFQPcLN8bpfepxFCT5CVNj0sgYyv321nuRtYz6nKOzWjLOuU2W4eHM22JAX8Y00K GBRwa7Jo9pzhoqgJCC57CftZEBoN1aDLp6MBPEXhYo/HTUxpOpFV4RBh+0j3Ef9kaUae XQkru+AA94KTrzM5CJQQpwGHOxFpECf3mVfscKl1IpF8ZLuBJKGU100CJsAMEQBA7EnV 7RyYksbUDp/cmeMgLnIO6Kp2Jj6yOPiZBH0DvlCe3czIgHLb6ZJ9vZSYWRJW5b1rNkyH 08zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=omn7rF2J; dkim=pass header.i=@codeaurora.org header.s=default header.b=omn7rF2J; 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 q14-v6si1471014pll.542.2018.04.27.09.45.36; Fri, 27 Apr 2018 09:45: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=omn7rF2J; dkim=pass header.i=@codeaurora.org header.s=default header.b=omn7rF2J; 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 S1758810AbeD0Qo0 (ORCPT + 99 others); Fri, 27 Apr 2018 12:44:26 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38076 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758562AbeD0QoX (ORCPT ); Fri, 27 Apr 2018 12:44:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C189A60310; Fri, 27 Apr 2018 16:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524847462; bh=9OIGL14nLl7yLUOHS/hSiKXbAZYwJPUxDTCAMdV8JQM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=omn7rF2J27oipxEydG//+yRw7ZdjM5oecWIguUnCI97dBOn5Kro24mpZWqyGsh7j1 KbRVY4+Ni8GAgYUHtGNFp2xiWmbv+8eBb0nGx7qsMSet4oQOM7/LzkYCgVDbqcuq4J uJojCDnoWUg0fkGmPkWAcKyUApaUmy1k8qJTRzeE= 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 localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E383F60310; Fri, 27 Apr 2018 16:44:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524847462; bh=9OIGL14nLl7yLUOHS/hSiKXbAZYwJPUxDTCAMdV8JQM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=omn7rF2J27oipxEydG//+yRw7ZdjM5oecWIguUnCI97dBOn5Kro24mpZWqyGsh7j1 KbRVY4+Ni8GAgYUHtGNFp2xiWmbv+8eBb0nGx7qsMSet4oQOM7/LzkYCgVDbqcuq4J uJojCDnoWUg0fkGmPkWAcKyUApaUmy1k8qJTRzeE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E383F60310 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 Date: Fri, 27 Apr 2018 10:44:21 -0600 From: Lina Iyer 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 v6 06/10] drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS Message-ID: <20180427164421.GB6380@codeaurora.org> References: <20180419221635.17849-1-ilina@codeaurora.org> <20180419221635.17849-7-ilina@codeaurora.org> <20180425221123.GD243180@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180425221123.GD243180@google.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 25 2018 at 16:11 -0600, Matthias Kaehlcke wrote: >On Thu, Apr 19, 2018 at 04:16:31PM -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 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 d169f7da5422..170d4a10275d 100644 >> --- a/drivers/soc/qcom/rpmh-rsc.c >> +++ b/drivers/soc/qcom/rpmh-rsc.c >> @@ -101,6 +101,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; >> + 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); > >Shouldn't this only clear the slots corresponding to 'm'? > >If resetting the entire bitmap is really intended it could be done >once after the loop, though the bitmap might be left in an >inconsistent state if a TCS is still in use. The TCS will not be in use, the check tcs_is_free() will ensure that. I will move the bitmap_zero() outside the for(). Thanks, Lina