qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de,
	David Hildenbrand <dahi@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 21/23] s390: unify allocation of initial memory
Date: Mon, 31 Aug 2015 13:14:01 +0200	[thread overview]
Message-ID: <1441019643-10677-22-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1441019643-10677-1-git-send-email-cornelia.huck@de.ibm.com>

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

Now that the calculation of the initial memory is hidden in the sclp
device, we can unify the allocation of the initial memory.

The remaining ugly part is the reserved memory for the virtio queues,
but that can be cleaned up later.

Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/s390x/s390-virtio-ccw.c | 24 ++++++++++++++----------
 hw/s390x/s390-virtio.c     |  9 +--------
 hw/s390x/s390-virtio.h     |  1 +
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index eae1305..27a8360 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -100,15 +100,28 @@ static void virtio_ccw_register_hcalls(void)
                                    virtio_ccw_hcall_early_printk);
 }
 
-static void ccw_init(MachineState *machine)
+void s390_memory_init(ram_addr_t mem_size)
 {
     MemoryRegion *sysmem = get_system_memory();
     MemoryRegion *ram = g_new(MemoryRegion, 1);
+
+    /* allocate RAM for core */
+    memory_region_init_ram(ram, NULL, "s390.ram", mem_size, &error_abort);
+    vmstate_register_ram_global(ram);
+    memory_region_add_subregion(sysmem, 0, ram);
+
+    /* Initialize storage key device */
+    s390_skeys_init();
+}
+
+static void ccw_init(MachineState *machine)
+{
     int ret;
     VirtualCssBus *css_bus;
     DeviceState *dev;
 
     s390_sclp_init();
+    s390_memory_init(machine->ram_size);
 
     /* get a BUS */
     css_bus = virtual_css_bus_init();
@@ -124,15 +137,6 @@ static void ccw_init(MachineState *machine)
     /* register hypercalls */
     virtio_ccw_register_hcalls();
 
-    /* allocate RAM for core */
-    memory_region_init_ram(ram, NULL, "s390.ram", machine->ram_size,
-                           &error_abort);
-    vmstate_register_ram_global(ram);
-    memory_region_add_subregion(sysmem, 0, ram);
-
-    /* Initialize storage key device */
-    s390_skeys_init();
-
     /* init CPUs */
     s390_init_cpus(machine->cpu_model);
 
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index c8e4737..e4000c9 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -262,8 +262,6 @@ int gtod_load(QEMUFile *f, void *opaque, int version_id)
 static void s390_init(MachineState *machine)
 {
     ram_addr_t my_ram_size;
-    MemoryRegion *sysmem = get_system_memory();
-    MemoryRegion *ram = g_new(MemoryRegion, 1);
     void *virtio_region;
     hwaddr virtio_region_len;
     hwaddr virtio_region_start;
@@ -285,9 +283,7 @@ static void s390_init(MachineState *machine)
     s390_virtio_register_hcalls();
 
     /* allocate RAM */
-    memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size, &error_abort);
-    vmstate_register_ram_global(ram);
-    memory_region_add_subregion(sysmem, 0, ram);
+    s390_memory_init(my_ram_size);
 
     /* clear virtio region */
     virtio_region_len = my_ram_size - ram_size;
@@ -298,9 +294,6 @@ static void s390_init(MachineState *machine)
     cpu_physical_memory_unmap(virtio_region, virtio_region_len, 1,
                               virtio_region_len);
 
-    /* Initialize storage key device */
-    s390_skeys_init();
-
     /* init CPUs */
     s390_init_cpus(machine->cpu_model);
 
diff --git a/hw/s390x/s390-virtio.h b/hw/s390x/s390-virtio.h
index cf68796..f389aa1 100644
--- a/hw/s390x/s390-virtio.h
+++ b/hw/s390x/s390-virtio.h
@@ -27,4 +27,5 @@ void s390_init_ipl_dev(const char *kernel_filename,
                        bool enforce_bios);
 void s390_create_virtio_net(BusState *bus, const char *name);
 void s390_nmi(NMIState *n, int cpu_index, Error **errp);
+void s390_memory_init(ram_addr_t mem_size);
 #endif
-- 
2.5.1

  parent reply	other threads:[~2015-08-31 11:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 11:13 [Qemu-devel] [PATCH 00/23] s390x: further patches Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 01/23] s390x/css: handle ccw-0 TIC correctly Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 02/23] s390x/css: ccw-0 enforces count > 0 Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 03/23] s390x/event-facility: fix receive mask check Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 04/23] s390x/css: start with cleared cstat/dstat Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 05/23] s390x/event-facility: fix location of receive mask Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 06/23] pc-bios/s390-ccw: Device detection in higher subchannel sets Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 07/23] pc-bios/s390-ccw: rebuild image Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 08/23] s390x/kvm: make setting of in-kernel irq routes more efficient Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 09/23] s390x/gdb: support reading/writing of control registers Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 10/23] sclp/s390: rework sclp cpu hotplug device notification Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 11/23] s390/sclp: rework sclp event facility initialization + device realization Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 12/23] s390/sclp: replace sclp event types with proper defines Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 13/23] s390/sclp: temporarily fix unassignment/reassignment of memory subregions Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 14/23] s390/sclp: introduce a root sclp device Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 15/23] s390/sclp: move sclp_execute related functions into the SCLP class Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 16/23] s390/sclp: move sclp_service_interrupt into the sclp device Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 17/23] s390: no need to manually parse for slots and maxmem Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 18/23] s390: disallow memory hotplug for the s390-virtio machine Cornelia Huck
2015-08-31 11:13 ` [Qemu-devel] [PATCH 19/23] s390/sclp: ignore memory hotplug operations if it is disabled Cornelia Huck
2015-08-31 11:14 ` [Qemu-devel] [PATCH 20/23] s390: move memory calculation into the sclp device Cornelia Huck
2015-08-31 11:14 ` Cornelia Huck [this message]
2015-08-31 11:14 ` [Qemu-devel] [PATCH 22/23] s390/sclp: store the increment_size in " Cornelia Huck
2015-08-31 11:14 ` [Qemu-devel] [PATCH 23/23] s390/sclp: simplify calculation of rnmax Cornelia Huck

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=1441019643-10677-22-git-send-email-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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).