public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00 of 27] Refactor libkvm code Phase 1
@ 2007-10-31 17:05 Jerone Young
  2007-10-31 17:05 ` [PATCH 01 of 27] Move kvm_context to kvmctl.h Jerone Young
                   ` (28 more replies)
  0 siblings, 29 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Kaniciwa!
        I am here to once again bring great honorable patches to refactor
libkvm x86 code. Patches that I sent in the past for this really took
the wrong approach, and also many variables that I was splitting out actually
could be shared amongst many architectures.

        This is the first phase as much of the code is tightly written for x86 
but can be reused by other archs, it's just a matter of an agreed upon method.
Also since there are about 27 of these lets get through these before moving
through more.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 01 of 27] Move kvm_context to kvmctl.h
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:37   ` Hollis Blanchard
  2007-10-31 22:33   ` Avi Kivity
  2007-10-31 17:05 ` [PATCH 02 of 27] Make static slot & kvm_memory region funcions public Jerone Young
                   ` (27 subsequent siblings)
  28 siblings, 2 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849563 18000
# Node ID 19a7c6d2ddfd1383aeb8a9bc09d9fe0673e7f9cc
# Parent  c3d6e1e2b8a0368485badcde0e55a82d9b1897d1
Move kvm_context to kvmctl.h

This patch moves kvm_context from kvmctl.c to kvmctl.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 kvmctl-x86.h. As these
are closely associated with the architecture.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/Makefile b/libkvm/Makefile
--- a/libkvm/Makefile
+++ b/libkvm/Makefile
@@ -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:
diff --git a/libkvm/config-i386.mak b/libkvm/config-i386.mak
--- a/libkvm/config-i386.mak
+++ b/libkvm/config-i386.mak
@@ -1,2 +1,3 @@
+libkvm-$(ARCH)-objs := libkvm-x86.o
 
 LIBDIR := /lib
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
new file mode 100644
--- /dev/null
+++ b/libkvm/libkvm-x86.h
@@ -0,0 +1,7 @@
+#ifndef KVMCTL_X86_H
+#define KVMCTL_X86_H
+
+#define KVM_MAX_NUM_MEM_REGIONS 8u
+#define MAX_VCPUS 4
+
+#endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -44,36 +44,8 @@ static int kvm_abi = EXPECTED_KVM_API_VE
 
 /* FIXME: share this number with kvm */
 /* FIXME: or dynamically alloc/realloc regions */
-#define KVM_MAX_NUM_MEM_REGIONS 8u
 int 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()
 {
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -1,4 +1,4 @@
-/** \file kvmctl.h
+/** \file libkvm.h
  * libkvm API
  */
 
@@ -26,6 +26,40 @@ struct kvm_context;
 struct kvm_context;
 
 typedef struct kvm_context *kvm_context_t;
+
+/* Add info from arch specific header */
+#if defined(__x86_64__) || defined(__i386__)
+#include "libkvm-x86.h"
+#endif
+
+
+/**
+ * \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;
+};
+
 
 /*!
  * \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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 02 of 27] Make static slot & kvm_memory region funcions public
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
  2007-10-31 17:05 ` [PATCH 01 of 27] Move kvm_context to kvmctl.h Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-11-01 12:41   ` Avi Kivity
  2007-10-31 17:05 ` [PATCH 03 of 27] Move fuction kvm_alloc_kernel_memory to kvmctl-x86.c Jerone Young
                   ` (26 subsequent siblings)
  28 siblings, 1 reply; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849563 18000
# Node ID 9c74b8e493e67f544c017b6bef8dd047c128c8d3
# Parent  19a7c6d2ddfd1383aeb8a9bc09d9fe0673e7f9cc
Make static slot & kvm_memory region funcions public

This patch changes static functions for manipulation of memory slots
and regions public in kvmctl.c. This also makes a decleration for these
functions in kvmctl.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).

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -47,7 +47,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()
 {
 	int i;
 
@@ -55,7 +55,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;
@@ -82,13 +82,13 @@ static int get_free_slot(kvm_context_t k
 	return -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;
 
@@ -101,7 +101,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)) {
@@ -113,7 +113,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;
@@ -127,7 +127,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__);
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -556,6 +556,18 @@ int kvm_get_lapic(kvm_context_t kvm, int
  */
 int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s);
 
+
+void init_slots();
+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
 
 #endif

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 03 of 27] Move fuction kvm_alloc_kernel_memory to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
  2007-10-31 17:05 ` [PATCH 01 of 27] Move kvm_context to kvmctl.h Jerone Young
  2007-10-31 17:05 ` [PATCH 02 of 27] Make static slot & kvm_memory region funcions public Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 04 of 27] Move kvm_alloc_userspace_memory " Jerone Young
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID c2ae34bff407fe7e3cfc695efdd1cfd4e2242403
# Parent  9c74b8e493e67f544c017b6bef8dd047c128c8d3
Move fuction kvm_alloc_kernel_memory to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
new file mode 100644
--- /dev/null
+++ b/libkvm/libkvm-x86.c
@@ -0,0 +1,81 @@
+#include "libkvm.h"
+#include <unistd.h>
+#include <stropts.h>
+#include <sys/mman.h>
+#include <stdio.h>
+
+int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
+								void **vm_mem)
+{
+	unsigned long dosmem = 0xa0000;
+	unsigned long exmem = 0xc0000;
+	unsigned long pcimem = 0xe0000000;
+	int r;
+	int tss_ext;
+	struct kvm_memory_region low_memory = {
+		.memory_size = memory  < dosmem ? memory : dosmem,
+		.guest_phys_addr = 0,
+	};
+	struct kvm_memory_region extended_memory = {
+		.memory_size = memory < exmem ? 0 : memory - exmem,
+		.guest_phys_addr = exmem,
+	};
+	struct kvm_memory_region above_4g_memory = {
+		.memory_size = memory < pcimem ? 0 : memory - pcimem,
+		.guest_phys_addr = 0x100000000ULL,
+	};
+
+#ifdef KVM_CAP_SET_TSS_ADDR
+	tss_ext = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
+#else
+	tss_ext = 0;
+#endif
+
+	if (memory >= pcimem)
+		extended_memory.memory_size = pcimem - exmem;
+
+	/* 640K should be enough. */
+	low_memory.slot = get_free_slot(kvm);
+	r = ioctl(kvm->vm_fd, KVM_SET_MEMORY_REGION, &low_memory);
+	if (r == -1) {
+		fprintf(stderr, "kvm_create_memory_region: %m\n");
+		return -1;
+	}
+	register_slot(low_memory.slot, low_memory.guest_phys_addr);
+
+	if (extended_memory.memory_size) {
+		if (tss_ext > 0)
+			extended_memory.slot = get_free_slot(kvm);
+		else
+			extended_memory.slot = 0;
+		r = ioctl(kvm->vm_fd, KVM_SET_MEMORY_REGION, &extended_memory);
+		if (r == -1) {
+			fprintf(stderr, "kvm_create_memory_region: %m\n");
+			return -1;
+		}
+		register_slot(extended_memory.slot,
+			      extended_memory.guest_phys_addr);
+	}
+
+	if (above_4g_memory.memory_size) {
+		above_4g_memory.slot = get_free_slot(kvm);
+		r = ioctl(kvm->vm_fd, KVM_SET_MEMORY_REGION, &above_4g_memory);
+		if (r == -1) {
+			fprintf(stderr, "kvm_create_memory_region: %m\n");
+			return -1;
+		}
+		register_slot(above_4g_memory.slot,
+			      above_4g_memory.guest_phys_addr);
+	}
+
+	kvm_memory_region_save_params(kvm, &low_memory);
+	kvm_memory_region_save_params(kvm, &extended_memory);
+	kvm_memory_region_save_params(kvm, &above_4g_memory);
+	if (above_4g_memory.memory_size)
+		kvm_memory_region_save_params(kvm, &above_4g_memory);
+
+	*vm_mem = mmap(NULL, memory, PROT_READ|PROT_WRITE, MAP_SHARED, kvm->vm_fd, 0);
+
+	return 0;
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -1,7 +1,15 @@
 #ifndef KVMCTL_X86_H
 #define KVMCTL_X86_H
 
+/* FIXME: share this number with kvm */
+/* FIXME: or dynamically alloc/realloc regions */
 #define KVM_MAX_NUM_MEM_REGIONS 8u
 #define MAX_VCPUS 4
 
+#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
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -39,11 +39,6 @@
 
 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 */
 int free_slots[KVM_MAX_NUM_MEM_REGIONS];
 unsigned long phys_addr_slots[KVM_MAX_NUM_MEM_REGIONS];
 
@@ -317,82 +312,6 @@ int kvm_get_shadow_pages(kvm_context_t k
 #endif
 	return -1;
 }
-
-int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
-								void **vm_mem)
-{
-	unsigned long dosmem = 0xa0000;
-	unsigned long exmem = 0xc0000;
-	unsigned long pcimem = 0xe0000000;
-	int r;
-	int tss_ext;
-	struct kvm_memory_region low_memory = {
-		.memory_size = memory  < dosmem ? memory : dosmem,
-		.guest_phys_addr = 0,
-	};
-	struct kvm_memory_region extended_memory = {
-		.memory_size = memory < exmem ? 0 : memory - exmem,
-		.guest_phys_addr = exmem,
-	};
-	struct kvm_memory_region above_4g_memory = {
-		.memory_size = memory < pcimem ? 0 : memory - pcimem,
-		.guest_phys_addr = 0x100000000ULL,
-	};
-
-#ifdef KVM_CAP_SET_TSS_ADDR
-	tss_ext = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
-#else
-	tss_ext = 0;
-#endif
-
-	if (memory >= pcimem)
-		extended_memory.memory_size = pcimem - exmem;
-
-	/* 640K should be enough. */
-	low_memory.slot = get_free_slot(kvm);
-	r = ioctl(kvm->vm_fd, KVM_SET_MEMORY_REGION, &low_memory);
-	if (r == -1) {
-		fprintf(stderr, "kvm_create_memory_region: %m\n");
-		return -1;
-	}
-	register_slot(low_memory.slot, low_memory.guest_phys_addr);
-
-	if (extended_memory.memory_size) {
-		if (tss_ext > 0)
-			extended_memory.slot = get_free_slot(kvm);
-		else
-			extended_memory.slot = 0;
-		r = ioctl(kvm->vm_fd, KVM_SET_MEMORY_REGION, &extended_memory);
-		if (r == -1) {
-			fprintf(stderr, "kvm_create_memory_region: %m\n");
-			return -1;
-		}
-		register_slot(extended_memory.slot,
-			      extended_memory.guest_phys_addr);
-	}
-
-	if (above_4g_memory.memory_size) {
-		above_4g_memory.slot = get_free_slot(kvm);
-		r = ioctl(kvm->vm_fd, KVM_SET_MEMORY_REGION, &above_4g_memory);
-		if (r == -1) {
-			fprintf(stderr, "kvm_create_memory_region: %m\n");
-			return -1;
-		}
-		register_slot(above_4g_memory.slot,
-			      above_4g_memory.guest_phys_addr);
-	}
-
-	kvm_memory_region_save_params(kvm, &low_memory);
-	kvm_memory_region_save_params(kvm, &extended_memory);
-	if (above_4g_memory.memory_size)
-		kvm_memory_region_save_params(kvm, &above_4g_memory);
-
-	*vm_mem = mmap(NULL, memory, PROT_READ|PROT_WRITE, MAP_SHARED, kvm->vm_fd, 0);
-
-	return 0;
-}
-
-#ifdef KVM_CAP_USER_MEMORY
 
 int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory,
 								void **vm_mem)

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 04 of 27] Move kvm_alloc_userspace_memory to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (2 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 03 of 27] Move fuction kvm_alloc_kernel_memory to kvmctl-x86.c Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 05 of 27] Move kvm_set_tss_addr " Jerone Young
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 70351a5f6af9602918e3e2475ca97574a83dbcac
# Parent  c2ae34bff407fe7e3cfc695efdd1cfd4e2242403
Move kvm_alloc_userspace_memory to kvmctl-x86.c

This moves x86 specific function kvm_alloc_userspace_memory() out
of kvmctl.c into kvmctl-x86.c.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -79,3 +79,106 @@ int kvm_alloc_kernel_memory(kvm_context_
 	return 0;
 }
 
