Received: by 2002:a17:90a:1609:0:0:0:0 with SMTP id n9csp3179pja; Thu, 9 Apr 2020 13:30:46 -0700 (PDT) X-Google-Smtp-Source: APiQypJQ21AKL7R/nt5xyBaBCptV8jRLr4M/S+d+y6vYKlnAPHOCX54MqSUkMs3OHczTou+sfWJl X-Received: by 2002:ac8:4cd1:: with SMTP id l17mr1326213qtv.20.1586464246706; Thu, 09 Apr 2020 13:30:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586464246; cv=none; d=google.com; s=arc-20160816; b=cuGiqRaK5qZ80EOrwDd6hphpcmRxrAP9e2GR7E9BLvAr/xLxGi2oPrKGX/pqw3aDWL oT1KZdpxOsYudfxICENShDRPnCS1DoZrUedTsPminAI+iRTfx8/rn28PijKPRcsp6ZVT npDjQivYeqmYSpCuH8Nq0TnzrrGckFbGUoF1kus86vhhEOztHkG0akeDc2NbTJxgnI0W e2cTfTBjgLvv6TIzWK7soik7HN4q0X1KJbrYKqkzlTGXP15BGRyiALWyhuh3Wtnf50lB wDIOclT7r0lvvHw1zF2iu4tHffdHCq5A3Sx3HPapPkOaeoPZ3EtAmkZBur5VOiitU3ZL HrTg== 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:date:to:cc:from :subject:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=sBJcOnwg24jleMutN+HP4yNIjd4URpK+S2uxHFb+3BM=; b=K/y0IVAR13R40IX0yr1wDq4lPd2Q6Lk1PwgSruwp8y+yA3oL3q+91bcpvZ21KttATU TgbjXl2jaD2kgheRSeGSX5d/I+COiOgZwlX4QAHmWzTMOcUf7lYICDAmXgwHKsgOJJBy K5WxOBN1J1XXdjzt/wJxBimfik1X3XxjDF8TQ+yemNr0iCvhg+oU4H58xmjTA9fS30WA W5HKLqEADKLWv2qwngmwVzWL8ZIbhH4x0ZDJiokxOtausoh1I+wOq+3IpYp34BbJMDVa i3g97aAUxQbWxlM2jrFTyvHu/9bRZXXeSUPZObXfoBuwTzEE5p6iLaxsUSqUuX82S4A6 Kebw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PvHz7dF2; 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 a13si6597581qvf.210.2020.04.09.13.30.31; Thu, 09 Apr 2020 13:30:46 -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=PvHz7dF2; 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 S1726891AbgDIUXR (ORCPT + 99 others); Thu, 9 Apr 2020 16:23:17 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:47024 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbgDIUXR (ORCPT ); Thu, 9 Apr 2020 16:23:17 -0400 Received: by mail-pl1-f196.google.com with SMTP id x2so1626539plv.13 for ; Thu, 09 Apr 2020 13:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=sBJcOnwg24jleMutN+HP4yNIjd4URpK+S2uxHFb+3BM=; b=PvHz7dF20As5sbbYhB4q2ZvdzPKLTHniMisQ6lTKn6fL1VKD9aT+MsurZd5T4Fv5ay qj11BWf5ZcmpCRPmF20yYNN0PA7qRI6ovhUYTvUx37Fpt8ufd3xInESvlq9hOzs0Vx81 z7jN2AMxqMEh4XWww6NDXOnw+Cs/pYKSa+yM4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=sBJcOnwg24jleMutN+HP4yNIjd4URpK+S2uxHFb+3BM=; b=dUUYE/Gxt9kfTNT9bs7IwoTMCtCTkJfQjF7j8UXlTpqA8z0uydlSN5lSPkyHsignLI TRZ5ZgeqS6sQzPjRJNR4cXgrq1aM/GjVs5ffz8gTlJ4MP3ZVoyQuFF87woxiooeQwUsN /UX7nBku6iKsTV6eN4NjmgGcLkvoVR2lkTpCxwYHwuRHl7J1Qe8m1OFHeTMCdEN18Yim tEmsbIz3La/ueQriCdIGw1XX++fpHSuAWV+9ggN71XtryZOxJrx1myeU3zNammML7gEw KcFnfFJCDOaiE0B2kqIFh1zvABHeKxNLoFeuSTiFA0IQf9XnRXDFOBc5HCda/xz5D/CY EDwA== X-Gm-Message-State: AGi0PuahsvngfsN7Gc8bRponNDmyRdTZJHpbkAVvwBjsjDygw1hoPHy8 VKsPcjC14Tv9bp4RI8/Lh0iyqzxHNtg= X-Received: by 2002:a17:902:14b:: with SMTP id 69mr1346044plb.121.1586463796146; Thu, 09 Apr 2020 13:23:16 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:fa53:7765:582b:82b9]) by smtp.gmail.com with ESMTPSA id h10sm18856937pgf.23.2020.04.09.13.23.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2020 13:23:15 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <1586154741-8293-4-git-send-email-mkshah@codeaurora.org> References: <1586154741-8293-1-git-send-email-mkshah@codeaurora.org> <1586154741-8293-4-git-send-email-mkshah@codeaurora.org> Subject: Re: [PATCH v16 3/6] soc: qcom: rpmh: Invalidate SLEEP and WAKE TCSes before flushing new data From: Stephen Boyd Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, agross@kernel.org, mka@chromium.org, rnayak@codeaurora.org, ilina@codeaurora.org, lsrao@codeaurora.org, Maulik Shah To: Maulik Shah , bjorn.andersson@linaro.org, dianders@chromium.org, evgreen@chromium.org Date: Thu, 09 Apr 2020 13:23:14 -0700 Message-ID: <158646379456.77611.8638840660664120750@swboyd.mtv.corp.google.com> User-Agent: alot/0.9 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Maulik Shah (2020-04-05 23:32:18) > TCSes have previously programmed data when rpmh_flush is called. rpmh_flush() > This can cause old data to trigger along with newly flushed. >=20 > Fix this by cleaning SLEEP and WAKE TCSes before new data is flushed. >=20 > With this there is no need to invoke rpmh_rsc_invalidate() call from > rpmh_invalidate(). >=20 > Simplify rpmh_invalidate() by moving invalidate_batch() inside. >=20 > Fixes: 600513dfeef3 ("drivers: qcom: rpmh: cache sleep/wake state request= s") > Signed-off-by: Maulik Shah > Reviewed-by: Douglas Anderson > --- > drivers/soc/qcom/rpmh.c | 41 ++++++++++++++++++----------------------- > 1 file changed, 18 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c > index 03630ae..a75f3df 100644 > --- a/drivers/soc/qcom/rpmh.c > +++ b/drivers/soc/qcom/rpmh.c > @@ -498,24 +492,25 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr) > } > =20 > /** > - * rpmh_invalidate: Invalidate all sleep and active sets > - * sets. > + * rpmh_invalidate: Invalidate sleep and wake sets in batch_cache > * > * @dev: The device making the request > * > - * Invalidate the sleep and active values in the TCS blocks. > + * Invalidate the sleep and wake values in batch_cache. > */ > int rpmh_invalidate(const struct device *dev) > { > struct rpmh_ctrlr *ctrlr =3D get_rpmh_ctrlr(dev); > - int ret; > - > - invalidate_batch(ctrlr); > + struct batch_cache_req *req, *tmp; > + unsigned long flags; > =20 > - do { > - ret =3D rpmh_rsc_invalidate(ctrlr_to_drv(ctrlr)); > - } while (ret =3D=3D -EAGAIN); > + spin_lock_irqsave(&ctrlr->cache_lock, flags); > + list_for_each_entry_safe(req, tmp, &ctrlr->batch_cache, list) > + kfree(req); > + INIT_LIST_HEAD(&ctrlr->batch_cache); > + ctrlr->dirty =3D true; > + spin_unlock_irqrestore(&ctrlr->cache_lock, flags); > =20 > - return ret; > + return 0; Now this always returns 0. Maybe it should become a void function, but doing that requires a change in the interconnect code so maybe do it later.