From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1fNj-0006Cv-Dl for qemu-devel@nongnu.org; Tue, 23 Jul 2013 12:24:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1fNh-00073a-KL for qemu-devel@nongnu.org; Tue, 23 Jul 2013 12:24:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1fNh-00073H-92 for qemu-devel@nongnu.org; Tue, 23 Jul 2013 12:24:09 -0400 From: Igor Mammedov Date: Tue, 23 Jul 2013 18:23:04 +0200 Message-Id: <1374596592-7027-9-git-send-email-imammedo@redhat.com> In-Reply-To: <1374596592-7027-1-git-send-email-imammedo@redhat.com> References: <1374596592-7027-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 08/16] pc: piix: make hotplug memory gap in high memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: vasilis.liaskovitis@profitbricks.com, hutao@cn.fujitsu.com, pbonzini@redhat.com reserves memory region above 4Gb ram region and upto maxmem before 64-bit PCI hole. Signed-off-by: Igor Mammedov --- hw/i386/pc.c | 10 +++++++++- include/hw/i386/pc.h | 1 + 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6e2c4d9..d3ccc79 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1054,8 +1054,12 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, { PcGuestInfoState *guest_info_state = g_malloc0(sizeof *guest_info_state); PcGuestInfo *guest_info = &guest_info_state->info; + QemuOpts *opts = qemu_opts_find(qemu_find_opts("memory-opts"), NULL); + ram_addr_t maxmem = (opts ? qemu_opt_get_size(opts, "maxmem", ram_size) : + ram_size); guest_info->ram_size = below_4g_mem_size + above_4g_mem_size; + guest_info->apic_id_limit = pc_apic_id_limit(max_cpus); guest_info->apic_xrupt_override = kvm_allows_irq0_override(); guest_info->numa_nodes = nb_numa_nodes; @@ -1072,6 +1076,10 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, guest_info->pci_info.w64.begin = 0; guest_info->pci_info.w64.end = 0; } else { + guest_info->hotplug_mem_win.begin = ROUND_UP((0x1ULL << 32) + + above_4g_mem_size, 0x1ULL << 30); + guest_info->hotplug_mem_win.end = guest_info->hotplug_mem_win.begin + + (maxmem - guest_info->ram_size); /* * BIOS does not set MTRR entries for the 64 bit window, so no need to * align address to power of two. Align address at 1G, this makes sure @@ -1079,7 +1087,7 @@ PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size, * pages. */ guest_info->pci_info.w64.begin = - ROUND_UP((0x1ULL << 32) + above_4g_mem_size, 0x1ULL << 30); + ROUND_UP(guest_info->hotplug_mem_win.end, 0x1ULL << 30); guest_info->pci_info.w64.end = guest_info->pci_info.w64.begin + (0x1ULL << 31); assert(guest_info->pci_info.w64.begin <= guest_info->pci_info.w64.end); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 7574d92..388d803 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -28,6 +28,7 @@ struct PcGuestInfo { PcPciInfo pci_info; bool has_pci_info; hwaddr ram_size; + Range hotplug_mem_win; unsigned apic_id_limit; bool apic_xrupt_override; bool has_hpet; -- 1.7.1