From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjNAP-0006cX-Tz for qemu-devel@nongnu.org; Thu, 21 Nov 2013 00:51:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VjNAJ-0004Q5-Uh for qemu-devel@nongnu.org; Thu, 21 Nov 2013 00:51:05 -0500 Received: from [222.73.24.84] (port=22173 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VjNAJ-0004Po-JQ for qemu-devel@nongnu.org; Thu, 21 Nov 2013 00:50:59 -0500 Message-ID: <528D9EC8.5090307@cn.fujitsu.com> Date: Thu, 21 Nov 2013 13:48:56 +0800 From: Li Guang MIME-Version: 1.0 References: <1385001528-12003-1-git-send-email-imammedo@redhat.com> <1385001528-12003-22-git-send-email-imammedo@redhat.com> In-Reply-To: <1385001528-12003-22-git-send-email-imammedo@redhat.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed Subject: Re: [Qemu-devel] [PATCH 21/27] pc: add memory hotplug 440fx machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: peter.maydell@linaro.org, aliguori@amazon.com, stefanb@linux.vnet.ibm.com, armbru@redhat.com, mst@redhat.com, mjt@tls.msk.ru, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, vasilis.liaskovitis@profitbricks.com, quintela@redhat.com, kraxel@redhat.com, stefanha@redhat.com, hutao@cn.fujitsu.com, pbonzini@redhat.com, marcel.a@redhat.com, lcapitulino@redhat.com, chegu_vinod@hp.com, afaerber@suse.de Hi, Igor Igor Mammedov wrote: > Add DimmBus for memory hotplug below 4Gb or above 4Gb depending > on initial memory size and hotplug memory size. > ... > +static > +void pc_hotplug_memory_init_impl(Object *owner, > + MemoryRegion *system_memory, > + ram_addr_t low_hotplug_mem_start, > + ram_addr_t low_hotplug_mem_end, > + DimmBus *hotplug_mem_bus, > + ram_addr_t *high_mem_end) > +{ > + QemuOpts *opts = qemu_opts_find(qemu_find_opts("memory-opts"), NULL); > + ram_addr_t ram_size = qemu_opt_get_size(opts, "mem", 0); > + ram_addr_t maxmem = qemu_opt_get_size(opts, "maxmem", 0); > + ram_addr_t hotplug_mem_size; > + > + if (maxmem<= ram_size) { > + /* Disable ACPI migration code and creation of memory devices in SSDT */ > Why not give the memory that not be hot-added a chance to be placed on one memory slot? if all memory can be hot-added and hot-removed, then we can bring in more flexibility for memory hotplug feature. Thanks! > + qemu_opt_set_number(opts, "slots", 0); > + return; > + } > + > + hotplug_mem_size = maxmem - ram_size; > + if (hotplug_mem_size<= (low_hotplug_mem_end - low_hotplug_mem_start)) { > + hotplug_mem_bus->base = low_hotplug_mem_start; > + } else { > + hotplug_mem_bus->base = ROUND_UP(*high_mem_end, 1ULL<< 30); > + *high_mem_end = hotplug_mem_bus->base + hotplug_mem_size; > + } > + > ...