Received: from eggs.gnu.org ([2001:4830:134:3::10]:52138) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYxj6-00069H-Tw for qemu-devel@nongnu.org; Mon, 07 Sep 2015 10:49:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYxj5-0002GX-T3 for qemu-devel@nongnu.org; Mon, 07 Sep 2015 10:48:56 -0400 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:45488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYxj5-0002Fy-E9 for qemu-devel@nongnu.org; Mon, 07 Sep 2015 10:48:55 -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, 7 Sep 2015 15:48:54 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 20F432190066 for ; Mon, 7 Sep 2015 15:48:23 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t87EmoO132571564 for ; Mon, 7 Sep 2015 14:48:51 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t87Emnea030815 for ; Mon, 7 Sep 2015 08:48:50 -0600 From: Cornelia Huck Date: Mon, 7 Sep 2015 16:48:36 +0200 Message-Id: <1441637317-14471-23-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1441637317-14471-1-git-send-email-cornelia.huck@de.ibm.com> References: <1441637317-14471-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PULL 22/23] s390/sclp: store the increment_size in the sclp device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, agraf@suse.de, David Hildenbrand , jfrei@linux.vnet.ibm.com, Cornelia Huck From: David Hildenbrand Let's calculate it once and reuse it. Suggested-by: Matthew Rosato Reviewed-by: Matthew Rosato Signed-off-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 20 +++----------------- include/hw/s390x/sclp.h | 1 + 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index ac582e8..0a7f4dd 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -36,7 +36,6 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) CPUState *cpu; int cpu_count = 0; int i = 0; - int increment_size = 20; int rnsize, rnmax; int slots = MIN(machine->ram_slots, s390_get_memslot_count(kvm_state)); @@ -57,23 +56,9 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO | SCLP_HAS_PCI_RECONFIG); - /* - * The storage increment size is a multiple of 1M and is a power of 2. - * The number of storage increments must be MAX_STORAGE_INCREMENTS or fewer. - */ - while ((ram_size >> increment_size) > MAX_STORAGE_INCREMENTS) { - increment_size++; - } - rnmax = ram_size >> increment_size; - + rnmax = ram_size >> sclp->increment_size; /* Memory Hotplug is only supported for the ccw machine type */ if (mhd) { - while ((mhd->standby_mem_size >> increment_size) > - MAX_STORAGE_INCREMENTS) { - increment_size++; - } - assert(increment_size == mhd->increment_size); - mhd->standby_subregion_size = MEM_SECTION_SIZE; /* Deduct the memory slot already used for core */ if (slots > 0) { @@ -105,7 +90,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) read_info->facilities |= cpu_to_be64(SCLP_FC_ASSIGN_ATTACH_READ_STOR); } - rnsize = 1 << (increment_size - 20); + rnsize = 1 << (sclp->increment_size - 20); if (rnsize <= 128) { read_info->rnsize = rnsize; } else { @@ -518,6 +503,7 @@ static void sclp_memory_init(SCLPDevice *sclp) increment_size++; } } + sclp->increment_size = increment_size; /* The core and standby memory areas need to be aligned with * the increment size. In effect, this can cause the diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index 50094eb..b0c71b5 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -174,6 +174,7 @@ typedef struct SCLPDevice { /* private */ DeviceState parent_obj; SCLPEventFacility *event_facility; + int increment_size; /* public */ } SCLPDevice; -- 2.5.1