+#ifdef KVM_CAP_USER_MEMORY
+
+int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory,
+								void **vm_mem)
+{
+	unsigned long dosmem = 0xa0000;
+	unsigned long exmem = 0xc0000;
+	unsigned long pcimem = 0xe0000000;
+	int r;
+	int tss_ext;
+	struct kvm_userspace_memory_region low_memory = {
+		.memory_size = memory  < dosmem ? memory : dosmem,
+		.guest_phys_addr = 0,
+	};
+	struct kvm_userspace_memory_region extended_memory = {
+		.memory_size = memory < exmem ? 0 : memory - exmem,
+		.guest_phys_addr = exmem,
+	};
+	struct kvm_userspace_memory_region above_4g_memory = {
+		.memory_size = memory < pcimem ? 0 : memory - pcimem,
+		.guest_phys_addr = 0x100000000ULL,
+	};
+
+#ifdef KVM_CAP_SET_TSS_ADDR
+	tss_ext = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
+#else
+	tss_ext = 0;
+#endif
+
+	if (memory >= pcimem) {
+		extended_memory.memory_size = pcimem - exmem;
+		*vm_mem = mmap(NULL, memory + 0x100000000ULL - pcimem,
+				PROT_READ|PROT_WRITE, MAP_ANONYMOUS |
+							MAP_SHARED, -1, 0);
+	}
+	else
+		*vm_mem = mmap(NULL, memory, PROT_READ|PROT_WRITE, MAP_ANONYMOUS
+							| MAP_SHARED, -1, 0);
+	if (*vm_mem == MAP_FAILED) {
+		fprintf(stderr, "kvm_alloc_userspace_memory: %s", strerror(errno));
+		return -1;
+	}
+
+	low_memory.userspace_addr = (unsigned long)*vm_mem;
+	low_memory.slot = get_free_slot(kvm);
+	/* 640K should be enough. */
+	r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &low_memory);
+	if (r == -1) {
+		fprintf(stderr, "kvm_create_memory_region: %m\n");
+		return -1;
+	}
+	register_slot(low_memory.slot, low_memory.guest_phys_addr);
+
+	if (extended_memory.memory_size) {
+		r = munmap(*vm_mem + dosmem, exmem - dosmem);
+		if (r == -1) {
+			fprintf(stderr, "kvm_alloc_userspace_memory: %s",
+							strerror(errno));
+			return -1;
+		}
+		extended_memory.userspace_addr = (unsigned long)(*vm_mem + exmem);
+		if (tss_ext > 0)
+			extended_memory.slot = get_free_slot(kvm);
+		else
+			extended_memory.slot = 0;
+		r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &extended_memory);
+		if (r == -1) {
+			fprintf(stderr, "kvm_create_memory_region: %m\n");
+			return -1;
+		}
+		register_slot(extended_memory.slot,
+			      extended_memory.guest_phys_addr);
+	}
+
+	if (above_4g_memory.memory_size) {
+		r = munmap(*vm_mem + pcimem, 0x100000000ULL - pcimem);
+		if (r == -1) {
+			fprintf(stderr, "kvm_alloc_userspace_memory: %s",
+							strerror(errno));
+			return -1;
+		}
+		above_4g_memory.userspace_addr = (unsigned long)(*vm_mem + 0x100000000ULL);
+		above_4g_memory.slot = get_free_slot(kvm);
+		r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &above_4g_memory);
+		if (r == -1) {
+			fprintf(stderr, "kvm_create_memory_region: %m\n");
+			return -1;
+		}
+		register_slot(above_4g_memory.slot,
+			      above_4g_memory.guest_phys_addr);
+	}
+
+	kvm_userspace_memory_region_save_params(kvm, &low_memory);
+	kvm_userspace_memory_region_save_params(kvm, &extended_memory);
+	kvm_userspace_memory_region_save_params(kvm, &above_4g_memory);
+	if (above_4g_memory.memory_size)
+		kvm_userspace_memory_region_save_params(kvm, &above_4g_memory);
+
+	return 0;
+}
+
+#endif
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -11,5 +11,7 @@
 
 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
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -312,106 +312,6 @@ int kvm_get_shadow_pages(kvm_context_t k
 #endif
 	return -1;
 }
-
-int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory,
-								void **vm_mem)
-{
-	unsigned long dosmem = 0xa0000;
-	unsigned long exmem = 0xc0000;
-	unsigned long pcimem = 0xe0000000;
-	int r;
-	int tss_ext;
-	struct kvm_userspace_memory_region low_memory = {
-		.memory_size = memory  < dosmem ? memory : dosmem,
-		.guest_phys_addr = 0,
-	};
-	struct kvm_userspace_memory_region extended_memory = {
-		.memory_size = memory < exmem ? 0 : memory - exmem,
-		.guest_phys_addr = exmem,
-	};
-	struct kvm_userspace_memory_region above_4g_memory = {
-		.memory_size = memory < pcimem ? 0 : memory - pcimem,
-		.guest_phys_addr = 0x100000000ULL,
-	};
-
-#ifdef KVM_CAP_SET_TSS_ADDR
-	tss_ext = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
-#else
-	tss_ext = 0;
-#endif
-
-	if (memory >= pcimem) {
-		extended_memory.memory_size = pcimem - exmem;
-		*vm_mem = mmap(NULL, memory + 0x100000000ULL - pcimem,
-				PROT_READ|PROT_WRITE, MAP_ANONYMOUS |
-							MAP_SHARED, -1, 0);
-	}
-	else
-		*vm_mem = mmap(NULL, memory, PROT_READ|PROT_WRITE, MAP_ANONYMOUS
-							| MAP_SHARED, -1, 0);
-	if (*vm_mem == MAP_FAILED) {
-		fprintf(stderr, "kvm_alloc_userspace_memory: %s", strerror(errno));
-		return -1;
-	}
-
-	low_memory.userspace_addr = (unsigned long)*vm_mem;
-	low_memory.slot = get_free_slot(kvm);
-	/* 640K should be enough. */
-	r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &low_memory);
-	if (r == -1) {
-		fprintf(stderr, "kvm_create_memory_region: %m\n");
-		return -1;
-	}
-	register_slot(low_memory.slot, low_memory.guest_phys_addr);
-
-	if (extended_memory.memory_size) {
-		r = munmap(*vm_mem + dosmem, exmem - dosmem);
-		if (r == -1) {
-			fprintf(stderr, "kvm_alloc_userspace_memory: %s",
-							strerror(errno));
-			return -1;
-		}
-		extended_memory.userspace_addr = (unsigned long)(*vm_mem + exmem);
-		if (tss_ext > 0)
-			extended_memory.slot = get_free_slot(kvm);
-		else
-			extended_memory.slot = 0;
-		r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &extended_memory);
-		if (r == -1) {
-			fprintf(stderr, "kvm_create_memory_region: %m\n");
-			return -1;
-		}
-		register_slot(extended_memory.slot,
-			      extended_memory.guest_phys_addr);
-	}
-
-	if (above_4g_memory.memory_size) {
-		r = munmap(*vm_mem + pcimem, 0x100000000ULL - pcimem);
-		if (r == -1) {
-			fprintf(stderr, "kvm_alloc_userspace_memory: %s",
-							strerror(errno));
-			return -1;
-		}
-		above_4g_memory.userspace_addr = (unsigned long)(*vm_mem + 0x100000000ULL);
-		above_4g_memory.slot = get_free_slot(kvm);
-		r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &above_4g_memory);
-		if (r == -1) {
-			fprintf(stderr, "kvm_create_memory_region: %m\n");
-			return -1;
-		}
-		register_slot(above_4g_memory.slot,
-			      above_4g_memory.guest_phys_addr);
-	}
-
-	kvm_userspace_memory_region_save_params(kvm, &low_memory);
-	kvm_userspace_memory_region_save_params(kvm, &extended_memory);
-	if (above_4g_memory.memory_size)
-		kvm_userspace_memory_region_save_params(kvm, &above_4g_memory);
-
-	return 0;
-}
-
-#endif
 
 int kvm_create_vm(kvm_context_t kvm)
 {

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 05 of 27] Move kvm_set_tss_addr to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (3 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 04 of 27] Move kvm_alloc_userspace_memory " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 06 of 27] imported patch move_kvm_set_init_tss Jerone Young
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 4d8d1bd969dc9a1f2ad3b983d7e63172bee64fd4
# Parent  70351a5f6af9602918e3e2475ca97574a83dbcac
Move kvm_set_tss_addr to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -182,3 +182,22 @@ int kvm_alloc_userspace_memory(kvm_conte
 
 #endif
 
+
+int kvm_set_tss_addr(kvm_context_t kvm, unsigned long addr)
+{
+#ifdef KVM_CAP_SET_TSS_ADDR
+	int r;
+
+	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
+	if (r > 0) {
+		r = ioctl(kvm->vm_fd, KVM_SET_TSS_ADDR, addr);
+		if (r == -1) {
+			fprintf(stderr, "kvm_set_tss_addr: %m\n");
+			return -errno;
+		}
+		return 0;
+	}
+#endif
+	return -ENOSYS;
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -13,5 +13,6 @@ int kvm_alloc_kernel_memory(kvm_context_
                                                                 void **vm_mem);
 int 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
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -328,23 +328,6 @@ int kvm_create_vm(kvm_context_t kvm)
 	return 0;
 }
 
-int kvm_set_tss_addr(kvm_context_t kvm, unsigned long addr)
-{
-#ifdef KVM_CAP_SET_TSS_ADDR
-	int r;
-
-	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
-	if (r > 0) {
-		r = ioctl(kvm->vm_fd, KVM_SET_TSS_ADDR, addr);
-		if (r == -1) {
-			fprintf(stderr, "kvm_set_tss_addr: %m\n");
-			return -errno;
-		}
-		return 0;
-	}
-#endif
-	return -ENOSYS;
-}
 
 static int kvm_init_tss(kvm_context_t kvm)
 {
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -446,7 +446,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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 06 of 27] imported patch move_kvm_set_init_tss
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (4 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 05 of 27] Move kvm_set_tss_addr " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 07 of 27] Move function kvm_create_default_phys_mem to kvmctl-x86 and rename Jerone Young
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID a809d39bd74d33d221dd98cc6afa02d9a35889a4
# Parent  4d8d1bd969dc9a1f2ad3b983d7e63172bee64fd4
imported patch move_kvm_set_init_tss

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -3,6 +3,7 @@
 #include <stropts.h>
 #include <sys/mman.h>
 #include <stdio.h>
+#include <errno.h>
 
 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
 								void **vm_mem)
@@ -201,3 +202,25 @@ int kvm_set_tss_addr(kvm_context_t kvm, 
 	return -ENOSYS;
 }
 
+static int kvm_init_tss(kvm_context_t kvm)
+{
+#ifdef KVM_CAP_SET_TSS_ADDR
+	int r;
+
+	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
+	if (r > 0) {
+		/*
+		 * this address is 3 pages before the bios, and the bios should present
+		 * as unavaible memory
+		 */
+		r = kvm_set_tss_addr(kvm, 0xfffbd000);
+		if (r < 0) {
+			printf("kvm_init_tss: unable to set tss addr\n");
+			return r;
+		}
+
+	}
+#endif
+	return 0;
+}
+
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -328,28 +328,6 @@ int kvm_create_vm(kvm_context_t kvm)
 	return 0;
 }
 
-
-static int kvm_init_tss(kvm_context_t kvm)
-{
-#ifdef KVM_CAP_SET_TSS_ADDR
-	int r;
-
-	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
-	if (r > 0) {
-		/*
-		 * this address is 3 pages before the bios, and the bios should present
-		 * as unavaible memory
-		 */
-		r = kvm_set_tss_addr(kvm, 0xfffbd000);
-		if (r < 0) {
-			printf("kvm_init_tss: unable to set tss addr\n");
-			return r;
-		}
-
-	}
-#endif
-	return 0;
-}
 
 static int kvm_create_default_phys_mem(kvm_context_t kvm,
 				       unsigned long phys_mem_bytes,

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 07 of 27] Move function kvm_create_default_phys_mem to kvmctl-x86 and rename
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (5 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 06 of 27] imported patch move_kvm_set_init_tss Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-11-01 12:44   ` Avi Kivity
  2007-10-31 17:05 ` [PATCH 08 of 27] Modify out arch specific code from kvm_create function Jerone Young
                   ` (21 subsequent siblings)
  28 siblings, 1 reply; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 7445bcdab796596fb97312b97393e4f2936e5450
# Parent  a809d39bd74d33d221dd98cc6afa02d9a35889a4
Move function kvm_create_default_phys_mem to kvmctl-x86 and rename

This patch moves function kvm_create_default_phys_mem to kvmctl-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 x86_kvm_create_default_phys_mem

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -4,6 +4,9 @@
 #include <sys/mman.h>
 #include <stdio.h>
 #include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
 
 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
 								void **vm_mem)
@@ -224,3 +227,29 @@ static int kvm_init_tss(kvm_context_t kv
 	return 0;
 }
 
+static int x86_create_default_phys_mem(kvm_context_t kvm,
+				       unsigned long phys_mem_bytes,
+				       void **vm_mem)
+{
+	unsigned long memory = (phys_mem_bytes + PAGE_SIZE - 1) & PAGE_MASK;
+	int zfd;
+	int r;
+
+#ifdef KVM_CAP_USER_MEMORY
+	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY);
+	if (r > 0)
+		r = kvm_alloc_userspace_memory(kvm, memory, vm_mem);
+	else
+#endif
+		r = kvm_alloc_kernel_memory(kvm, memory, vm_mem);
+	if (r < 0)
+		return r;
+
+        zfd = open("/dev/zero", O_RDONLY);
+        mmap(*vm_mem + 0xa8000, 0x8000, PROT_READ|PROT_WRITE,
+             MAP_PRIVATE|MAP_FIXED, zfd, 0);
+        close(zfd);
+
+	kvm->physical_memory = *vm_mem;
+	return 0;
+}
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -329,32 +329,6 @@ int kvm_create_vm(kvm_context_t kvm)
 }
 
 
-static int kvm_create_default_phys_mem(kvm_context_t kvm,
-				       unsigned long phys_mem_bytes,
-				       void **vm_mem)
-{
-	unsigned long memory = (phys_mem_bytes + PAGE_SIZE - 1) & PAGE_MASK;
-	int zfd;
-	int r;
-
-#ifdef KVM_CAP_USER_MEMORY
-	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY);
-	if (r > 0)
-		r = kvm_alloc_userspace_memory(kvm, memory, vm_mem);
-	else
-#endif
-		r = kvm_alloc_kernel_memory(kvm, memory, vm_mem);
-	if (r < 0)
-		return r;
-
-        zfd = open("/dev/zero", O_RDONLY);
-        mmap(*vm_mem + 0xa8000, 0x8000, PROT_READ|PROT_WRITE,
-             MAP_PRIVATE|MAP_FIXED, zfd, 0);
-        close(zfd);
-
-	kvm->physical_memory = *vm_mem;
-	return 0;
-}
 
 void kvm_create_irqchip(kvm_context_t kvm)
 {

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 08 of 27] Modify out arch specific code from kvm_create function
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (6 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 07 of 27] Move function kvm_create_default_phys_mem to kvmctl-x86 and rename Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-11-01 12:45   ` Avi Kivity
  2007-10-31 17:05 ` [PATCH 09 of 27] Move kvm_create_kernel_phys_mem to kvmctl-x86.c Jerone Young
                   ` (20 subsequent siblings)
  28 siblings, 1 reply; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 179d9b30ab973e6676dcd0b6fa08e9635969d44c
