Received: by 10.192.165.148 with SMTP id m20csp941095imm; Fri, 27 Apr 2018 09:55:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqJGvqo4QUsYs+p/+G8JM2P2CJoV0qT4jDFy3oU/sYKE2R/24i8h6sbnSAB4rG3SSOELwIF X-Received: by 2002:a63:bf44:: with SMTP id i4-v6mr2770949pgo.66.1524848140070; Fri, 27 Apr 2018 09:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524848140; cv=none; d=google.com; s=arc-20160816; b=fXCR2WLOWP2FH9KI05XP7ITe7bfLh/EsoT8tkH9AaJEAq+exfr4UXR4RUR7GlUMC5E JLfTJ1SZNAofkxAwmS8ahlZ63KvzWDOY+CFb+LUo9jDKSGm1FePBpiK1LMr1w1Aijfzs +38GFZuCFr6xBX4PScxmxuUHk5D5p+JgTbXCKIXTB7JahrYUUzX4PV8XVFmk0oEm1fzs lb2DtJd9l5ml0A+Ew1CEY0ujD5A4lveiRs3lbMYsCTD7m+yMNB0d1xMaxULsVT7nixsc Vv0TWkqDissy2xj6WrZNqDSKOmBz+67l4aU17Cu6FT7nWAYi5aQrEuAow6syg9aU77jh MbZg== 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:dkim-signature:arc-authentication-results; bh=9wSIQv/VptiNPCCQMUDSVRX1/96/IjAIzlGD06uWIMw=; b=FKlFHdqpn+wJicYlfrz8lbNO31VSNAxVA7B1aFjqhCyXrK6SbYGjNAyMgGpUBccLwb 1c/lTX2M50AdLO3yKruiB5Pj7WUH/iUlWgs/z5pyVct9EO7xeykxAukzcwvHFNfrgTCo 5Ce6owgTWX3qw/tuIBi/+xJVXlKgVRkq+1nFKU1xkBUVAmAktKi5sXFMCkx82vfUieqs MRJrOJW/Zlmcigr5uks61gTwTrI3qpz0O6RJHd8xzoj8d1DUCIngffGJGK5fYIgy7SFU leanwr7mfYcMRhg7VbRefWzFFGPhIzliu0nPlQXSXJDL+FSnJbvBkG2+vuR6aHbzJqD/ peCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YxPAhDJ0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si1534915pff.356.2018.04.27.09.55.23; Fri, 27 Apr 2018 09:55:40 -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=@chromium.org header.s=google header.b=YxPAhDJ0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758651AbeD0QyN (ORCPT + 99 others); Fri, 27 Apr 2018 12:54:13 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:40750 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758550AbeD0QyL (ORCPT ); Fri, 27 Apr 2018 12:54:11 -0400 Received: by mail-pf0-f193.google.com with SMTP id f189so1895833pfa.7 for ; Fri, 27 Apr 2018 09:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9wSIQv/VptiNPCCQMUDSVRX1/96/IjAIzlGD06uWIMw=; b=YxPAhDJ0HyYGQb66WNUEVjLNV5zJkniowWlyUmLaURPtiQgFJzpCD1ECWD218GnnVu OwtxlUTlz1dKIJCx56kJlAfgR74ys1YyT9NetKeDwhjMH3/dCUOXLU+jPlsxPl7HV6kl 3nn0TaNG1EaFm+W4QOzcB54f1xVnsaCvkut+Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9wSIQv/VptiNPCCQMUDSVRX1/96/IjAIzlGD06uWIMw=; b=lyp+8YLz+y8RgkNPHM59ZuzHo+i/kW7SwQbFeLh1DkbPl9SdJArBnq5UhUxWbSv+eC 32r9tY2ggh/spiaP4RAFbPkYgE5URs6+HUuAQB6izJyCNkjqxkLUNylX/ltRVwbIEmJP qxxs/YazMY1kvWuxW2EQmKdBkna4xr5Sut3+x8RcP6g6GL8kenSM/UV5VoqaUOownf2Z EtnY5nDVTeR91hfWJK7jTbmiE2LeSYp7mC4xi8CiknjUqs+RsSupPydNci45dTgvU3tm 5+m4/VyryROeKrG/H6zjSDatNkHbqdja8UyyfeGX0IRwfegbLjeh0I90HV2tZ8WkoZBF WYtw== X-Gm-Message-State: ALQs6tC3bkCQY+TBr2sN5bvaa/NYvIqwU5flFEEGZCinshedMocgL0h9 cndklIcEDA6nL44JFFRFgNpTuA== X-Received: by 2002:a63:7e52:: with SMTP id o18-v6mr2755264pgn.116.1524848050641; Fri, 27 Apr 2018 09:54:10 -0700 (PDT) Received: from localhost ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id x5sm3726938pfh.115.2018.04.27.09.54.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 27 Apr 2018 09:54:09 -0700 (PDT) Date: Fri, 27 Apr 2018 09:54:09 -0700 From: Matthias Kaehlcke To: Lina Iyer 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: <20180427165409.GH243180@google.com> References: <20180419221635.17849-1-ilina@codeaurora.org> <20180419221635.17849-7-ilina@codeaurora.org> <20180425221123.GD243180@google.com> <20180427164421.GB6380@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180427164421.GB6380@codeaurora.org> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 27, 2018 at 10:44:21AM -0600, Lina Iyer wrote: > 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(). Sure, but 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.