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: <CAMdnO-JUkMvoB8yiJqDFLnmCvchsTdBvf0G+Rtcov6YTdh_BVQ@mail.gmail.com>
Date: Thu, 8 Aug 2024 18:17:47 -0700
From: Jitendra Vegiraju <jitendra.vegiraju@...adcom.com>
To: Serge Semin <fancer.lancer@...il.com>
Cc: netdev@...r.kernel.org, alexandre.torgue@...s.st.com, joabreu@...opsys.com, 
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, 
	mcoquelin.stm32@...il.com, bcm-kernel-feedback-list@...adcom.com, 
	richardcochran@...il.com, ast@...nel.org, daniel@...earbox.net, 
	hawk@...nel.org, john.fastabend@...il.com, linux-kernel@...r.kernel.org, 
	linux-stm32@...md-mailman.stormreply.com, 
	linux-arm-kernel@...ts.infradead.org, bpf@...r.kernel.org, andrew@...n.ch, 
	linux@...linux.org.uk, horms@...nel.org, florian.fainelli@...adcom.com
Subject: Re: [PATCH net-next v3 2/3] net: stmmac: Integrate dwxgmac4 into
 stmmac hwif handling

Hi Serge
On Tue, Aug 6, 2024 at 3:14 PM Serge Semin <fancer.lancer@...il.com> wrote:
>
> On Thu, Aug 01, 2024 at 08:18:21PM -0700, jitendra.vegiraju@...adcom.com wrote:
> > From: Jitendra Vegiraju <jitendra.vegiraju@...adcom.com>
> >
> > Integrate dwxgmac4 support into stmmac hardware interface handling.
> > A dwxgmac4 is an xgmac device and hence it inherits properties from
> > existing stmmac_hw table entry.
> > The quirks handling facility is used to update dma_ops field to
> > point to dwxgmac400_dma_ops when the user version field matches.
> >
> > Signed-off-by: Jitendra Vegiraju <jitendra.vegiraju@...adcom.com>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/common.h |  4 +++
> >  drivers/net/ethernet/stmicro/stmmac/hwif.c   | 26 +++++++++++++++++++-
> >  drivers/net/ethernet/stmicro/stmmac/hwif.h   |  1 +
> >  3 files changed, 30 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> > index cd36ff4da68c..9bf278e11704 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> > +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> > @@ -37,11 +37,15 @@
> >  #define DWXGMAC_CORE_2_10    0x21
> >  #define DWXGMAC_CORE_2_20    0x22
> >  #define DWXLGMAC_CORE_2_00   0x20
>
> > +#define DWXGMAC_CORE_4_00    0x40
>
> DW25GMAC_CORE_4_00?
Will do.
>
> >
> >  /* Device ID */
> >  #define DWXGMAC_ID           0x76
>
> What is the device ID in your case? Does it match to DWXGMAC_ID?
The early adopter 25MAC IP core used on this has 0x76.
But, synopsis confirmed the 25GMAC is assigned with value 0x55.
Will define DW25MAC_ID 0x55 and use it for 25GMAC hw_if entry.
However, we would like to get a suggestion for dealing with this early
adopter device_id number.
Can we add override mechanism by defining device_id in stmmac_priv
structure and let the hardware specific setup function in the glue
driver update the device_id to 0x55 function?

>
> >  #define DWXLGMAC_ID          0x27
> >
> > +/* User Version */
> > +#define DWXGMAC_USER_VER_X22 0x22
> > +
> >  #define STMMAC_CHAN0 0       /* Always supported and default for all chips */
> >
> >  /* TX and RX Descriptor Length, these need to be power of two.
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
> > index 29367105df54..713cb5aa2c3e 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
> > @@ -36,6 +36,18 @@ static u32 stmmac_get_dev_id(struct stmmac_priv *priv, u32 id_reg)
> >       return (reg & GENMASK(15, 8)) >> 8;
> >  }
> >
>
> > +static u32 stmmac_get_user_version(struct stmmac_priv *priv, u32 id_reg)
> > +{
> > +     u32 reg = readl(priv->ioaddr + id_reg);
> > +
> > +     if (!reg) {
> > +             dev_info(priv->device, "User Version not available\n");
> > +             return 0x0;
> > +     }
> > +
> > +     return (reg & GENMASK(23, 16)) >> 16;
> > +}
> > +
>
> The User Version is purely a vendor-specific stuff defined on the
> IP-core synthesis stage. Moreover I don't see you'll need it anyway.
>
Yes, we don't need this function with the 25GMAC entry.
> >  static void stmmac_dwmac_mode_quirk(struct stmmac_priv *priv)
> >  {
> >       struct mac_device_info *mac = priv->hw;
> > @@ -82,6 +94,18 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv)
> >       return 0;
> >  }
> >
>
> > +static int stmmac_dwxgmac_quirks(struct stmmac_priv *priv)
> > +{
> > +     struct mac_device_info *mac = priv->hw;
> > +     u32 user_ver;
> > +
> > +     user_ver = stmmac_get_user_version(priv, GMAC4_VERSION);
> > +     if (priv->synopsys_id == DWXGMAC_CORE_4_00 &&
> > +         user_ver == DWXGMAC_USER_VER_X22)
> > +             mac->dma = &dwxgmac400_dma_ops;
> > +     return 0;
> > +}
> > +
Will remove this function.
> >  static int stmmac_dwxlgmac_quirks(struct stmmac_priv *priv)
> >  {
> >       priv->hw->xlgmac = true;
> > @@ -256,7 +280,7 @@ static const struct stmmac_hwif_entry {
> >               .mmc = &dwxgmac_mmc_ops,
> >               .est = &dwmac510_est_ops,
> >               .setup = dwxgmac2_setup,
> > -             .quirks = NULL,
> > +             .quirks = stmmac_dwxgmac_quirks,
>
> Why? You can just introduce a new stmmac_hw[] entry with the DW
> 25GMAC-specific stmmac_dma_ops instance specified.
>
Will do.
> -Serge(y)
>
> >       }, {
> >               .gmac = false,
> >               .gmac4 = false,
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
> > index e53c32362774..6213c496385c 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
> > +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
> > @@ -683,6 +683,7 @@ extern const struct stmmac_desc_ops dwxgmac210_desc_ops;
> >  extern const struct stmmac_mmc_ops dwmac_mmc_ops;
> >  extern const struct stmmac_mmc_ops dwxgmac_mmc_ops;
> >  extern const struct stmmac_est_ops dwmac510_est_ops;
> > +extern const struct stmmac_dma_ops dwxgmac400_dma_ops;
> >
> >  #define GMAC_VERSION         0x00000020      /* GMAC CORE Version */
> >  #define GMAC4_VERSION                0x00000110      /* GMAC4+ CORE Version */
> > --
> > 2.34.1
> >
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