From: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: gleb@redhat.com, agraf@suse.de, borntraeger@de.ibm.com,
aliguori@amazon.com, cornelia.huck@de.ibm.com,
pbonzini@redhat.com, rth@twiddle.net
Subject: [Qemu-devel] [PATCH 2/5] virtio-ccw: Include standby memory when calculating storage increment
Date: Mon, 16 Dec 2013 15:51:09 -0500 [thread overview]
Message-ID: <1387227072-21965-3-git-send-email-mjrosato@linux.vnet.ibm.com> (raw)
In-Reply-To: <1387227072-21965-1-git-send-email-mjrosato@linux.vnet.ibm.com>
When determining the memory increment size, include the standby
memory as well as the core memory.
Signed-off-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
---
hw/s390x/s390-virtio-ccw.c | 30 +++++++++++++++++++++++++-----
target-s390x/cpu.h | 4 ++++
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 733d988..75deb24 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -17,6 +17,8 @@
#include "css.h"
#include "virtio-ccw.h"
+ram_addr_t pad_size;
+
void io_subsystem_reset(void)
{
DeviceState *css, *sclp;
@@ -84,11 +86,22 @@ static void ccw_init(QEMUMachineInitArgs *args)
int ret;
VirtualCssBus *css_bus;
- /* 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++;
+ if (standby_mem_size) {
+ /* The storage increment size is a multiple of 1M and is a power of 2.
+ * The number of storage increments must be 1020 or fewer. */
+ while ((my_ram_size >> (20 + shift)) > 1020) {
+ shift++;
+ }
+ while ((standby_mem_size >> (20 + shift)) > 1020) {
+ shift++;
+ }
+ standby_mem_size = standby_mem_size >> (20 + shift) << (20 + shift);
+ } else {
+ while ((my_ram_size >> (20 + shift)) > 65535) {
+ shift++;
+ }
}
+
my_ram_size = my_ram_size >> (20 + shift) << (20 + shift);
/* let's propagate the changed ram size into the global variable. */
@@ -103,11 +116,18 @@ static void ccw_init(QEMUMachineInitArgs *args)
/* register hypercalls */
virtio_ccw_register_hcalls();
- /* allocate RAM */
+ /* allocate RAM for core */
memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size);
vmstate_register_ram_global(ram);
memory_region_add_subregion(sysmem, 0, ram);
+ if (standby_mem_size) {
+ if (my_ram_size % MEM_SECTION_SIZE) {
+ pad_size = MEM_SECTION_SIZE - my_ram_size % MEM_SECTION_SIZE;
+ }
+ my_ram_size += standby_mem_size + pad_size;
+ }
+
/* allocate storage keys */
storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE);
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index a2c077b..3383d55 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -385,6 +385,10 @@ unsigned s390_del_running_cpu(S390CPU *cpu);
/* service interrupts are floating therefore we must not pass an cpustate */
void s390_sclp_extint(uint32_t parm);
+/* from s390-virtio-ccw */
+#define MEM_SECTION_SIZE 0x10000000UL
+extern ram_addr_t standby_mem_size;
+
/* from s390-virtio-bus */
extern const hwaddr virtio_size;
--
1.7.9.5
next prev parent reply other threads:[~2013-12-16 20:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-16 20:51 [Qemu-devel] [PATCH 0/5] s390: Support for Hotplug of Standby Memory Matthew Rosato
2013-12-16 20:51 ` [Qemu-devel] [PATCH 1/5] Add the standby-mem machine option Matthew Rosato
2013-12-17 10:09 ` Paolo Bonzini
2013-12-17 15:53 ` Matthew Rosato
2013-12-16 20:51 ` Matthew Rosato [this message]
2013-12-16 20:51 ` [Qemu-devel] [PATCH 3/5] target-s390: Check for standby memory specification Matthew Rosato
2013-12-16 21:25 ` Alexander Graf
2013-12-17 15:58 ` Matthew Rosato
2013-12-17 16:48 ` Alexander Graf
2013-12-16 20:51 ` [Qemu-devel] [PATCH 4/5] sclp-s390: Define new SCLP codes and structures Matthew Rosato
2014-01-22 10:08 ` Christian Borntraeger
2014-03-20 9:56 ` Christian Borntraeger
2014-03-20 16:33 ` Matthew Rosato
2014-03-20 16:36 ` Christian Borntraeger
2013-12-16 20:51 ` [Qemu-devel] [PATCH 5/5] sclp-s390: Add memory hotplug SCLPs Matthew Rosato
2013-12-16 21:42 ` Alexander Graf
2013-12-16 23:18 ` Alexander Graf
2013-12-17 16:09 ` Matthew Rosato
2013-12-17 16:06 ` Matthew Rosato
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=1387227072-21965-3-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=gleb@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).