From: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: agraf@suse.de, borntraeger@de.ibm.com, aliguori@amazon.com,
imammedo@redhat.com, cornelia.huck@de.ibm.com,
pbonzini@redhat.com, rth@twiddle.net
Subject: [Qemu-devel] [PATCH v8 3/4] s390-virtio: Apply same memory boundaries as virtio-ccw
Date: Thu, 28 Aug 2014 11:25:34 -0400 [thread overview]
Message-ID: <1409239536-29691-4-git-send-email-mjrosato@linux.vnet.ibm.com> (raw)
In-Reply-To: <1409239536-29691-1-git-send-email-mjrosato@linux.vnet.ibm.com>
Although s390-virtio won't support memory hotplug, it should
enforce the same memory boundaries so that it can use shared codepaths
(like read_SCP_info).
Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
---
hw/s390x/s390-virtio.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index 93c7ace..857f8d3 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -229,18 +229,21 @@ static void s390_init(MachineState *machine)
ram_addr_t my_ram_size = machine->ram_size;
MemoryRegion *sysmem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
- int shift = 0;
+ int increment_size = 20;
uint8_t *storage_keys;
void *virtio_region;
hwaddr virtio_region_len;
hwaddr virtio_region_start;
- /* s390x ram size detection needs a 16bit multiplier + an increment. So
- guests > 64GB can be specified in 2MB steps etc. */
- while ((my_ram_size >> (20 + shift)) > 65535) {
- shift++;
+ /*
+ * 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 ((my_ram_size >> increment_size) > MAX_STORAGE_INCREMENTS) {
+ increment_size++;
}
- my_ram_size = my_ram_size >> (20 + shift) << (20 + shift);
+ my_ram_size = my_ram_size >> increment_size << increment_size;
/* let's propagate the changed ram size into the global variable. */
ram_size = my_ram_size;
--
1.7.9.5
next prev parent reply other threads:[~2014-08-28 15:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-28 15:25 [Qemu-devel] [PATCH v8 0/4] s390: Support for Hotplug of Standby Memory Matthew Rosato
2014-08-28 15:25 ` [Qemu-devel] [PATCH v8 1/4] sclp-s390: Add device to manage s390 memory hotplug Matthew Rosato
2014-08-28 15:25 ` [Qemu-devel] [PATCH v8 2/4] virtio-ccw: Include standby memory when calculating storage increment Matthew Rosato
2014-08-28 15:25 ` Matthew Rosato [this message]
2014-08-28 15:25 ` [Qemu-devel] [PATCH v8 4/4] sclp-s390: Add memory hotplug SCLPs Matthew Rosato
2014-09-01 7:39 ` [Qemu-devel] [PATCH v8 0/4] s390: Support for Hotplug of Standby Memory Christian Borntraeger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409239536-29691-4-git-send-email-mjrosato@linux.vnet.ibm.com \
--to=mjrosato@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=aliguori@amazon.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).