libkvm refactor
PATCH v4 1/1 libkvm refactor
Here is the 4th revision of the refactoring of libkvm. This revision changes since the 3rd revision:
- removes libkvm-x86.h
- keeps functions kvm_create_default_phys_mem & kvm_create_phys_mem in place
- added kvm_arch_create_default_phys_mem
- Adds needed copyrights to new files
- Adds void to slots() --> slots(void) decleartions
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move kvm_context to kvm-common.h & add CFLAGS to config-* filese
# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367624 21600
# Node ID dc86d46f1d10fd53c332f1cb7c2f1e880616694a
# Parent 6ce27ddeb45df182e923060ae3abe699ce704ca3
Move kvm_context to kvm-common.h & add CFLAGS to config-* filese
This patch moves kvm_context from libkvm.c to kvm-common.h. This is so other files are able to see members of kvm_context. Also you should allways declare stuff like this in a header anyway.
Also moved are delcrations MAX_VCPU, KVM_MAX_NUM_MEM_REGIONS to kvm-common.h. While PAGE_SIZE & PAGE_MASK where moved to kvm-x86.h.
The idea here is kvm-$(ARCH).h will be headers for interal use by libkvm. Headers name libkvm-$(ARCH) will be functions that are arch specific that will be exposed to a user.
Also apart of this patch is added CFLAGS to the config-$(ARCH).mak files. Really instead there needed to be a unified make file for libkvm & user directory. But for now this fixes the issue
libkvm/config-i386.mak +2 -0
@@ -1,2 +1,4 @@ LIBDIR := /lib +CFLAGS += -m32 +CFLAGS += -D__i386__
libkvm/config-x86_64.mak +2 -0
@@ -1,2 +1,4 @@ LIBDIR := /lib64 +CFLAGS += -m64 +CFLAGS += -D__x86_64__
libkvm/kvm-common.h new file +52 -0
52 lines not on this page · raw message
libkvm/kvm-x86.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* This header is for functions & variables that will ONLY be +* used inside libkvm for x86. +* THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE +* WITHIN LIBKVM. +* +* derived from libkvm.c +* +* Copyright (C) 2006 Qumranet, Inc. +* +* Authors: +* Avi Kivity <avi-atKUWr5tajBWk0Htik3J/[email protected]> +* Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/[email protected]> +* +* This work is licensed under the GNU LGPL license, version 2. +*/ + +#ifndef KVM_X86_H +#define KVM_X86_H + +#include "kvm-common.h" + +#define PAGE_SIZE 4096ul +#define PAGE_MASK (~(PAGE_SIZE - 1)) + +#endif
libkvm/libkvm.c +4 -33
@@ -37,43 +37,14 @@#include "libkvm.h" #include "kvm-abi-10.h" +#if defined(__x86_64__) || defined(__i386__) +#include "kvm-x86.h" +#endif +static int kvm_abi =EXPECTED_KVM_API_VERSION ; -#define PAGE_SIZE 4096ul -#define PAGE_MASK (~(PAGE_SIZE - 1)) - -/* FIXME: share this number with kvm */ -/* FIXME: or dynamically alloc/realloc regions */ -#define KVM_MAX_NUM_MEM_REGIONS 8uint free_slots[KVM_MAX_NUM_MEM_REGIONS ];unsigned long phys_addr_slots[KVM_MAX_NUM_MEM_REGIONS ]; -#define MAX_VCPUS 4 - -/** -* \brief The KVM context -* -* The verbose KVM context -*/ -struct kvm_context { -/// Filedescriptor to /dev/kvm -int fd; -int vm_fd; -int vcpu_fd[MAX_VCPUS ]; -struct kvm_run *run[MAX_VCPUS ]; -/// Callbacks that KVM uses to emulate various unvirtualizable functionality -struct kvm_callbacks *callbacks; -void *opaque; -/// A pointer to the memory used as the physical memory for the guest -void *physical_memory; -/// is dirty pages logging enabled for all regions or not -int dirty_pages_log_all; -/// memory regions parameters -struct kvm_memory_region mem_regions[KVM_MAX_NUM_MEM_REGIONS ]; -/// do not create in-kernel irqchip if set -int no_irqchip_creation; -/// in-kernel irqchip status -int irqchip_in_kernel; -};static void init_slots () {
libkvm/libkvm.h +1 -1
@@ -1,4 +1,4 @@ -/** \file kvmctl.h +/** \file libkvm.h * libkvm API */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Make static slot & kvm_memory region funcions public
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367645 21600
# Node ID e564a557782efc23428705de12cd3e8b9517e11c
# Parent dc86d46f1d10fd53c332f1cb7c2f1e880616694a
Make static slot & kvm_memory region funcions public
This patch changes static functions for manipulation of memory slots and regions public in libkvm.c. This also makes a decleration for these functions in kvm-common.h.
This allow for breaking out code into other files and still keep this functionality. These functions can later be broken up some to move there x86 specific stuff (ex. TSS).
libkvm/kvm-common.h +10 -0
@@ -49,4 +49,14 @@ struct kvm_context { int irqchip_in_kernel; }; +void init_slots (void ); +int get_free_slot (kvm_context_t kvm); +void register_slot (int slot,unsigned long phys_addr); +int get_slot (unsigned long phys_addr); +void kvm_memory_region_save_params (kvm_context_t kvm, +struct kvm_memory_region *mem); +void kvm_userspace_memory_region_save_params (kvm_context_t kvm, +struct kvm_userspace_memory_region *mem); +void kvm_memory_region_clear_params (kvm_context_t kvm,int regnum); +#endif
libkvm/libkvm.c +7 -7
@@ -46,7 +46,7 @@ int free_slots[KVM_MAX_NUM_MEM_REGIONS];int free_slots[KVM_MAX_NUM_MEM_REGIONS ];unsigned long phys_addr_slots[KVM_MAX_NUM_MEM_REGIONS ]; -static void init_slots () +void init_slots (void ) {int i;
@@ -54,7 +54,7 @@ static void init_slots() free_slots[i] =0 ; } -static int get_free_slot (kvm_context_t kvm) +int get_free_slot (kvm_context_t kvm) {int i;int tss_ext;
@@ -81,13 +81,13 @@ static int get_free_slot(kvm_context_t kreturn -1 ; } -static void register_slot (int slot,unsigned long phys_addr) +void register_slot (int slot,unsigned long phys_addr) { free_slots[slot] =1 ; phys_addr_slots[slot] = phys_addr; } -static int get_slot (unsigned long phys_addr) +int get_slot (unsigned long phys_addr) {int i;
@@ -100,7 +100,7 @@ static int get_slot(unsigned long phys_a/* * memory regions parameters */ -static void kvm_memory_region_save_params (kvm_context_t kvm, +void kvm_memory_region_save_params (kvm_context_t kvm,struct kvm_memory_region *mem) {if (!mem || (mem->slot >=KVM_MAX_NUM_MEM_REGIONS )) {
@@ -112,7 +112,7 @@ static void kvm_memory_region_save_param#ifdef KVM_CAP_USER_MEMORY -static void kvm_userspace_memory_region_save_params (kvm_context_t kvm, +void kvm_userspace_memory_region_save_params (kvm_context_t kvm,struct kvm_userspace_memory_region *mem) {struct kvm_memory_region kvm_mem;
@@ -126,7 +126,7 @@ static void kvm_userspace_memory_region_#endif -static void kvm_memory_region_clear_params (kvm_context_t kvm,int regnum) +void kvm_memory_region_clear_params (kvm_context_t kvm,int regnum) {if (regnum >=KVM_MAX_NUM_MEM_REGIONS ) {fprintf (stderr,"BUG: %s: invalid parameters\n" , __FUNCTION__);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move fuction kvm_alloc_kernel_memory to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367646 21600
# Node ID e82588d0a81df7955c12bf18c27d095f46545b6e
# Parent e564a557782efc23428705de12cd3e8b9517e11c
Move fuction kvm_alloc_kernel_memory to libkvm-x86.c
libkvm/Makefile +1 -1
@@ -21,7 +21,7 @@ autodepend-flags = -MMD -MF $(dir $*).$( all: libkvm.a -libkvm.a: libkvm.o +libkvm.a: libkvm.o $(libkvm-$(ARCH)-objs) $(AR) rcs $@ $^ install:
libkvm/config-i386.mak +2 -0
@@ -2,3 +2,5 @@ LIBDIR := /lib LIBDIR := /lib CFLAGS += -m32 CFLAGS += -D__i386__ + +libkvm-$(ARCH)-objs := libkvm-x86.o
libkvm/config-x86_64.mak +2 -0
@@ -2,3 +2,5 @@ LIBDIR := /lib64 LIBDIR := /lib64 CFLAGS += -m64 CFLAGS += -D__x86_64__ + +libkvm-$(ARCH)-objs := libkvm-x86.o
libkvm/kvm-x86.h +4 -0
@@ -23,4 +23,8 @@#define PAGE_SIZE 4096ul#define PAGE_MASK (~(PAGE_SIZE - 1)) + +int kvm_alloc_kernel_memory (kvm_context_t kvm,unsigned long memory, +void **vm_mem); +#endif
libkvm/libkvm-x86.c new file +81 -0
81 lines not on this page · raw message
libkvm/libkvm.c +0 -73
79 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move kvm_alloc_userspace_memory to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367647 21600
# Node ID 5a8dcd2c2316ade1bcb332c57b74b8cc071cfa95
# Parent e82588d0a81df7955c12bf18c27d095f46545b6e
Move kvm_alloc_userspace_memory to libkvm-x86.c
This moves x86 specific function kvm_alloc_userspace_memory() out of libkvm.c into libkvm-x86.c.
libkvm/kvm-x86.h +3 -0
@@ -27,4 +27,7 @@ int kvm_alloc_kernel_memory(kvm_context_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); +#endif
libkvm/libkvm-x86.c +107 -0
115 lines not on this page · raw message
libkvm/libkvm.c +0 -102
108 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Modify out arch specific code from kvm_create function
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367648 21600
# Node ID 4bab1bb82930ade04b5a796ca79e75e392265ba7
# Parent 5a8dcd2c2316ade1bcb332c57b74b8cc071cfa95
Modify out arch specific code from kvm_create function
This function removes all x86 specific code and creates a hook function kv_arch_create to accomidate for this code.
This patch also moves the following funcitons to libkvm-x86.c:
kvm_set_tss_addr
kvm_set_init_tss
kvm_create_default_phys_mem
This patch moves function kvm_create_default_phys_mem to libkvm-x86. This function is arch specific to x86 and also today no one allocates guest memory in the kernel. To remove confusion the function has been renameed kvm_x86_create_default_phys_mem
libkvm/kvm-common.h +6 -0
@@ -59,4 +59,10 @@ void kvm_userspace_memory_region_save_pa struct kvm_userspace_memory_region *mem);void kvm_memory_region_clear_params (kvm_context_t kvm,int regnum); +int kvm_arch_create (kvm_context_t kvm,unsigned long phys_mem_bytes, +void **vm_mem); +int kvm_arch_create_default_phys_mem (kvm_context_t kvm, +unsigned long phys_mem_bytes, +void **vm_mem); +#endif
libkvm/kvm-x86.h +3 -0
@@ -30,4 +30,7 @@ int kvm_alloc_userspace_memory(kvm_conteint kvm_alloc_userspace_memory (kvm_context_t kvm,unsigned long memory,void **vm_mem); +int kvm_set_tss_addr (kvm_context_t kvm,unsigned long addr); + +#endif
libkvm/libkvm-x86.c +76 -0
85 lines not on this page · raw message
libkvm/libkvm.c +4 -46
73 lines not on this page · raw message
libkvm/libkvm.h +0 -1
@@ -412,7 +412,6 @@ int kvm_dump_vcpu(kvm_context_t kvm, int*/ void kvm_show_regs (kvm_context_t kvm,int vcpu); -int kvm_set_tss_addr (kvm_context_t kvm,unsigned long addr);void *kvm_create_phys_mem (kvm_context_t ,unsigned long phys_start,unsigned long len,int log,int writable);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move kvm_create_kernel_phys_mem to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367649 21600
# Node ID 7ea01f673a05fe66cb0d9c514b5a43ddcd72c07f
# Parent 4bab1bb82930ade04b5a796ca79e75e392265ba7
Move kvm_create_kernel_phys_mem to libkvm-x86.c
This patch moves kvm_create_kernel_phys_mem to x86 as this is the only arch that will be allocating memory for guest in the kernel (at least for older kvm versions).
libkvm/kvm-x86.h +5 -0
@@ -20,6 +20,8 @@#include "kvm-common.h" +#include "kvm-common.h" +#define PAGE_SIZE 4096ul#define PAGE_MASK (~(PAGE_SIZE - 1))
@@ -33,4 +35,7 @@ int kvm_set_tss_addr(kvm_context_t kvm,int kvm_set_tss_addr (kvm_context_t kvm,unsigned long addr); +void *kvm_create_kernel_phys_mem (kvm_context_t kvm,unsigned long phys_start, +unsigned long len,int log,int writable); +#endif
libkvm/libkvm-x86.c +33 -1
@@ -261,4 +261,36 @@ int kvm_arch_create(kvm_context_t kvm, ureturn 0 ; } - +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); +kvm_memory_region_save_params (kvm, &memory); + +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; +} +
libkvm/libkvm.c +0 -32
@@ -399,38 +399,6 @@ int kvm_create(kvm_context_t kvm, unsignreturn 0 ; } -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); -kvm_memory_region_save_params (kvm, &memory); - -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; -}#ifdef KVM_CAP_USER_MEMORY
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move kvm_create_memory_alias & kvm_destroy_memory_alias to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367649 21600
# Node ID cb186258bc6ecf05ded03d81a3d2ee820e58f605
# Parent 7ea01f673a05fe66cb0d9c514b5a43ddcd72c07f
Move kvm_create_memory_alias & kvm_destroy_memory_alias to libkvm-x86.c
libkvm/libkvm-x86.c +29 -0
@@ -294,3 +294,32 @@ void *kvm_create_kernel_phys_mem(kvm_conreturn ptr; } +int kvm_create_memory_alias (kvm_context_t kvm, +uint64_t phys_addr, +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 fd = kvm->vm_fd; +int r; + + alias.slot =get_slot (phys_addr); + + r =ioctl (fd,KVM_SET_MEMORY_ALIAS , &alias); +if (r ==-1 ) +return -errno; + +return 0 ; +} + +int kvm_destroy_memory_alias (kvm_context_t kvm,uint64_t phys_addr) +{ +return kvm_create_memory_alias (kvm, phys_addr,0 ,0 ,0 ); +} +
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: [PATCH 07 of 17] Move kvm_create_memory_alias & kvm_destroy_memory_alias to libkvm-x86.c
Quoted 37 lines · Jerone Young
# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367649 21600
# Node IDcb186258bc6ecf05ded03d81a3d2ee820e58f605
# Parent7ea01f673a05fe66cb0d9c514b5a43ddcd72c07f
Movekvm_create_memory_alias&kvm_destroy_memory_aliastolibkvm-x86.cSigned-off-by Jerone Young <jyoung5-r/[email protected]>libkvm/libkvm-x86.c +19
-0@@ -294,3 +294,32 @@ void *kvm_create_kernel_phys_mem(kvm_conreturn ptr; } +int kvm_create_memory_alias (kvm_context_t kvm, +uint64_t phys_addr, +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 fd = kvm->vm_fd; +int r; + + alias.slot =get_slot (phys_addr); + + r =ioctl (fd,KVM_SET_MEMORY_ALIAS , &alias); +if (r ==-1 )
libkvm/libkvm-x86.c void *kvm_create_kernel_phys_mem(kvm_con · line 325
Quoted 10 lines
libkvm/libkvm-x86.c +10
-0+return -errno; + +return 0 ; +} + +int kvm_destroy_memory_alias (kvm_context_t kvm,uint64_t phys_addr) +{ +return kvm_create_memory_alias (kvm, phys_addr,0 ,0 ,0 ); +} +
This is missing the delete part of the move. I supplied it.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move kvm_get & kmv_set_lapci functions to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367650 21600
# Node ID 739af911ff85420dc4bb367584a1113ca5c82551
# Parent cb186258bc6ecf05ded03d81a3d2ee820e58f605
Move kvm_get & kmv_set_lapci functions to libkvm-x86.c
libkvm/libkvm-x86.c +31 -0
@@ -323,3 +323,34 @@ int kvm_destroy_memory_alias(kvm_contextreturn kvm_create_memory_alias (kvm, phys_addr,0 ,0 ,0 ); } +#ifdef KVM_CAP_IRQCHIP + +int kvm_get_lapic (kvm_context_t kvm,int vcpu,struct kvm_lapic_state *s) +{ +int r; +if (!kvm->irqchip_in_kernel) +return 0 ; + r =ioctl (kvm->vcpu_fd[vcpu],KVM_GET_LAPIC , s); +if (r ==-1 ) { + r = -errno; +perror ("kvm_get_lapic" ); + } +return r; +} + +int kvm_set_lapic (kvm_context_t kvm,int vcpu,struct kvm_lapic_state *s) +{ +int r; +if (!kvm->irqchip_in_kernel) +return 0 ; + r =ioctl (kvm->vcpu_fd[vcpu],KVM_SET_LAPIC , s); +if (r ==-1 ) { + r = -errno; +perror ("kvm_set_lapic" ); + } +return r; +} + +#endif + +
libkvm/libkvm.c +0 -26
@@ -636,32 +636,6 @@ int kvm_set_irqchip(kvm_context_t kvm, sif (r ==-1 ) { r = -errno;perror ("kvm_set_irqchip\n" ); - } -return r; -} - -int kvm_get_lapic (kvm_context_t kvm,int vcpu,struct kvm_lapic_state *s) -{ -int r; -if (!kvm->irqchip_in_kernel) -return 0 ; - r =ioctl (kvm->vcpu_fd[vcpu],KVM_GET_LAPIC , s); -if (r ==-1 ) { - r = -errno; -perror ("kvm_get_lapic" ); - } -return r; -} - -int kvm_set_lapic (kvm_context_t kvm,int vcpu,struct kvm_lapic_state *s) -{ -int r; -if (!kvm->irqchip_in_kernel) -return 0 ; - r =ioctl (kvm->vcpu_fd[vcpu],KVM_SET_LAPIC , s); -if (r ==-1 ) { - r = -errno; -perror ("kvm_set_lapic" ); }return r; }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Make functions in libkvm.c nonstatic
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367651 21600
# Node ID b0f337ae377c7e9050251057a88219d4877c159f
# Parent 739af911ff85420dc4bb367584a1113ca5c82551
Make functions in libkvm.c nonstatic.
This patch makes the following functions nonstatic. These functions are potentially reusable by other archs, but are need by arch specific code in libkvm-x86.c.
These functions include:
handle_halt
handle_shutdown
post_kvm_run
pre_kvm_run
handle_io_window
handle_debug
libkvm/kvm-common.h +8 -0
@@ -65,4 +65,12 @@ int kvm_arch_create_default_phys_mem(kvmunsigned long phys_mem_bytes, void **vm_mem); +int handle_halt (kvm_context_t kvm,int vcpu); +int handle_shutdown (kvm_context_t kvm,int vcpu); +void post_kvm_run (kvm_context_t kvm,int vcpu); +int pre_kvm_run (kvm_context_t kvm,int vcpu); +int handle_io_window (kvm_context_t kvm); +int handle_debug (kvm_context_t kvm,int vcpu); +int try_push_interrupts (kvm_context_t kvm); +#endif
libkvm/libkvm.c +6 -6
@@ -754,7 +754,7 @@ static int handle_io(kvm_context_t kvm,return 0 ; } -static int handle_debug (kvm_context_t kvm,int vcpu) +int handle_debug (kvm_context_t kvm,int vcpu) {return kvm->callbacks->debug (kvm->opaque, vcpu); }
@@ -1039,17 +1039,17 @@ static int handle_mmio(kvm_context_t kvmreturn r; } -static int handle_io_window (kvm_context_t kvm) +int handle_io_window (kvm_context_t kvm) {return kvm->callbacks->io_window (kvm->opaque); } -static int handle_halt (kvm_context_t kvm,int vcpu) +int handle_halt (kvm_context_t kvm,int vcpu) {return kvm->callbacks->halt (kvm->opaque, vcpu); } -static int handle_shutdown (kvm_context_t kvm,int vcpu) +int handle_shutdown (kvm_context_t kvm,int vcpu) {return kvm->callbacks->shutdown (kvm->opaque, vcpu); }
@@ -1059,12 +1059,12 @@ int try_push_interrupts(kvm_context_t kvreturn kvm->callbacks->try_push_interrupts (kvm->opaque); } -static void post_kvm_run (kvm_context_t kvm,int vcpu) +void post_kvm_run (kvm_context_t kvm,int vcpu) { kvm->callbacks->post_kvm_run (kvm->opaque, vcpu); } -static int pre_kvm_run (kvm_context_t kvm,int vcpu) +int pre_kvm_run (kvm_context_t kvm,int vcpu) {return kvm->callbacks->pre_kvm_run (kvm->opaque, vcpu); }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move abi 10 functions to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367652 21600
# Node ID b1154d12bcc774520ed334f0b84934f1f4db7ce4
# Parent b0f337ae377c7e9050251057a88219d4877c159f
Move abi 10 functions to libkvm-x86.c
Move handle_io_abi_10 to libkvm-x86.c
Move handle_mmio_abi10 to libkvm-x86.c
Move kvm_run_abi10 to libkvm-x86.c
Move kvm_show_code to libkvm-x86.c
libkvm/kvm-x86.h +4 -0
@@ -38,4 +38,8 @@ void *kvm_create_kernel_phys_mem(kvm_convoid *kvm_create_kernel_phys_mem (kvm_context_t kvm,unsigned long phys_start,unsigned long len,int log,int writable); +int kvm_run_abi10 (kvm_context_t kvm,int vcpu); + +void kvm_show_code (kvm_context_t kvm,int vcpu); +#endif
libkvm/libkvm-x86.c +223 -1
238 lines not on this page · raw message
libkvm/libkvm.c +6 -218
258 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move msrs functions to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367653 21600
# Node ID cbe4ad07343fc1ef904f02734c68d0fb8506cb9e
# Parent b1154d12bcc774520ed334f0b84934f1f4db7ce4
Move msrs functions to libkvm-x86.c
This patch moves functions:
kvm_msr_list
move kvm_get_msrs
move kvm_set_msrs
libkvm/kvm-x86.h +4 -0
@@ -42,4 +42,8 @@ int kvm_run_abi10(kvm_context_t kvm, intvoid kvm_show_code (kvm_context_t kvm,int vcpu); +struct kvm_msr_list *kvm_get_msr_list (kvm_context_t ); +int kvm_get_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); +int kvm_set_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); +#endif
libkvm/libkvm-x86.c +68 -0
71 lines not on this page · raw message
libkvm/libkvm.c +0 -67
73 lines not on this page · raw message
libkvm/libkvm.h +0 -4
@@ -335,10 +335,6 @@ int kvm_get_sregs(kvm_context_t kvm, int*/ int kvm_set_sregs (kvm_context_t kvm,int vcpu,struct kvm_sregs *regs); -struct kvm_msr_list *kvm_get_msr_list (kvm_context_t ); -int kvm_get_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -int kvm_set_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -/*! * \brief Simulate an external vectored interrupt *
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: [PATCH 11 of 17] Move msrs functions to libkvm-x86.c
Quoted 6 lines · Jerone Young
Move msrs functions to
libkvm-x86.cThis patch moves functions:
kvm_msr_list
movekvm_get_msrs
movekvm_set_msrs
the problem is that with this the definitions were moved as well from libkvm.h to kvm-x86.h which is private and not meant to be exported outside of libkvm but those 3 functions are used by qemu-kvm.c as shown by :
/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c: In function `load_regs':/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:319:
warning: implicit declaration of function kvm_set_msrs' /var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c: In function save_regs':/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:457:
warning: implicit declaration of function kvm_get_msrs' /var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c: In function kvm_qemu_create_context':/var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:1020:
warning: implicit declaration of function `kvm_get_msr_list' /var/tmp/portage/app-emulation/kvm-51/work/kvm-51/qemu/qemu-kvm.c:1020:
warning: assignment makes pointer from integer without a cast
the following patch moves them to a new public arch specific header for libkvm named libkvm-x86.h and that needs to be installed in userspace as well but is not completely independent and would had been as well ifdef inside libkvm.h for simplicity.
Jerone or anyone else that is working in the architectural work care to comment?
Carlo
PS. tested in amd64
--
libkvm/Makefile +1 -0
@@ -26,6 +26,7 @@ libkvm.a: libkvm.o $(libkvm-$(ARCH)-objs) install: install -D libkvm.h $(DESTDIR)/$(PREFIX)/include/libkvm.h + install -D libkvm-x86.h $(DESTDIR)/$(PREFIX)/include/libkvm-x86.h install -D $(KERNELDIR)/include/linux/kvm.h \ $(DESTDIR)/$(PREFIX)/include/linux/kvm.h install -D $(KERNELDIR)/include/linux/kvm_para.h \
libkvm/kvm-x86.h +1 -6
@@ -19,8 +19,7 @@#define KVM_X86_H #include "kvm-common.h" - -#include "kvm-common.h" +#include "libkvm-x86.h" #define PAGE_SIZE 4096ul#define PAGE_MASK (~(PAGE_SIZE - 1))
@@ -42,8 +41,4 @@ int kvm_run_abi10(kvm_context_t kvm, int vcpu);void kvm_show_code (kvm_context_t kvm,int vcpu); -struct kvm_msr_list *kvm_get_msr_list (kvm_context_t ); -int kvm_get_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -int kvm_set_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -#endif
libkvm/libkvm-x86.h new file +12 -0
@@ -0,0 +1,12 @@ +/** \file libkvm-x86.h +* libkvm for x86 API +*/ + +#ifndef LIBKVM_X86_H +#define LIBKVM_X86_H + +struct kvm_msr_list *kvm_get_msr_list (kvm_context_t kvm); +int kvm_get_msrs (kvm_context_t kvm,int vcpu,struct kvm_msr_entry *msrs,int n); +int kvm_set_msrs (kvm_context_t kvm,int vcpu,struct kvm_msr_entry *msrs,int n); + +#endif
libkvm/libkvm.h +4 -0
@@ -19,6 +19,10 @@ struct kvm_context;typedef struct kvm_context *kvm_context_t ; +#if defined(__x86_64__) || defined(__i386__) +#include <libkvm-x86.h> +#endif +/*! * \brief KVM callbacks structure *
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: [PATCH 11 of 17] Move msrs functions to libkvm-x86.c
Quoted 10 lines · Carlo Marcelo Arenas Belon
Quoted 7 lines · Jerone Young
Move msrs functions to
libkvm-x86.cThis patch moves functions:
kvm_msr_list
movekvm_get_msrs
movekvm_set_msrs
Quoted 5 lines
the problem is that with this the definitions were moved as well from
libkvm.htokvm-x86.hwhich is private and not meant to be exported outside of libkvm but those 3 functions are used byqemu-kvm.cas shown by :
They need to be moved back to libkvm.h with a #ifdef. And to the #ifdef purists I say: deorbit.
Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 4732A4AE.30100-atKUWr5tajBWk0Htik3J/[email protected]
PATCH 1/1 make msrs functions public for x86
This patch partially reverts 9105435f46ca4e110237eae57272e4f5deaf8dd6 so that kvm_msr_list, kvm_get_msrs and kvm_set_msrs are again public and visible in userspace for x86 as they are used by qemu-kvm
--- libkvm/kvm-x86.h | 4 ---- libkvm/libkvm.h | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-)
libkvm/kvm-x86.h +0 -4
@@ -42,8 +42,4 @@ int kvm_run_abi10(kvm_context_t kvm, int vcpu);void kvm_show_code (kvm_context_t kvm,int vcpu); -struct kvm_msr_list *kvm_get_msr_list (kvm_context_t ); -int kvm_get_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -int kvm_set_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -#endif
libkvm/libkvm.h +6 -0
@@ -19,6 +19,12 @@ struct kvm_context;typedef struct kvm_context *kvm_context_t ; +#if defined(__x86_64__) || defined(__i386__) +struct kvm_msr_list *kvm_get_msr_list (kvm_context_t ); +int kvm_get_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); +int kvm_set_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); +#endif +/*! * \brief KVM callbacks structure *
Signature · 8 lines
1.5.2.5 ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Avi Kivity
AppliedRe: [PATCH] make msrs functions public for x86
Quoted 4 lines · Carlo Marcelo Arenas Belon
This patch partially reverts
9105435f46ca4e110237eae57272e4f5deaf8dd6so thatkvm_msr_list,kvm_get_msrsandkvm_set_msrsare again public and visible in userspace for x86 as they are used by qemu-kvm
Applied, thanks.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: [PATCH] make msrs functions public for x86
In reply to Carlo Marcelo Arenas BelonThis would be my bad. Things kept changing and I didn't put these back into libkvm.h.
Quoted 30 lines · Carlo Marcelo Arenas Belon
This patch partially reverts
9105435f46ca4e110237eae57272e4f5deaf8dd6so thatkvm_msr_list,kvm_get_msrsandkvm_set_msrsare again public and visible in userspace for x86 as they are used by qemu-kvmSigned-off-by Carlo Marcelo Arenas Belon <[email protected]>--- libkvm/kvm-x86.h | 4 ---- libkvm/libkvm.h | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-)libkvm/kvm-x86.h +0
-4@@ -42,8 +42,4 @@ int kvm_run_abi10(kvm_context_t kvm, int vcpu);void kvm_show_code (kvm_context_t kvm,int vcpu); -struct kvm_msr_list *kvm_get_msr_list (kvm_context_t ); -int kvm_get_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -int kvm_set_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); -#endif libkvm/libkvm.h +0
-0@@ -19,6 +19,12 @@ struct kvm_context;typedef struct kvm_context *kvm_context_t ;
libkvm/libkvm.h struct kvm_context; · line 30
Quoted 10 lines
libkvm/libkvm.h +6
-0+#if defined(__x86_64__) || defined(__i386__) +struct kvm_msr_list *kvm_get_msr_list (kvm_context_t ); +int kvm_get_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); +int kvm_set_msrs (kvm_context_t ,int vcpu,struct kvm_msr_entry *msrs,int n); +#endif +/*! * \brief KVM callbacks structure *
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: [PATCH 11 of 17] Move msrs functions to libkvm-x86.c
In reply to a message not in the archiveQuoted 11 lines · Avi Kivity
Quoted 10 lines · Carlo Marcelo Arenas Belon
Quoted 7 lines · Jerone Young
Move msrs functions to
libkvm-x86.cThis patch moves functions:
kvm_msr_list
movekvm_get_msrs
movekvm_set_msrs
Quoted 8 lines
Quoted 5 lines
the problem is that with this the definitions were moved as well from
libkvm.htokvm-x86.hwhich is private and not meant to be exported outside of libkvm but those 3 functions are used byqemu-kvm.cas shown by :They need to be moved back to
libkvm.hwith a #ifdef. And to the #ifdef purists I say: deorbit.
Re-entry is looking rough; things are much better up here. ;)
Anyways, you don't need to ifdef a prototype; just don't call it.
Also, naming them kvm_x86_get_msrs() and kvm_x86_set_msrs() would be a much better warning sign for callers.
Signature · 9 lines
Hollis Blanchard IBM Linux Technology Center ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Re: [PATCH 11 of 17] Move msrs functions to libkvm-x86.c
Quoted 21 lines · Hollis Blanchard
Quoted 19 lines · Avi Kivity
Quoted 17 lines · Carlo Marcelo Arenas Belon
Quoted 8 lines · Jerone Young
Move msrs functions to
libkvm-x86.cThis patch moves functions:
kvm_msr_list
movekvm_get_msrs
movekvm_set_msrsthe problem is that with this the definitions were moved as well from
libkvm.htokvm-x86.hwhich is private and not meant to be exported outside of libkvm but those 3 functions are used byqemu-kvm.cas shown by :
Quoted 8 lines
Quoted 3 lines
They need to be moved back to
libkvm.hwith a #ifdef. And to the #ifdef purists I say: deorbit.Re-entry is looking rough; things are much better up here. ;)
Anyways, you don't need to ifdef a prototype; just don't call it.
See, that's what I meant: you're willing to turn a compile error into a link error just because you dislike #ifdefs.
There are some things the preprocessor does well, there's no need to ban it just because it is often abused.
Quoted 3 lines
Also, naming them
kvm_x86_get_msrs()andkvm_x86_set_msrs()would be a much better warning sign for callers.
The rename makes sense, in addition to guarding the prototypes.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move print_seg & Move kvm_show_regs to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367653 21600
# Node ID 5148847d713a7108527906df774e35a042853ad1
# Parent cbe4ad07343fc1ef904f02734c68d0fb8506cb9e
Move print_seg & Move kvm_show_regs to libkvm-x86.c
This patch moves functions print_seg, kvm_show_regs, & print_dt to libkvm-x86.c. Since kvm_show_regs really has little to no shared code (besides an ioctl call and variable declarations), it is best that this be moved into arch specific code.
libkvm/libkvm-x86.c +60 -0
@@ -644,3 +644,63 @@ int kvm_set_msrs(kvm_context_t kvm, intreturn r; } +static void print_seg (FILE *file,const char *name,struct kvm_segment *seg) +{ +fprintf (stderr, +"%s %04x (%08llx/%08x p %d dpl %d db %d s %d type %x l %d" +" g %d avl %d)\n" , + name, seg->selector, seg->base, seg->limit, seg->present, + seg->dpl, seg->db, seg->s, seg->type, seg->l, seg->g, + seg->avl); +} + +static void print_dt (FILE *file,const char *name,struct kvm_dtable *dt) +{ +fprintf (stderr,"%s %llx/%x\n" , name, dt->base, dt->limit); +} + +void kvm_show_regs (kvm_context_t kvm,int vcpu) +{ +int fd = kvm->vcpu_fd[vcpu]; +struct kvm_regs regs; +struct kvm_sregs sregs; +int r; + + r =ioctl (fd,KVM_GET_REGS , ®s); +if (r ==-1 ) { +perror ("KVM_GET_REGS" ); +return ; + } +fprintf (stderr, +"rax %016llx rbx %016llx rcx %016llx rdx %016llx\n" +"rsi %016llx rdi %016llx rsp %016llx rbp %016llx\n" +"r8 %016llx r9 %016llx r10 %016llx r11 %016llx\n" +"r12 %016llx r13 %016llx r14 %016llx r15 %016llx\n" +"rip %016llx rflags %08llx\n" , + regs.rax, regs.rbx, regs.rcx, regs.rdx, + regs.rsi, regs.rdi, regs.rsp, regs.rbp, + regs.r8, regs.r9, regs.r10, regs.r11, + regs.r12, regs.r13, regs.r14, regs.r15, + regs.rip, regs.rflags); + r =ioctl (fd,KVM_GET_SREGS , &sregs); +if (r ==-1 ) { +perror ("KVM_GET_SREGS" ); +return ; + } +print_seg (stderr,"cs" , &sregs.cs); +print_seg (stderr,"ds" , &sregs.ds); +print_seg (stderr,"es" , &sregs.es); +print_seg (stderr,"ss" , &sregs.ss); +print_seg (stderr,"fs" , &sregs.fs); +print_seg (stderr,"gs" , &sregs.gs); +print_seg (stderr,"tr" , &sregs.tr); +print_seg (stderr,"ldt" , &sregs.ldt); +print_dt (stderr,"gdt" , &sregs.gdt); +print_dt (stderr,"idt" , &sregs.idt); +fprintf (stderr,"cr0 %llx cr2 %llx cr3 %llx cr4 %llx cr8 %llx" +" efer %llx\n" , + sregs.cr0, sregs.cr2, sregs.cr3, sregs.cr4, sregs.cr8, + sregs.efer); +} + +
libkvm/libkvm.c +0 -59
65 lines not on this page · raw message
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Declare kvm_abi as a global variable in kvm-common.h
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367654 21600
# Node ID 3c691b26a79c2e589e20d5c8245a7c30ec456976
# Parent 5148847d713a7108527906df774e35a042853ad1
Declare kvm_abi as a global variable in kvm-common.h
libkvm/kvm-common.h +2 -0
@@ -21,6 +21,8 @@#define KVM_MAX_NUM_MEM_REGIONS 8u#define MAX_VCPUS 4 +/* kvm abi verison variable */ +extern int kvm_abi;/** * \brief The KVM context
libkvm/libkvm.c +1 -1
@@ -41,7 +41,7 @@#include "kvm-x86.h" #endif -static int kvm_abi =EXPECTED_KVM_API_VERSION ; +int kvm_abi =EXPECTED_KVM_API_VERSION ;int free_slots[KVM_MAX_NUM_MEM_REGIONS ];unsigned long phys_addr_slots[KVM_MAX_NUM_MEM_REGIONS ];
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move kvm_get_apic to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367655 21600
# Node ID 7ef9d60771ef7e6d32919ace92d078a482b9d589
# Parent 3c691b26a79c2e589e20d5c8245a7c30ec456976
Move kvm_get_apic to libkvm-x86.c
Moves apic function since it is x86 only.
libkvm/libkvm-x86.c +9 -1
@@ -703,4 +703,12 @@ void kvm_show_regs(kvm_context_t kvm, in sregs.efer); } - +uint64_t kvm_get_apic_base (kvm_context_t kvm,int vcpu) +{ +struct kvm_run *run = kvm->run[vcpu]; + +if (kvm_abi ==10 ) +return ((struct kvm_run_abi10 *)run)->apic_base; +return run->apic_base; +} +
libkvm/libkvm.c +0 -9
@@ -815,15 +815,6 @@ int kvm_get_interrupt_flag(kvm_context_treturn run->if_flag; } -uint64_t kvm_get_apic_base (kvm_context_t kvm,int vcpu) -{ -struct kvm_run *run = kvm->run[vcpu]; - -if (kvm_abi ==10 ) -return ((struct kvm_run_abi10 *)run)->apic_base; -return run->apic_base; -} -int kvm_is_ready_for_interrupt_injection (kvm_context_t kvm,int vcpu) {struct kvm_run *run = kvm->run[vcpu];
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move cr8 functions to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367666 21600
# Node ID f610c78e9f363a53b3e9677aa84873b05a692acb
# Parent 7ef9d60771ef7e6d32919ace92d078a482b9d589
Move cr8 functions to libkvm-x86.c
This patch moves functions:
kvm_set_cr8 kvm_get_cr8
cr8 is an x86 only register.
libkvm/libkvm-x86.c +16 -0
@@ -712,3 +712,19 @@ uint64_t kvm_get_apic_base(kvm_context_treturn run->apic_base; } +void kvm_set_cr8 (kvm_context_t kvm,int vcpu,uint64_t cr8) +{ +struct kvm_run *run = kvm->run[vcpu]; + +if (kvm_abi ==10 ) { + ((struct kvm_run_abi10 *)run)->cr8 = cr8; +return ; + } + run->cr8 = cr8; +} + +__u64 kvm_get_cr8 (kvm_context_t kvm,int vcpu) +{ +return kvm->run[vcpu]->cr8; +} +
libkvm/libkvm.c +0 -16
@@ -824,22 +824,6 @@ int kvm_is_ready_for_interrupt_injectionreturn run->ready_for_interrupt_injection; } -void kvm_set_cr8 (kvm_context_t kvm,int vcpu,uint64_t cr8) -{ -struct kvm_run *run = kvm->run[vcpu]; - -if (kvm_abi ==10 ) { - ((struct kvm_run_abi10 *)run)->cr8 = cr8; -return ; - } - run->cr8 = cr8; -} - -__u64 kvm_get_cr8 (kvm_context_t kvm,int vcpu) -{ -return kvm->run[vcpu]->cr8; -} -int kvm_run (kvm_context_t kvm,int vcpu) {int r;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Move kvm_setup_cpuid to libkvm-x86.c
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367666 21600
# Node ID 43dc6f59e0944c18b2cbd092c819b4141889ee61
# Parent f610c78e9f363a53b3e9677aa84873b05a692acb
Move kvm_setup_cpuid to libkvm-x86.c
cpuid is an x86 instruction, so needs to go
in the approriate place.
libkvm/libkvm-x86.c +18 -0
@@ -728,3 +728,21 @@ __u64 kvm_get_cr8(kvm_context_t kvm, intreturn kvm->run[vcpu]->cr8; } +int kvm_setup_cpuid (kvm_context_t kvm,int vcpu,int nent, +struct kvm_cpuid_entry *entries) +{ +struct kvm_cpuid *cpuid; +int r; + + cpuid =malloc (sizeof (*cpuid) + nent *sizeof (*entries)); +if (!cpuid) +return -ENOMEM ; + + cpuid->nent = nent; +memcpy (cpuid->entries, entries, nent *sizeof (*entries)); + r =ioctl (kvm->vcpu_fd[vcpu],KVM_SET_CPUID , cpuid); + +free (cpuid); +return r; +} +
libkvm/libkvm.c +0 -18
@@ -919,24 +919,6 @@ int kvm_guest_debug(kvm_context_t kvm, ireturn ioctl (kvm->vcpu_fd[vcpu],KVM_DEBUG_GUEST , dbg); } -int kvm_setup_cpuid (kvm_context_t kvm,int vcpu,int nent, -struct kvm_cpuid_entry *entries) -{ -struct kvm_cpuid *cpuid; -int r; - - cpuid =malloc (sizeof (*cpuid) + nent *sizeof (*entries)); -if (!cpuid) -return -ENOMEM ; - - cpuid->nent = nent; -memcpy (cpuid->entries, entries, nent *sizeof (*entries)); - r =ioctl (kvm->vcpu_fd[vcpu],KVM_SET_CPUID , cpuid); - -free (cpuid); -return r; -} -int kvm_set_signal_mask (kvm_context_t kvm,int vcpu,const sigset_t *sigset) {struct kvm_signal_mask *sigmask;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
PATCH 1/1 Remove unsued inclusion of linux/kvm_parah.h in userspace libkvm.h
In reply to Jerone Young# HG changeset patch
# User Jerone Young <jyoung5-r/[email protected]> # Date 1194367666 21600
# Node ID 93b712e019dcfa0fa425353e972fb404b4750278
# Parent 43dc6f59e0944c18b2cbd092c819b4141889ee61
Remove unsued inclusion of linux/kvm_parah.h in userspace libkvm.h
This remove unused code from libkvm.h.
libkvm/libkvm.h +0 -8
@@ -12,14 +12,6 @@#endif #include <linux/kvm.h> - -#define u32 uint32_t/* older kvm_para.h had a u32 exposed */ -#define u64 uint32_t/* older kvm_para.h had a u32 exposed */ -#define PAGE_SIZE 4096 -#include <linux/kvm_para.h> -#undef u32 -#undef u64 -#undef PAGE_SIZE#include <signal.h>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Quoted 10 lines · Jerone Young
Here is the 4th revision of the refactoring of libkvm. This revision changes since the 3rd revision:
- removeslibkvm-x86.h
- keeps functionskvm_create_default_phys_mem&kvm_create_phys_memin place
- addedkvm_arch_create_default_phys_mem
- Adds needed copyrights to new files
- Adds void toslots()--> slots(void) decleartions
Applied the lot; thanks.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/