[PATCH v2 1/5] hw/net:ftgmac100: update memory region size to 0x200

Jamin Lin via posted 5 patches 3 months, 2 weeks ago
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Alistair Francis <alistair@alistair23.me>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Jason Wang <jasowang@redhat.com>, Cleber Rosa <crosa@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>
There is a newer version of this series
[PATCH v2 1/5] hw/net:ftgmac100: update memory region size to 0x200
Posted by Jamin Lin via 3 months, 2 weeks ago
According to the datasheet of ASPEED SOCs,
one MAC controller owns 128KB of register space for AST2500.

However, one MAC controller only owns 64KB of register space for AST2600
and AST2700.

It set the memory region size 128KB and it occupied another
controllers Address Spaces.

Currently, the ftgmac100 model use 0x100 register space.
To support DMA 64 bits dram address and new future mode(ftgmac100_high) which
have "Normal Priority Transmit Ring Base Address Register High(0x17C)",
"High Priority Transmit Ring Base Address Register High(0x184)" and
"Receive Ring Base Address Register High(0x18C)" to save the high part physical
address of descriptor manager.

Update memory region size to 0x200.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 hw/net/ftgmac100.c         | 2 +-
 include/hw/net/ftgmac100.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
index 25e4c0cd5b..4e88430b2f 100644
--- a/hw/net/ftgmac100.c
+++ b/hw/net/ftgmac100.c
@@ -1108,7 +1108,7 @@ static void ftgmac100_realize(DeviceState *dev, Error **errp)
     }
 
     memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops, s,
-                          TYPE_FTGMAC100, 0x2000);
+                          TYPE_FTGMAC100, FTGMAC100_NR_REGS);
     sysbus_init_mmio(sbd, &s->iomem);
     sysbus_init_irq(sbd, &s->irq);
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h
index 765d1538a4..5a970676da 100644
--- a/include/hw/net/ftgmac100.h
+++ b/include/hw/net/ftgmac100.h
@@ -14,6 +14,8 @@
 #define TYPE_FTGMAC100 "ftgmac100"
 OBJECT_DECLARE_SIMPLE_TYPE(FTGMAC100State, FTGMAC100)
 
+#define FTGMAC100_NR_REGS   0x200
+
 #include "hw/sysbus.h"
 #include "net/net.h"
 
-- 
2.34.1
Re: [PATCH v2 1/5] hw/net:ftgmac100: update memory region size to 0x200
Posted by Cédric Le Goater 3 months, 2 weeks ago
On 7/3/24 10:16 AM, Jamin Lin wrote:
> According to the datasheet of ASPEED SOCs,
> one MAC controller owns 128KB of register space for AST2500.
> 
> However, one MAC controller only owns 64KB of register space for AST2600
> and AST2700.
> 
> It set the memory region size 128KB and it occupied another
> controllers Address Spaces.
> 
> Currently, the ftgmac100 model use 0x100 register space.
> To support DMA 64 bits dram address and new future mode(ftgmac100_high) which
> have "Normal Priority Transmit Ring Base Address Register High(0x17C)",
> "High Priority Transmit Ring Base Address Register High(0x184)" and
> "Receive Ring Base Address Register High(0x18C)" to save the high part physical
> address of descriptor manager.
> 
> Update memory region size to 0x200.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   hw/net/ftgmac100.c         | 2 +-
>   include/hw/net/ftgmac100.h | 2 ++
>   2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
> index 25e4c0cd5b..4e88430b2f 100644
> --- a/hw/net/ftgmac100.c
> +++ b/hw/net/ftgmac100.c
> @@ -1108,7 +1108,7 @@ static void ftgmac100_realize(DeviceState *dev, Error **errp)
>       }
>   
>       memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops, s,
> -                          TYPE_FTGMAC100, 0x2000);
> +                          TYPE_FTGMAC100, FTGMAC100_NR_REGS);
>       sysbus_init_mmio(sbd, &s->iomem);
>       sysbus_init_irq(sbd, &s->irq);
>       qemu_macaddr_default_if_unset(&s->conf.macaddr);
> diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h
> index 765d1538a4..5a970676da 100644
> --- a/include/hw/net/ftgmac100.h
> +++ b/include/hw/net/ftgmac100.h
> @@ -14,6 +14,8 @@
>   #define TYPE_FTGMAC100 "ftgmac100"
>   OBJECT_DECLARE_SIMPLE_TYPE(FTGMAC100State, FTGMAC100)
>   
> +#define FTGMAC100_NR_REGS   0x200

Since this value will size a memory region, I think the define name should
be changed to FTGMAC100_{MEM,REGION,MMIO}_SIZE. What ever you prefer.


Thanks,

C.


  
> +
>   #include "hw/sysbus.h"
>   #include "net/net.h"
>
RE: [PATCH v2 1/5] hw/net:ftgmac100: update memory region size to 0x200
Posted by Jamin Lin 3 months, 2 weeks ago
Hi Cedric,

> Subject: Re: [PATCH v2 1/5] hw/net:ftgmac100: update memory region size to
> 0x200
> 
> On 7/3/24 10:16 AM, Jamin Lin wrote:
> > According to the datasheet of ASPEED SOCs, one MAC controller owns
> > 128KB of register space for AST2500.
> >
> > However, one MAC controller only owns 64KB of register space for
> > AST2600 and AST2700.
> >
> > It set the memory region size 128KB and it occupied another
> > controllers Address Spaces.
> >
> > Currently, the ftgmac100 model use 0x100 register space.
> > To support DMA 64 bits dram address and new future
> > mode(ftgmac100_high) which have "Normal Priority Transmit Ring Base
> > Address Register High(0x17C)", "High Priority Transmit Ring Base
> > Address Register High(0x184)" and "Receive Ring Base Address Register
> > High(0x18C)" to save the high part physical address of descriptor manager.
> >
> > Update memory region size to 0x200.
> >
> > Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> > ---
> >   hw/net/ftgmac100.c         | 2 +-
> >   include/hw/net/ftgmac100.h | 2 ++
> >   2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c index
> > 25e4c0cd5b..4e88430b2f 100644
> > --- a/hw/net/ftgmac100.c
> > +++ b/hw/net/ftgmac100.c
> > @@ -1108,7 +1108,7 @@ static void ftgmac100_realize(DeviceState *dev,
> Error **errp)
> >       }
> >
> >       memory_region_init_io(&s->iomem, OBJECT(dev), &ftgmac100_ops,
> s,
> > -                          TYPE_FTGMAC100, 0x2000);
> > +                          TYPE_FTGMAC100,
> FTGMAC100_NR_REGS);
> >       sysbus_init_mmio(sbd, &s->iomem);
> >       sysbus_init_irq(sbd, &s->irq);
> >       qemu_macaddr_default_if_unset(&s->conf.macaddr);
> > diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h
> > index 765d1538a4..5a970676da 100644
> > --- a/include/hw/net/ftgmac100.h
> > +++ b/include/hw/net/ftgmac100.h
> > @@ -14,6 +14,8 @@
> >   #define TYPE_FTGMAC100 "ftgmac100"
> >   OBJECT_DECLARE_SIMPLE_TYPE(FTGMAC100State, FTGMAC100)
> >
> > +#define FTGMAC100_NR_REGS   0x200
> 
> Since this value will size a memory region, I think the define name should be
> changed to FTGMAC100_{MEM,REGION,MMIO}_SIZE. What ever you prefer.
> 

Will fix
Thanks-Jamin
> 
> Thanks,
> 
> C.
> 
> 
> 
> > +
> >   #include "hw/sysbus.h"
> >   #include "net/net.h"
> >