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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 28 Sep 2020 05:23:26 +0000
From:   Joakim Zhang <qiangqing.zhang@....com>
To:     Marc Kleine-Budde <mkl@...gutronix.de>,
        "linux-can@...r.kernel.org" <linux-can@...r.kernel.org>
CC:     dl-linux-imx <linux-imx@....com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH V2 1/3] can: flexcan: initialize all flexcan memory for
 ECC function


> -----Original Message-----
> From: Joakim Zhang <qiangqing.zhang@....com>
> Sent: 2020年9月28日 10:29
> To: Marc Kleine-Budde <mkl@...gutronix.de>; linux-can@...r.kernel.org
> Cc: dl-linux-imx <linux-imx@....com>; netdev@...r.kernel.org
> Subject: RE: [PATCH V2 1/3] can: flexcan: initialize all flexcan memory for ECC
> function
> 
> 
> > -----Original Message-----
> > From: Marc Kleine-Budde <mkl@...gutronix.de>
> > Sent: 2020年9月28日 3:58
> > To: Joakim Zhang <qiangqing.zhang@....com>; linux-can@...r.kernel.org
> > Cc: dl-linux-imx <linux-imx@....com>; netdev@...r.kernel.org
> > Subject: Re: [PATCH V2 1/3] can: flexcan: initialize all flexcan
> > memory for ECC function
> >
> > On 9/27/20 6:07 PM, Joakim Zhang wrote:
> > [...]
> >
> > > +static void flexcan_init_ram(struct net_device *dev) {
> > > +	struct flexcan_priv *priv = netdev_priv(dev);
> > > +	struct flexcan_regs __iomem *regs = priv->regs;
> > > +	u32 reg_ctrl2;
> > > +	int i;
> > > +
> > > +	/* 11.8.3.13 Detection and correction of memory errors:
> > > +	 * CTRL2[WRMFRZ] grants write access to all memory positions that
> > > +	 * require initialization, ranging from 0x080 to 0xADF and
> > > +	 * from 0xF28 to 0xFFF when the CAN FD feature is enabled.
> > > +	 * The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK
> registers
> > need to
> > > +	 * be initialized as well. MCR[RFEN] must not be set during memory
> > > +	 * initialization.
> > > +	 */
> > > +	reg_ctrl2 = priv->read(&regs->ctrl2);
> > > +	reg_ctrl2 |= FLEXCAN_CTRL2_WRMFRZ;
> > > +	priv->write(reg_ctrl2, &regs->ctrl2);
> > > +
> > > +	for (i = 0; i < ram_init[0].len; i++)
> > > +		priv->write(0, (void __iomem *)regs + ram_init[0].offset +
> > > +sizeof(u32) * i);
> >
> > As the write function only does endian conversion, and you're writing 0 here.
> > What about using iowrite32_rep() and get rid of the for loop?
> 
> Thanks for this point, I will update in next version.

Ahhh.. I check iowrite32_rep() writes a buf to single address, no shift for address.

I prefer to use memset_io() here to initialize a block of io memory. What do you think?

Best Regards,
Joakim Zhang
> Best Regards,
> Joakim Zhang
> > Marc
> >
> > --
> > Pengutronix e.K.                 | Marc Kleine-Budde           |
> > Embedded Linux                   | https://www.pengutronix.de  |
> > Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
> > Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists