qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@linux.vnet.ibm.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH v3] spapr: make sure RMA is in first mode of first memory node
Date: Thu, 7 Nov 2013 09:33:50 +0100	[thread overview]
Message-ID: <20131107093350.16f457ba@oc7435384737.ibm.com> (raw)
In-Reply-To: <1383796200-13276-1-git-send-email-aik@ozlabs.ru>

On Thu,  7 Nov 2013 14:50:00 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> The SPAPR specification says that the RMA starts at the LPAR's logical
> address 0 and is the first logical memory block reported in
> the LPAR’s device tree.
> 
> So SLOF only maps the first block and that block needs to span
> the full RMA.
> 
> This makes sure that the RMA area is where SLOF expects it.
> 
> Cc: Thomas Huth <thuth@linux.vnet.ibm.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v3:
> * removed unnecessary RMA fixup from spapr_populate_memory()
> 
> v2:
> * changed as recommended by Alex Graf
> ---
>  hw/ppc/spapr.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 7e53a5f..1f320f6 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -532,9 +532,6 @@ static int spapr_populate_memory(sPAPREnvironment *spapr, void *fdt)
> 
>      /* memory node(s) */
>      node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;
> -    if (spapr->rma_size > node0_size) {
> -        spapr->rma_size = node0_size;
> -    }
> 
>      /* RMA */
>      mem_reg_property[0] = 0;
> @@ -1113,6 +1110,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
>      MemoryRegion *sysmem = get_system_memory();
>      MemoryRegion *ram = g_new(MemoryRegion, 1);
>      hwaddr rma_alloc_size;
> +    hwaddr node0_size = (nb_numa_nodes > 1) ? node_mem[0] : ram_size;
>      uint32_t initrd_base = 0;
>      long kernel_size = 0, initrd_size = 0;
>      long load_limit, rtas_limit, fw_size;
> @@ -1137,7 +1135,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
>      if (rma_alloc_size && (rma_alloc_size < ram_size)) {

Uh, sorry for not seeing this earlier, ... but should that be
"rma_alloc_size < node0_size" instead of "rma_alloc_size < ram_size"?
For example, if rma_alloc_size = 256 MB, ram_size = 512 MB but
node0_size = 128 MB, this will set rma_size to 256 MB ...

>          spapr->rma_size = rma_alloc_size;
>      } else {
> -        spapr->rma_size = ram_size;
> +        spapr->rma_size = node0_size;
> 
>          /* With KVM, we don't actually know whether KVM supports an
>           * unbounded RMA (PR KVM) or is limited by the hash table size
> @@ -1154,6 +1152,12 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
>          }
>      }
> 
> +    if (spapr->rma_size > node0_size) {
> +        fprintf(stderr, "Error: Numa node 0 has to span the RMA (%#08"HWADDR_PRIx")\n",
> +                spapr->rma_size);
> +        exit(1);
> +    }

... so in the above example you would get the error + exit here.
Or did I miss something?

 Thomas

  reply	other threads:[~2013-11-07  8:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-07  3:50 [Qemu-devel] [PATCH v3] spapr: make sure RMA is in first mode of first memory node Alexey Kardashevskiy
2013-11-07  8:33 ` Thomas Huth [this message]
2013-11-07 10:11   ` Alexander Graf

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=20131107093350.16f457ba@oc7435384737.ibm.com \
    --to=thuth@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).