diff options
author | Markus Armbruster | 2013-07-31 15:11:08 +0200 |
---|---|---|
committer | Anthony Liguori | 2013-09-12 18:45:31 +0200 |
commit | 91138037cb341a04a66e4c43b6cb31d5d8a43a73 (patch) | |
tree | 9ab40169a46bf3ab0de332920ff8cceb0edecc88 /target-s390x | |
parent | exec: Reduce ifdeffery around -mem-path (diff) | |
download | qemu-91138037cb341a04a66e4c43b6cb31d5d8a43a73.tar.gz qemu-91138037cb341a04a66e4c43b6cb31d5d8a43a73.tar.xz qemu-91138037cb341a04a66e4c43b6cb31d5d8a43a73.zip |
exec: Simplify the guest physical memory allocation hook
Make it a generic hook rather than a KVM hook. Less code and
ifdeffery.
Since the only user of the hook is old S390 KVM, there's hope we can
get rid of it some day.
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Message-id: 1375276272-15988-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
Diffstat (limited to 'target-s390x')
-rw-r--r-- | target-s390x/kvm.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 185c8f5a45..0b75164ddb 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; } @@ -333,17 +339,6 @@ static void *legacy_s390_alloc(ram_addr_t size) 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); - } -} - int kvm_arch_insert_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp) { static const uint8_t diag_501[] = {0x83, 0x24, 0x05, 0x01}; |