* [Patch][2/3] Move kvm_mmu init and exit functionality to arch.
@ 2007-11-19 5:35 Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9A0A7E-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Xiantao @ 2007-11-19 5:35 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
[-- Attachment #1: Type: text/plain, Size: 64 bytes --]
Move kvm_mmu init and exit functionality to arch.
Xiantao
[-- Attachment #2: 0002-KVM-Portability-MMU-split.patch --]
[-- Type: application/octet-stream, Size: 2438 bytes --]
From 1e7d70b2cd3b784e01e87a3b831b9d6300d5ffe7 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Sun, 18 Nov 2007 20:43:21 +0800
Subject: [PATCH] KVM Portability: MMU split
Move out kvm_mmu init and exit functionality from kvm_main.c
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
drivers/kvm/kvm_main.c | 8 --------
drivers/kvm/x86.c | 24 +++++++++++++++++++-----
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 3400265..2be166b 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1416,10 +1416,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
int r;
int cpu;
- r = kvm_mmu_module_init();
- if (r)
- goto out4;
-
kvm_init_debug();
r = kvm_arch_init(opaque);
@@ -1478,8 +1474,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
kvm_preempt_ops.sched_in = kvm_sched_in;
kvm_preempt_ops.sched_out = kvm_sched_out;
- kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
-
return 0;
out_free:
@@ -1498,7 +1492,6 @@ out_free_0:
out:
kvm_arch_exit();
kvm_exit_debug();
- kvm_mmu_module_exit();
out4:
return r;
}
@@ -1517,6 +1510,5 @@ void kvm_exit(void)
kvm_arch_exit();
kvm_exit_debug();
__free_page(bad_page);
- kvm_mmu_module_exit();
}
EXPORT_SYMBOL_GPL(kvm_exit);
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 8eebd40..772edef 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -1699,33 +1699,47 @@ EXPORT_SYMBOL_GPL(kvm_emulate_pio_string);
int kvm_arch_init(void *opaque)
{
+ int r;
struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
+ r = kvm_mmu_module_init();
+ if (r)
+ goto out_fail;
+
kvm_init_msr_list();
if (kvm_x86_ops) {
printk(KERN_ERR "kvm: already loaded the other module\n");
- return -EEXIST;
+ r = -EEXIST;
+ goto out;
}
if (!ops->cpu_has_kvm_support()) {
printk(KERN_ERR "kvm: no hardware support\n");
- return -EOPNOTSUPP;
+ r = -EOPNOTSUPP;
+ goto out;
}
if (ops->disabled_by_bios()) {
printk(KERN_ERR "kvm: disabled by bios\n");
- return -EOPNOTSUPP;
+ r = -EOPNOTSUPP;
+ goto out;
}
kvm_x86_ops = ops;
-
+ kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
return 0;
+
+out:
+ kvm_mmu_module_exit();
+out_fail:
+ return r;
}
void kvm_arch_exit(void)
{
kvm_x86_ops = NULL;
- }
+ kvm_mmu_module_exit();
+}
int kvm_emulate_halt(struct kvm_vcpu *vcpu)
{
--
1.5.1.2
[-- Attachment #3: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- Attachment #4: 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 related [flat|nested] 2+ messages in thread
* Re: [Patch][2/3] Move kvm_mmu init and exit functionality to arch.
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9A0A7E-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-11-19 14:40 ` Carsten Otte
0 siblings, 0 replies; 2+ messages in thread
From: Carsten Otte @ 2007-11-19 14:40 UTC (permalink / raw)
To: Zhang, Xiantao; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Avi Kivity
Zhang, Xiantao wrote:
> Move kvm_mmu init and exit functionality to arch.
Acked-by: Carsten Otte <cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-19 14:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-19 5:35 [Patch][2/3] Move kvm_mmu init and exit functionality to arch Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9A0A7E-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-19 14:40 ` Carsten Otte
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox