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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a3975cd6-ae9a-4dc1-b186-5dacf1df5150@lunn.ch>
Date: Sat, 6 Apr 2024 16:46:48 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Yanteng Si <siyanteng@...ngson.cn>
Cc: hkallweit1@...il.com, peppe.cavallaro@...com,
	alexandre.torgue@...s.st.com, joabreu@...opsys.com,
	fancer.lancer@...il.com, Jose.Abreu@...opsys.com,
	chenhuacai@...ngson.cn, linux@...linux.org.uk,
	guyinggang@...ngson.cn, netdev@...r.kernel.org,
	chris.chenfeiyang@...il.com, siyanteng01@...il.com
Subject: Re: [PATCH net-next v9 6/6] net: stmmac: dwmac-loongson: Add GNET
 support

> +static void loongson_gnet_fix_speed(void *priv, unsigned int speed,
> +				    unsigned int mode)
> +{
> +	struct loongson_data *ld = (struct loongson_data *)priv;
> +	struct net_device *ndev = dev_get_drvdata(ld->dev);
> +	struct stmmac_priv *ptr = netdev_priv(ndev);
> +
> +	/* The controller and PHY don't work well together.
> +	 * We need to use the PS bit to check if the controller's status
> +	 * is correct and reset PHY if necessary.
> +	 * MAC_CTRL_REG.15 is defined by the GMAC_CONTROL_PS macro.
> +	 */
> +	if (speed == SPEED_1000) {
> +		if (readl(ptr->ioaddr + MAC_CTRL_REG) & (1 << 15))

It would be good to add a #define using BIT(15) for this PS bit. Also,
what does PS actually mean?

> +	priv->synopsys_id = 0x37;

hwif.c:		if (priv->synopsys_id >= DWMAC_CORE_3_50) {
hwif.c:	priv->synopsys_id = id;
hwif.c:		/* Use synopsys_id var because some setups can override this */
hwif.c:		if (priv->synopsys_id < entry->min_id)
stmmac_ethtool.c:		if (priv->synopsys_id >= DWMAC_CORE_3_50)
stmmac.h:	int synopsys_id;
stmmac_main.c:			if (priv->synopsys_id < DWMAC_CORE_4_10)
stmmac_main.c:	if (priv->synopsys_id >= DWMAC_CORE_4_00 ||
stmmac_main.c:		if (priv->synopsys_id < DWMAC_CORE_4_00)
stmmac_main.c:	if (((priv->synopsys_id >= DWMAC_CORE_3_50) ||
stmmac_main.c:	if (priv->synopsys_id < DWMAC_CORE_5_20)
stmmac_main.c:	else if ((priv->plat->enh_desc) || (priv->synopsys_id >= DWMAC_CORE_4_00))
stmmac_mdio.c:	if (priv->synopsys_id < DWXGMAC_CORE_2_20) {
stmmac_mdio.c:	if (priv->synopsys_id < DWXGMAC_CORE_2_20 &&
stmmac_mdio.c:	if (priv->synopsys_id < DWXGMAC_CORE_2_20 &&
stmmac_mdio.c:		if (priv->synopsys_id < DWXGMAC_CORE_2_20) {

Please add a #define for this 0x37.

Who allocated this value? Synopsys?

/* Synopsys Core versions */
#define DWMAC_CORE_3_40         0x34
#define DWMAC_CORE_3_50         0x35
#define DWMAC_CORE_4_00         0x40
#define DWMAC_CORE_4_10         0x41

0x37 makes it somewhere between a 3.5 and 4.0.

stmmac_ethtool.c:		if (priv->synopsys_id >= DWMAC_CORE_3_50)
stmmac_main.c:	if (((priv->synopsys_id >= DWMAC_CORE_3_50) ||

Does the hardware actually provide what these two bits of code
require? Have you reviewed all similar bits of code to confirm they
are correct for your hardware?

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