s390x/kvm: passing max memory size to accelerator

With "KVM: s390: Allow userspace to limit guest memory size" KVM is able to
do some optimizations based on the guest memory limit.

The guest memory limit is computed by the initial definition and with the notion of
hotplugged memory.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Guenther Hutzl <hutzl@linux.vnet.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Message-Id: <1425570981-40609-3-git-send-email-jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
This commit is contained in:
Dominik Dingel 2015-03-05 16:56:21 +01:00 committed by Christian Borntraeger
parent 5e5ced386a
commit a310b283e3
3 changed files with 69 additions and 0 deletions

View file

@ -97,6 +97,7 @@ static void ccw_init(MachineState *machine)
ram_addr_t pad_size = 0;
ram_addr_t maxmem = qemu_opt_get_size(opts, "maxmem", my_ram_size);
ram_addr_t standby_mem_size = maxmem - my_ram_size;
uint64_t kvm_limit;
/* 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.
@ -121,6 +122,15 @@ static void ccw_init(MachineState *machine)
/* let's propagate the changed ram size into the global variable. */
ram_size = my_ram_size;
machine->maxram_size = my_ram_size + standby_mem_size;
ret = s390_set_memory_limit(machine->maxram_size, &kvm_limit);
if (ret == -E2BIG) {
hw_error("qemu: host supports a maximum of %" PRIu64 " GB",
kvm_limit >> 30);
} else if (ret) {
hw_error("qemu: setting the guest size failed");
}
/* get a BUS */
css_bus = virtual_css_bus_init();