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:   Tue, 29 Sep 2020 16:50:56 +0200
From:   Marc Kleine-Budde <mkl@...gutronix.de>
To:     Jakub Kicinski <kuba@...nel.org>,
        Joakim Zhang <qiangqing.zhang@....com>
Cc:     linux-can@...r.kernel.org, netdev@...r.kernel.org,
        linux-imx@....com
Subject: Re: [PATCH V4 1/3] can: flexcan: initialize all flexcan memory for
 ECC function

On 9/29/20 4:48 PM, Jakub Kicinski wrote:
> On Wed, 30 Sep 2020 04:30:39 +0800 Joakim Zhang wrote:
>> @@ -1292,6 +1307,35 @@ static void flexcan_set_bittiming(struct net_device *dev)
>>  		return flexcan_set_bittiming_ctrl(dev);
>>  }
>>  
>> +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;
>> +
>> +	/* 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);
>> +
>> +	memset_io(&regs->mb[0][0], 0,
>> +		  (u8 *)&regs->rx_smb1[3] - &regs->mb[0][0] + 0x4);
>> +
>> +	if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
>> +		memset_io(&regs->tx_smb_fd[0], 0,
>> +			  (u8 *)&regs->rx_smb1_fd[17] - (u8 *)&regs->tx_smb_fd[0] + 0x4);
>> +
>> +	reg_ctrl2 &= ~FLEXCAN_CTRL2_WRMFRZ;
>> +	priv->write(reg_ctrl2, &regs->ctrl2);
>> +}
>> +
>>  /* flexcan_chip_start
>>   *
>>   * this functions is entered with clocks enabled

> drivers/net/can/flexcan.c:1329:20: warning: cast removes address space '__iomem' of expression
> drivers/net/can/flexcan.c:1329:43: error: subtraction of different types can't work (different address spaces)

Thanks, this patch is outdated, we use offset of now to calculate the range:

> 	memset_io(&regs->mb[0][0], 0,
> 		  offsetof(struct flexcan_regs, rx_smb1[3]) -
> 		  offsetof(struct flexcan_regs, mb[0][0]) + 0x4);

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 |



Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists