Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2227355ybh; Mon, 9 Mar 2020 01:29:12 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsQXV+e9TrJInqFFh0Hbgu43u+hijfurljkW8C5spxl5LwJCXA0HEYoudamuPmNppvQ9atw X-Received: by 2002:a9d:6a0b:: with SMTP id g11mr8106385otn.31.1583742552533; Mon, 09 Mar 2020 01:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583742552; cv=none; d=google.com; s=arc-20160816; b=bgNm2l64rAcJgLH+X/tsLiuREj5AnP3rfE0go6mDHAkauVyXywqlFowLze1aC9nGbH VepylXrRsFt0FvWjSkCKkr5rUiaV2Acx1TZG+prAj5xptiIHuGh7gdW8RiBSuZjkyksC qc+1Lpxg1FEmFHuWPvbGynsdRTNEPaSvJ2xC4CM8RnSiOYPMcYcF5rcswVnWYY0CQYfJ r2wD8+io9LM2m23ssWvMgCLkQxDgm4EV5UhxxHL4o21o1WNo1T+mjkR1B8mBR9FoGjTp e0JchWhOyiIrzvPsmOFB4J4KdaDDKx32DjegmuwB8nBuwL4pzLaoLBBYHFuZBdmGGhIT I4sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=iRMYSgEIhfB7egeL4H61oZlGJCDjaQ6CbrUcdFxIW9Q=; b=eCTfn4pzlnZAbA7+1H0gLIIUS+WZsXyxEewLhUNoHcEJty5jWA/8ZQOABwvrLEuTXb FOP4JfwsdnbgZeoEPFFGrw64Kki8/cwtE9pvx3z3WoexeMapri06Qlhfu9QFKZz62YWu dU7qzSivfQ51/zhj8AVXblQFlQwA6DH/WmKhyWCupSazgsfE6E0S1ntVyg0+awP2UwXP vGJHv77kbQE7/g4SR+8aMpIyzehiGPd3BwVhOL+mujrrzyotEeVgW212lh0/UH9Xd76R i93+xD/fqAvGBlObZZlCZV2YfBCsItWL2ad/ze8C5trFqy48JvfEDzPCCIFK5I5oX1o0 6wtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Fn7OQoo6; 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 l3si6034309otn.286.2020.03.09.01.29.00; Mon, 09 Mar 2020 01:29:12 -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=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Fn7OQoo6; 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 S1726475AbgCII2V (ORCPT + 99 others); Mon, 9 Mar 2020 04:28:21 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:61291 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726215AbgCII2V (ORCPT ); Mon, 9 Mar 2020 04:28:21 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1583742500; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=iRMYSgEIhfB7egeL4H61oZlGJCDjaQ6CbrUcdFxIW9Q=; b=Fn7OQoo606y3GeuMWtlzU62Q0q2+uzvebg6lqER4wFqiFK72pHuk4bu3jtPlsoo2Br3ZRLC0 Q+JpBEIDxuwFlBB9HJgjit7Wc6C12zw3667ZTAzRLNefzbt6pmP80pKKH5T+PBU/cIud/x3v yhZM3EdMzLP1YPoRH2zi7N0RY04= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e65fe17.7f8f16f890d8-smtp-out-n01; Mon, 09 Mar 2020 08:28:07 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id C4EA4C432C2; Mon, 9 Mar 2020 08:28:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [10.206.13.37] (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mkshah) by smtp.codeaurora.org (Postfix) with ESMTPSA id D91E3C433F2; Mon, 9 Mar 2020 08:28:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D91E3C433F2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=mkshah@codeaurora.org Subject: Re: [PATCH v12 4/4] soc: qcom: rpmh: Invalidate SLEEP and WAKE TCSes before flushing new data To: Doug Anderson Cc: Stephen Boyd , Matthias Kaehlcke , Evan Green , Bjorn Andersson , LKML , linux-arm-msm , Andy Gross , Rajendra Nayak , Lina Iyer , lsrao@codeaurora.org References: <1583428023-19559-1-git-send-email-mkshah@codeaurora.org> <1583428023-19559-5-git-send-email-mkshah@codeaurora.org> From: Maulik Shah Message-ID: <0238976f-28d4-15ff-81f0-61aab5c20b42@codeaurora.org> Date: Mon, 9 Mar 2020 13:58:00 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/6/2020 3:50 AM, Doug Anderson wrote: > Hi, > > On Thu, Mar 5, 2020 at 9:07 AM Maulik Shah wrote: >> TCSes have previously programmed data when rpmh_flush is called. >> This can cause old data to trigger along with newly flushed. >> >> Fix this by cleaning SLEEP and WAKE TCSes before new data is flushed. >> >> Fixes: 600513dfeef3 ("drivers: qcom: rpmh: cache sleep/wake state requests") >> Signed-off-by: Maulik Shah >> --- >> drivers/soc/qcom/rpmh.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c >> index 1951f6a..63364ce 100644 >> --- a/drivers/soc/qcom/rpmh.c >> +++ b/drivers/soc/qcom/rpmh.c >> @@ -472,6 +472,11 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr) >> return 0; >> } >> >> + /* Invalidate the TCSes first to avoid stale data */ >> + do { >> + ret = rpmh_rsc_invalidate(ctrlr_to_drv(ctrlr)); >> + } while (ret == -EAGAIN); >> + >> /* First flush the cached batch requests */ >> ret = flush_batch(ctrlr); >> if (ret) > I think you should make this patch 3/4 instead of 4/4, and then: > > 1. In this patch remove the call to rpmh_rsc_invalidate() in > rpmh_invalidate(). You've already marked things "dirty" in > invalidate_batch() so no need to actually program the hardware--it'll > happen in the flush. Done. > > 2. In patch 4/4 (the flushing patch) add a call to rpmh_flush() to > rpmh_invalidate() if you're in non-OSI mode. Presumably you'll need a > spinlock around the rpmh_flush() call? With (1) addressed and rpmh_start_transaction and rpmh_end_transaction introduced in v13, this is not required. Thanks, Maulik > > > The end result of that will be that rpmh_invalidate() will properly > leave the non-batch sleep/wake sets programmed. > > > -Doug -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation