From: Zhang Xiantao <[EMAIL PROTECTED]> Date: Tue, 11 Dec 2007 20:47:56 +0800 Subject: [PATCH] kvm: kvm structure split.
Using macro KVM_COMM to hold kvm common fields
as kvm_vcpu does. And, every arch defines its kvm structure
separately.
Signed-off-by: Zhang Xiantao <[EMAIL PROTECTED]>
---
drivers/kvm/kvm.h | 40 +++++++++++++---------------------------
drivers/kvm/x86.h | 18 ++++++++++++++++++
2 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 17715b9..ebe5156 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -244,34 +244,20 @@ struct kvm_vm_stat {
u32 remote_tlb_flush;
};
-struct kvm {
- struct mutex lock; /* protects everything except vcpus */
- struct mm_struct *mm; /* userspace tied to this vm */
- int naliases;
- struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS];
- int nmemslots;
- struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
- KVM_PRIVATE_MEM_SLOTS];
- /*
- * Hash table of struct kvm_mmu_page.
- */
- struct list_head active_mmu_pages;
- unsigned int n_free_mmu_pages;
- unsigned int n_requested_mmu_pages;
- unsigned int n_alloc_mmu_pages;
- struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
- struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
- struct list_head vm_list;
- struct file *filp;
- struct kvm_io_bus mmio_bus;
- struct kvm_io_bus pio_bus;
- struct kvm_pic *vpic;
- struct kvm_ioapic *vioapic;
+#define KVM_COMM
\
+ struct mutex lock; /* protects everything except vcpus */
\
+ struct mm_struct *mm; /* userspace tied to this vm */
\
+
\
+ int nmemslots;
\
+ struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
\
+ KVM_PRIVATE_MEM_SLOTS];
\
+ struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
\
+ struct list_head vm_list;
\
+ struct file *filp;
\
+ struct kvm_io_bus mmio_bus;
\
+ struct kvm_io_bus pio_bus;
\
int round_robin_prev_vcpu;
- unsigned int tss_addr;
- struct page *apic_access_page;
- struct kvm_vm_stat stat;
-};
+struct kvm;
/* The guest did something we don't support. */
#define pr_unimpl(vcpu, fmt, ...)
\
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h
index d711c91..50abb2a 100644
--- a/drivers/kvm/x86.h
+++ b/drivers/kvm/x86.h
@@ -165,6 +165,24 @@ struct kvm_vcpu {
struct x86_emulate_ctxt emulate_ctxt;
};
+struct kvm {
+ KVM_COMM;
+ int naliases;
+ struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS];
+ /*
+ * Hash table of struct kvm_mmu_page.
+ */
+ struct list_head active_mmu_pages;
+ unsigned int n_free_mmu_pages;
+ unsigned int n_requested_mmu_pages;
+ unsigned int n_alloc_mmu_pages;
+ struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
+ struct kvm_pic *vpic;
+ struct kvm_ioapic *vioapic;
+ unsigned int tss_addr;
+ struct page *apic_access_page;
+ struct kvm_vm_stat stat;
+};
struct descriptor_table {
u16 limit;
unsigned long base;
--
1.5.1.2
0003-kvm-kvm-structure-split.patch
Description: 0003-kvm-kvm-structure-split.patch
------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php
_______________________________________________ kvm-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/kvm-devel
