lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <DU0PR04MB9496C653249E66016A43F97790A32@DU0PR04MB9496.eurprd04.prod.outlook.com>
Date: Wed, 17 Jul 2024 02:03:35 +0000
From: Bough Chen <haibo.chen@....com>
To: Marc Kleine-Budde <mkl@...gutronix.de>, Frank Li <frank.li@....com>
CC: Vincent Mailhol <mailhol.vincent@...adoo.fr>, "David S. Miller"
	<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Rob Herring
	<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
	<conor+dt@...nel.org>, "linux-can@...r.kernel.org"
	<linux-can@...r.kernel.org>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "devicetree@...r.kernel.org"
	<devicetree@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
	Han Xu <han.xu@....com>
Subject: RE: [PATCH v2 4/4] can: flexcan: add wakeup support for imx95


> -----Original Message-----
> From: Marc Kleine-Budde <mkl@...gutronix.de>
> Sent: 2024年7月16日 22:46
> To: Frank Li <frank.li@....com>
> Cc: Vincent Mailhol <mailhol.vincent@...adoo.fr>; David S. Miller
> <davem@...emloft.net>; Eric Dumazet <edumazet@...gle.com>; Jakub
> Kicinski <kuba@...nel.org>; Paolo Abeni <pabeni@...hat.com>; Rob Herring
> <robh@...nel.org>; Krzysztof Kozlowski <krzk+dt@...nel.org>; Conor Dooley
> <conor+dt@...nel.org>; linux-can@...r.kernel.org; netdev@...r.kernel.org;
> devicetree@...r.kernel.org; linux-kernel@...r.kernel.org; Bough Chen
> <haibo.chen@....com>; imx@...ts.linux.dev; Han Xu <han.xu@....com>
> Subject: Re: [PATCH v2 4/4] can: flexcan: add wakeup support for imx95
> 
> On 16.07.2024 10:40:31, Frank Li wrote:
> > > > @@ -2330,9 +2366,12 @@ static int __maybe_unused
> flexcan_noirq_resume(struct device *device)
> > > >  	if (netif_running(dev)) {
> > > >  		int err;
> > > >
> > > > -		err = pm_runtime_force_resume(device);
> > > > -		if (err)
> > > > -			return err;
> > > > +		if (!(device_may_wakeup(device) &&
> > >                       ^^^^^^^^^^^^^^^^^^^^^^^^
> > >
> > > Where does this come from?
> >
> > include/linux/pm_wakeup.h
> >
> > static inline bool device_may_wakeup(struct device *dev)
> > {
> >         return dev->power.can_wakeup && !!dev->power.wakeup;
> > }
> 
> Sorry for the confusion. I wanted to point out, that the original driver doesn't
> have the check to device_may_wakeup(). Why was this added?

Hi Marc,

Here add this to make sure for CAN with flag FLEXCAN_QUIRK_SETUP_STOP_MODE_SCMI and really used as wakeup source, do not need to call pm_runtime_force_resume(), keep it align with
what we do in flexcan_noirq_suspend.
As the comment in flexcan_noirq_suspend, CAN with flag FLEXCAN_QUIRK_SETUP_STOP_MODE_SCMI, when used as wakeup source, need to keep CAN clock on when system suspend, let ATF part logic works, detail steps please refer to this patch commit log. Whether gate off the CAN clock or not depends on the Hardware design. So for this case, in flexcan_noirq_suspend, directly return0, do not call the pm_runtime_force_suspend(), then in flexcan_noirq_resume(), use the same logic to skip the pm_runtime_force_resume().

Best Regards
Haibo Chen 
> 
> > >
> > > > +		      priv->devtype_data.quirks &
> FLEXCAN_QUIRK_SETUP_STOP_MODE_SCMI)) {
> > > > +			err = pm_runtime_force_resume(device);
> > > > +			if (err)
> > > > +				return err;
> > > > +		}
> > > >
> > > >  		if (device_may_wakeup(device))
> > > >  			flexcan_enable_wakeup_irq(priv, false); diff --git
> > > > a/drivers/net/can/flexcan/flexcan.h
> > > > b/drivers/net/can/flexcan/flexcan.h
> > > > index 025c3417031f4..4933d8c7439e6 100644
> > > > --- a/drivers/net/can/flexcan/flexcan.h
> > > > +++ b/drivers/net/can/flexcan/flexcan.h
> > > > @@ -68,6 +68,8 @@
> > > >  #define FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR BIT(15)
> > > >  /* Device supports RX via FIFO */  #define
> > > > FLEXCAN_QUIRK_SUPPORT_RX_FIFO BIT(16)
> > > > +/* Setup stop mode with ATF SCMI protocol to support wakeup */
> > > > +#define FLEXCAN_QUIRK_SETUP_STOP_MODE_SCMI BIT(17)
> > > >
> > > >  struct flexcan_devtype_data {
> > > >  	u32 quirks;		/* quirks needed for different IP cores */
> 
> regards,
> Marc
> 
> --
> Pengutronix e.K.                 | Marc Kleine-Budde          |
> Embedded Linux                   | https://www.pengutronix.de |
> Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
> Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