Message ID | 20200217173452.15243-48-imammedo@redhat.com |
---|---|
State | New |
Headers | show |
Series | refactor main RAM allocation to use hostmem backend | expand |
On 2/17/20 9:34 AM, Igor Mammedov wrote: > Switch to using generic main RAM allocation. To do this set > MachineClass::default_ram_id to m68k_mac.ram and use > MachineState::ram instead of manually initializing > RAM memory region. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > Acked-by: Laurent Vivier <laurent@vivier.eu> > --- Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On 2/17/20 6:34 PM, Igor Mammedov wrote: > Switch to using generic main RAM allocation. To do this set > MachineClass::default_ram_id to m68k_mac.ram and use > MachineState::ram instead of manually initializing > RAM memory region. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> > Acked-by: Laurent Vivier <laurent@vivier.eu> > --- > hw/m68k/q800.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c > index 1e32363688..a4c4bc14cb 100644 > --- a/hw/m68k/q800.c > +++ b/hw/m68k/q800.c > @@ -160,7 +160,6 @@ static void q800_init(MachineState *machine) > ram_addr_t initrd_base; > int32_t initrd_size; > MemoryRegion *rom; > - MemoryRegion *ram; > MemoryRegion *io; > const int io_slice_nb = (IO_SIZE / IO_SLICE) - 1; > int i; > @@ -194,9 +193,7 @@ static void q800_init(MachineState *machine) > qemu_register_reset(main_cpu_reset, cpu); > > /* RAM */ > - ram = g_malloc(sizeof(*ram)); > - memory_region_init_ram(ram, NULL, "m68k_mac.ram", ram_size, &error_abort); > - memory_region_add_subregion(get_system_memory(), 0, ram); > + memory_region_add_subregion(get_system_memory(), 0, machine->ram); > > /* > * Memory from IO_BASE to IO_BASE + IO_SLICE is repeated > @@ -443,6 +440,7 @@ static void q800_machine_class_init(ObjectClass *oc, void *data) > mc->max_cpus = 1; > mc->is_default = 0; > mc->block_default_type = IF_SCSI; > + mc->default_ram_id = "m68k_mac.ram"; > } > > static const TypeInfo q800_machine_typeinfo = { > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 1e32363688..a4c4bc14cb 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -160,7 +160,6 @@ static void q800_init(MachineState *machine) ram_addr_t initrd_base; int32_t initrd_size; MemoryRegion *rom; - MemoryRegion *ram; MemoryRegion *io; const int io_slice_nb = (IO_SIZE / IO_SLICE) - 1; int i; @@ -194,9 +193,7 @@ static void q800_init(MachineState *machine) qemu_register_reset(main_cpu_reset, cpu); /* RAM */ - ram = g_malloc(sizeof(*ram)); - memory_region_init_ram(ram, NULL, "m68k_mac.ram", ram_size, &error_abort); - memory_region_add_subregion(get_system_memory(), 0, ram); + memory_region_add_subregion(get_system_memory(), 0, machine->ram); /* * Memory from IO_BASE to IO_BASE + IO_SLICE is repeated @@ -443,6 +440,7 @@ static void q800_machine_class_init(ObjectClass *oc, void *data) mc->max_cpus = 1; mc->is_default = 0; mc->block_default_type = IF_SCSI; + mc->default_ram_id = "m68k_mac.ram"; } static const TypeInfo q800_machine_typeinfo = {