Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1585471ybm; Sat, 30 May 2020 13:46:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI0td+eDgayGcEwHtwwXqmGzbdPMP/Lmz2ZxglE5viU1z8M+UFBa7Aabg803yK5NjrkKBQ X-Received: by 2002:a50:b2a1:: with SMTP id p30mr14861593edd.199.1590871608735; Sat, 30 May 2020 13:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590871608; cv=none; d=google.com; s=arc-20160816; b=G2GMyGpkt2u0Ijj5+S8YCxW34Vv/Li2pPKveIGramXUQBFdnn0lGBirRGs/FOtgBXt fX7IIymKdGG+DDqeGiJNyBWJ6PEcstQeS1jcMaqXeiXNhmPHjmRJGEde6oKCDpkWGKVG A4/V9HDQKZKVxc0rXkVhUQ9CjLHFcRc8a49vl+HH//+yn8Wuot+sC/9h02fkVd6A/tOS wbBsS9myHQ/oeoXLv7t4TnyoowQk1QtdoHYXpVGK2KZ4Hg6UWhs+csXMfKMLwAb5eY2/ WvZNVnQ9mCl4hJx8vHVtcHBYSXJslIsKruL+iiEDdId8Vnr2Fc4+xcj16rNjPIiwwm4W 2INA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=V4AsZGoHkWeKZl23U2BgKUaE05/budRARyGFisUFMAg=; b=ImkVGbEJuJumiDXbNUdcXRinKpMk3cVMw9uuSWBNI244cmeWPtIPulEfRhrxxhlYIg mKSFzqRTUG/U48lnbByIS/X/OXBZNjZpAKA6c75+5PhgUFOEBE0i+djACOJktumlJpEU l1bLOjOtggjRJQkc/VE8mfbLLFeTf/1hdey0yaplvb1gLvlYI9a5FMALGqqP19FpY6TE OW5DHhLixys5kFnw2lciq4iDCg63L9i64pDK518nQEqSruf/a6f4e5FMbIQhjn0vD26f /tNEWqKnbCeND48KyUCBEOtunxRUY3wAEiKl/EiHCsh325+YVmhNH3hlvGqqmuMn/E/k f3vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OQmXWerI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s12si8363260edj.222.2020.05.30.13.46.25; Sat, 30 May 2020 13:46:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OQmXWerI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729371AbgE3Und (ORCPT + 99 others); Sat, 30 May 2020 16:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729351AbgE3Unb (ORCPT ); Sat, 30 May 2020 16:43:31 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B51BC03E969 for ; Sat, 30 May 2020 13:43:31 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id q8so3010862iow.7 for ; Sat, 30 May 2020 13:43:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V4AsZGoHkWeKZl23U2BgKUaE05/budRARyGFisUFMAg=; b=OQmXWerIg8QIvwAPvdBRaSBVezUo5IXv/JrET0Ok0KHl9WRT5scWvK8IQNIWc0KtMn Lkvgxho9ysVNpAmheK8lMRh+f/RTpT1iR1OUu8fKh3+Mm8bVJc7ycrmuXuY5ixrA9l2C u+ROczlA8vOOgr4hXs0YzFBOOoTea9C8kKE3ZzTrFT4vjw8DfhxYJb5XxvOqEIaZPV69 +1Z3UFEDChNboaZGgHvjtF+0DbDU1zlODSZLNLwoiI3FRNkNbOiV/fnl9YoLatz91vlM 27sZKOL0n4svv6djq4nMOvMXkLFAmII8H4tO99dsK8k5k8nHOdMrUVL/Cn83cidaQhb7 ArhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V4AsZGoHkWeKZl23U2BgKUaE05/budRARyGFisUFMAg=; b=ByUrhNmuo0mKJFtzc9F/UxOmxwC7wJU9Qnjz63Vfl8sIxducA+b5j2AK5SHJ4VhdjX YVxd0FwXC3j6KGwJgiyaFswDjwtUtSIRSG4GQdc6OtqPmUFKDWQ7tXJrleK3B+ouDJDK I+gNEosAIduUUaIMsXht0HLNuoSooP9bS7R0cjdbdBbTWJ8MhUJlY1tzSPPrrkBJgLAV lGnz6OWqrx+e6qocw8IXlQKkbhKVwBAAgsyUQUAkoiwfx4tuvQSfqLkCHuLTlQcpf9fx hPBCG//hkonKFUZ1+gZaqjAuTvChvPTMTYFvBk40znkcEc0m7Qab5+kcUySUi8lV1LRl c1+Q== X-Gm-Message-State: AOAM532QWfuy5WqLaZmMbWiWSh9MFrTmjCl/usPFc3D3vChhYpNso+Da a/pb5BGRE5cQnLSm0WXXiJwLORdZtXOfjA1ziPI= X-Received: by 2002:a05:6602:2c45:: with SMTP id x5mr12011542iov.80.1590871410827; Sat, 30 May 2020 13:43:30 -0700 (PDT) MIME-Version: 1.0 References: <1587682871-528-1-git-send-email-Anson.Huang@nxp.com> In-Reply-To: From: Jassi Brar Date: Sat, 30 May 2020 15:43:20 -0500 Message-ID: Subject: Re: [PATCH] mailbox: imx: Add context save/restore for suspend/resume To: Anson Huang Cc: Aisheng Dong , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , dl-linux-imx Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 8:55 PM Anson Huang wrote: > > Gentle ping... > > > > Subject: RE: [PATCH] mailbox: imx: Add context save/restore for > > suspend/resume > > > > > > > > > Subject: RE: [PATCH] mailbox: imx: Add context save/restore for > > > suspend/resume > > > > > > > From: Anson Huang > > > > Sent: Friday, April 24, 2020 10:33 AM > > > > > > > > > Subject: RE: [PATCH] mailbox: imx: Add context save/restore for > > > > > suspend/resume > > > > > > > > > > > From: Anson Huang > > > > > > Sent: Friday, April 24, 2020 7:01 AM > > > > > > > > > > > > For "mem" mode suspend on i.MX8 SoCs, MU settings could be lost > > > > > > because its power is off, so save/restore is needed for MU > > > > > > settings during > > > > > suspend/resume. > > > > > > However, the restore can ONLY be done when MU settings are > > > > > > actually lost, for the scenario of settings NOT lost in "freeze" > > > > > > mode suspend, since there could be still IPC going on multiple > > > > > > CPUs, restoring the MU settings could overwrite the TIE by > > > > > > mistake and cause system freeze, so need to make sure ONLY > > > > > > restore the MU settings when it is > > > > > powered off. > > > > > > > > > > > > Signed-off-by: Anson Huang > > > > > > > > > > As mentioned before, we'd better keep the original author. > > > > > > > > > > > --- > > > > > > drivers/mailbox/imx-mailbox.c | 35 > > > > > > +++++++++++++++++++++++++++++++++++ > > > > > > 1 file changed, 35 insertions(+) > > > > > > > > > > > > diff --git a/drivers/mailbox/imx-mailbox.c > > > > > > b/drivers/mailbox/imx-mailbox.c index 97bf0ac..b53cf63 100644 > > > > > > --- a/drivers/mailbox/imx-mailbox.c > > > > > > +++ b/drivers/mailbox/imx-mailbox.c > > > > > > @@ -67,6 +67,8 @@ struct imx_mu_priv { > > > > > > struct clk *clk; > > > > > > int irq; > > > > > > > > > > > > + u32 xcr; > > > > > > + > > > > > > bool side_b; > > > > > > }; > > > > > > > > > > > > @@ -583,12 +585,45 @@ static const struct of_device_id > > > > > > imx_mu_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, imx_mu_dt_ids); > > > > > > > > > > > > +static int imx_mu_suspend_noirq(struct device *dev) { > > > > > > + struct imx_mu_priv *priv = dev_get_drvdata(dev); > > > > > > + > > > > > > + priv->xcr = imx_mu_read(priv, priv->dcfg->xCR); > > > > > > + > > > > > > + return 0; > > > > > > +} > > > > > > + > > > > > > +static int imx_mu_resume_noirq(struct device *dev) { > > > > > > + struct imx_mu_priv *priv = dev_get_drvdata(dev); > > > > > > + > > > > > > + /* > > > > > > + * ONLY restore MU when context lost, the TIE could > > > > > > + * be set during noirq resume as there is MU data > > > > > > + * communication going on, and restore the saved > > > > > > + * value will overwrite the TIE and cause MU data > > > > > > + * send failed, may lead to system freeze. This issue > > > > > > + * is observed by testing freeze mode suspend. > > > > > > + */ > > > > > > + if (!imx_mu_read(priv, priv->dcfg->xCR)) > > > > > > + imx_mu_write(priv, priv->xcr, priv->dcfg->xCR); > > > > > > > > > > This could be separate patch if it aims to fix a specific corner case. > > > > > > > > This is NOT corner case, it can be reproduced with our imx_5.4.y > > > > very easily, and this issue cause me many days to debug...Also cause > > > > Clark's effort to help test it a lot for many days... > > > > > > > > > > Is this issue only happen for non-state lost case (eg. Freeze mode)? > > > If yes, it's a specific case and worth a separate patch to highlight it IMHO. > > > > > > BTW, it seems most drivers have this issue in current kernel because > > > they don't know whether the state are really lost, it seems like > > > kernel still doesn't support this well. > > > > > > > I do NOT think it makes sense to first send out your patch with bug > > > > for review, And then add another patch to fix it. 1 patch is enough > > > > for this > > > feature. > > > > > > > > > > Anyway, if you really want to go with one patch, for this case, we > > > usually could keep original author and add a small fix note in commit > > message. > > > (You could see many community guys do like this if you search kernel > > > commit > > > log) > > > > > > Basically we try our best to keep origin author in order to respect > > > others' work for community work. > > > > I am fine with whoever is the author, my focus is the issue fix and easy rebase. > > If maintainer agrees that introduce a patch with bug and add another patch to > > fix is OK, then I can rework the patch into 2 patches. > > Not two patches, just add to the original patch and add a fix note in commit as Anson suggested ... though I don't know what the original patch was. But I am definitely in support of giving credit to the original author. thanks.