From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxKP-0004gA-BN for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:37:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwxKJ-0003Wi-5i for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:37:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxKI-0003W6-T2 for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:37:43 -0400 Date: Tue, 17 Jun 2014 20:38:05 +0300 From: "Michael S. Tsirkin" Message-ID: <1403021756-15960-32-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 031/103] pc: add "hotplug-memory-region-size" property to PC_MACHINE 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 ... it will be used by acpi-build code and by unit tests Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 1 + hw/i386/pc.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6050115..a2bf22c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -35,6 +35,7 @@ struct PCMachineState { }; #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" +#define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size" /** * PCMachineClass: diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ffecb33..8444bf9 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -60,6 +60,7 @@ #include "acpi-build.h" #include "hw/mem/pc-dimm.h" #include "trace.h" +#include "qapi/visitor.h" /* debug PC/ISA interrupts */ //#define DEBUG_IRQ @@ -1633,6 +1634,23 @@ static HotplugHandler *pc_get_hotpug_handler(MachineState *machine, pcmc->get_hotplug_handler(machine, dev) : NULL; } +static void +pc_machine_get_hotplug_memory_region_size(Object *obj, Visitor *v, void *opaque, + const char *name, Error **errp) +{ + PCMachineState *pcms = PC_MACHINE(obj); + int64_t value = memory_region_size(&pcms->hotplug_memory); + + visit_type_int(v, &value, name, errp); +} + +static void pc_machine_initfn(Object *obj) +{ + object_property_add(obj, PC_MACHINE_MEMHP_REGION_SIZE, "int", + pc_machine_get_hotplug_memory_region_size, + NULL, NULL, NULL, NULL); +} + static void pc_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -1649,6 +1667,7 @@ static const TypeInfo pc_machine_info = { .parent = TYPE_MACHINE, .abstract = true, .instance_size = sizeof(PCMachineState), + .instance_init = pc_machine_initfn, .class_size = sizeof(PCMachineClass), .class_init = pc_machine_class_init, .interfaces = (InterfaceInfo[]) { -- MST