# Parent  7445bcdab796596fb97312b97393e4f2936e5450
Modify out arch specific code from kvm_create function

This function removes all x86 specific code and creates
a hook function arch_kvm_create to accomidate for this code.
arch_kvm_create is a hook that is placed in kvmctl-$(ARCH).c & h.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -253,3 +253,18 @@ static int x86_create_default_phys_mem(k
 	kvm->physical_memory = *vm_mem;
 	return 0;
 }
+
+int arch_kvm_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
+			void **vm_mem)
+{
+	int r = 0;
+
+	r = kvm_init_tss(kvm);
+	if (r < 0)
+		return r;
+	r = x86_create_default_phys_mem(kvm, phys_mem_bytes, vm_mem);
+	if (r < 0)
+	        return r;
+
+	return 0;
+}
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -15,4 +15,12 @@ int kvm_alloc_userspace_memory(kvm_conte
 								void **vm_mem);
 int kvm_set_tss_addr(kvm_context_t kvm, unsigned long addr);
 
+/*
+ * \brief Architecutre hook for kvm_create
+ *
+ * This function adds architcutre specific functionality to kvm_create
+ */
+int arch_kvm_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
+		    void **vm_mem);
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -356,13 +356,10 @@ int kvm_create(kvm_context_t kvm, unsign
 	r = kvm_create_vm(kvm);
 	if (r < 0)
 	        return r;
-	r = kvm_init_tss(kvm);
+	r = arch_kvm_create(kvm, phys_mem_bytes, vm_mem);
 	if (r < 0)
 		return r;
 	init_slots();
-	r = kvm_create_default_phys_mem(kvm, phys_mem_bytes, vm_mem);
-	if (r < 0)
-	        return r;
 	kvm_create_irqchip(kvm);
 	r = kvm_create_vcpu(kvm, 0);
 	if (r < 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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 09 of 27] Move kvm_create_kernel_phys_mem to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (7 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 08 of 27] Modify out arch specific code from kvm_create function Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 10 of 27] Move kvm_create_phys_mem " Jerone Young
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 1d255ea8e5ed989683dd75cec1324791a12e14a2
# Parent  179d9b30ab973e6676dcd0b6fa08e9635969d44c
Move kvm_create_kernel_phys_mem to kvmctl-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).

Signed-off-by: Jerone Young <jeroney-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -268,3 +268,36 @@ int arch_kvm_create(kvm_context_t kvm, u
 
 	return 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;
+}
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -23,4 +23,7 @@ int arch_kvm_create(kvm_context_t kvm, u
 int arch_kvm_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
 		    void **vm_mem);
 
+void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start,
+                      unsigned long len, int log, int writable);
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -366,39 +366,6 @@ int kvm_create(kvm_context_t kvm, unsign
 		return r;
 
 	return 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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 10 of 27] Move kvm_create_phys_mem to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (8 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 09 of 27] Move kvm_create_kernel_phys_mem to kvmctl-x86.c Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 11 of 27] Move kvm_destroy_phys_mem " Jerone Young
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID e0abf43119181082d46e21c02b07f275f08db02b
# Parent  1d255ea8e5ed989683dd75cec1324791a12e14a2
Move kvm_create_phys_mem to kvmctl-x86.c

This patch moves kvm_create_phys_mem to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -301,3 +301,20 @@ void *kvm_create_kernel_phys_mem(kvm_con
 
 	return ptr;
 }
+
+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);
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -26,4 +26,7 @@ void *kvm_create_kernel_phys_mem(kvm_con
 void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start,
                       unsigned long len, int log, int writable);
 
+void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
+			  unsigned long len, int log, int writable);
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -408,22 +408,6 @@ void *kvm_create_userspace_phys_mem(kvm_
 }
 
 #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);
-}
 
 int kvm_register_userspace_phys_mem(kvm_context_t kvm,
 			unsigned long phys_start, void *userspace_addr,
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -447,8 +447,6 @@ void kvm_show_regs(kvm_context_t kvm, in
 void kvm_show_regs(kvm_context_t kvm, int vcpu);
 
 
-void *kvm_create_phys_mem(kvm_context_t, unsigned long phys_start, 
-			  unsigned long len, int log, int writable);
 void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start, 
 			  unsigned long len);
 int kvm_register_userspace_phys_mem(kvm_context_t kvm,
@@ -565,6 +563,8 @@ void kvm_userspace_memory_region_save_pa
 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);
+void *kvm_create_userspace_phys_mem(kvm_context_t kvm, unsigned long phys_start,
+			unsigned long len, int log, int writable);
 
 
 #endif

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 11 of 27] Move kvm_destroy_phys_mem to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (9 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 10 of 27] Move kvm_create_phys_mem " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 21:11   ` Izik Eidus
  2007-10-31 17:05 ` [PATCH 12 of 27] Move kvm_create_memory_alias & kvm_destroy_memory_alias " Jerone Young
                   ` (17 subsequent siblings)
  28 siblings, 1 reply; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID e2a804737e3b4847d7150dd5141e24a95460c46e
# Parent  e0abf43119181082d46e21c02b07f275f08db02b
Move kvm_destroy_phys_mem to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -318,3 +318,29 @@ void *kvm_create_phys_mem(kvm_context_t 
 								log, writable);
 }
 
+/* destroy/free a whole slot.
+ * phys_start, len and slot are the params passed to kvm_create_phys_mem()
+ */
+void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start, 
+			  unsigned long len)
+{
+	int slot;
+	struct kvm_memory_region *mem;
+
+	slot = get_slot(phys_start);
+
+	if (slot >= KVM_MAX_NUM_MEM_REGIONS) {
+		fprintf(stderr, "BUG: %s: invalid parameters (slot=%d)\n",
+			__FUNCTION__, slot);
+		return;
+	}
+	mem = &kvm->mem_regions[slot];
+	if (phys_start != mem->guest_phys_addr) {
+		fprintf(stderr,
+			"WARNING: %s: phys_start is 0x%lx expecting 0x%llx\n",
+			__FUNCTION__, phys_start, mem->guest_phys_addr);
+		phys_start = mem->guest_phys_addr;
+	}
+	kvm_create_phys_mem(kvm, phys_start, 0, 0, 0);
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -29,4 +29,7 @@ void *kvm_create_phys_mem(kvm_context_t 
 void *kvm_create_phys_mem(kvm_context_t kvm, unsigned long phys_start,
 			  unsigned long len, int log, int writable);
 
+void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start,
+                          unsigned long len);
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -440,32 +440,6 @@ int kvm_register_userspace_phys_mem(kvm_
 #endif
 }
 
-
-/* destroy/free a whole slot.
- * phys_start, len and slot are the params passed to kvm_create_phys_mem()
- */
-void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start, 
-			  unsigned long len)
-{
-	int slot;
-	struct kvm_memory_region *mem;
-
-	slot = get_slot(phys_start);
-
-	if (slot >= KVM_MAX_NUM_MEM_REGIONS) {
-		fprintf(stderr, "BUG: %s: invalid parameters (slot=%d)\n",
-			__FUNCTION__, slot);
-		return;
-	}
-	mem = &kvm->mem_regions[slot];
-	if (phys_start != mem->guest_phys_addr) {
-		fprintf(stderr,
-			"WARNING: %s: phys_start is 0x%lx expecting 0x%llx\n",
-			__FUNCTION__, phys_start, mem->guest_phys_addr);
-		phys_start = mem->guest_phys_addr;
-	}
-	kvm_create_phys_mem(kvm, phys_start, 0, 0, 0);
-}
 
 int kvm_create_memory_alias(kvm_context_t kvm,
 			    uint64_t phys_addr,
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -447,8 +447,6 @@ void kvm_show_regs(kvm_context_t kvm, in
 void kvm_show_regs(kvm_context_t kvm, int vcpu);
 
 
-void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start, 
-			  unsigned long len);
 int kvm_register_userspace_phys_mem(kvm_context_t kvm,
 			unsigned long phys_start, void *userspace_addr,
 			unsigned long len, int log);

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 12 of 27] Move kvm_create_memory_alias & kvm_destroy_memory_alias to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (10 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 11 of 27] Move kvm_destroy_phys_mem " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 13 of 27] Move kvm_get & kmv_set_lapci functions " Jerone Young
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID edb32b02931230708cc80c38d8260d31d44e0344
# Parent  e2a804737e3b4847d7150dd5141e24a95460c46e
Move kvm_create_memory_alias & kvm_destroy_memory_alias to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -344,3 +344,32 @@ void kvm_destroy_phys_mem(kvm_context_t 
 	kvm_create_phys_mem(kvm, phys_start, 0, 0, 0);
 }
 
+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);
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -32,4 +32,23 @@ void kvm_destroy_phys_mem(kvm_context_t 
 void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start,
                           unsigned long len);
 
