From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxIXu-0000Wa-44 for qemu-devel@nongnu.org; Wed, 18 Jun 2014 12:17:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxIXk-0006P9-RC for qemu-devel@nongnu.org; Wed, 18 Jun 2014 12:17:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxIXk-0006Oi-IY for qemu-devel@nongnu.org; Wed, 18 Jun 2014 12:17:00 -0400 Date: Wed, 18 Jun 2014 19:17:23 +0300 From: "Michael S. Tsirkin" Message-ID: <1403108034-32054-30-git-send-email-mst@redhat.com> References: <1403108034-32054-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403108034-32054-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL v2 029/106] pc: propagate memory hotplug event to ACPI device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Peter Crosthwaite , Anthony Liguori , Igor Mammedov From: Igor Mammedov Notify PIIX4_PM/ICH9LPC device about hotplug event, so that it would send SCI to guest notifying about newly added memory. Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c9d888f..0bedd46 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1549,6 +1549,7 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { int slot; + HotplugHandlerClass *hhc; Error *local_err = NULL; PCMachineState *pcms = PC_MACHINE(hotplug_dev); MachineState *machine = MACHINE(hotplug_dev); @@ -1591,9 +1592,18 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev, } trace_mhp_pc_dimm_assigned_slot(slot); + if (!pcms->acpi_dev) { + error_setg(&local_err, + "memory hotplug is not enabled: missing acpi device"); + goto out; + } + memory_region_add_subregion(&pcms->hotplug_memory, addr - pcms->hotplug_memory_base, mr); vmstate_register_ram(mr, dev); + + hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); + hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); out: error_propagate(errp, local_err); } -- MST