From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWN2q-0006fj-Nw for qemu-devel@nongnu.org; Mon, 31 Aug 2015 07:14:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWN2o-0006Lo-FS for qemu-devel@nongnu.org; Mon, 31 Aug 2015 07:14:36 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:55653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWN2o-0006LN-75 for qemu-devel@nongnu.org; Mon, 31 Aug 2015 07:14:34 -0400 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 31 Aug 2015 12:14:33 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9F57617D8059 for ; Mon, 31 Aug 2015 12:16:12 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7VBESJv21561350 for ; Mon, 31 Aug 2015 11:14:31 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7VBEIZR022393 for ; Mon, 31 Aug 2015 05:14:19 -0600 From: Cornelia Huck Date: Mon, 31 Aug 2015 13:13:57 +0200 Message-Id: <1441019643-10677-18-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1441019643-10677-1-git-send-email-cornelia.huck@de.ibm.com> References: <1441019643-10677-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH 17/23] s390: no need to manually parse for slots and maxmem List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de, David Hildenbrand From: David Hildenbrand ram_slots and maxram_size has already been parsed and verified by common code for us. Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 3 +-- hw/s390x/sclp.c | 11 +++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e2a26e9..d4afe7d 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -109,9 +109,8 @@ static void ccw_init(MachineState *machine) int ret; VirtualCssBus *css_bus; DeviceState *dev; - QemuOpts *opts = qemu_opts_find(qemu_find_opts("memory"), NULL); ram_addr_t pad_size = 0; - ram_addr_t maxmem = qemu_opt_get_size(opts, "maxmem", my_ram_size); + ram_addr_t maxmem = machine->maxram_size; ram_addr_t standby_mem_size = maxmem - my_ram_size; uint64_t kvm_limit; diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 87f4902..3ad5d3a 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -17,7 +17,7 @@ #include "exec/memory.h" #include "sysemu/sysemu.h" #include "exec/address-spaces.h" -#include "qemu/config-file.h" +#include "hw/boards.h" #include "hw/s390x/sclp.h" #include "hw/s390x/event-facility.h" #include "hw/s390x/s390-pci-bus.h" @@ -31,19 +31,14 @@ static inline SCLPDevice *get_sclp_device(void) static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) { ReadInfo *read_info = (ReadInfo *) sccb; + MachineState *machine = MACHINE(qdev_get_machine()); sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev(); CPUState *cpu; int cpu_count = 0; int i = 0; int increment_size = 20; int rnsize, rnmax; - QemuOpts *opts = qemu_opts_find(qemu_find_opts("memory"), NULL); - int slots = qemu_opt_get_number(opts, "slots", 0); - int max_avail_slots = s390_get_memslot_count(kvm_state); - - if (slots > max_avail_slots) { - slots = max_avail_slots; - } + int slots = MIN(machine->ram_slots, s390_get_memslot_count(kvm_state)); CPU_FOREACH(cpu) { cpu_count++; -- 2.5.1