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]
Date: Mon, 8 Apr 2024 10:30:37 +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/7 23:27, Andrew Lunn 写道:
> On Sun, Apr 07, 2024 at 05:06:34PM +0800, Yanteng Si wrote:
>> 在 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
> Since this is a standard bit in a register, please add a #define for
> it. Something like
>
> #define MAC_CTRL_PORT_SELECT_10_100 BIT(15)
>
> maybe in commom.h? I don't know this driver too well, so it might have
OK.
> a different naming convention.
>
> 	if (speed == SPEED_1000) {
> 		if (readl(ptr->ioaddr + MAC_CTRL_REG) & MAC_CTRL_PORT_SELECT_10_100)
> 		/* Word around hardware bug, restart autoneg */
>
> is more obvious what is going on.
great!
>
>>>> +	priv->synopsys_id = 0x37;
>>> hwif.c:		if (priv->synopsys_id >= DWMAC_CORE_3_50) {
>>> 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.
> That did not answer my question. Did Synopsys allocate this value?  If
> not, what happens when Synopsys does produce a version which makes use
> of this value?

Hmm, that will not happen, because the value already exists, and we can 
find it in the code.

title: Synopsys DesignWare MAC

maintainers:
   - Alexandre Torgue <alexandre.torgue@...s.st.com>
   - Giuseppe Cavallaro <peppe.cavallaro@...com>
   - Jose Abreu <joabreu@...opsys.com>

# Select every compatible, including the deprecated ones. This way, we
# will be able to report a warning when we have that compatible, since
# we will validate the node thanks to the select, but won't report it
# as a valid value in the compatible property description
select:
   properties:
     compatible:
       contains:
         enum:
           - snps,dwmac
           - snps,dwmac-3.40a
           - snps,dwmac-3.50a
           - snps,dwmac-3.610
           - snps,dwmac-3.70a
           - snps,dwmac-3.710
           - snps,dwmac-4.00
           - snps,dwmac-4.10a
           - snps,dwmac-4.20a
           - snps,dwmac-5.10a
           - snps,dwmac-5.20
           - snps,dwxgmac
           - snps,dwxgmac-2.10

           # Deprecated
           - st,spear600-gmac

There are a lot of calls like that. Let's grep -rn dwmac-3.70a:

drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c:57: { .compatible = 
"snps,dwmac-3.70a"},
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:524: 
of_device_is_compatible(np, "snps,dwmac-3.70a") ||

arch/arm64/boot/dts/amlogic/meson-axg.dtsi:279: "snps,dwmac-3.70a",
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi:171: "snps,dwmac-3.70a",
arch/arm64/boot/dts/amlogic/meson-gx.dtsi:585: "snps,dwmac-3.70a",
arch/arm64/boot/dts/amlogic/meson-s4.dtsi:489: "snps,dwmac-3.70a",
arch/loongarch/boot/dts/.loongson-2k0500-ref.dtb.dts.tmp:114: compatible 
= "snps,dwmac-3.70a";

......

>>> /* 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?
> No, because of the version comparisons within the code, developers
> need to know what versions actually exist. So you should include it
> along side all the other values.

OK, Let's:

@@ -29,6 +29,7 @@
  /* Synopsys Core versions */
  #define        DWMAC_CORE_3_40         0x34
  #define        DWMAC_CORE_3_50         0x35
+#define        DWMAC_CORE_3_70         0x37
  #define        DWMAC_CORE_4_00         0x40
  #define DWMAC_CORE_4_10                0x41
  #define DWMAC_CORE_5_00                0x50


Thanks,

Yanteng


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