diff options
author | Glauber Costa <glommer@redhat.com> | 2008-09-10 16:21:00 -0300 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-09-11 11:55:48 +0300 |
commit | 857a3c34714bd30e57b252889e2513352528a4bb (patch) | |
tree | 2df6c976c6b58f884879b1785530c8907bcfe7fd /libkvm | |
parent | 7d2aea1de2e6867afea99ec247e9a5f647d4c861 (diff) |
kvm: libkvm: remove create_kernel_phys_mem
Wipe out create_kernel_phys_mem(), and all of its users.
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'libkvm')
-rw-r--r-- | libkvm/kvm-common.h | 3 | ||||
-rw-r--r-- | libkvm/libkvm-ia64.c | 6 | ||||
-rw-r--r-- | libkvm/libkvm-powerpc.c | 7 | ||||
-rw-r--r-- | libkvm/libkvm-s390.c | 7 | ||||
-rw-r--r-- | libkvm/libkvm-x86.c | 33 | ||||
-rw-r--r-- | libkvm/libkvm.c | 14 |
6 files changed, 3 insertions, 67 deletions
diff --git a/libkvm/kvm-common.h b/libkvm/kvm-common.h index 93cea1b7..0c04cbc8 100644 --- a/libkvm/kvm-common.h +++ b/libkvm/kvm-common.h @@ -72,9 +72,6 @@ int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory, void **vm_mem); int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory, void **vm_mem); -void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start, - unsigned long len, int log, int writable); - int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, void **vm_mem); diff --git a/libkvm/libkvm-ia64.c b/libkvm/libkvm-ia64.c index 152d8fd4..f3afc56e 100644 --- a/libkvm/libkvm-ia64.c +++ b/libkvm/libkvm-ia64.c @@ -33,12 +33,6 @@ #include <fcntl.h> #include <stdlib.h> -void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start, - unsigned long len, int log, int writable) -{ - return NULL; -} - int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes, void **vm_mem) { diff --git a/libkvm/libkvm-powerpc.c b/libkvm/libkvm-powerpc.c index c523f26a..aaebfef6 100644 --- a/libkvm/libkvm-powerpc.c +++ b/libkvm/libkvm-powerpc.c @@ -43,13 +43,6 @@ int handle_dcr(struct kvm_run *run, kvm_context_t kvm, int vcpu) return ret; } -void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start, - unsigned long len, int log, int writable) -{ - fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); - return NULL; -} - void kvm_show_code(kvm_context_t kvm, int vcpu) { fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); diff --git a/libkvm/libkvm-s390.c b/libkvm/libkvm-s390.c index 59c534fc..041c0ce3 100644 --- a/libkvm/libkvm-s390.c +++ b/libkvm/libkvm-s390.c @@ -22,13 +22,6 @@ #include <stdio.h> #include <inttypes.h> -void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start, - unsigned long len, int log, int writable) -{ - fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); - return NULL; -} - void kvm_show_code(kvm_context_t kvm, int vcpu) { fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__); diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c index 4ca3d7ba..a8cca151 100644 --- a/libkvm/libkvm-x86.c +++ b/libkvm/libkvm-x86.c @@ -145,39 +145,6 @@ int kvm_arch_run(struct kvm_run *run,kvm_context_t kvm, int vcpu) return r; } -void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start, - unsigned long len, int log, int writable) -{ - int r; - int prot = PROT_READ; - void *ptr; - struct kvm_memory_region memory = { - .memory_size = len, - .guest_phys_addr = phys_start, - .flags = log ? KVM_MEM_LOG_DIRTY_PAGES : 0, - }; - - memory.slot = get_free_slot(kvm); - r = ioctl(kvm->vm_fd, KVM_SET_MEMORY_REGION, &memory); - if (r == -1) { - fprintf(stderr, "create_kernel_phys_mem: %s", strerror(errno)); - return 0; - } - register_slot(memory.slot, memory.guest_phys_addr, memory.memory_size, - 0, 0, memory.flags); - - if (writable) - prot |= PROT_WRITE; - - ptr = mmap(NULL, len, prot, MAP_SHARED, kvm->vm_fd, phys_start); - if (ptr == MAP_FAILED) { - fprintf(stderr, "create_kernel_phys_mem: %s", strerror(errno)); - return 0; - } - - return ptr; -} - #define MAX_ALIAS_SLOTS 4 static struct { uint64_t start; diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c index 6f3f3a08..c1c295de 100644 --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -456,13 +456,8 @@ void kvm_destroy_userspace_phys_mem(kvm_context_t kvm, void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start, unsigned long len, int log, int writable) { - 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 - return kvm_create_kernel_phys_mem(kvm, phys_start, len, - log, writable); + return kvm_create_userspace_phys_mem(kvm, phys_start, len, + log, writable); } int kvm_is_intersecting_mem(kvm_context_t kvm, unsigned long phys_start) @@ -595,10 +590,7 @@ void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start, phys_start = slots[slot].phys_addr; } - if (ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY) > 0) - kvm_destroy_userspace_phys_mem(kvm, phys_start); - else - kvm_create_kernel_phys_mem(kvm, phys_start, 0, 0, 0); + kvm_destroy_userspace_phys_mem(kvm, phys_start); } static int kvm_get_map(kvm_context_t kvm, int ioctl_num, int slot, void *buf) |