* [PATCH 2/6] kvm: libkvm: Add Supporting for in-kernel PIT model
@ 2008-03-04 10:22 Yang, Sheng
0 siblings, 0 replies; 2+ messages in thread
From: Yang, Sheng @ 2008-03-04 10:22 UTC (permalink / raw)
To: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 2767 bytes --]
From da231cf5bb50310b4b98cc4b58370723b8e3f65d Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Sun, 27 Jan 2008 11:25:29 +0800
Subject: [PATCH] kvm: libkvm: Add Supporting for in-kernel PIT model
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
kernel/Kbuild | 2 +-
libkvm/kvm-common.h | 4 ++++
libkvm/libkvm-x86.c | 25 +++++++++++++++++++++++++
libkvm/libkvm.c | 5 +++++
4 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/kernel/Kbuild b/kernel/Kbuild
index ed02f5a..014cc17 100644
--- a/kernel/Kbuild
+++ b/kernel/Kbuild
@@ -1,7 +1,7 @@
EXTRA_CFLAGS := -I$(src)/include -include $(src)/external-module-compat.h
obj-m := kvm.o kvm-intel.o kvm-amd.o
kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o anon_inodes.o irq.o i8259.o
\
- lapic.o ioapic.o preempt.o
+ lapic.o ioapic.o preempt.o i8254.o
kvm-intel-objs := vmx.o vmx-debug.o
kvm-amd-objs := svm.o
diff --git a/libkvm/kvm-common.h b/libkvm/kvm-common.h
index d4df1a4..b8a88ee 100644
--- a/libkvm/kvm-common.h
+++ b/libkvm/kvm-common.h
@@ -47,6 +47,10 @@ struct kvm_context {
int no_irqchip_creation;
/// in-kernel irqchip status
int irqchip_in_kernel;
+ /// do not create in-kernel pit if set
+ int no_pit_creation;
+ /// in-kernel pit status
+ int pit_in_kernel;
};
void init_slots(void);
diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
index 4bd0e2f..b3a241e 100644
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -144,6 +144,27 @@ int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
return 0;
}
+int kvm_create_pit(kvm_context_t kvm)
+{
+#ifdef KVM_CAP_PIT
+ int r;
+
+ kvm->pit_in_kernel = 0;
+ if (!kvm->no_pit_creation) {
+ r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_PIT);
+ if (r > 0) {
+ r = ioctl(kvm->vm_fd, KVM_CREATE_PIT);
+ if (r >= 0)
+ kvm->pit_in_kernel = 1;
+ else {
+ printf("Create kernel PIC irqchip failed\n");
+ return r;
+ }
+ }
+ }
+#endif
+ return 0;
+}
int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
void **vm_mem)
@@ -154,6 +175,10 @@ int kvm_arch_create(kvm_context_t kvm, unsigned long
phys_mem_bytes,
if (r < 0)
return r;
+ r = kvm_create_pit(kvm);
+ if (r < 0)
+ return r;
+
return 0;
}
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 966501c..a7cc0e6 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -271,6 +271,11 @@ void kvm_disable_irqchip_creation(kvm_context_t kvm)
kvm->no_irqchip_creation = 1;
}
+void kvm_disable_pit_creation(kvm_context_t kvm)
+{
+ kvm->no_pit_creation = 1;
+}
+
int kvm_create_vcpu(kvm_context_t kvm, int slot)
{
long mmap_size;
--
debian.1.5.3.7.1-dirty
[-- Attachment #2: 0001-kvm-libkvm-Add-Supporting-for-in-kernel-PIT-model.patch --]
[-- Type: text/x-diff, Size: 2771 bytes --]
From da231cf5bb50310b4b98cc4b58370723b8e3f65d Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Sun, 27 Jan 2008 11:25:29 +0800
Subject: [PATCH] kvm: libkvm: Add Supporting for in-kernel PIT model
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
kernel/Kbuild | 2 +-
libkvm/kvm-common.h | 4 ++++
libkvm/libkvm-x86.c | 25 +++++++++++++++++++++++++
libkvm/libkvm.c | 5 +++++
4 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/kernel/Kbuild b/kernel/Kbuild
index ed02f5a..014cc17 100644
--- a/kernel/Kbuild
+++ b/kernel/Kbuild
@@ -1,7 +1,7 @@
EXTRA_CFLAGS := -I$(src)/include -include $(src)/external-module-compat.h
obj-m := kvm.o kvm-intel.o kvm-amd.o
kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o anon_inodes.o irq.o i8259.o \
- lapic.o ioapic.o preempt.o
+ lapic.o ioapic.o preempt.o i8254.o
kvm-intel-objs := vmx.o vmx-debug.o
kvm-amd-objs := svm.o
diff --git a/libkvm/kvm-common.h b/libkvm/kvm-common.h
index d4df1a4..b8a88ee 100644
--- a/libkvm/kvm-common.h
+++ b/libkvm/kvm-common.h
@@ -47,6 +47,10 @@ struct kvm_context {
int no_irqchip_creation;
/// in-kernel irqchip status
int irqchip_in_kernel;
+ /// do not create in-kernel pit if set
+ int no_pit_creation;
+ /// in-kernel pit status
+ int pit_in_kernel;
};
void init_slots(void);
diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
index 4bd0e2f..b3a241e 100644
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -144,6 +144,27 @@ int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
return 0;
}
+int kvm_create_pit(kvm_context_t kvm)
+{
+#ifdef KVM_CAP_PIT
+ int r;
+
+ kvm->pit_in_kernel = 0;
+ if (!kvm->no_pit_creation) {
+ r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_PIT);
+ if (r > 0) {
+ r = ioctl(kvm->vm_fd, KVM_CREATE_PIT);
+ if (r >= 0)
+ kvm->pit_in_kernel = 1;
+ else {
+ printf("Create kernel PIC irqchip failed\n");
+ return r;
+ }
+ }
+ }
+#endif
+ return 0;
+}
int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
void **vm_mem)
@@ -154,6 +175,10 @@ int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
if (r < 0)
return r;
+ r = kvm_create_pit(kvm);
+ if (r < 0)
+ return r;
+
return 0;
}
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 966501c..a7cc0e6 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -271,6 +271,11 @@ void kvm_disable_irqchip_creation(kvm_context_t kvm)
kvm->no_irqchip_creation = 1;
}
+void kvm_disable_pit_creation(kvm_context_t kvm)
+{
+ kvm->no_pit_creation = 1;
+}
+
int kvm_create_vcpu(kvm_context_t kvm, int slot)
{
long mmap_size;
--
debian.1.5.3.7.1-dirty
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 158 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/6] kvm: libkvm: Add Supporting for in-kernel PIT model
@ 2008-03-07 12:52 Yang, Sheng
0 siblings, 0 replies; 2+ messages in thread
From: Yang, Sheng @ 2008-03-07 12:52 UTC (permalink / raw)
To: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 2767 bytes --]
From 0e5d4fad7a6a917232d89afb58b960f6951990de Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Sun, 27 Jan 2008 11:25:29 +0800
Subject: [PATCH] kvm: libkvm: Add Supporting for in-kernel PIT model
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
kernel/Kbuild | 2 +-
libkvm/kvm-common.h | 4 ++++
libkvm/libkvm-x86.c | 25 +++++++++++++++++++++++++
libkvm/libkvm.c | 5 +++++
4 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/kernel/Kbuild b/kernel/Kbuild
index ed02f5a..014cc17 100644
--- a/kernel/Kbuild
+++ b/kernel/Kbuild
@@ -1,7 +1,7 @@
EXTRA_CFLAGS := -I$(src)/include -include $(src)/external-module-compat.h
obj-m := kvm.o kvm-intel.o kvm-amd.o
kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o anon_inodes.o irq.o i8259.o
\
- lapic.o ioapic.o preempt.o
+ lapic.o ioapic.o preempt.o i8254.o
kvm-intel-objs := vmx.o vmx-debug.o
kvm-amd-objs := svm.o
diff --git a/libkvm/kvm-common.h b/libkvm/kvm-common.h
index d4df1a4..b8a88ee 100644
--- a/libkvm/kvm-common.h
+++ b/libkvm/kvm-common.h
@@ -47,6 +47,10 @@ struct kvm_context {
int no_irqchip_creation;
/// in-kernel irqchip status
int irqchip_in_kernel;
+ /// do not create in-kernel pit if set
+ int no_pit_creation;
+ /// in-kernel pit status
+ int pit_in_kernel;
};
void init_slots(void);
diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
index 4bd0e2f..b3a241e 100644
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -144,6 +144,27 @@ int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
return 0;
}
+int kvm_create_pit(kvm_context_t kvm)
+{
+#ifdef KVM_CAP_PIT
+ int r;
+
+ kvm->pit_in_kernel = 0;
+ if (!kvm->no_pit_creation) {
+ r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_PIT);
+ if (r > 0) {
+ r = ioctl(kvm->vm_fd, KVM_CREATE_PIT);
+ if (r >= 0)
+ kvm->pit_in_kernel = 1;
+ else {
+ printf("Create kernel PIC irqchip failed\n");
+ return r;
+ }
+ }
+ }
+#endif
+ return 0;
+}
int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
void **vm_mem)
@@ -154,6 +175,10 @@ int kvm_arch_create(kvm_context_t kvm, unsigned long
phys_mem_bytes,
if (r < 0)
return r;
+ r = kvm_create_pit(kvm);
+ if (r < 0)
+ return r;
+
return 0;
}
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 966501c..a7cc0e6 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -271,6 +271,11 @@ void kvm_disable_irqchip_creation(kvm_context_t kvm)
kvm->no_irqchip_creation = 1;
}
+void kvm_disable_pit_creation(kvm_context_t kvm)
+{
+ kvm->no_pit_creation = 1;
+}
+
int kvm_create_vcpu(kvm_context_t kvm, int slot)
{
long mmap_size;
--
debian.1.5.3.7.1-dirty
[-- Attachment #2: 0001-kvm-libkvm-Add-Supporting-for-in-kernel-PIT-model.patch --]
[-- Type: text/x-diff, Size: 2771 bytes --]
From 0e5d4fad7a6a917232d89afb58b960f6951990de Mon Sep 17 00:00:00 2001
From: Sheng Yang <sheng.yang@intel.com>
Date: Sun, 27 Jan 2008 11:25:29 +0800
Subject: [PATCH] kvm: libkvm: Add Supporting for in-kernel PIT model
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
---
kernel/Kbuild | 2 +-
libkvm/kvm-common.h | 4 ++++
libkvm/libkvm-x86.c | 25 +++++++++++++++++++++++++
libkvm/libkvm.c | 5 +++++
4 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/kernel/Kbuild b/kernel/Kbuild
index ed02f5a..014cc17 100644
--- a/kernel/Kbuild
+++ b/kernel/Kbuild
@@ -1,7 +1,7 @@
EXTRA_CFLAGS := -I$(src)/include -include $(src)/external-module-compat.h
obj-m := kvm.o kvm-intel.o kvm-amd.o
kvm-objs := kvm_main.o x86.o mmu.o x86_emulate.o anon_inodes.o irq.o i8259.o \
- lapic.o ioapic.o preempt.o
+ lapic.o ioapic.o preempt.o i8254.o
kvm-intel-objs := vmx.o vmx-debug.o
kvm-amd-objs := svm.o
diff --git a/libkvm/kvm-common.h b/libkvm/kvm-common.h
index d4df1a4..b8a88ee 100644
--- a/libkvm/kvm-common.h
+++ b/libkvm/kvm-common.h
@@ -47,6 +47,10 @@ struct kvm_context {
int no_irqchip_creation;
/// in-kernel irqchip status
int irqchip_in_kernel;
+ /// do not create in-kernel pit if set
+ int no_pit_creation;
+ /// in-kernel pit status
+ int pit_in_kernel;
};
void init_slots(void);
diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
index 4bd0e2f..b3a241e 100644
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -144,6 +144,27 @@ int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
return 0;
}
+int kvm_create_pit(kvm_context_t kvm)
+{
+#ifdef KVM_CAP_PIT
+ int r;
+
+ kvm->pit_in_kernel = 0;
+ if (!kvm->no_pit_creation) {
+ r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_PIT);
+ if (r > 0) {
+ r = ioctl(kvm->vm_fd, KVM_CREATE_PIT);
+ if (r >= 0)
+ kvm->pit_in_kernel = 1;
+ else {
+ printf("Create kernel PIC irqchip failed\n");
+ return r;
+ }
+ }
+ }
+#endif
+ return 0;
+}
int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
void **vm_mem)
@@ -154,6 +175,10 @@ int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
if (r < 0)
return r;
+ r = kvm_create_pit(kvm);
+ if (r < 0)
+ return r;
+
return 0;
}
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 966501c..a7cc0e6 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -271,6 +271,11 @@ void kvm_disable_irqchip_creation(kvm_context_t kvm)
kvm->no_irqchip_creation = 1;
}
+void kvm_disable_pit_creation(kvm_context_t kvm)
+{
+ kvm->no_pit_creation = 1;
+}
+
int kvm_create_vcpu(kvm_context_t kvm, int slot)
{
long mmap_size;
--
debian.1.5.3.7.1-dirty
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: Type: text/plain, Size: 158 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-07 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04 10:22 [PATCH 2/6] kvm: libkvm: Add Supporting for in-kernel PIT model Yang, Sheng
-- strict thread matches above, loose matches on Subject: below --
2008-03-07 12:52 Yang, Sheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox