Received: by 10.192.165.148 with SMTP id m20csp1244003imm; Wed, 25 Apr 2018 15:14:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+/pNdi/mtVb3Hs7hgtpT5XAUrzEwb2+pQQuerAD0MK5agLgarpztnPX8wIcjWdY4iRlVlU X-Received: by 10.101.82.133 with SMTP id y5mr24816685pgp.27.1524694447437; Wed, 25 Apr 2018 15:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524694447; cv=none; d=google.com; s=arc-20160816; b=vfoE7SNzrje4QVrd3F2g2fRZbpJra6xom1vebCKv66DZOczhe7aTx6UX7jFtKvYAwE DBbeRpRwNf+GQWbcOBM7ui5Ib8XtmB+53o5WQ3V2KMElnBYiWE5g7KVWAdx2NgHYZefu tklpFjw7z/+qxSGCmhyVoFefqBWKBGEI6DauNIveErXTBn+b7h7NxXIW6mre1G5Y6Rqw ZaBUsuPV+Wabu9/Xf/6j816bGngieCxzG484pD9Ax3yT4Khcx+ZHNG0oXkcF2QM7mK59 ZqcUWXFiC8JkddKQHFOvrCWsn2flzH8oVLUO+jGDVQD/fB/g3CWuP3Qh0cgFic66kW11 k2mA== 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=eTCt4qmi11KUiLiBGlItOwz1So1R6AO/wB0Q93ficVY=; b=S525WeV67z8x8yvl+0vHQFqYzI+yiujoMs4susXSJQxmxcPc6y6s9svGcnuQZUlpfS MHoyzt+Yiamtk4WXKqAVq49hNh/QgfNk39rC9XBZQbJqXicBwa1DrYuu1dF9YPGvkxJ7 KTf1m8EOROV59gdpVzdHlUMLIJi8UDNdBxp+3gTdICvbKxfRZsPTe6JS9W4BKyEkp2Xz U231XF2G4dmLOsBuA/8AOxLW78ID0iYX9xdlxrCcDHY8A51Z9obMqnU83W/eAD4Je1Y0 3GeNFcgWWarByTZTZpl+oGLXbirrNC9vWc2shoamai6MRVILMmjpMLJXd5qY9qbnKr2g AbcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kdWsrzV2; 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 h4-v6si17880771pln.468.2018.04.25.15.13.53; Wed, 25 Apr 2018 15:14:07 -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=kdWsrzV2; 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 S1753705AbeDYWLa (ORCPT + 99 others); Wed, 25 Apr 2018 18:11:30 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:46378 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751887AbeDYWLY (ORCPT ); Wed, 25 Apr 2018 18:11:24 -0400 Received: by mail-pg0-f66.google.com with SMTP id z4so1405118pgu.13 for ; Wed, 25 Apr 2018 15:11:24 -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=eTCt4qmi11KUiLiBGlItOwz1So1R6AO/wB0Q93ficVY=; b=kdWsrzV2jCQB0qCE2cLHUvKdfWIeyQIeKT0Q3N8B694EgYz4S9w5vb5FcxF6dhtO8S krpHLS624Bf7sKuB5hnL1OkFkZAgXd+PHF2iBesGwVExf4IGV/mHySeF42Rc+BPxGZun t81ukAWcnLHqELfad+Iyt9dVPUfU/K4zLZovQ= 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=eTCt4qmi11KUiLiBGlItOwz1So1R6AO/wB0Q93ficVY=; b=ov+XlRSIi9lVRDJnH0FUw7ZgX3Ik0Z8q7w/j+KCEivX9zo0zVHIpYSZK0IetdNLqmn JGIjN8b7m/Cms+ARjs11+ksrY4722Oi54C8mj6FdnGRvwnOKfDxzN6xQhwQ03G+cfN3z gLo4TBDioD1ts0a98qGStOCcfvF9eYoS3fX9lkZUDi1Nw6O/NqYCTpBZGTEbps4K49Sp SBcFwHPnY506QF07BIG0JSkLKjycupuoUH9b0am5S4sGcekESYt8j8rrY0rzVpN8snPy fApKpIJgfc9AlUhjl6N89jDswVGk+0MbwUnCDbnzb7lAkpvYWuAM46tujy4J36iAuPvT AxTg== X-Gm-Message-State: ALQs6tDUTLAYe+U4giRtS4UHjg1vJV1nhkJ42pRTIdTtJED16aXNPcRI 4YrcbZ9FFVRTYGHFBYzdRUZ0NA== X-Received: by 10.99.127.3 with SMTP id a3mr24843183pgd.267.1524694284502; Wed, 25 Apr 2018 15:11:24 -0700 (PDT) Received: from localhost ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id c12sm29377830pfn.13.2018.04.25.15.11.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Apr 2018 15:11:23 -0700 (PDT) Date: Wed, 25 Apr 2018 15:11:23 -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: <20180425221123.GD243180@google.com> References: <20180419221635.17849-1-ilina@codeaurora.org> <20180419221635.17849-7-ilina@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180419221635.17849-7-ilina@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 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.