From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOR7x-0001dB-1E for qemu-devel@nongnu.org; Mon, 01 Sep 2014 08:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOR7j-00057C-7X for qemu-devel@nongnu.org; Mon, 01 Sep 2014 08:54:32 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:35060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOR7i-00056s-TW for qemu-devel@nongnu.org; Mon, 01 Sep 2014 08:54:19 -0400 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Sep 2014 13:54:18 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 78A622190023 for ; Mon, 1 Sep 2014 13:53:55 +0100 (BST) Received: from d06av03.portsmouth.uk.ibm.com (d06av03.portsmouth.uk.ibm.com [9.149.37.213]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s81CsEPi46006372 for ; Mon, 1 Sep 2014 12:54:14 GMT Received: from d06av03.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av03.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s81CsB5a024260 for ; Mon, 1 Sep 2014 06:54:13 -0600 From: Christian Borntraeger Date: Mon, 1 Sep 2014 14:54:23 +0200 Message-Id: <1409576070-55803-13-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1409576070-55803-1-git-send-email-borntraeger@de.ibm.com> References: <1409576070-55803-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PULL 12/19] sclp-s390: Add device to manage s390 memory hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Matthew Rosato , qemu-devel , Alexander Graf , Christian Borntraeger , Jens Freimann , Anthony Liguori , Cornelia Huck , Richard Henderson From: Matthew Rosato Add sclpMemoryHotplugDev to contain associated data structures, etc. Signed-off-by: Matthew Rosato Signed-off-by: Christian Borntraeger --- hw/s390x/sclp.c | 30 ++++++++++++++++++++++++++++++ include/hw/s390x/sclp.h | 20 ++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index d8ddf35..769d7c3 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -183,3 +183,33 @@ void s390_sclp_init(void) OBJECT(dev), NULL); qdev_init_nofail(dev); } + +sclpMemoryHotplugDev *init_sclp_memory_hotplug_dev(void) +{ + DeviceState *dev; + dev = qdev_create(NULL, TYPE_SCLP_MEMORY_HOTPLUG_DEV); + object_property_add_child(qdev_get_machine(), + TYPE_SCLP_MEMORY_HOTPLUG_DEV, + OBJECT(dev), NULL); + qdev_init_nofail(dev); + return SCLP_MEMORY_HOTPLUG_DEV(object_resolve_path( + TYPE_SCLP_MEMORY_HOTPLUG_DEV, NULL)); +} + +sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void) +{ + return SCLP_MEMORY_HOTPLUG_DEV(object_resolve_path( + TYPE_SCLP_MEMORY_HOTPLUG_DEV, NULL)); +} + +static TypeInfo sclp_memory_hotplug_dev_info = { + .name = TYPE_SCLP_MEMORY_HOTPLUG_DEV, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(sclpMemoryHotplugDev), +}; + +static void register_types(void) +{ + type_register_static(&sclp_memory_hotplug_dev_info); +} +type_init(register_types); diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index 7ef1622..5c43574 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -37,6 +37,7 @@ #define SCLP_STARTING_SUBINCREMENT_ID 0x10001 #define SCLP_INCREMENT_UNIT 0x10000 #define MAX_AVAIL_SLOTS 32 +#define MAX_STORAGE_INCREMENTS 1020 /* CPU hotplug SCLP codes */ #define SCLP_HAS_CPU_INFO 0x0C00000000000000ULL @@ -156,6 +157,23 @@ typedef struct SCCB { char data[SCCB_DATA_LEN]; } QEMU_PACKED SCCB; +typedef struct sclpMemoryHotplugDev sclpMemoryHotplugDev; + +#define TYPE_SCLP_MEMORY_HOTPLUG_DEV "sclp-memory-hotplug-dev" +#define SCLP_MEMORY_HOTPLUG_DEV(obj) \ + OBJECT_CHECK(sclpMemoryHotplugDev, (obj), TYPE_SCLP_MEMORY_HOTPLUG_DEV) + +struct sclpMemoryHotplugDev { + SysBusDevice parent; + ram_addr_t standby_mem_size; + ram_addr_t padded_ram_size; + ram_addr_t pad_size; + ram_addr_t standby_subregion_size; + ram_addr_t rzm; + int increment_size; + char *standby_state_map; +}; + static inline int sccb_data_len(SCCB *sccb) { return be16_to_cpu(sccb->h.length) - sizeof(sccb->h); @@ -163,6 +181,8 @@ static inline int sccb_data_len(SCCB *sccb) void s390_sclp_init(void); +sclpMemoryHotplugDev *init_sclp_memory_hotplug_dev(void); +sclpMemoryHotplugDev *get_sclp_memory_hotplug_dev(void); void sclp_service_interrupt(uint32_t sccb); void raise_irq_cpu_hotplug(void); -- 1.8.4.2