From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxKI-0004Uu-GA for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:37:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwxKC-0003UE-5P for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:37:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxKB-0003Th-Tq for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:37:36 -0400 Date: Tue, 17 Jun 2014 20:37:59 +0300 From: "Michael S. Tsirkin" Message-ID: <1403021756-15960-30-git-send-email-mst@redhat.com> References: <1403021756-15960-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403021756-15960-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 029/103] 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 , 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 538a8db..ffecb33 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); } -- MST