Message ID | 20241112181044.92193-21-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | hw/net/xilinx_ethlite: Map RAM buffers as RAM and remove tswap() calls | expand |
On Tue, Nov 12, 2024 at 07:10:44PM +0100, Philippe Mathieu-Daudé wrote: > Having all its address range mapped by subregions, > s->mmio MemoryRegion effectively became a container. > Rename it as 'container' for clarity. Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com> > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/net/xilinx_ethlite.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c > index da453465ca..c65001cf46 100644 > --- a/hw/net/xilinx_ethlite.c > +++ b/hw/net/xilinx_ethlite.c > @@ -93,7 +93,7 @@ struct XlnxXpsEthLite > { > SysBusDevice parent_obj; > > - MemoryRegion mmio; > + MemoryRegion container; > qemu_irq irq; > NICState *nic; > NICConf conf; > @@ -306,7 +306,7 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) > { > XlnxXpsEthLite *s = XILINX_ETHLITE(dev); > > - memory_region_init(&s->mmio, OBJECT(dev), > + memory_region_init(&s->container, OBJECT(dev), > "xlnx.xps-ethernetlite", 0x2000); > > object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, > @@ -314,31 +314,31 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) > qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio"); > qdev_prop_set_uint64(DEVICE(&s->mdio), "size", 4 * 4); > sysbus_realize(SYS_BUS_DEVICE(&s->mdio), &error_fatal); > - memory_region_add_subregion(&s->mmio, A_MDIO_BASE, > + memory_region_add_subregion(&s->container, A_MDIO_BASE, > sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0)); > > for (unsigned i = 0; i < 2; i++) { > memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev), > i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf", > 0x07f4, &error_abort); > - memory_region_add_subregion(&s->mmio, 0x0800 * i, &s->port[i].txbuf); > + memory_region_add_subregion(&s->container, 0x0800 * i, &s->port[i].txbuf); > memory_region_init_io(&s->port[i].txio, OBJECT(dev), > ð_porttx_ops, s, > i ? "ethlite.tx[1]io" : "ethlite.tx[0]io", > 4 * TX_MAX); > - memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0, > + memory_region_add_subregion(&s->container, i ? A_TX_BASE1 : A_TX_BASE0, > &s->port[i].txio); > > memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev), > i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf", > 0x07f4, &error_abort); > - memory_region_add_subregion(&s->mmio, 0x1000 + 0x0800 * i, > + memory_region_add_subregion(&s->container, 0x1000 + 0x0800 * i, > &s->port[i].rxbuf); > memory_region_init_io(&s->port[i].rxio, OBJECT(dev), > ð_portrx_ops, s, > i ? "ethlite.rx[1]io" : "ethlite.rx[0]io", > 4 * RX_MAX); > - memory_region_add_subregion(&s->mmio, i ? A_RX_BASE1 : A_RX_BASE0, > + memory_region_add_subregion(&s->container, i ? A_RX_BASE1 : A_RX_BASE0, > &s->port[i].rxio); > } > > @@ -354,7 +354,7 @@ static void xilinx_ethlite_init(Object *obj) > XlnxXpsEthLite *s = XILINX_ETHLITE(obj); > > sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); > - sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); > + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->container); > } > > static Property xilinx_ethlite_properties[] = { > -- > 2.45.2 >
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index da453465ca..c65001cf46 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -93,7 +93,7 @@ struct XlnxXpsEthLite { SysBusDevice parent_obj; - MemoryRegion mmio; + MemoryRegion container; qemu_irq irq; NICState *nic; NICConf conf; @@ -306,7 +306,7 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { XlnxXpsEthLite *s = XILINX_ETHLITE(dev); - memory_region_init(&s->mmio, OBJECT(dev), + memory_region_init(&s->container, OBJECT(dev), "xlnx.xps-ethernetlite", 0x2000); object_initialize_child(OBJECT(dev), "ethlite.mdio", &s->mdio, @@ -314,31 +314,31 @@ static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) qdev_prop_set_string(DEVICE(&s->mdio), "name", "ethlite.mdio"); qdev_prop_set_uint64(DEVICE(&s->mdio), "size", 4 * 4); sysbus_realize(SYS_BUS_DEVICE(&s->mdio), &error_fatal); - memory_region_add_subregion(&s->mmio, A_MDIO_BASE, + memory_region_add_subregion(&s->container, A_MDIO_BASE, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->mdio), 0)); for (unsigned i = 0; i < 2; i++) { memory_region_init_ram(&s->port[i].txbuf, OBJECT(dev), i ? "ethlite.tx[1]buf" : "ethlite.tx[0]buf", 0x07f4, &error_abort); - memory_region_add_subregion(&s->mmio, 0x0800 * i, &s->port[i].txbuf); + memory_region_add_subregion(&s->container, 0x0800 * i, &s->port[i].txbuf); memory_region_init_io(&s->port[i].txio, OBJECT(dev), ð_porttx_ops, s, i ? "ethlite.tx[1]io" : "ethlite.tx[0]io", 4 * TX_MAX); - memory_region_add_subregion(&s->mmio, i ? A_TX_BASE1 : A_TX_BASE0, + memory_region_add_subregion(&s->container, i ? A_TX_BASE1 : A_TX_BASE0, &s->port[i].txio); memory_region_init_ram(&s->port[i].rxbuf, OBJECT(dev), i ? "ethlite.rx[1]buf" : "ethlite.rx[0]buf", 0x07f4, &error_abort); - memory_region_add_subregion(&s->mmio, 0x1000 + 0x0800 * i, + memory_region_add_subregion(&s->container, 0x1000 + 0x0800 * i, &s->port[i].rxbuf); memory_region_init_io(&s->port[i].rxio, OBJECT(dev), ð_portrx_ops, s, i ? "ethlite.rx[1]io" : "ethlite.rx[0]io", 4 * RX_MAX); - memory_region_add_subregion(&s->mmio, i ? A_RX_BASE1 : A_RX_BASE0, + memory_region_add_subregion(&s->container, i ? A_RX_BASE1 : A_RX_BASE0, &s->port[i].rxio); } @@ -354,7 +354,7 @@ static void xilinx_ethlite_init(Object *obj) XlnxXpsEthLite *s = XILINX_ETHLITE(obj); sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); - sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->container); } static Property xilinx_ethlite_properties[] = {
Having all its address range mapped by subregions, s->mmio MemoryRegion effectively became a container. Rename it as 'container' for clarity. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/net/xilinx_ethlite.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)