diff options
Diffstat (limited to 'target-s390x')
-rw-r--r-- | target-s390x/kvm.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 185c8f5a45..4923e0a717 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -93,9 +93,15 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { static int cap_sync_regs; +static void *legacy_s390_alloc(ram_addr_t size); + int kvm_arch_init(KVMState *s) { 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); + } return 0; } @@ -326,22 +332,7 @@ static void *legacy_s390_alloc(ram_addr_t size) mem = mmap((void *) 0x800000000ULL, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); - if (mem == MAP_FAILED) { - fprintf(stderr, "Allocating RAM failed\n"); - abort(); - } - return mem; -} - -void *kvm_arch_ram_alloc(ram_addr_t size) -{ - /* Can we use the standard allocation ? */ - if (kvm_check_extension(kvm_state, KVM_CAP_S390_GMAP) && - kvm_check_extension(kvm_state, KVM_CAP_S390_COW)) { - return NULL; - } else { - return legacy_s390_alloc(size); - } + return mem == MAP_FAILED ? NULL : mem; } int kvm_arch_insert_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp) |