From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSHx-0004iQ-9x for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:28:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrSHr-0008AR-7L for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:28:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSHq-00089z-W2 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:28:27 -0400 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:25 +0200 Message-Id: <1401715529-636-30-git-send-email-imammedo@redhat.com> In-Reply-To: <1401715529-636-1-git-send-email-imammedo@redhat.com> References: <1401715529-636-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH v4 29/33] 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: lcapitulino@redhat.com, aliguori@amazon.com, mst@redhat.com 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 --- v2: * fix memory leak, reported by pbonzini * use link to ACPI device instead of looking it up in QOM tree --- hw/i386/pc.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 6b8940a..7c23274 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1553,6 +1553,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); @@ -1595,9 +1596,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); } -- 1.7.1