From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxzV-0000OK-Iv for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:18:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZxzU-0004Y0-Pr for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:18:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZxzU-0004Xq-LW for qemu-devel@nongnu.org; Thu, 10 Sep 2015 05:18:00 -0400 Date: Thu, 10 Sep 2015 12:17:57 +0300 From: "Michael S. Tsirkin" Message-ID: <1441876643-7467-6-git-send-email-mst@redhat.com> References: <1441876643-7467-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441876643-7467-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 5/7] pc: memhotplug: fix incorrectly set reserved-memory-end List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Igor Mammedov From: Igor Mammedov reserved-memory-end tells firmware address from which it could start treating memory as PCI address space and map PCI BARs after it to avoid collisions with RAM. Currently it is incorrectly pointing to address where hotplugged memory range starts which could redirect hotplugged RAM accesses to PCI BARs when firmware maps them over RAM or viceverse. Fix this by pointing reserved-memory-end to the end of memory hotplug area. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Eduardo Habkost --- hw/i386/pc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 9f2924e..354e1b3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1412,7 +1412,9 @@ FWCfgState *pc_memory_init(PCMachineState *pcms, if (guest_info->has_reserved_memory && pcms->hotplug_memory.base) { uint64_t *val = g_malloc(sizeof(*val)); - *val = cpu_to_le64(ROUND_UP(pcms->hotplug_memory.base, 0x1ULL << 30)); + uint64_t res_mem_end = pcms->hotplug_memory.base + + memory_region_size(&pcms->hotplug_memory.mr); + *val = cpu_to_le64(ROUND_UP(res_mem_end, 0x1ULL << 30)); fw_cfg_add_file(fw_cfg, "etc/reserved-memory-end", val, sizeof(*val)); } -- MST