From: David Gibson <david@gibson.dropbear.id.au>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, agraf@suse.de,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com,
imammedo@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH v4 1/5] spapr: Initialize hotplug memory address space
Date: Tue, 23 Jun 2015 11:33:58 +1000 [thread overview]
Message-ID: <20150623013358.GW13352@voom.redhat.com> (raw)
In-Reply-To: <1434709077-17491-2-git-send-email-bharata@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 4246 bytes --]
On Fri, Jun 19, 2015 at 03:47:53PM +0530, Bharata B Rao wrote:
> Initialize a hotplug memory region under which all the hotplugged
> memory is accommodated. Also enable memory hotplug by setting
> CONFIG_MEM_HOTPLUG.
>
> Modelled on i386 memory hotplug.
>
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> ---
> default-configs/ppc64-softmmu.mak | 1 +
> hw/ppc/spapr.c | 28 ++++++++++++++++++++++++++++
> include/hw/ppc/spapr.h | 12 ++++++++++++
> 3 files changed, 41 insertions(+)
>
> diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
> index ab62cc7..e77cb1a 100644
> --- a/default-configs/ppc64-softmmu.mak
> +++ b/default-configs/ppc64-softmmu.mak
> @@ -52,3 +52,4 @@ CONFIG_XICS_KVM=$(and $(CONFIG_PSERIES),$(CONFIG_KVM))
> # For PReP
> CONFIG_MC146818RTC=y
> CONFIG_ISA_TESTDEV=y
> +CONFIG_MEM_HOTPLUG=y
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 5ca817c..87a29dc 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -1549,6 +1549,34 @@ static void ppc_spapr_init(MachineState *machine)
> memory_region_add_subregion(sysmem, 0, rma_region);
> }
>
> + /* initialize hotplug memory address space */
> + if (machine->ram_size < machine->maxram_size) {
> + ram_addr_t hotplug_mem_size = machine->maxram_size - machine->ram_size;
> +
> + if (machine->ram_slots > SPAPR_MAX_RAM_SLOTS) {
> + error_report("unsupported amount of memory slots: %"PRIu64,
> + machine->ram_slots);
> + exit(EXIT_FAILURE);
> + }
> +
> + spapr->hotplug_memory.base = ROUND_UP(machine->ram_size,
> + SPAPR_HOTPLUG_MEM_ALIGN);
> +
> + hotplug_mem_size += SPAPR_HOTPLUG_MEM_ALIGN * machine->ram_slots;
I'm not sure what this adjustment is about. Are you putting a gap of
size SPAPR_HOTPLUG_MEM_ALIGN between each memory slot? That doesn't
see to match the DRC initialization code in the next patch which
assigns all the LMBs in the hotplug area contiguous addresses.
> + if ((spapr->hotplug_memory.base + hotplug_mem_size) <
> + hotplug_mem_size) {
> + error_report("unsupported amount of maximum memory: " RAM_ADDR_FMT,
> + machine->maxram_size);
> + exit(EXIT_FAILURE);
> + }
> +
> + memory_region_init(&spapr->hotplug_memory.mr, OBJECT(spapr),
> + "hotplug-memory", hotplug_mem_size);
> + memory_region_add_subregion(sysmem, spapr->hotplug_memory.base,
> + &spapr->hotplug_memory.mr);
> + }
> +
> filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "spapr-rtas.bin");
> if (!filename) {
> error_report("Could not find LPAR rtas '%s'", "spapr-rtas.bin");
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 91a61ab..8a1929b 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -5,6 +5,7 @@
> #include "hw/boards.h"
> #include "hw/ppc/xics.h"
> #include "hw/ppc/spapr_drc.h"
> +#include "hw/mem/pc-dimm.h"
>
> struct VIOsPAPRBus;
> struct sPAPRPHBState;
> @@ -76,6 +77,7 @@ struct sPAPRMachineState {
>
> /*< public >*/
> char *kvm_type;
> + MemoryHotplugState hotplug_memory;
> };
>
> #define H_SUCCESS 0
> @@ -609,4 +611,14 @@ int spapr_rtc_import_offset(DeviceState *dev, int64_t legacy_offset);
>
> #define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */
>
> +/*
> + * This defines the maximum number of DIMM slots we can have for sPAPR
> + * guest. This is not defined by sPAPR but we are defining it to 32 slots
> + * based on default number of slots provided by PowerPC kernel.
> + */
> +#define SPAPR_MAX_RAM_SLOTS 32
> +
> +/* 1GB alignment for hotplug memory region */
> +#define SPAPR_HOTPLUG_MEM_ALIGN (1ULL << 30)
> +
> #endif /* !defined (__HW_SPAPR_H__) */
--
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: Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-06-23 3:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-19 10:17 [Qemu-devel] [RFC PATCH v4 0/5] Memory hotplug for PowerPC sPAPR guests Bharata B Rao
2015-06-19 10:17 ` [Qemu-devel] [RFC PATCH v4 1/5] spapr: Initialize hotplug memory address space Bharata B Rao
2015-06-23 1:33 ` David Gibson [this message]
2015-06-24 2:14 ` Bharata B Rao
2015-06-19 10:17 ` [Qemu-devel] [RFC PATCH v4 2/5] spapr: Add LMB DR connectors Bharata B Rao
2015-06-23 1:32 ` David Gibson
2015-06-24 2:19 ` Bharata B Rao
2015-06-24 3:24 ` Bharata B Rao
2015-06-24 5:51 ` David Gibson
2015-06-25 12:56 ` Michael Roth
2015-06-19 10:17 ` [Qemu-devel] [RFC PATCH v4 3/5] spapr: Support ibm, dynamic-reconfiguration-memory Bharata B Rao
2015-06-23 1:54 ` David Gibson
2015-06-24 2:25 ` Bharata B Rao
2015-06-24 5:55 ` David Gibson
2015-06-25 6:17 ` Bharata B Rao
2015-06-19 10:17 ` [Qemu-devel] [RFC PATCH v4 4/5] spapr: Make hash table size a factor of maxram_size Bharata B Rao
2015-06-23 2:08 ` David Gibson
2015-06-19 10:17 ` [Qemu-devel] [RFC PATCH v4 5/5] spapr: Memory hotplug support Bharata B Rao
2015-06-23 2:29 ` David Gibson
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=20150623013358.GW13352@voom.redhat.com \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=bharata@linux.vnet.ibm.com \
--cc=imammedo@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=nfont@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=tyreld@linux.vnet.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.