>From e7a0fcaa7d87c20a4e7155a11ee2afa880bdc471 Mon Sep 17 00:00:00 2001
From: Zhang xiantao <[EMAIL PROTECTED]>
Date: Tue, 20 Nov 2007 10:44:08 +0800
Subject: [PATCH] KVM Portability split: splitting kvm.h
Moving code related to mmu to x86.h
Signed-off-by: Zhang xiantao <[EMAIL PROTECTED]>
---
 drivers/kvm/kvm.h |   78
----------------------------------------------------
 drivers/kvm/x86.h |   79
+++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 78 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 445012e..5149d39 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -58,89 +58,11 @@ typedef unsigned long  hva_t;
 typedef u64            hpa_t;
 typedef unsigned long  hfn_t;
 
-#define NR_PTE_CHAIN_ENTRIES 5
-
-struct kvm_pte_chain {
-       u64 *parent_ptes[NR_PTE_CHAIN_ENTRIES];
-       struct hlist_node link;
-};
-
-/*
- * kvm_mmu_page_role, below, is defined as:
- *
- *   bits 0:3 - total guest paging levels (2-4, or zero for real mode)
- *   bits 4:7 - page table level for this shadow (1-4)
- *   bits 8:9 - page table quadrant for 2-level guests
- *   bit   16 - "metaphysical" - gfn is not a real page (huge page/real
mode)
- *   bits 17:19 - "access" - the user, writable, and nx bits of a huge
page pde
- */
-union kvm_mmu_page_role {
-       unsigned word;
-       struct {
-               unsigned glevels : 4;
-               unsigned level : 4;
-               unsigned quadrant : 2;
-               unsigned pad_for_nice_hex_output : 6;
-               unsigned metaphysical : 1;
-               unsigned hugepage_access : 3;
-       };
-};
-
-struct kvm_mmu_page {
-       struct list_head link;
-       struct hlist_node hash_link;
-
-       /*
-        * The following two entries are used to key the shadow page in
the
-        * hash table.
-        */
-       gfn_t gfn;
-       union kvm_mmu_page_role role;
-
-       u64 *spt;
-       /* hold the gfn of each spte inside spt */
-       gfn_t *gfns;
-       unsigned long slot_bitmap; /* One bit set per slot which has
memory
-                                   * in this shadow page.
-                                   */
-       int multimapped;         /* More than one parent_pte? */
-       int root_count;          /* Currently serving as active root */
-       union {
-               u64 *parent_pte;               /* !multimapped */
-               struct hlist_head parent_ptes; /* multimapped,
kvm_pte_chain */
-       };
-};
 
 struct kvm_vcpu;
 extern struct kmem_cache *kvm_vcpu_cache;
 
 /*
- * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and
2-level
- * 32-bit).  The kvm_mmu structure abstracts the details of the current
mmu
- * mode.
- */
-struct kvm_mmu {
-       void (*new_cr3)(struct kvm_vcpu *vcpu);
-       int (*page_fault)(struct kvm_vcpu *vcpu, gva_t gva, u32 err);
-       void (*free)(struct kvm_vcpu *vcpu);
-       gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva);
-       void (*prefetch_page)(struct kvm_vcpu *vcpu,
-                             struct kvm_mmu_page *page);
-       hpa_t root_hpa;
-       int root_level;
-       int shadow_root_level;
-
-       u64 *pae_root;
-};
-
-#define KVM_NR_MEM_OBJS 40
-
-struct kvm_mmu_memory_cache {
-       int nobjs;
-       void *objects[KVM_NR_MEM_OBJS];
-};
-
-/*
  * We don't want allocation failures within the mmu code, so we
preallocate
  * enough memory for a single page fault in a cache.
  */
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h
index 1a6f8fe..2fdda8f 100644
--- a/drivers/kvm/x86.h
+++ b/drivers/kvm/x86.h
@@ -55,6 +55,85 @@
 extern spinlock_t kvm_lock;
 extern struct list_head vm_list;
 
+#define NR_PTE_CHAIN_ENTRIES 5
+
+struct kvm_pte_chain {
+       u64 *parent_ptes[NR_PTE_CHAIN_ENTRIES];
+       struct hlist_node link;
+};
+
+/*
+ * kvm_mmu_page_role, below, is defined as:
+ *
+ *   bits 0:3 - total guest paging levels (2-4, or zero for real mode)
+ *   bits 4:7 - page table level for this shadow (1-4)
+ *   bits 8:9 - page table quadrant for 2-level guests
+ *   bit   16 - "metaphysical" - gfn is not a real page (huge page/real
mode)
+ *   bits 17:19 - "access" - the user, writable, and nx bits of a huge
page pde
+ */
+union kvm_mmu_page_role {
+       unsigned word;
+       struct {
+               unsigned glevels : 4;
+               unsigned level : 4;
+               unsigned quadrant : 2;
+               unsigned pad_for_nice_hex_output : 6;
+               unsigned metaphysical : 1;
+               unsigned hugepage_access : 3;
+       };
+};
+
+struct kvm_mmu_page {
+       struct list_head link;
+       struct hlist_node hash_link;
+
+       /*
+        * The following two entries are used to key the shadow page in
the
+        * hash table.
+        */
+       gfn_t gfn;
+       union kvm_mmu_page_role role;
+
+       u64 *spt;
+       /* hold the gfn of each spte inside spt */
+       gfn_t *gfns;
+       unsigned long slot_bitmap; /* One bit set per slot which has
memory
+                                   * in this shadow page.
+                                   */
+       int multimapped;         /* More than one parent_pte? */
+       int root_count;          /* Currently serving as active root */
+       union {
+               u64 *parent_pte;               /* !multimapped */
+               struct hlist_head parent_ptes; /* multimapped,
kvm_pte_chain */
+       };
+};
+
+/*
+ * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and
2-level
+ * 32-bit).  The kvm_mmu structure abstracts the details of the current
mmu
+ * mode.
+ */
+struct kvm_mmu {
+       void (*new_cr3)(struct kvm_vcpu *vcpu);
+       int (*page_fault)(struct kvm_vcpu *vcpu, gva_t gva, u32 err);
+       void (*free)(struct kvm_vcpu *vcpu);
+       gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva);
+       void (*prefetch_page)(struct kvm_vcpu *vcpu,
+                             struct kvm_mmu_page *page);
+       hpa_t root_hpa;
+       int root_level;
+       int shadow_root_level;
+
+       u64 *pae_root;
+};
+
+#define KVM_NR_MEM_OBJS 40
+
+struct kvm_mmu_memory_cache {
+       int nobjs;
+       void *objects[KVM_NR_MEM_OBJS];
+};
+
 enum {
        VCPU_REGS_RAX = 0,
        VCPU_REGS_RCX = 1,
-- 
1.5.0.5

Attachment: 0002-KVM-Portability-split-splitting-kvm.h.patch
Description: 0002-KVM-Portability-split-splitting-kvm.h.patch

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

Reply via email to