qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/5] target-s390: Check for standby memory specifica


From: Matthew Rosato
Subject: [Qemu-devel] [PATCH 3/5] target-s390: Check for standby memory specification
Date: Mon, 16 Dec 2013 15:51:10 -0500

When machine=...,standby-mem={size} has been specified, convert the value
to bytes and store it for use.

Signed-off-by: Matthew Rosato <address@hidden>
---
 target-s390x/kvm.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 02ac4ba..d4081f4 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -97,11 +97,27 @@ static void *legacy_s390_alloc(size_t size);
 
 int kvm_arch_init(KVMState *s)
 {
+    int64_t value;
+
     cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS);
     if (!kvm_check_extension(s, KVM_CAP_S390_GMAP)
         || !kvm_check_extension(s, KVM_CAP_S390_COW)) {
         phys_mem_set_alloc(legacy_s390_alloc);
     }
+
+    value = qemu_opt_get_size(qemu_get_machine_opts(), "standby-mem", -1);
+
+    if (value < 0) {
+        fprintf(stderr, "qemu: invalid standby-mem size:%"PRId64"\n", value);
+        exit(1);
+    }
+
+    if (value != (int64_t)(ram_addr_t)value) {
+        fprintf(stderr, "qemu: standby size too large\n");
+        exit(1);
+    }
+    standby_mem_size = value * 1024 * 1024;
+
     return 0;
 }
 
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]