diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2010-05-03 19:48:20 -0300 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-05 11:49:36 +0300 |
commit | 6daf734f1f1ba9f56c2cac5becb56f6598768f1b (patch) | |
tree | 9385b78643a923f227a072aabe2189872cffd645 /qemu-kvm-x86.c | |
parent | e8600b7e56744e0ca9df45eeb8916e42811a1a01 (diff) |
remove alias support
Aliases were added to workaround kvm's inability to destroy
memory regions. This was fixed in 2.6.29, and advertised via
KVM_CAP_DESTROY_MEMORY_REGION_WORKS.
Also, alias support will be removed from the kernel in July 2010.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'qemu-kvm-x86.c')
-rw-r--r-- | qemu-kvm-x86.c | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 439c31abd..4426f3657 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -214,71 +214,6 @@ int kvm_arch_run(CPUState *env) return r; } -#define MAX_ALIAS_SLOTS 4 -static struct { - uint64_t start; - uint64_t len; -} kvm_aliases[MAX_ALIAS_SLOTS]; - -static int get_alias_slot(uint64_t start) -{ - int i; - - for (i=0; i<MAX_ALIAS_SLOTS; i++) - if (kvm_aliases[i].start == start) - return i; - return -1; -} -static int get_free_alias_slot(void) -{ - int i; - - for (i=0; i<MAX_ALIAS_SLOTS; i++) - if (kvm_aliases[i].len == 0) - return i; - return -1; -} - -static void register_alias(int slot, uint64_t start, uint64_t len) -{ - kvm_aliases[slot].start = start; - kvm_aliases[slot].len = len; -} - -int kvm_create_memory_alias(kvm_context_t kvm, - uint64_t phys_start, - uint64_t len, - uint64_t target_phys) -{ - struct kvm_memory_alias alias = { - .flags = 0, - .guest_phys_addr = phys_start, - .memory_size = len, - .target_phys_addr = target_phys, - }; - int r; - int slot; - - slot = get_alias_slot(phys_start); - if (slot < 0) - slot = get_free_alias_slot(); - if (slot < 0) - return -EBUSY; - alias.slot = slot; - - r = kvm_vm_ioctl(kvm_state, KVM_SET_MEMORY_ALIAS, &alias); - if (r == -1) - return -errno; - - register_alias(slot, phys_start, len); - return 0; -} - -int kvm_destroy_memory_alias(kvm_context_t kvm, uint64_t phys_start) -{ - return kvm_create_memory_alias(kvm, phys_start, 0, 0); -} - #ifdef KVM_CAP_IRQCHIP int kvm_get_lapic(CPUState *env, struct kvm_lapic_state *s) @@ -616,18 +551,6 @@ static int kvm_enable_tpr_access_reporting(CPUState *env) } #endif -int kvm_qemu_create_memory_alias(uint64_t phys_start, - uint64_t len, - uint64_t target_phys) -{ - return kvm_create_memory_alias(kvm_context, phys_start, len, target_phys); -} - -int kvm_qemu_destroy_memory_alias(uint64_t phys_start) -{ - return kvm_destroy_memory_alias(kvm_context, phys_start); -} - #ifdef KVM_CAP_ADJUST_CLOCK static struct kvm_clock_data kvmclock_data; |