qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com,
	nfont@linux.vnet.ibm.com, aik@au1.ibm.com, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [RFC PATCH v1 2/3] spapr: Remove alignment gap b/n RAM and hotplug regions
Date: Fri, 3 Jun 2016 17:09:08 +1000	[thread overview]
Message-ID: <20160603070908.GR1087@voom.fritz.box> (raw)
In-Reply-To: <201606030550.u535jnsX039604@mx0a-001b2d01.pphosted.com>

[-- Attachment #1: Type: text/plain, Size: 3460 bytes --]

On Fri, Jun 03, 2016 at 11:19:43AM +0530, Bharata B Rao wrote:
> Let the alignment b/n RAM and memory hotplug region be equal to
> LMB size (256MB) so that there is no gap b/n RAM and hotplug region.
> This new alignment is true for only pseries-2.7 onwards and the older
> machine types continue to have the earlier 1GB alignment.
> 
> Suggested-by: David Gibson <david@gibson.dropbear.id.au>
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>

Code looks fine, but the commit message needs to explain the rationale
for this (IIUC it's essentially due to a guest bug processing the dt
information describing the gap).

> ---
>  hw/ppc/spapr.c         | 11 ++++++++++-
>  include/hw/ppc/spapr.h |  5 ++---
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 30b9731..623c35f 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1825,7 +1825,7 @@ static void ppc_spapr_init(MachineState *machine)
>          }
>  
>          spapr->hotplug_memory.base = ROUND_UP(machine->ram_size,
> -                                              SPAPR_HOTPLUG_MEM_ALIGN);
> +                                              smc->hotplug_alignment);
>          memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr),
>                             "hotplug-memory", hotplug_mem_size);
>          memory_region_add_subregion(sysmem, spapr->hotplug_memory.base,
> @@ -2294,6 +2294,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
>      mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id;
>  
>      smc->dr_lmb_enabled = true;
> +    smc->hotplug_alignment = SPAPR_MEMORY_BLOCK_SIZE;
>      fwc->get_dev_path = spapr_get_fw_dev_path;
>      nc->nmi_monitor_handler = spapr_nmi;
>  }
> @@ -2369,8 +2370,16 @@ static void spapr_machine_2_6_instance_options(MachineState *machine)
>  
>  static void spapr_machine_2_6_class_options(MachineClass *mc)
>  {
> +    sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
> +
>      spapr_machine_2_7_class_options(mc);
>      SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_6);
> +
> +    /*
> +     * 2.6 and older types supported 1GB alignment gap b/n RAM
> +     * and hotplug memory region.
> +     */
> +    smc->hotplug_alignment = G_BYTE;
>  }
>  
>  DEFINE_SPAPR_MACHINE(2_6, "2.6", false);
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 971df3d..b2aeb15 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -37,6 +37,8 @@ struct sPAPRMachineClass {
>      /*< public >*/
>      bool dr_lmb_enabled;       /* enable dynamic-reconfig/hotplug of LMBs */
>      bool use_ohci_by_default;  /* use USB-OHCI instead of XHCI */
> +    hwaddr hotplug_alignment;  /* controls the alignment b/n RAM and hotplug
> +                                  regions */
>  };
>  
>  /**
> @@ -610,9 +612,6 @@ int spapr_rng_populate_dt(void *fdt);
>   */
>  #define SPAPR_MAX_RAM_SLOTS     32
>  
> -/* 1GB alignment for hotplug memory region */
> -#define SPAPR_HOTPLUG_MEM_ALIGN (1ULL << 30)
> -
>  /*
>   * Number of 32 bit words in each LMB list entry in ibm,dynamic-memory
>   * property under ibm,dynamic-reconfiguration-memory node.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-06-03  7:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1464932984-26623-1-git-send-email-bharata@linux.vnet.ibm.com>
2016-06-03  5:49 ` [Qemu-devel] [RFC PATCH v1 1/3] spapr: Introduce pseries-2.7 machine type Bharata B Rao
2016-06-03  5:49 ` [Qemu-devel] [RFC PATCH v1 2/3] spapr: Remove alignment gap b/n RAM and hotplug regions Bharata B Rao
2016-06-03  5:49 ` [Qemu-devel] [RFC PATCH v1 3/3] spapr: spapr: Work around the memory hotplug failure with DDW Bharata B Rao
     [not found] ` <201606030550.u535joke039889@mx0a-001b2d01.pphosted.com>
2016-06-03  6:59   ` [Qemu-devel] [RFC PATCH v1 1/3] spapr: Introduce pseries-2.7 machine type David Gibson
     [not found] ` <201606030550.u535jnsX039604@mx0a-001b2d01.pphosted.com>
2016-06-03  7:09   ` David Gibson [this message]
     [not found] ` <201606030550.u535jnDh039622@mx0a-001b2d01.pphosted.com>
2016-06-03  7:10   ` [Qemu-devel] [RFC PATCH v1 3/3] spapr: spapr: Work around the memory hotplug failure with DDW David Gibson
2016-06-06  3:48     ` Bharata B Rao

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=20160603070908.GR1087@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@au1.ibm.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=nfont@linux.vnet.ibm.com \
    --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).