From 32bc765f65184f6612549a52ead86c740d0ce5a9 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Tue, 20 Nov 2007 22:40:04 +0800
Subject: [PATCH] KVM Portability: Spliting kvm structure.
Introduing kvm_x86 structure to hold x86_specific fileds,
but only infrastructure is implemented.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 drivers/kvm/x86.c |    8 ++++----
 drivers/kvm/x86.h |    9 +++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index 2b41217..fd2ccb9 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -2591,14 +2591,14 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
 
 struct  kvm *kvm_arch_create_vm(void)
 {
-	struct kvm *kvm = kzalloc(sizeof(struct kvm), GFP_KERNEL);
+	struct kvm_x86 *kvm_x86 = kzalloc(sizeof(struct kvm_x86), GFP_KERNEL);
 
-	if (!kvm)
+	if (!kvm_x86)
 		return ERR_PTR(-ENOMEM);
 
-	INIT_LIST_HEAD(&kvm->active_mmu_pages);
+	INIT_LIST_HEAD(&kvm_x86->kvm.active_mmu_pages);
 
-	return kvm;
+	return &kvm_x86->kvm;
 }
 
 static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h
index 71f2477..5a87557 100644
--- a/drivers/kvm/x86.h
+++ b/drivers/kvm/x86.h
@@ -156,6 +156,15 @@ struct kvm_vcpu {
 	struct x86_emulate_ctxt emulate_ctxt;
 };
 
+struct kvm_x86 {
+	struct kvm kvm;
+};
+
+static inline struct kvm_x86 *to_kvm_x86(struct kvm *kvm)
+{
+	return container_of(kvm, struct kvm_x86, kvm);
+}
+
 struct kvm_x86_ops {
 	int (*cpu_has_kvm_support)(void);          /* __init */
 	int (*disabled_by_bios)(void);             /* __init */
-- 
1.5.1.2

