summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlauber Costa <glommer@redhat.com>2008-09-10 16:20:59 -0300
committerAvi Kivity <avi@qumranet.com>2008-09-11 11:55:30 +0300
commit7d2aea1de2e6867afea99ec247e9a5f647d4c861 (patch)
treee1e3544e2d0d0e3dcb9cd739f54a30a4a11667d0
parent11d13dbbc2238bcc04ca384653414d1b96adc43b (diff)
kvm: libkvm: remove KVM_CAP_USER_MEMORY from libkvm.c.
One of them is left, which is the initial check. Code that does ioctl checking is left to be removed in a future commit. Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r--libkvm/libkvm.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index d0c65cbe..6f3f3a08 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -153,7 +153,6 @@ static int kvm_dirty_pages_log_change(kvm_context_t kvm, unsigned long phys_addr
return 1;
}
flag |= slots[slot].flags;
-#ifdef KVM_CAP_USER_MEMORY
if (slots[slot].user_alloc) {
struct kvm_userspace_memory_region mem = {
.slot = slot,
@@ -164,7 +163,6 @@ static int kvm_dirty_pages_log_change(kvm_context_t kvm, unsigned long phys_addr
};
r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &mem);
}
-#endif
if (!slots[slot].user_alloc) {
struct kvm_memory_region mem = {
.slot = slot,
@@ -388,8 +386,6 @@ int kvm_create(kvm_context_t kvm, unsigned long phys_mem_bytes, void **vm_mem)
}
-#ifdef KVM_CAP_USER_MEMORY
-
void *kvm_create_userspace_phys_mem(kvm_context_t kvm, unsigned long phys_start,
unsigned long len, int log, int writable)
{
@@ -457,20 +453,14 @@ void kvm_destroy_userspace_phys_mem(kvm_context_t kvm,
free_slot(memory.slot);
}
-#endif
-
void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
unsigned long len, int log, int writable)
{
-#ifdef KVM_CAP_USER_MEMORY
- int r;
-
r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY);
if (r > 0)
return kvm_create_userspace_phys_mem(kvm, phys_start, len,
log, writable);
else
-#endif
return kvm_create_kernel_phys_mem(kvm, phys_start, len,
log, writable);
}
@@ -496,7 +486,6 @@ int kvm_is_allocated_mem(kvm_context_t kvm, unsigned long phys_start,
int kvm_create_mem_hole(kvm_context_t kvm, unsigned long phys_start,
unsigned long len)
{
-#ifdef KVM_CAP_USER_MEMORY
int slot;
int r;
struct kvm_userspace_memory_region rmslot;
@@ -556,7 +545,6 @@ int kvm_create_mem_hole(kvm_context_t kvm, unsigned long phys_start,
register_slot(newslot2.slot, newslot2.guest_phys_addr,
newslot2.memory_size, 1, newslot2.userspace_addr,
newslot2.flags);
-#endif
return 0;
}
@@ -565,7 +553,6 @@ int kvm_register_userspace_phys_mem(kvm_context_t kvm,
unsigned long len, int log)
{
-#ifdef KVM_CAP_USER_MEMORY
struct kvm_userspace_memory_region memory = {
.memory_size = len,
.guest_phys_addr = phys_start,
@@ -583,9 +570,6 @@ int kvm_register_userspace_phys_mem(kvm_context_t kvm,
register_slot(memory.slot, memory.guest_phys_addr, memory.memory_size,
1, memory.userspace_addr, memory.flags);
return 0;
-#else
- return -ENOSYS;
-#endif
}
@@ -611,11 +595,9 @@ void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start,
phys_start = slots[slot].phys_addr;
}
-#ifdef KVM_CAP_USER_MEMORY
if (ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY) > 0)
kvm_destroy_userspace_phys_mem(kvm, phys_start);
else
-#endif
kvm_create_kernel_phys_mem(kvm, phys_start, 0, 0, 0);
}