+/*!
+ * \brief Create a memory alias
+ *
+ * Aliases a portion of physical memory to another portion.  If the guest
+ * accesses the alias region, it will behave exactly as if it accessed
+ * the target memory.
+ */
+int kvm_create_memory_alias(kvm_context_t, uint64_t phys_addr,
+			    uint64_t phys_start, uint64_t len,
+			    uint64_t target_phys);
+
+/*!
+ * \brief Destroy a memory alias
+ *
+ * Removes an alias created with kvm_create_memory_alias().
+ */
+int kvm_destroy_memory_alias(kvm_context_t, uint64_t phys_addr);
+
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -438,36 +438,6 @@ int kvm_register_userspace_phys_mem(kvm_
 #else
 	return -ENOSYS;
 #endif
-}
-
-
-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);
 }
 
 static int kvm_get_map(kvm_context_t kvm, int ioctl_num, int slot, void *buf)
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -454,24 +454,6 @@ int kvm_get_dirty_pages(kvm_context_t, u
 
 
 /*!
- * \brief Create a memory alias
- *
- * Aliases a portion of physical memory to another portion.  If the guest
- * accesses the alias region, it will behave exactly as if it accessed
- * the target memory.
- */
-int kvm_create_memory_alias(kvm_context_t, uint64_t phys_addr,
-			    uint64_t phys_start, uint64_t len,
-			    uint64_t target_phys);
-
-/*!
- * \brief Destroy a memory alias
- *
- * Removes an alias created with kvm_create_memory_alias().
- */
-int kvm_destroy_memory_alias(kvm_context_t, uint64_t phys_addr);
-
-/*!
  * \brief Get a bitmap of guest ram pages which are allocated to the guest.
  *
  * \param kvm Pointer to the current kvm_context

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 13 of 27] Move kvm_get & kmv_set_lapci functions to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (11 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 12 of 27] Move kvm_create_memory_alias & kvm_destroy_memory_alias " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 14 of 27] Make functions in kvmctl.c nonstatic Jerone Young
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 6a35e049b61391f45d8df6ccb5c11d9effc67bf7
# Parent  edb32b02931230708cc80c38d8260d31d44e0344
Move kvm_get & kmv_set_lapci functions to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -373,3 +373,34 @@ int kvm_destroy_memory_alias(kvm_context
 	return 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
+
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -51,4 +51,9 @@ int kvm_destroy_memory_alias(kvm_context
 int kvm_destroy_memory_alias(kvm_context_t, uint64_t phys_addr);
 
 
+#ifdef KVM_CAP_IRQCHIP
+int kvm_get_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s);
+int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s);
 #endif
+
+#endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -532,32 +532,6 @@ int kvm_set_irqchip(kvm_context_t kvm, s
 	if (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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 14 of 27] Make functions in kvmctl.c nonstatic
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (12 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 13 of 27] Move kvm_get & kmv_set_lapci functions " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 15 of 27] Move handle_io_abi_10 to kvmctl-x86.c Jerone Young
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 8bb1470e4e5d442f0b46abedc9402a05e00119b6
# Parent  6a35e049b61391f45d8df6ccb5c11d9effc67bf7
Make functions in kvmctl.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 kvmctl-x86.c.

These functions include:
	handle_halt
	handle_shutdown
	post_kvm_run
	pre_kvm_run
	handle_io_window
	handle_debug

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -650,7 +650,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);
 }
@@ -935,17 +935,17 @@ static int handle_mmio(kvm_context_t kvm
 	return 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);
 }
@@ -955,12 +955,12 @@ int try_push_interrupts(kvm_context_t kv
 	return 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);
 }
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -547,6 +547,14 @@ void *kvm_create_userspace_phys_mem(kvm_
 			unsigned long len, int log, int writable);
 
 
+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
 
 #endif

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 15 of 27] Move handle_io_abi_10 to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (13 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 14 of 27] Make functions in kvmctl.c nonstatic Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 16 of 27] Move handle_mmio_abi10 " Jerone Young
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 054af67e39314b79bbee8e4cc92a7354aff92fc2
# Parent  8bb1470e4e5d442f0b46abedc9402a05e00119b6
Move handle_io_abi_10 to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -1,4 +1,5 @@
 #include "libkvm.h"
+#include "kvm-abi-10.h"
 #include <unistd.h>
 #include <stropts.h>
 #include <sys/mman.h>
@@ -403,4 +404,59 @@ int kvm_set_lapic(kvm_context_t kvm, int
 
 #endif
 
-
+static int handle_io_abi10(kvm_context_t kvm, struct kvm_run_abi10 *run,
+			   int vcpu)
+{
+	uint16_t addr = run->io.port;
+	int r;
+	int i;
+	void *p = (void *)run + run->io.data_offset;
+
+	for (i = 0; i < run->io.count; ++i) {
+		switch (run->io.direction) {
+		case KVM_EXIT_IO_IN:
+			switch (run->io.size) {
+			case 1:
+				r = kvm->callbacks->inb(kvm->opaque, addr, p);
+				break;
+			case 2:
+				r = kvm->callbacks->inw(kvm->opaque, addr, p);
+				break;
+			case 4:
+				r = kvm->callbacks->inl(kvm->opaque, addr, p);
+				break;
+			default:
+				fprintf(stderr, "bad I/O size %d\n", run->io.size);
+				return -EMSGSIZE;
+			}
+			break;
+		case KVM_EXIT_IO_OUT:
+		    	switch (run->io.size) {
+			case 1:
+				r = kvm->callbacks->outb(kvm->opaque, addr,
+						     *(uint8_t *)p);
+				break;
+			case 2:
+				r = kvm->callbacks->outw(kvm->opaque, addr,
+						     *(uint16_t *)p);
+				break;
+			case 4:
+				r = kvm->callbacks->outl(kvm->opaque, addr,
+						     *(uint32_t *)p);
+				break;
+			default:
+				fprintf(stderr, "bad I/O size %d\n", run->io.size);
+				return -EMSGSIZE;
+			}
+			break;
+		default:
+			fprintf(stderr, "bad I/O direction %d\n", run->io.direction);
+			return -EPROTO;
+		}
+
+		p += run->io.size;
+	}
+	run->io_completed = 1;
+
+	return 0;
+}
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -538,8 +538,7 @@ int kvm_set_irqchip(kvm_context_t kvm, s
 
 #endif
 
-static int handle_io_abi10(kvm_context_t kvm, struct kvm_run_abi10 *run,
-			   int vcpu)
+static int handle_io(kvm_context_t kvm, struct kvm_run *run, int vcpu)
 {
 	uint16_t addr = run->io.port;
 	int r;
@@ -590,62 +589,6 @@ static int handle_io_abi10(kvm_context_t
 
 		p += run->io.size;
 	}
-	run->io_completed = 1;
-
-	return 0;
-}
-
-static int handle_io(kvm_context_t kvm, struct kvm_run *run, int vcpu)
-{
-	uint16_t addr = run->io.port;
-	int r;
-	int i;
-	void *p = (void *)run + run->io.data_offset;
-
-	for (i = 0; i < run->io.count; ++i) {
-		switch (run->io.direction) {
-		case KVM_EXIT_IO_IN:
-			switch (run->io.size) {
-			case 1:
-				r = kvm->callbacks->inb(kvm->opaque, addr, p);
-				break;
-			case 2:
-				r = kvm->callbacks->inw(kvm->opaque, addr, p);
-				break;
-			case 4:
-				r = kvm->callbacks->inl(kvm->opaque, addr, p);
-				break;
-			default:
-				fprintf(stderr, "bad I/O size %d\n", run->io.size);
-				return -EMSGSIZE;
-			}
-			break;
-		case KVM_EXIT_IO_OUT:
-		    	switch (run->io.size) {
-			case 1:
-				r = kvm->callbacks->outb(kvm->opaque, addr,
-						     *(uint8_t *)p);
-				break;
-			case 2:
-				r = kvm->callbacks->outw(kvm->opaque, addr,
-						     *(uint16_t *)p);
-				break;
-			case 4:
-				r = kvm->callbacks->outl(kvm->opaque, addr,
-						     *(uint32_t *)p);
-				break;
-			default:
-				fprintf(stderr, "bad I/O size %d\n", run->io.size);
-				return -EMSGSIZE;
-			}
-			break;
-		default:
-			fprintf(stderr, "bad I/O direction %d\n", run->io.direction);
-			return -EPROTO;
-		}
-
-		p += run->io.size;
-	}
 
 	return 0;
 }
@@ -1224,3 +1167,4 @@ int kvm_irqchip_in_kernel(kvm_context_t 
 {
     return kvm->irqchip_in_kernel;
 }
+

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 16 of 27] Move handle_mmio_abi10 to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (14 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 15 of 27] Move handle_io_abi_10 to kvmctl-x86.c Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 17 of 27] Move kvm_run_abi10 " Jerone Young
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID a694904630e6805dfe51f4eed16e18b7ac2ed504
# Parent  054af67e39314b79bbee8e4cc92a7354aff92fc2
Move handle_mmio_abi10 to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -460,3 +460,53 @@ static int handle_io_abi10(kvm_context_t
 
 	return 0;
 }
+
+static int handle_mmio_abi10(kvm_context_t kvm, struct kvm_run_abi10 *kvm_run)
+{
+	unsigned long addr = kvm_run->mmio.phys_addr;
+	void *data = kvm_run->mmio.data;
+	int r = -1;
+
+	if (kvm_run->mmio.is_write) {
+		switch (kvm_run->mmio.len) {
+		case 1:
+			r = kvm->callbacks->writeb(kvm->opaque, addr,
+							*(uint8_t *)data);
+			break;
+		case 2:
+			r = kvm->callbacks->writew(kvm->opaque, addr,
+							*(uint16_t *)data);
+			break;
+		case 4:
+			r = kvm->callbacks->writel(kvm->opaque, addr,
+							*(uint32_t *)data);
+			break;
+		case 8:
+			r = kvm->callbacks->writeq(kvm->opaque, addr,
+							*(uint64_t *)data);
+			break;
+		}
+	} else {
+		switch (kvm_run->mmio.len) {
+		case 1:
+			r = kvm->callbacks->readb(kvm->opaque, addr,
+							(uint8_t *)data);
+			break;
+		case 2:
+			r = kvm->callbacks->readw(kvm->opaque, addr,
+							(uint16_t *)data);
+			break;
+		case 4:
+			r = kvm->callbacks->readl(kvm->opaque, addr,
+							(uint32_t *)data);
+			break;
+		case 8:
+			r = kvm->callbacks->readq(kvm->opaque, addr,
+							(uint64_t *)data);
+			break;
+		}
+		kvm_run->io_completed = 1;
+	}
+	return r;
+}
+
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -793,46 +793,6 @@ static void kvm_show_code(kvm_context_t 
 	fprintf(stderr, "code:%s\n", code_str);
 }
 
-static int handle_mmio_abi10(kvm_context_t kvm, struct kvm_run_abi10 *kvm_run)
-{
-	unsigned long addr = kvm_run->mmio.phys_addr;
-	void *data = kvm_run->mmio.data;
-	int r = -1;
-
-	if (kvm_run->mmio.is_write) {
-		switch (kvm_run->mmio.len) {
-		case 1:
-			r = kvm->callbacks->writeb(kvm->opaque, addr, *(uint8_t *)data);
-			break;
-		case 2:
-			r = kvm->callbacks->writew(kvm->opaque, addr, *(uint16_t *)data);
-			break;
-		case 4:
-			r = kvm->callbacks->writel(kvm->opaque, addr, *(uint32_t *)data);
-			break;
-		case 8:
-			r = kvm->callbacks->writeq(kvm->opaque, addr, *(uint64_t *)data);
-			break;
-		}
-	} else {
-		switch (kvm_run->mmio.len) {
-		case 1:
-			r = kvm->callbacks->readb(kvm->opaque, addr, (uint8_t *)data);
-			break;
-		case 2:
-			r = kvm->callbacks->readw(kvm->opaque, addr, (uint16_t *)data);
-			break;
-		case 4:
-			r = kvm->callbacks->readl(kvm->opaque, addr, (uint32_t *)data);
-			break;
-		case 8:
-			r = kvm->callbacks->readq(kvm->opaque, addr, (uint64_t *)data);
-			break;
-		}
-		kvm_run->io_completed = 1;
-	}
-	return r;
-}
 
 static int handle_mmio(kvm_context_t kvm, struct kvm_run *kvm_run)
 {

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 17 of 27] Move kvm_run_abi10 to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (15 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 16 of 27] Move handle_mmio_abi10 " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 18 of 27] Change name of post_kvm_run & pre_kvm_run in kvmctl.c Jerone Young
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 278fbab64f4b40dd4c40a7b07cb92e9b19aedd71
# Parent  a694904630e6805dfe51f4eed16e18b7ac2ed504
Move kvm_run_abi10 to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -510,3 +510,79 @@ static int handle_mmio_abi10(kvm_context
 	return r;
 }
 
+int kvm_run_abi10(kvm_context_t kvm, int vcpu)
+{
+	int r;
+	int fd = kvm->vcpu_fd[vcpu];
+	struct kvm_run_abi10 *run = (struct kvm_run_abi10 *)kvm->run[vcpu];
+
+again:
+	run->request_interrupt_window = try_push_interrupts(kvm);
+	r = pre_kvm_run(kvm, vcpu);
+	if (r)
+	    return r;
+	r = ioctl(fd, KVM_RUN, 0);
+	post_kvm_run(kvm, vcpu);
+
+	run->io_completed = 0;
+	if (r == -1 && errno != EINTR) {
+		r = -errno;
+		printf("kvm_run: %m\n");
+		return r;
+	}
+	if (r == -1) {
+		r = handle_io_window(kvm);
+		goto more;
+	}
+	if (1) {
+		switch (run->exit_reason) {
+		case KVM_EXIT_UNKNOWN:
+			fprintf(stderr, "unhandled vm exit: 0x%x vcpu_id %d\n",
+				(unsigned)run->hw.hardware_exit_reason, vcpu);
+			kvm_show_regs(kvm, vcpu);
+			abort();
+			break;
+		case KVM_EXIT_FAIL_ENTRY:
+			fprintf(stderr, "kvm_run: failed entry, reason %u\n", 
+				(unsigned)run->fail_entry.hardware_entry_failure_reason & 0xffff);
+			return -ENOEXEC;
+			break;
+		case KVM_EXIT_EXCEPTION:
+			fprintf(stderr, "exception %d (%x)\n", 
+			       run->ex.exception,
+			       run->ex.error_code);
+			kvm_show_regs(kvm, vcpu);
+			kvm_show_code(kvm, vcpu);
+			abort();
+			break;
+		case KVM_EXIT_IO:
+			r = handle_io_abi10(kvm, run, vcpu);
+			break;
+		case KVM_EXIT_DEBUG:
+			r = handle_debug(kvm, vcpu);
+			break;
+		case KVM_EXIT_MMIO:
+			r = handle_mmio_abi10(kvm, run);
+			break;
+		case KVM_EXIT_HLT:
+			r = handle_halt(kvm, vcpu);
+			break;
+		case KVM_EXIT_IRQ_WINDOW_OPEN:
+			break;
+		case KVM_EXIT_SHUTDOWN:
+			r = handle_shutdown(kvm, vcpu);
+			break;
+		default:
+			fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason);
+			kvm_show_regs(kvm, vcpu);
+			abort();
+			break;
+		}
+	}
+more:
+	if (!r)
+		goto again;
+	return r;
+}
+
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -56,4 +56,6 @@ int kvm_set_lapic(kvm_context_t kvm, int
 int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state *s);
 #endif
 
+int kvm_run_abi10(kvm_context_t kvm, int vcpu);
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -911,81 +911,6 @@ __u64 kvm_get_cr8(kvm_context_t kvm, int
 	return kvm->run[vcpu]->cr8;
 }
 
-static int kvm_run_abi10(kvm_context_t kvm, int vcpu)
-{
-	int r;
-	int fd = kvm->vcpu_fd[vcpu];
-	struct kvm_run_abi10 *run = (struct kvm_run_abi10 *)kvm->run[vcpu];
-
-again:
-	run->request_interrupt_window = try_push_interrupts(kvm);
-	r = pre_kvm_run(kvm, vcpu);
-	if (r)
-	    return r;
-	r = ioctl(fd, KVM_RUN, 0);
-	post_kvm_run(kvm, vcpu);
-
-	run->io_completed = 0;
-	if (r == -1 && errno != EINTR) {
-		r = -errno;
-		printf("kvm_run: %m\n");
-		return r;
-	}
-	if (r == -1) {
-		r = handle_io_window(kvm);
-		goto more;
-	}
-	if (1) {
-		switch (run->exit_reason) {
-		case KVM_EXIT_UNKNOWN:
-			fprintf(stderr, "unhandled vm exit: 0x%x vcpu_id %d\n",
-				(unsigned)run->hw.hardware_exit_reason, vcpu);
-			kvm_show_regs(kvm, vcpu);
-			abort();
-			break;
-		case KVM_EXIT_FAIL_ENTRY:
-			fprintf(stderr, "kvm_run: failed entry, reason %u\n", 
-				(unsigned)run->fail_entry.hardware_entry_failure_reason & 0xffff);
-			return -ENOEXEC;
-			break;
-		case KVM_EXIT_EXCEPTION:
-			fprintf(stderr, "exception %d (%x)\n", 
-			       run->ex.exception,
-			       run->ex.error_code);
-			kvm_show_regs(kvm, vcpu);
-			kvm_show_code(kvm, vcpu);
-			abort();
-			break;
-		case KVM_EXIT_IO:
-			r = handle_io_abi10(kvm, run, vcpu);
-			break;
-		case KVM_EXIT_DEBUG:
-			r = handle_debug(kvm, vcpu);
-			break;
-		case KVM_EXIT_MMIO:
-			r = handle_mmio_abi10(kvm, run);
-			break;
-		case KVM_EXIT_HLT:
-			r = handle_halt(kvm, vcpu);
-			break;
-		case KVM_EXIT_IRQ_WINDOW_OPEN:
-			break;
-		case KVM_EXIT_SHUTDOWN:
-			r = handle_shutdown(kvm, vcpu);
-			break;
-		default:
-			fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason);
-			kvm_show_regs(kvm, vcpu);
-			abort();
-			break;
-		}
-	}
-more:
-	if (!r)
-		goto again;
-	return r;
-}
-
 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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 18 of 27] Change name of post_kvm_run & pre_kvm_run in kvmctl.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (16 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 17 of 27] Move kvm_run_abi10 " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 19 of 27] Move msrs functions to kvmctl-x86.c Jerone Young
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 93f50f2aeecde3b78c110712acecce60e47e8899
# Parent  278fbab64f4b40dd4c40a7b07cb92e9b19aedd71
Change name of post_kvm_run & pre_kvm_run in kvmctl.c

This patch changes the name of:
	post_kvm_run --> kvm_post_run
	pre_kvm_run --> kvm_pre_run

The reason for this change is to avoid a name conflict with
the current qemu code. In this code qemu-kvm.c has fuctions
of the same name causes a compilation error since these fuctions
are no longer static.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -518,11 +518,11 @@ int kvm_run_abi10(kvm_context_t kvm, int
 
 again:
 	run->request_interrupt_window = try_push_interrupts(kvm);
-	r = pre_kvm_run(kvm, vcpu);
+	r = kvm_pre_run(kvm, vcpu);
 	if (r)
 	    return r;
 	r = ioctl(fd, KVM_RUN, 0);
-	post_kvm_run(kvm, vcpu);
+	kvm_post_run(kvm, vcpu);
 
 	run->io_completed = 0;
 	if (r == -1 && errno != EINTR) {
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -858,12 +858,12 @@ int try_push_interrupts(kvm_context_t kv
 	return kvm->callbacks->try_push_interrupts(kvm->opaque);
 }
 
-void post_kvm_run(kvm_context_t kvm, int vcpu)
+void kvm_post_run(kvm_context_t kvm, int vcpu)
 {
 	kvm->callbacks->post_kvm_run(kvm->opaque, vcpu);
 }
 
-int pre_kvm_run(kvm_context_t kvm, int vcpu)
+int kvm_pre_run(kvm_context_t kvm, int vcpu)
 {
 	return kvm->callbacks->pre_kvm_run(kvm->opaque, vcpu);
 }
@@ -923,11 +923,11 @@ again:
 again:
 	if (!kvm->irqchip_in_kernel)
 		run->request_interrupt_window = try_push_interrupts(kvm);
-	r = pre_kvm_run(kvm, vcpu);
+	r = kvm_pre_run(kvm, vcpu);
 	if (r)
 	    return r;
 	r = ioctl(fd, KVM_RUN, 0);
-	post_kvm_run(kvm, vcpu);
+	kvm_post_run(kvm, vcpu);
 
 	if (r == -1 && errno != EINTR && errno != EAGAIN) {
 		r = -errno;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -549,8 +549,8 @@ void *kvm_create_userspace_phys_mem(kvm_
 
 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);
+void kvm_post_run(kvm_context_t kvm, int vcpu);
+int kvm_pre_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);

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 19 of 27] Move msrs functions to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (17 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 18 of 27] Change name of post_kvm_run & pre_kvm_run in kvmctl.c Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 20 of 27] Move print_seg " Jerone Young
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 2046856ab739f070a37294645cfe22fd14923ee5
# Parent  93f50f2aeecde3b78c110712acecce60e47e8899
Move msrs functions to kvmctl-x86.c

This patch moves functions:
	kvm_msr_list
	move kvm_get_msrs
	move kvm_set_msrs

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -1,5 +1,6 @@
 #include "libkvm.h"
 #include "kvm-abi-10.h"
+#include <string.h>
 #include <unistd.h>
 #include <stropts.h>
 #include <sys/mman.h>
@@ -585,4 +586,70 @@ more:
 	return r;
 }
 
-
+/*
+ * Returns available msr list.  User must free.
+ */
+struct kvm_msr_list *kvm_get_msr_list(kvm_context_t kvm)
+{
+	struct kvm_msr_list sizer, *msrs;
+	int r, e;
+
+	sizer.nmsrs = 0;
+	r = ioctl(kvm->fd, KVM_GET_MSR_INDEX_LIST, &sizer);
+	if (r == -1 && errno != E2BIG)
+		return NULL;
+	msrs = malloc(sizeof *msrs + sizer.nmsrs * sizeof *msrs->indices);
+	if (!msrs) {
+		errno = ENOMEM;
+		return NULL;
+	}
+	msrs->nmsrs = sizer.nmsrs;
+	r = ioctl(kvm->fd, KVM_GET_MSR_INDEX_LIST, msrs);
+	if (r == -1) {
+		e = errno;
+		free(msrs);
+		errno = e;
+		return NULL;
+	}
+	return msrs;
+}
+
+int kvm_get_msrs(kvm_context_t kvm, int vcpu, struct kvm_msr_entry *msrs,
+		 int n)
+{
+    struct kvm_msrs *kmsrs = malloc(sizeof *kmsrs + n * sizeof *msrs);
+    int r, e;
+
+    if (!kmsrs) {
+	errno = ENOMEM;
+	return -1;
+    }
+    kmsrs->nmsrs = n;
+    memcpy(kmsrs->entries, msrs, n * sizeof *msrs);
+    r = ioctl(kvm->vcpu_fd[vcpu], KVM_GET_MSRS, kmsrs);
+    e = errno;
+    memcpy(msrs, kmsrs->entries, n * sizeof *msrs);
+    free(kmsrs);
+    errno = e;
+    return r;
+}
+
+int kvm_set_msrs(kvm_context_t kvm, int vcpu, struct kvm_msr_entry *msrs,
+		 int n)
+{
+    struct kvm_msrs *kmsrs = malloc(sizeof *kmsrs + n * sizeof *msrs);
+    int r, e;
+
+    if (!kmsrs) {
+	errno = ENOMEM;
+	return -1;
+    }
+    kmsrs->nmsrs = n;
+    memcpy(kmsrs->entries, msrs, n * sizeof *msrs);
+    r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_MSRS, kmsrs);
+    e = errno;
+    free(kmsrs);
+    errno = e;
+    return r;
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -58,4 +58,9 @@ int kvm_set_lapic(kvm_context_t kvm, int
 
 int kvm_run_abi10(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
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -628,73 +628,6 @@ int kvm_set_sregs(kvm_context_t kvm, int
     return ioctl(kvm->vcpu_fd[vcpu], KVM_SET_SREGS, sregs);
 }
 
-/*
- * Returns available msr list.  User must free.
- */
-struct kvm_msr_list *kvm_get_msr_list(kvm_context_t kvm)
-{
-	struct kvm_msr_list sizer, *msrs;
-	int r, e;
-
-	sizer.nmsrs = 0;
-	r = ioctl(kvm->fd, KVM_GET_MSR_INDEX_LIST, &sizer);
-	if (r == -1 && errno != E2BIG)
-		return NULL;
-	msrs = malloc(sizeof *msrs + sizer.nmsrs * sizeof *msrs->indices);
-	if (!msrs) {
-		errno = ENOMEM;
-		return NULL;
-	}
-	msrs->nmsrs = sizer.nmsrs;
-	r = ioctl(kvm->fd, KVM_GET_MSR_INDEX_LIST, msrs);
-	if (r == -1) {
-		e = errno;
-		free(msrs);
-		errno = e;
-		return NULL;
-	}
-	return msrs;
-}
-
-int kvm_get_msrs(kvm_context_t kvm, int vcpu, struct kvm_msr_entry *msrs,
-		 int n)
-{
-    struct kvm_msrs *kmsrs = malloc(sizeof *kmsrs + n * sizeof *msrs);
-    int r, e;
-
-    if (!kmsrs) {
-	errno = ENOMEM;
-	return -1;
-    }
-    kmsrs->nmsrs = n;
-    memcpy(kmsrs->entries, msrs, n * sizeof *msrs);
-    r = ioctl(kvm->vcpu_fd[vcpu], KVM_GET_MSRS, kmsrs);
-    e = errno;
-    memcpy(msrs, kmsrs->entries, n * sizeof *msrs);
-    free(kmsrs);
-    errno = e;
-    return r;
-}
-
-int kvm_set_msrs(kvm_context_t kvm, int vcpu, struct kvm_msr_entry *msrs,
-		 int n)
-{
-    struct kvm_msrs *kmsrs = malloc(sizeof *kmsrs + n * sizeof *msrs);
-    int r, e;
-
-    if (!kmsrs) {
-	errno = ENOMEM;
-	return -1;
-    }
-    kmsrs->nmsrs = n;
-    memcpy(kmsrs->entries, msrs, n * sizeof *msrs);
-    r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_MSRS, kmsrs);
-    e = errno;
-    free(kmsrs);
-    errno = e;
-    return r;
-}
-
 static void print_seg(FILE *file, const char *name, struct kvm_segment *seg)
 {
     	fprintf(stderr,
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -369,10 +369,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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 20 of 27] Move print_seg to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (18 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 19 of 27] Move msrs functions to kvmctl-x86.c Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 21 of 27] Move kvm_show_regs " Jerone Young
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 72ce75e8e95413d8e671ce9a1ffada64bf7715e5
# Parent  2046856ab739f070a37294645cfe22fd14923ee5
Move print_seg to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -653,3 +653,14 @@ int kvm_set_msrs(kvm_context_t kvm, int 
     return 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);
+}
+
+
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -628,16 +628,6 @@ int kvm_set_sregs(kvm_context_t kvm, int
     return ioctl(kvm->vcpu_fd[vcpu], KVM_SET_SREGS, sregs);
 }
 
-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);

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 21 of 27] Move kvm_show_regs to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (19 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 20 of 27] Move print_seg " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 22 of 27] Declare kvm_abi as a global variable in kvmctl.h Jerone Young
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID cf8625fd771025b9ddfe5192eab79affd9be5885
# Parent  72ce75e8e95413d8e671ce9a1ffada64bf7715e5
Move kvm_show_regs to kvmctl-x86.c

