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: <60b7a9c3-ad98-4493-b1c7-3ee221a3101a@loongson.cn>
Date: Sun, 7 Apr 2024 17:06:34 +0800
From: Yanteng Si <siyanteng@...ngson.cn>
To: Andrew Lunn <andrew@...n.ch>
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


在 2024/4/6 22:46, Andrew Lunn 写道:
>> +	 */
>> +	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,
OK.
> what does PS actually mean?

In DW GMAC v3.73a:

It is the bit 15 of MAC Configuration Register


Port Select

This bit selects the Ethernet line speed.

* 0: For 1000 Mbps operations

* 1: For 10 or 100 Mbps operations


In 10 or 100 Mbps operations, this bit, along with FES bit, selects the 
exact line
speed. In the 10/100 Mbps-only (always 1) or 1000 Mbps-only (always 0)
configurations, this bit is read-only with the appropriate value. In default
10/100/1000 Mbps configuration, this bit is R_W. The mac_portselect_o or
mac_speed_o[1] signal reflects the value of this bit.
>
>> +	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?
It look like this.
>
> /* 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.

Yeah,

How about defining it in 
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c?

>
> 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?

Yes, because in fact the IP core of our gnet is 0x37, but some chips 
(2k2000) split

the rx/tx register definition from one into two. In order to distinguish 
them, 0x10

was created. it is not worth adding a new entry for this.


According to Serge's comment, we made these devices work by overwriting
priv->synopsys_id = 0x37 and mac->dma = <LS_dma_ops>.


Thanks,

Yanteng


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