[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/HVM: move per-vendor function tables into .init.data



commit 0352856935590a6b740306f2559fe204908472c9
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Apr 29 15:46:15 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Apr 29 15:46:15 2013 +0200

    x86/HVM: move per-vendor function tables into .init.data
    
    hvm_enable() copies the table contents rather than storing the pointer,
    so there's no need to keep these tables post-boot.
    
    Also constify the return values of the per-vendor initialization
    functions, making clear that once the per-vendor initialization is
    complete, the vendor specific tables won't get modified anymore.
    
    Finally, in hvm_enable(), use the returned pointer for all read
    accesses as being more efficient than global variable accesses. Writes
    of course still need to go to the global variable.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/hvm/hvm.c        |   10 +++++-----
 xen/arch/x86/hvm/svm/svm.c    |    4 ++--
 xen/arch/x86/hvm/vmx/vmx.c    |    4 ++--
 xen/include/asm-x86/hvm/hvm.h |    4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8522963..c8487b8 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -113,7 +113,7 @@ static struct notifier_block cpu_nfb = {
 
 static int __init hvm_enable(void)
 {
-    struct hvm_function_table *fns = NULL;
+    const struct hvm_function_table *fns = NULL;
 
     if ( cpu_has_vmx )
         fns = start_vmx();
@@ -126,8 +126,8 @@ static int __init hvm_enable(void)
     hvm_funcs = *fns;
     hvm_enabled = 1;
 
-    printk("HVM: %s enabled\n", hvm_funcs.name);
-    if ( !hvm_funcs.hap_supported )
+    printk("HVM: %s enabled\n", fns->name);
+    if ( !fns->hap_supported )
         printk("HVM: Hardware Assisted Paging (HAP) not detected\n");
     else if ( !opt_hap_enabled )
     {
@@ -138,9 +138,9 @@ static int __init hvm_enable(void)
     {
         printk("HVM: Hardware Assisted Paging (HAP) detected\n");
         printk("HVM: HAP page sizes: 4kB");
-        if ( hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_2MB )
+        if ( fns->hap_capabilities & HVM_HAP_SUPERPAGE_2MB )
             printk(", 2MB%s", opt_hap_2mb ? "" : " [disabled]");
-        if ( hvm_funcs.hap_capabilities & HVM_HAP_SUPERPAGE_1GB )
+        if ( fns->hap_capabilities & HVM_HAP_SUPERPAGE_1GB )
             printk(", 1GB%s", opt_hap_1gb ? "" : " [disabled]");
         printk("\n");
     }
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 8123f37..bc1fe62 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1233,7 +1233,7 @@ static int svm_cpu_up(void)
     return 0;
 }
 
-struct hvm_function_table * __init start_svm(void)
+const struct hvm_function_table * __init start_svm(void)
 {
     bool_t printed = 0;
 
@@ -1958,7 +1958,7 @@ static void svm_invlpg_intercept(unsigned long vaddr)
     svm_asid_g_invlpg(curr, vaddr);
 }
 
-static struct hvm_function_table __read_mostly svm_function_table = {
+static struct hvm_function_table __initdata svm_function_table = {
     .name                 = "SVM",
     .cpu_up_prepare       = svm_cpu_up_prepare,
     .cpu_dead             = svm_cpu_dead,
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 6866cd0..51187a9 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1502,7 +1502,7 @@ static void vmx_sync_pir_to_irr(struct vcpu *v)
         vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
 }
 
-static struct hvm_function_table __read_mostly vmx_function_table = {
+static struct hvm_function_table __initdata vmx_function_table = {
     .name                 = "VMX",
     .cpu_up_prepare       = vmx_cpu_up_prepare,
     .cpu_dead             = vmx_cpu_dead,
@@ -1557,7 +1557,7 @@ static struct hvm_function_table __read_mostly 
vmx_function_table = {
     .nhvm_hap_walk_L1_p2m = nvmx_hap_walk_L1_p2m,
 };
 
-struct hvm_function_table * __init start_vmx(void)
+const struct hvm_function_table * __init start_vmx(void)
 {
     set_in_cr4(X86_CR4_VMXE);
 
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 85dc85b..8408420 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -199,8 +199,8 @@ extern bool_t hvm_enabled;
 extern bool_t cpu_has_lmsl;
 extern s8 hvm_port80_allowed;
 
-extern struct hvm_function_table *start_svm(void);
-extern struct hvm_function_table *start_vmx(void);
+extern const struct hvm_function_table *start_svm(void);
+extern const struct hvm_function_table *start_vmx(void);
 
 int hvm_domain_initialise(struct domain *d);
 void hvm_domain_relinquish_resources(struct domain *d);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.