This patch moves functions kvm_show_regs & print_dt
to kvmctl-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.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -663,4 +663,53 @@ static void print_seg(FILE *file, const 
 		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, &regs);
+	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);
+}
+
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -62,5 +62,18 @@ int kvm_get_msrs(kvm_context_t, int vcpu
 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 Dump VCPU registers
+ *
+ * This dumps some of the information that KVM has about a virtual CPU, namely:
+ * - GP Registers
+ *
+ * A much more verbose version of this is available as kvm_dump_vcpu()
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should get dumped
+ * \return 0 on success
+ */
+void kvm_show_regs(kvm_context_t kvm, int vcpu);
 
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -628,55 +628,6 @@ int kvm_set_sregs(kvm_context_t kvm, int
     return ioctl(kvm->vcpu_fd[vcpu], KVM_SET_SREGS, sregs);
 }
 
-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, &regs);
-	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);
-}
-
 static void kvm_show_code(kvm_context_t kvm, int vcpu)
 {
 #define CR0_PE_MASK	(1ULL<<0)
@@ -716,7 +667,6 @@ static void kvm_show_code(kvm_context_t 
 	fprintf(stderr, "code:%s\n", code_str);
 }
 
-
 static int handle_mmio(kvm_context_t kvm, struct kvm_run *kvm_run)
 {
 	unsigned long addr = kvm_run->mmio.phys_addr;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -428,20 +428,6 @@ int kvm_set_signal_mask(kvm_context_t kv
  */
 int kvm_dump_vcpu(kvm_context_t kvm, int vcpu);
 
-/*!
- * \brief Dump VCPU registers
- *
- * This dumps some of the information that KVM has about a virtual CPU, namely:
- * - GP Registers
- *
- * A much more verbose version of this is available as kvm_dump_vcpu()
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- * \return 0 on success
- */
-void kvm_show_regs(kvm_context_t kvm, int vcpu);
-
 
 int kvm_register_userspace_phys_mem(kvm_context_t kvm,
 			unsigned long phys_start, void *userspace_addr,

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 22 of 27] Declare kvm_abi as a global variable in kvmctl.h
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (20 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 21 of 27] Move kvm_show_regs " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 23 of 27] Move kvm_get_apic to kvmctl-x86.c Jerone Young
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID fe1300ca9f861d5cf635d147485c8ef333bbac5a
# Parent  cf8625fd771025b9ddfe5192eab79affd9be5885
Declare kvm_abi as a global variable in kvmctl.h

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -37,7 +37,7 @@
 #include "libkvm.h"
 #include "kvm-abi-10.h"
 
-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];
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -31,6 +31,9 @@ typedef struct kvm_context *kvm_context_
 #if defined(__x86_64__) || defined(__i386__)
 #include "libkvm-x86.h"
 #endif
+
+/* kvm abi verison variable */
+extern int kvm_abi;
 
 
 /**

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 23 of 27] Move kvm_get_apic to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (21 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 22 of 27] Declare kvm_abi as a global variable in kvmctl.h Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 24 of 27] Move cr8 functions " Jerone Young
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849564 18000
# Node ID 1e5d53747cb7e5b3ec8a35e36d7d4c9f35cb7c6b
# Parent  fe1300ca9f861d5cf635d147485c8ef333bbac5a
Move kvm_get_apic to kvmctl-x86.c

Moves apic function since it is x86 only.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -712,4 +712,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;
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -76,4 +76,16 @@ int kvm_set_msrs(kvm_context_t, int vcpu
  */
 void kvm_show_regs(kvm_context_t kvm, int vcpu);
 
+/*!
+ * \brief Get the value of the APIC_BASE msr as of last exit to userspace
+ *
+ * This gets the APIC_BASE msr as it was on the last exit to userspace.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should get dumped
+ * \return APIC_BASE msr contents
+ */
+uint64_t kvm_get_apic_base(kvm_context_t kvm, int vcpu);
+
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -750,15 +750,6 @@ int kvm_get_interrupt_flag(kvm_context_t
 	return 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];
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -233,17 +233,6 @@ int kvm_get_interrupt_flag(kvm_context_t
 int kvm_get_interrupt_flag(kvm_context_t kvm, int vcpu);
 
 /*!
- * \brief Get the value of the APIC_BASE msr as of last exit to userspace
- *
- * This gets the APIC_BASE msr as it was on the last exit to userspace.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- * \return APIC_BASE msr contents
- */
-uint64_t kvm_get_apic_base(kvm_context_t kvm, int vcpu);
-
-/*!
  * \brief Check if a vcpu is ready for interrupt injection
  *
  * This checks if vcpu interrupts are not masked by mov ss or sti.

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 24 of 27] Move cr8 functions to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (22 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 23 of 27] Move kvm_get_apic to kvmctl-x86.c Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 25 of 27] Move kvm_setup_cpuid " Jerone Young
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849565 18000
# Node ID 374df93e6585eeb4f923265d2591b98c2d8e6bd1
# Parent  1e5d53747cb7e5b3ec8a35e36d7d4c9f35cb7c6b
Move cr8 functions to kvmctl-x86.c

This patch moves functions:
	kvm_set_cr8
	kvm_get_cr8

cr8 is an x86 only register.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -721,3 +721,19 @@ uint64_t kvm_get_apic_base(kvm_context_t
 	return 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;
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -87,5 +87,27 @@ void kvm_show_regs(kvm_context_t kvm, in
  */
 uint64_t kvm_get_apic_base(kvm_context_t kvm, int vcpu);
 
+/*!
+ * \brief Set up cr8 for next time the vcpu is executed
+ *
+ * This is a fast setter for cr8, which will be applied when the
+ * vcpu next enters guest mode.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should get dumped
+ * \param cr8 next cr8 value
+ */
+void kvm_set_cr8(kvm_context_t kvm, int vcpu, uint64_t cr8);
+
+/*!
+ * \brief Get cr8 for sync tpr in qemu apic emulation
+ *
+ * This is a getter for cr8, which used to sync with the tpr in qemu
+ * apic emualtion.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should get dumped
+ */
+__u64 kvm_get_cr8(kvm_context_t kvm, int vcpu);
 
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -759,22 +759,6 @@ int kvm_is_ready_for_interrupt_injection
 	return 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;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -244,29 +244,6 @@ int kvm_is_ready_for_interrupt_injection
 int kvm_is_ready_for_interrupt_injection(kvm_context_t kvm, int vcpu);
 
 /*!
- * \brief Set up cr8 for next time the vcpu is executed
- *
- * This is a fast setter for cr8, which will be applied when the
- * vcpu next enters guest mode.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- * \param cr8 next cr8 value
- */
-void kvm_set_cr8(kvm_context_t kvm, int vcpu, uint64_t cr8);
-
-/*!
- * \brief Get cr8 for sync tpr in qemu apic emulation
- *
- * This is a getter for cr8, which used to sync with the tpr in qemu
- * apic emualtion.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- */
-__u64 kvm_get_cr8(kvm_context_t kvm, int vcpu);
-
-/*!
  * \brief Read VCPU registers
  *
  * This gets the GP registers from the VCPU and outputs them

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 25 of 27] Move kvm_setup_cpuid to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (23 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 24 of 27] Move cr8 functions " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 26 of 27] Move kvm_show_code " Jerone Young
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849565 18000
# Node ID 30414641dae8853149da869e7ddb86964c788118
# Parent  374df93e6585eeb4f923265d2591b98c2d8e6bd1
Move kvm_setup_cpuid to kvmctl-x86.c

cpuid is an x86 instruction, so needs to go
in the approriate place.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -9,6 +9,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
 								void **vm_mem)
@@ -737,3 +738,21 @@ __u64 kvm_get_cr8(kvm_context_t kvm, int
 	return 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;
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -110,4 +110,19 @@ void kvm_set_cr8(kvm_context_t kvm, int 
  */
 __u64 kvm_get_cr8(kvm_context_t kvm, int vcpu);
 
+/*!
+ * \brief Setup a vcpu's cpuid instruction emulation
+ *
+ * Set up a table of cpuid function to cpuid outputs.\n
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should be initialized
+ * \param nent number of entries to be installed
+ * \param entries cpuid function entries table
+ * \return 0 on success, or -errno on error
+ */
+int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
+		    struct kvm_cpuid_entry *entries);
+
+
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -854,24 +854,6 @@ int kvm_guest_debug(kvm_context_t kvm, i
 	return 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;
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -353,20 +353,6 @@ int kvm_guest_debug(kvm_context_t, int v
 int kvm_guest_debug(kvm_context_t, int vcpu, struct kvm_debug_guest *dbg);
 
 /*!
- * \brief Setup a vcpu's cpuid instruction emulation
- *
- * Set up a table of cpuid function to cpuid outputs.\n
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should be initialized
- * \param nent number of entries to be installed
- * \param entries cpuid function entries table
- * \return 0 on success, or -errno on error
- */
-int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
-		    struct kvm_cpuid_entry *entries);
-
-/*!
  * \brief Set a vcpu's signal mask for guest mode
  *
  * A vcpu can have different signals blocked in guest mode and user mode.

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 26 of 27] Move kvm_show_code to kvmctl-x86.c
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (24 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 25 of 27] Move kvm_setup_cpuid " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-10-31 17:05 ` [PATCH 27 of 27] Remove unsued inclusion of linux/kvm_parah.h in userspace kvmctl.h Jerone Young
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849565 18000
# Node ID 610dda45359f71e5d047867b33f5b8912aa30884
# Parent  30414641dae8853149da869e7ddb86964c788118
Move kvm_show_code to kvmctl-x86.c

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -756,3 +756,42 @@ int kvm_setup_cpuid(kvm_context_t kvm, i
 	return r;
 }
 
+void kvm_show_code(kvm_context_t kvm, int vcpu)
+{
+#define CR0_PE_MASK	(1ULL<<0)
+	int fd = kvm->vcpu_fd[vcpu];
+	struct kvm_regs regs;
+	struct kvm_sregs sregs;
+	int r;
+	unsigned char code[50];
+	int back_offset;
+	char code_str[sizeof(code) * 3 + 1];
+	unsigned long rip;
+
+	r = ioctl(fd, KVM_GET_SREGS, &sregs);
+	if (r == -1) {
+		perror("KVM_GET_SREGS");
+		return;
+	}
+	if (sregs.cr0 & CR0_PE_MASK)
+		return;
+
+	r = ioctl(fd, KVM_GET_REGS, &regs);
+	if (r == -1) {
+		perror("KVM_GET_REGS");
+		return;
+	}
+	rip = sregs.cs.base + regs.rip;
+	back_offset = regs.rip;
+	if (back_offset > 20)
+	    back_offset = 20;
+	memcpy(code, kvm->physical_memory + rip - back_offset, sizeof code);
+	*code_str = 0;
+	for (r = 0; r < sizeof code; ++r) {
+	    	if (r == back_offset)
+			strcat(code_str, " -->");
+		sprintf(code_str + strlen(code_str), " %02x", code[r]);
+	}
+	fprintf(stderr, "code:%s\n", code_str);
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -124,5 +124,6 @@ int kvm_setup_cpuid(kvm_context_t kvm, i
 int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
 		    struct kvm_cpuid_entry *entries);
 
+void kvm_show_code(kvm_context_t kvm, int vcpu);
 
 #endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -628,45 +628,6 @@ int kvm_set_sregs(kvm_context_t kvm, int
     return ioctl(kvm->vcpu_fd[vcpu], KVM_SET_SREGS, sregs);
 }
 
-static void kvm_show_code(kvm_context_t kvm, int vcpu)
-{
-#define CR0_PE_MASK	(1ULL<<0)
-	int fd = kvm->vcpu_fd[vcpu];
-	struct kvm_regs regs;
-	struct kvm_sregs sregs;
-	int r;
-	unsigned char code[50];
-	int back_offset;
-	char code_str[sizeof(code) * 3 + 1];
-	unsigned long rip;
-
-	r = ioctl(fd, KVM_GET_SREGS, &sregs);
-	if (r == -1) {
-		perror("KVM_GET_SREGS");
-		return;
-	}
-	if (sregs.cr0 & CR0_PE_MASK)
-		return;
-
-	r = ioctl(fd, KVM_GET_REGS, &regs);
-	if (r == -1) {
-		perror("KVM_GET_REGS");
-		return;
-	}
-	rip = sregs.cs.base + regs.rip;
-	back_offset = regs.rip;
-	if (back_offset > 20)
-	    back_offset = 20;
-	memcpy(code, kvm->physical_memory + rip - back_offset, sizeof code);
-	*code_str = 0;
-	for (r = 0; r < sizeof code; ++r) {
-	    	if (r == back_offset)
-			strcat(code_str, " -->");
-		sprintf(code_str + strlen(code_str), " %02x", code[r]);
-	}
-	fprintf(stderr, "code:%s\n", code_str);
-}
-
 static int handle_mmio(kvm_context_t kvm, struct kvm_run *kvm_run)
 {
 	unsigned long addr = kvm_run->mmio.phys_addr;

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 27 of 27] Remove unsued inclusion of linux/kvm_parah.h in userspace kvmctl.h
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (25 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 26 of 27] Move kvm_show_code " Jerone Young
@ 2007-10-31 17:05 ` Jerone Young
  2007-11-01 12:52 ` [PATCH 00 of 27] Refactor libkvm code Phase 1 Avi Kivity
  2007-11-02  5:26 ` Zhang, Xiantao
  28 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 17:05 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

# HG changeset patch
# User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
# Date 1193849565 18000
# Node ID 5800fd87b4d5afcfc7d8ba7bf4a38e6eefb2acf8
# Parent  610dda45359f71e5d047867b33f5b8912aa30884
Remove unsued inclusion of linux/kvm_parah.h in userspace kvmctl.h

This remove unused code from kvmctl.h.

Signed-off-by: Jerone Young <jyoug5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 01 of 27] Move kvm_context to kvmctl.h
  2007-10-31 17:05 ` [PATCH 01 of 27] Move kvm_context to kvmctl.h Jerone Young
@ 2007-10-31 17:37   ` Hollis Blanchard
  2007-10-31 18:48     ` Jerone Young
  2007-10-31 22:33   ` Avi Kivity
  1 sibling, 1 reply; 41+ messages in thread
From: Hollis Blanchard @ 2007-10-31 17:37 UTC (permalink / raw)
  To: Jerone Young; +Cc: kvm-devel, kvm-ppc-devel

On Wed, 2007-10-31 at 12:05 -0500, Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> # Date 1193849563 18000
> # Node ID 19a7c6d2ddfd1383aeb8a9bc09d9fe0673e7f9cc
> # Parent  c3d6e1e2b8a0368485badcde0e55a82d9b1897d1
> Move kvm_context to kvmctl.h
> 
> This patch moves kvm_context from kvmctl.c to kvmctl.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 kvmctl-x86.h. As these
> are closely associated with the architecture.
> 
> Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> 
> diff --git a/libkvm/Makefile b/libkvm/Makefile
> --- a/libkvm/Makefile
> +++ b/libkvm/Makefile
> @@ -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:
> diff --git a/libkvm/config-i386.mak b/libkvm/config-i386.mak
> --- a/libkvm/config-i386.mak
> +++ b/libkvm/config-i386.mak
> @@ -1,2 +1,3 @@
> +libkvm-$(ARCH)-objs := libkvm-x86.o
> 
>  LIBDIR := /lib

This patch does not create libkvm-x86.o.

> diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
> new file mode 100644
> --- /dev/null
> +++ b/libkvm/libkvm-x86.h
> @@ -0,0 +1,7 @@
> +#ifndef KVMCTL_X86_H
> +#define KVMCTL_X86_H
> +
> +#define KVM_MAX_NUM_MEM_REGIONS 8u
> +#define MAX_VCPUS 4
> +
> +#endif

I'm not sure this is needed.

Since there may be other intra-patch logical discrepancies, it might be
best for reviewers to apply all at once and then examine the final
result, rather than trying to read and comment on each individual patch.

-- 
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 01 of 27] Move kvm_context to kvmctl.h
  2007-10-31 17:37   ` Hollis Blanchard
@ 2007-10-31 18:48     ` Jerone Young
  0 siblings, 0 replies; 41+ messages in thread
From: Jerone Young @ 2007-10-31 18:48 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: kvm-devel, kvm-ppc-devel


On Wed, 2007-10-31 at 12:37 -0500, Hollis Blanchard wrote:
> On Wed, 2007-10-31 at 12:05 -0500, Jerone Young wrote:
> > # HG changeset patch
> > # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > # Date 1193849563 18000
> > # Node ID 19a7c6d2ddfd1383aeb8a9bc09d9fe0673e7f9cc
> > # Parent  c3d6e1e2b8a0368485badcde0e55a82d9b1897d1
> > Move kvm_context to kvmctl.h
> > 
> > This patch moves kvm_context from kvmctl.c to kvmctl.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 kvmctl-x86.h. As these
> > are closely associated with the architecture.
> > 
> > Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> > 
> > diff --git a/libkvm/Makefile b/libkvm/Makefile
> > --- a/libkvm/Makefile
> > +++ b/libkvm/Makefile
> > @@ -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:
> > diff --git a/libkvm/config-i386.mak b/libkvm/config-i386.mak
> > --- a/libkvm/config-i386.mak
> > +++ b/libkvm/config-i386.mak
> > @@ -1,2 +1,3 @@
> > +libkvm-$(ARCH)-objs := libkvm-x86.o
> > 
> >  LIBDIR := /lib
> 
> This patch does not create libkvm-x86.o.

Yeah this was left from moving stuff around. libkvm-x86.c
is created in patch:
[PATCH 03 of 27] Move fuction kvm_alloc_kernel_memory to kvmctl-x86.c


> > diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
> > new file mode 100644
> > --- /dev/null
> > +++ b/libkvm/libkvm-x86.h
> > @@ -0,0 +1,7 @@
> > +#ifndef KVMCTL_X86_H
> > +#define KVMCTL_X86_H
> > +
> > +#define KVM_MAX_NUM_MEM_REGIONS 8u
> > +#define MAX_VCPUS 4
> > +
> > +#endif
> 
> I'm not sure this is needed.


This part is mainly needed for moving of kvm_context structure.

> 
> Since there may be other intra-patch logical discrepancies, it might be
> best for reviewers to apply all at once and then examine the final
> result, rather than trying to read and comment on each individual patch.





-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 11 of 27] Move kvm_destroy_phys_mem to kvmctl-x86.c
  2007-10-31 17:05 ` [PATCH 11 of 27] Move kvm_destroy_phys_mem " Jerone Young
@ 2007-10-31 21:11   ` Izik Eidus
  0 siblings, 0 replies; 41+ messages in thread
From: Izik Eidus @ 2007-10-31 21:11 UTC (permalink / raw)
  To: Jerone Young
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> # Date 1193849564 18000
> # Node ID e2a804737e3b4847d7150dd5141e24a95460c46e
> # Parent  e0abf43119181082d46e21c02b07f275f08db02b
> Move kvm_destroy_phys_mem to kvmctl-x86.c
>
>   
this is good that you removed it from kvcmtl, beacuse it use 
kvm_create_phys_mem, that have x86 depened stuff (for old kernel memory 
allocation support) , but we probably will want to keep the same 
function in kvmctl and just call it:
with kvm_create_userspace_phys_mem (where len is zero) and change it 
name to kvm_destroy_userspace_mem or something like that,

beside this i looked at your patch, and the logic seems good, all the 
functions that you removed as far as i can tell shouldnt be used by 
other archs

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 01 of 27] Move kvm_context to kvmctl.h
  2007-10-31 17:05 ` [PATCH 01 of 27] Move kvm_context to kvmctl.h Jerone Young
  2007-10-31 17:37   ` Hollis Blanchard
@ 2007-10-31 22:33   ` Avi Kivity
  1 sibling, 0 replies; 41+ messages in thread
From: Avi Kivity @ 2007-10-31 22:33 UTC (permalink / raw)
  To: Jerone Young
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Jerone Young wrote:
> Move kvm_context to kvmctl.h
>
>   

Description seems outdated?

> This patch moves kvm_context from kvmctl.c to kvmctl.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 kvmctl-x86.h. As these
> are closely associated with the architecture.
>   

> diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
> --- a/libkvm/libkvm.h
> +++ b/libkvm/libkvm.h
> @@ -1,4 +1,4 @@
> -/** \file kvmctl.h
> +/** \file libkvm.h
>   * libkvm API
>   */
>  
> @@ -26,6 +26,40 @@ struct kvm_context;
>  struct kvm_context;
>  
>  typedef struct kvm_context *kvm_context_t;
> +
> +/* Add info from arch specific header */
> +#if defined(__x86_64__) || defined(__i386__)
> +#include "libkvm-x86.h"
> +#endif
> +
>   

This won't compile.  For bisectability, each patch in a patchset should 
compile (and run) after applying.

> +
> +/**
> + * \brief The KVM context
> + *
> + * The verbose KVM context
> + */
> +
> +struct kvm_context {
>   

Please move it to some private header file so users aren't tempted.  
Especially I'd like the size of the structure to be hidden as it's easy 
to break binary compatibility unintentionally if that's exposed.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 02 of 27] Make static slot & kvm_memory region funcions public
  2007-10-31 17:05 ` [PATCH 02 of 27] Make static slot & kvm_memory region funcions public Jerone Young
@ 2007-11-01 12:41   ` Avi Kivity
  0 siblings, 0 replies; 41+ messages in thread
From: Avi Kivity @ 2007-11-01 12:41 UTC (permalink / raw)
  To: Jerone Young
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> # Date 1193849563 18000
> # Node ID 9c74b8e493e67f544c017b6bef8dd047c128c8d3
> # Parent  19a7c6d2ddfd1383aeb8a9bc09d9fe0673e7f9cc
> Make static slot & kvm_memory region funcions public
>
> This patch changes static functions for manipulation of memory slots
> and regions public in kvmctl.c. This also makes a decleration for these
> functions in kvmctl.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).
>
>   

We have to differentiate between exported functions (to user of the 
library) to global functions (visible inside the library, but not to its 
users).  IMO these belong to the latter kind, and so should not be in 
libkvm.h (update the comment, too).

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 07 of 27] Move function kvm_create_default_phys_mem to kvmctl-x86 and rename
  2007-10-31 17:05 ` [PATCH 07 of 27] Move function kvm_create_default_phys_mem to kvmctl-x86 and rename Jerone Young
@ 2007-11-01 12:44   ` Avi Kivity
  0 siblings, 0 replies; 41+ messages in thread
From: Avi Kivity @ 2007-11-01 12:44 UTC (permalink / raw)
  To: Jerone Young
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> # Date 1193849564 18000
> # Node ID 7445bcdab796596fb97312b97393e4f2936e5450
> # Parent  a809d39bd74d33d221dd98cc6afa02d9a35889a4
> Move function kvm_create_default_phys_mem to kvmctl-x86 and rename
>
> This patch moves function kvm_create_default_phys_mem to kvmctl-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 x86_kvm_create_default_phys_mem
>
>   

kvm_x86_create_default_phys_mem, please.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 08 of 27] Modify out arch specific code from kvm_create function
  2007-10-31 17:05 ` [PATCH 08 of 27] Modify out arch specific code from kvm_create function Jerone Young
@ 2007-11-01 12:45   ` Avi Kivity
  0 siblings, 0 replies; 41+ messages in thread
From: Avi Kivity @ 2007-11-01 12:45 UTC (permalink / raw)
  To: Jerone Young
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> # Date 1193849564 18000
> # Node ID 179d9b30ab973e6676dcd0b6fa08e9635969d44c
> # Parent  7445bcdab796596fb97312b97393e4f2936e5450
> Modify out arch specific code from kvm_create function
>
> This function removes all x86 specific code and creates
> a hook function arch_kvm_create to accomidate for this code.
> arch_kvm_create is a hook that is placed in kvmctl-$(ARCH).c & h.
>
>   

kvm_arch_create() please.  don't export it.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00 of 27] Refactor libkvm code Phase 1
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (26 preceding siblings ...)
  2007-10-31 17:05 ` [PATCH 27 of 27] Remove unsued inclusion of linux/kvm_parah.h in userspace kvmctl.h Jerone Young
@ 2007-11-01 12:52 ` Avi Kivity
  2007-11-02  5:26 ` Zhang, Xiantao
  28 siblings, 0 replies; 41+ messages in thread
From: Avi Kivity @ 2007-11-01 12:52 UTC (permalink / raw)
  To: Jerone Young; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, kvm-ppc-devel

Jerone Young wrote:
> Kaniciwa!
>         I am here to once again bring great honorable patches to refactor
> libkvm x86 code. Patches that I sent in the past for this really took
> the wrong approach, and also many variables that I was splitting out actually
> could be shared amongst many architectures.
>
>         This is the first phase as much of the code is tightly written for x86 
> but can be reused by other archs, it's just a matter of an agreed upon method.
> Also since there are about 27 of these lets get through these before moving
> through more.
>
>   

Apart from the namespace issues (don't export library-private functions, 
start names with kvm_) this looks good.  Please make sure that it's 
bisect friendly (should compile as each patch is applied in sequence).  
With git I use something like

   for rev in $(git rev-list foo..bar); do git checkout $rev; make; done

to make sure that's the case.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00 of 27] Refactor libkvm code Phase 1
  2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
                   ` (27 preceding siblings ...)
  2007-11-01 12:52 ` [PATCH 00 of 27] Refactor libkvm code Phase 1 Avi Kivity
@ 2007-11-02  5:26 ` Zhang, Xiantao
       [not found]   ` <42DFA526FC41B1429CE7279EF83C6BDC9040D8-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  28 siblings, 1 reply; 41+ messages in thread
From: Zhang, Xiantao @ 2007-11-02  5:26 UTC (permalink / raw)
  To: Jerone Young, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 2112 bytes --]

Hi Young, 
	Quick hand! For patch 07/27, 09/27, i have some concerns about them.  In these two patches you moved the functions kvm_create_kernel_phys_mem, kvm_create_default_phys_mem to x86 arch. But I think it should work well for most archs. As somebody said, S390 may have a very different memory allocation mechanism, but we can't move them directly to x86 arch, because other archs may also need them.  We should find another approach to handle them, and make s390 and other archs all happy ! What about your ideas?:)
thanks 
Xiantao

-----Original Message-----
From: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Jerone Young
Sent: 2007年11月1日 1:05
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [kvm-devel] [PATCH 00 of 27] Refactor libkvm code Phase 1

Kaniciwa!
        I am here to once again bring great honorable patches to refactor
libkvm x86 code. Patches that I sent in the past for this really took
the wrong approach, and also many variables that I was splitting out actually
could be shared amongst many architectures.

        This is the first phase as much of the code is tightly written for x86 
but can be reused by other archs, it's just a matter of an agreed upon method.
Also since there are about 27 of these lets get through these before moving
through more.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

-------------------------------------------------------------------------
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/
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[-- Attachment #2: Type: text/plain, Size: 314 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #3: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00 of 27] Refactor libkvm code Phase 1
       [not found]   ` <42DFA526FC41B1429CE7279EF83C6BDC9040D8-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-11-02  7:49     ` Jerone Young
  2007-11-02 19:41       ` [kvm-ppc-devel] " Hollis Blanchard
  2007-11-04  7:40       ` Avi Kivity
  0 siblings, 2 replies; 41+ messages in thread
From: Jerone Young @ 2007-11-02  7:49 UTC (permalink / raw)
  To: Zhang, Xiantao
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Hmm,
	The problem here is in the case of kvm_create_phys_mem &
kvm_create_default_phys_mem, most archs from now on should always be
allocating guest memory from userspace (at least I think this correct).

	Now if this is not the case then really adding an architecture hook
function to kvm_create_default_phys_mem would also solve this problem.
As There is a mmap call that maps memory for video(?), which is
something that is just for x86.

	With the size of these functions being very small, I think it's best to
move them for now. Then if someone else does need them they can easily
create there own and then we can figure out how to make a common
function in this case.

	Anyone disagree?

  
On Fri, 2007-11-02 at 13:26 +0800, Zhang, Xiantao wrote:
> Hi Young, 
> 	Quick hand! For patch 07/27, 09/27, i have some concerns about them.  In these two patches you moved the functions kvm_create_kernel_phys_mem, kvm_create_default_phys_mem to x86 arch. But I think it should work well for most archs. As somebody said, S390 may have a very different memory allocation mechanism, but we can't move them directly to x86 arch, because other archs may also need them.  We should find another approach to handle them, and make s390 and other archs all happy ! What about your ideas?:)
> thanks 
> Xiantao
> 
> -----Original Message-----
> From: kvm-devel-bounces@lists.sourceforge.net [mailto:kvm-devel-bounces@lists.sourceforge.net] On Behalf Of Jerone Young
> Sent: 2007年11月1日 1:05
> To: kvm-devel@lists.sourceforge.net
> Cc: kvm-ppc-devel@lists.sourceforge.net
> Subject: [kvm-devel] [PATCH 00 of 27] Refactor libkvm code Phase 1
> 
> Kaniciwa!
>         I am here to once again bring great honorable patches to refactor
> libkvm x86 code. Patches that I sent in the past for this really took
> the wrong approach, and also many variables that I was splitting out actually
> could be shared amongst many architectures.
> 
>         This is the first phase as much of the code is tightly written for x86 
> but can be reused by other archs, it's just a matter of an agreed upon method.
> Also since there are about 27 of these lets get through these before moving
> through more.
> 
> Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> 
> -------------------------------------------------------------------------
> 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/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
> 
> -------------------------------------------------------------------------
> 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/
> _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel


-------------------------------------------------------------------------
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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [kvm-ppc-devel] [PATCH 00 of 27] Refactor libkvm code Phase 1
  2007-11-02  7:49     ` Jerone Young
@ 2007-11-02 19:41       ` Hollis Blanchard
  2007-11-04  7:40       ` Avi Kivity
  1 sibling, 0 replies; 41+ messages in thread
From: Hollis Blanchard @ 2007-11-02 19:41 UTC (permalink / raw)
  To: jyoung5-r/Jw6+rmf7HQT0dZR+AlfA
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Zhang, Xiantao

Yes, everybody should be doing userspace memory allocation now, and we
just need to support kernel allocation for compatibility on x86.

-- 
Hollis Blanchard
IBM Linux Technology Center

On Fri, 2007-11-02 at 02:49 -0500, Jerone Young wrote:
> Hmm,
> 	The problem here is in the case of kvm_create_phys_mem &
> kvm_create_default_phys_mem, most archs from now on should always be
> allocating guest memory from userspace (at least I think this correct).
> 
> 	Now if this is not the case then really adding an architecture hook
> function to kvm_create_default_phys_mem would also solve this problem.
> As There is a mmap call that maps memory for video(?), which is
> something that is just for x86.
> 
> 	With the size of these functions being very small, I think it's best to
> move them for now. Then if someone else does need them they can easily
> create there own and then we can figure out how to make a common
> function in this case.
> 
> 	Anyone disagree?
> 
>   
> On Fri, 2007-11-02 at 13:26 +0800, Zhang, Xiantao wrote:
> > Hi Young, 
> > 	Quick hand! For patch 07/27, 09/27, i have some concerns about them.  In these two patches you moved the functions kvm_create_kernel_phys_mem, kvm_create_default_phys_mem to x86 arch. But I think it should work well for most archs. As somebody said, S390 may have a very different memory allocation mechanism, but we can't move them directly to x86 arch, because other archs may also need them.  We should find another approach to handle them, and make s390 and other archs all happy ! What about your ideas?:)
> > thanks 
> > Xiantao
> > 
> > -----Original Message-----
> > From: kvm-devel-bounces@lists.sourceforge.net [mailto:kvm-devel-bounces@lists.sourceforge.net] On Behalf Of Jerone Young
> > Sent: 2007年11月1日 1:05
> > To: kvm-devel@lists.sourceforge.net
> > Cc: kvm-ppc-devel@lists.sourceforge.net
> > Subject: [kvm-devel] [PATCH 00 of 27] Refactor libkvm code Phase 1
> > 
> > Kaniciwa!
> >         I am here to once again bring great honorable patches to refactor
> > libkvm x86 code. Patches that I sent in the past for this really took
> > the wrong approach, and also many variables that I was splitting out actually
> > could be shared amongst many architectures.
> > 
> >         This is the first phase as much of the code is tightly written for x86 
> > but can be reused by other archs, it's just a matter of an agreed upon method.
> > Also since there are about 27 of these lets get through these before moving
> > through more.
> > 
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> > 
> > -------------------------------------------------------------------------
> > 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/
> > _______________________________________________
> > kvm-devel mailing list
> > kvm-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/kvm-devel
> > 
> > -------------------------------------------------------------------------
> > 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/
> > _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel
> 
> 
> -------------------------------------------------------------------------
> 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/
> _______________________________________________
> kvm-ppc-devel mailing list
> kvm-ppc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel


-------------------------------------------------------------------------
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/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00 of 27] Refactor libkvm code Phase 1
  2007-11-02  7:49     ` Jerone Young
  2007-11-02 19:41       ` [kvm-ppc-devel] " Hollis Blanchard
