Received: from eggs.gnu.org ([2001:4830:134:3::10]:53936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aoOaY-0006Wi-PM for qemu-devel@nongnu.org; Fri, 08 Apr 2016 01:04:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aoOaV-0004pW-Jr for qemu-devel@nongnu.org; Fri, 08 Apr 2016 01:04:10 -0400 From: David Gibson Date: Fri, 8 Apr 2016 15:05:18 +1000 Message-Id: <1460091918-8803-2-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1460091918-8803-1-git-send-email-david@gibson.dropbear.id.au> References: <1460091918-8803-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PULL 1/1] spapr: Fix ibm,lrdr-capacity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Bharata B Rao , David Gibson From: Bharata B Rao ibm,lrdr-capacity has a field to describe the maximum address in bytes and therefore, the most memory that can be allocated to this guest. We are using maxmem for this field, but instead should use the actual RAM address corresponding to the end of hotplug region. Signed-off-by: Bharata B Rao Signed-off-by: David Gibson --- hw/ppc/spapr_rtas.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 2db2292..f073258 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -684,6 +684,9 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr, int i; uint32_t lrdr_capacity[5]; MachineState *machine = MACHINE(qdev_get_machine()); + sPAPRMachineState *spapr = SPAPR_MACHINE(machine); + uint64_t max_hotplug_addr = spapr->hotplug_memory.base + + memory_region_size(&spapr->hotplug_memory.mr); ret = fdt_add_mem_rsv(fdt, rtas_addr, rtas_size); if (ret < 0) { @@ -733,8 +736,8 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr, } - lrdr_capacity[0] = cpu_to_be32(((uint64_t)machine->maxram_size) >> 32); - lrdr_capacity[1] = cpu_to_be32(machine->maxram_size & 0xffffffff); + lrdr_capacity[0] = cpu_to_be32(max_hotplug_addr >> 32); + lrdr_capacity[1] = cpu_to_be32(max_hotplug_addr & 0xffffffff); lrdr_capacity[2] = 0; lrdr_capacity[3] = cpu_to_be32(SPAPR_MEMORY_BLOCK_SIZE); lrdr_capacity[4] = cpu_to_be32(max_cpus/smp_threads); -- 2.5.5