[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/21] hw: Drop QOM ownership on memory_region_allocate_syste
From: |
Artyom Tarasenko |
Subject: |
Re: [PATCH 07/21] hw: Drop QOM ownership on memory_region_allocate_system_memory() calls |
Date: |
Tue, 22 Oct 2019 11:47:24 +0200 |
On Tue, Oct 22, 2019 at 1:23 AM Alistair Francis <address@hidden> wrote:
>
> On Sun, Oct 20, 2019 at 4:10 PM Philippe Mathieu-Daudé
> <address@hidden> wrote:
> >
> > All the memory_region_allocate_system_memory() calls are in the
> > board_init() code. From the 58 calls in the repository, only
> > 4 set the 'owner' parameter. It is obvious we want the Machine
> > to be the owner of the RAM, so we want to use OBJECT(machine)
> > as owner. We can simplify a bit by passing MachineState to
> > memory_region_allocate_system_memory(). In preparation of this
> > refactor, first drop the 'owner' argument from these 4 uses.
> >
> > $ git grep memory_region_allocate_system_memory hw/ | wc -l
> > 58
> >
> > Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
>
> Reviewed-by: Alistair Francis <address@hidden>
Reviewed-by: Artyom Tarasenko <address@hidden>
>
> Alistair
>
> > ---
> > hw/alpha/typhoon.c | 2 +-
> > hw/arm/raspi.c | 2 +-
> > hw/hppa/machine.c | 2 +-
> > hw/sparc/sun4m.c | 2 +-
> > 4 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
> > index 179e1f7658..8489ec335c 100644
> > --- a/hw/alpha/typhoon.c
> > +++ b/hw/alpha/typhoon.c
> > @@ -851,7 +851,7 @@ PCIBus *typhoon_init(ram_addr_t ram_size, ISABus
> > **isa_bus,
> >
> > /* Main memory region, 0x00.0000.0000. Real hardware supports 32GB,
> > but the address space hole reserved at this point is 8TB. */
> > - memory_region_allocate_system_memory(&s->ram_region, OBJECT(s), "ram",
> > + memory_region_allocate_system_memory(&s->ram_region, NULL, "ram",
> > ram_size);
> > memory_region_add_subregion(addr_space, 0, &s->ram_region);
> >
> > diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> > index 615d755879..f76b6eaad3 100644
> > --- a/hw/arm/raspi.c
> > +++ b/hw/arm/raspi.c
> > @@ -182,7 +182,7 @@ static void raspi_init(MachineState *machine, int
> > version)
> > &error_abort, NULL);
> >
> > /* Allocate and map RAM */
> > - memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram",
> > + memory_region_allocate_system_memory(&s->ram, NULL, "ram",
> > machine->ram_size);
> > /* FIXME: Remove when we have custom CPU address space support */
> > memory_region_add_subregion_overlap(get_system_memory(), 0, &s->ram,
> > 0);
> > diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> > index 953d454f48..dbe1ff0fe5 100644
> > --- a/hw/hppa/machine.c
> > +++ b/hw/hppa/machine.c
> > @@ -96,7 +96,7 @@ static void machine_hppa_init(MachineState *machine)
> >
> > /* Main memory region. */
> > ram_region = g_new(MemoryRegion, 1);
> > - memory_region_allocate_system_memory(ram_region, OBJECT(machine),
> > + memory_region_allocate_system_memory(ram_region, NULL,
> > "ram", ram_size);
> > memory_region_add_subregion(addr_space, 0, ram_region);
> >
> > diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> > index 6c5a17a020..0bb7524655 100644
> > --- a/hw/sparc/sun4m.c
> > +++ b/hw/sparc/sun4m.c
> > @@ -788,7 +788,7 @@ static void ram_realize(DeviceState *dev, Error **errp)
> > RamDevice *d = SUN4M_RAM(dev);
> > SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> >
> > - memory_region_allocate_system_memory(&d->ram, OBJECT(d), "sun4m.ram",
> > + memory_region_allocate_system_memory(&d->ram, NULL, "sun4m.ram",
> > d->size);
> > sysbus_init_mmio(sbd, &d->ram);
> > }
> > --
> > 2.21.0
> >
> >
--
Regards,
Artyom Tarasenko
SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
- [PATCH 04/21] hw/arm/omap2: Create the RAM in the board, (continued)
- [PATCH 04/21] hw/arm/omap2: Create the RAM in the board, Philippe Mathieu-Daudé, 2019/10/20
- [PATCH 05/21] hw/arm/omap1: Create the RAM in the board, Philippe Mathieu-Daudé, 2019/10/20
- [PATCH 06/21] hw/arm/digic4: Inline digic4_board_setup_ram() function, Philippe Mathieu-Daudé, 2019/10/20
- [PATCH 07/21] hw: Drop QOM ownership on memory_region_allocate_system_memory() calls, Philippe Mathieu-Daudé, 2019/10/20
- [PATCH 08/21] hw/alpha/dp264: Create the RAM in the board, Philippe Mathieu-Daudé, 2019/10/20
- [PATCH 09/21] hw: Let memory_region_allocate_system_memory take MachineState argument, Philippe Mathieu-Daudé, 2019/10/20
- [PATCH 10/21] hw/core: Let the machine be the owner of the system memory, Philippe Mathieu-Daudé, 2019/10/20