@ 2007-11-04  7:40       ` Avi Kivity
       [not found]         ` <472D7772.9070907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  1 sibling, 1 reply; 41+ messages in thread
From: Avi Kivity @ 2007-11-04  7:40 UTC (permalink / raw)
  To: jyoung5-r/Jw6+rmf7HQT0dZR+AlfA
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Zhang, Xiantao

Jerone Young wrote:
> Hmm,
> 	The problem here is in the case of kvm_create_phys_mem &
> kvm_create_default_phys_mem, most archs from now on should always be
> allocating guest memory from userspace (at least I think this correct).
>
> 	Now if this is not the case then really adding an architecture hook
> function to kvm_create_default_phys_mem would also solve this problem.
> As There is a mmap call that maps memory for video(?), which is
> something that is just for x86.
>
> 	With the size of these functions being very small, I think it's best to
> move them for now. Then if someone else does need them they can easily
> create there own and then we can figure out how to make a common
> function in this case.
>
> 	Anyone disagree?
>   

Me.  Let's not copy and re-unify needlessly.

If the create_kernel_memory() thing is a problem, define a function for 
non-x86 that returns -ENOSYS.  It won't be called anyway.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00 of 27] Refactor libkvm code Phase 1
       [not found]         ` <472D7772.9070907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-11-05  1:13           ` Zhang, Xiantao
  0 siblings, 0 replies; 41+ messages in thread
