qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Dirk Müller" <dirk@dmllr.de>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH for-2.3] arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory
Date: Tue, 24 Mar 2015 22:29:15 +0100	[thread overview]
Message-ID: <5511D72B.8080806@redhat.com> (raw)
In-Reply-To: <CAL5wTH73NjUrm=y+JAjJCu33Pkyqohk+0hAKGvyEV7xi9YS3zg@mail.gmail.com>



On 24/03/2015 22:24, Dirk Müller wrote:
> +++ b/hw/arm/exynos4210.c
> @@ -283,16 +283,16 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
>      /* DRAM */
>      mem_size = ram_size;
>      if (mem_size > EXYNOS4210_DRAM_MAX_SIZE) {
> -        memory_region_init_ram(&s->dram1_mem, NULL, "exynos4210.dram1",
> -                mem_size - EXYNOS4210_DRAM_MAX_SIZE, &error_abort);
> -        vmstate_register_ram_global(&s->dram1_mem);
> +        unsigned long dram1_size = mem_size - EXYNOS4210_DRAM_MAX_SIZE;
> +        memory_region_allocate_system_memory(&s->dram1_mem, NULL,
> +                                             "exynos4210.dram1",
> +                                             dram1_size);
>          memory_region_add_subregion(system_mem, EXYNOS4210_DRAM1_BASE_ADDR,
>                  &s->dram1_mem);
>          mem_size = EXYNOS4210_DRAM_MAX_SIZE;
>      }
> -    memory_region_init_ram(&s->dram0_mem, NULL, "exynos4210.dram0", mem_size,
> -                           &error_abort);
> -    vmstate_register_ram_global(&s->dram0_mem);
> +    memory_region_allocate_system_memory(&s->dram0_mem, NULL,
> +                                         "exynos4210.dram0", mem_size);
>      memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
>              &s->dram0_mem);

You cannot call memory_region_allocate_system_memory twice.  For cases
like this one, the right thing to do is to create a region with
memory_region_allocate_system_memory, and then replace
memory_region_init_ram with memory_region_init_alias.  This "slices" the
region created by memory_region_allocate_system_memory.

Paolo

  reply	other threads:[~2015-03-24 21:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 21:24 [Qemu-devel] [PATCH for-2.3] arm: memory: Replace memory_region_init_ram with memory_region_allocate_system_memory Dirk Müller
2015-03-24 21:29 ` Paolo Bonzini [this message]
2015-03-24 22:09   ` Dirk Müller
2015-03-25  0:10 ` Peter Maydell
2015-03-25  0:14   ` Peter Maydell
2015-03-25 11:12     ` Dirk Müller
2015-03-25 10:10   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5511D72B.8080806@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dirk@dmllr.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).