diff mbox

[for-2.3] sparc: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory

Message ID CAL5wTH7o8uA59Ep0n41i0M19VFWa73n9m172j2W3fjz6=PSVBA@mail.gmail.com
State New
Headers show

Commit Message

Dirk Müller March 24, 2015, 9:30 p.m. UTC
Commit 0b183fc871:"memory: move mem_path handling to
memory_region_allocate_system_memory" split memory_region_init_ram and
memory_region_init_ram_from_file. Also it moved mem-path handling a step
up from memory_region_init_ram to memory_region_allocate_system_memory.

Therefore for any board that uses memory_region_init_ram directly,
-mem-path is not supported.

Fix this by replacing memory_region_init_ram with
memory_region_allocate_system_memory.

Signed-off-by: Dirk Mueller <dmueller@suse.com>
---
 hw/sparc/leon3.c | 3 +--
 hw/sparc/sun4m.c | 5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Andreas Färber March 24, 2015, 11:08 p.m. UTC | #1
Am 24.03.2015 um 22:30 schrieb Dirk Müller:
> Commit 0b183fc871:"memory: move mem_path handling to
> memory_region_allocate_system_memory" split memory_region_init_ram and
> memory_region_init_ram_from_file. Also it moved mem-path handling a step
> up from memory_region_init_ram to memory_region_allocate_system_memory.
> 
> Therefore for any board that uses memory_region_init_ram directly,
> -mem-path is not supported.
> 
> Fix this by replacing memory_region_init_ram with
> memory_region_allocate_system_memory.
> 
> Signed-off-by: Dirk Mueller <dmueller@suse.com>
> ---
>  hw/sparc/leon3.c | 3 +--
>  hw/sparc/sun4m.c | 5 ++---
>  2 files changed, 3 insertions(+), 5 deletions(-)

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas
Paolo Bonzini March 25, 2015, 1:36 p.m. UTC | #2
On 24/03/2015 22:30, Dirk Müller wrote:
> Commit 0b183fc871:"memory: move mem_path handling to
> memory_region_allocate_system_memory" split memory_region_init_ram and
> memory_region_init_ram_from_file. Also it moved mem-path handling a step
> up from memory_region_init_ram to memory_region_allocate_system_memory.
> 
> Therefore for any board that uses memory_region_init_ram directly,
> -mem-path is not supported.
> 
> Fix this by replacing memory_region_init_ram with
> memory_region_allocate_system_memory.
> 
> Signed-off-by: Dirk Mueller <dmueller@suse.com>
> ---
>  hw/sparc/leon3.c | 3 +--
>  hw/sparc/sun4m.c | 5 ++---
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
> index e41ec0b..7f5dcd6 100644
> --- a/hw/sparc/leon3.c
> +++ b/hw/sparc/leon3.c
> @@ -151,8 +151,7 @@ static void leon3_generic_hw_init(MachineState *machine)
>          exit(1);
>      }
> 
> -    memory_region_init_ram(ram, NULL, "leon3.ram", ram_size, &error_abort);
> -    vmstate_register_ram_global(ram);
> +    memory_region_allocate_system_memory(ram, NULL, "leon3.ram", ram_size);
>      memory_region_add_subregion(address_space_mem, 0x40000000, ram);
> 
>      /* Allocate BIOS */
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index b879aa9..7761321 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -805,9 +805,8 @@ static int ram_init1(SysBusDevice *dev)
>  {
>      RamDevice *d = SUN4M_RAM(dev);
> 
> -    memory_region_init_ram(&d->ram, OBJECT(d), "sun4m.ram", d->size,
> -                           &error_abort);
> -    vmstate_register_ram_global(&d->ram);
> +    memory_region_allocate_system_memory(&d->ram, OBJECT(d), "sun4m.ram",
> +                                         d->size);
>      sysbus_init_mmio(dev, &d->ram);
>      return 0;
>  }
> 

Applied, thanks.

Paolo
diff mbox

Patch

diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c
index e41ec0b..7f5dcd6 100644
--- a/hw/sparc/leon3.c
+++ b/hw/sparc/leon3.c
@@ -151,8 +151,7 @@  static void leon3_generic_hw_init(MachineState *machine)
         exit(1);
     }

-    memory_region_init_ram(ram, NULL, "leon3.ram", ram_size, &error_abort);
-    vmstate_register_ram_global(ram);
+    memory_region_allocate_system_memory(ram, NULL, "leon3.ram", ram_size);
     memory_region_add_subregion(address_space_mem, 0x40000000, ram);

     /* Allocate BIOS */
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index b879aa9..7761321 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -805,9 +805,8 @@  static int ram_init1(SysBusDevice *dev)
 {
     RamDevice *d = SUN4M_RAM(dev);

-    memory_region_init_ram(&d->ram, OBJECT(d), "sun4m.ram", d->size,
-                           &error_abort);
-    vmstate_register_ram_global(&d->ram);
+    memory_region_allocate_system_memory(&d->ram, OBJECT(d), "sun4m.ram",
+                                         d->size);
     sysbus_init_mmio(dev, &d->ram);
     return 0;
 }