From: Zhang, Xiantao @ 2007-11-05  1:13 UTC (permalink / raw)
  To: Avi Kivity, jyoung5-r/Jw6+rmf7HQT0dZR+AlfA
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kvm-ppc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Avi Kivity wrote:
> Jerone Young wrote:
>> Hmm,
>> 	The problem here is in the case of kvm_create_phys_mem &
>> kvm_create_default_phys_mem, most archs from now on should always be
>> allocating guest memory from userspace (at least I think this
>> correct). 
>> 
>> 	Now if this is not the case then really adding an architecture
hook
>> function to kvm_create_default_phys_mem would also solve this
>> problem. As There is a mmap call that maps memory for video(?),
>> which is something that is just for x86.
>> 
>> 	With the size of these functions being very small, I think it's
>> best to move them for now. Then if someone else does need them they
>> can easily create there own and then we can figure out how to make a
>> common function in this case. 
>> 
>> 	Anyone disagree?
>> 
> 
> Me.  Let's not copy and re-unify needlessly.
> 
> If the create_kernel_memory() thing is a problem, define a function
> for non-x86 that returns -ENOSYS.  It won't be called anyway.

Totally agree.

Xiantao

-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2007-11-05  1:13 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-31 17:05 [PATCH 00 of 27] Refactor libkvm code Phase 1 Jerone Young
2007-10-31 17:05 ` [PATCH 01 of 27] Move kvm_context to kvmctl.h Jerone Young
2007-10-31 17:37   ` Hollis Blanchard
2007-10-31 18:48     ` Jerone Young
2007-10-31 22:33   ` Avi Kivity
2007-10-31 17:05 ` [PATCH 02 of 27] Make static slot & kvm_memory region funcions public Jerone Young
2007-11-01 12:41   ` Avi Kivity
2007-10-31 17:05 ` [PATCH 03 of 27] Move fuction kvm_alloc_kernel_memory to kvmctl-x86.c Jerone Young
2007-10-31 17:05 ` [PATCH 04 of 27] Move kvm_alloc_userspace_memory " Jerone Young
2007-10-31 17:05 ` [PATCH 05 of 27] Move kvm_set_tss_addr " Jerone Young
2007-10-31 17:05 ` [PATCH 06 of 27] imported patch move_kvm_set_init_tss Jerone Young
2007-10-31 17:05 ` [PATCH 07 of 27] Move function kvm_create_default_phys_mem to kvmctl-x86 and rename Jerone Young
2007-11-01 12:44   ` Avi Kivity
2007-10-31 17:05 ` [PATCH 08 of 27] Modify out arch specific code from kvm_create function Jerone Young
2007-11-01 12:45   ` Avi Kivity
2007-10-31 17:05 ` [PATCH 09 of 27] Move kvm_create_kernel_phys_mem to kvmctl-x86.c Jerone Young
2007-10-31 17:05 ` [PATCH 10 of 27] Move kvm_create_phys_mem " Jerone Young
2007-10-31 17:05 ` [PATCH 11 of 27] Move kvm_destroy_phys_mem " Jerone Young
2007-10-31 21:11   ` Izik Eidus
2007-10-31 17:05 ` [PATCH 12 of 27] Move kvm_create_memory_alias & kvm_destroy_memory_alias " Jerone Young
2007-10-31 17:05 ` [PATCH 13 of 27] Move kvm_get & kmv_set_lapci functions " Jerone Young
2007-10-31 17:05 ` [PATCH 14 of 27] Make functions in kvmctl.c nonstatic Jerone Young
2007-10-31 17:05 ` [PATCH 15 of 27] Move handle_io_abi_10 to kvmctl-x86.c Jerone Young
2007-10-31 17:05 ` [PATCH 16 of 27] Move handle_mmio_abi10 " Jerone Young
2007-10-31 17:05 ` [PATCH 17 of 27] Move kvm_run_abi10 " Jerone Young
2007-10-31 17:05 ` [PATCH 18 of 27] Change name of post_kvm_run & pre_kvm_run in kvmctl.c Jerone Young
2007-10-31 17:05 ` [PATCH 19 of 27] Move msrs functions to kvmctl-x86.c Jerone Young
2007-10-31 17:05 ` [PATCH 20 of 27] Move print_seg " Jerone Young
2007-10-31 17:05 ` [PATCH 21 of 27] Move kvm_show_regs " Jerone Young
2007-10-31 17:05 ` [PATCH 22 of 27] Declare kvm_abi as a global variable in kvmctl.h Jerone Young
2007-10-31 17:05 ` [PATCH 23 of 27] Move kvm_get_apic to kvmctl-x86.c Jerone Young
2007-10-31 17:05 ` [PATCH 24 of 27] Move cr8 functions " Jerone Young
2007-10-31 17:05 ` [PATCH 25 of 27] Move kvm_setup_cpuid " Jerone Young
2007-10-31 17:05 ` [PATCH 26 of 27] Move kvm_show_code " Jerone Young
2007-10-31 17:05 ` [PATCH 27 of 27] Remove unsued inclusion of linux/kvm_parah.h in userspace kvmctl.h Jerone Young
2007-11-01 12:52 ` [PATCH 00 of 27] Refactor libkvm code Phase 1 Avi Kivity
2007-11-02  5:26 ` Zhang, Xiantao
     [not found]   ` <42DFA526FC41B1429CE7279EF83C6BDC9040D8-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-02  7:49     ` Jerone Young
2007-11-02 19:41       ` [kvm-ppc-devel] " Hollis Blanchard
2007-11-04  7:40       ` Avi Kivity
     [not found]         ` <472D7772.9070907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-05  1:13           ` Zhang, Xiantao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox