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

[Xen-changelog] [linux-2.6.18-xen] x86/MTRR: misc adjustments


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Fri, 07 Oct 2016 10:11:02 +0000
  • Delivery-date: Fri, 07 Oct 2016 10:11:11 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1475834715 -7200
#      Fri Oct 07 12:05:15 2016 +0200
# Node ID 896b47a37cf83c7d204ee2196b8135eeee1dff9d
# Parent  d8a0a20fdf208e98c3e41464cf8bdd4eee0ac25b
x86/MTRR: misc adjustments

Properly clear mtrr_if when there's no MTRR support, and properly bail
from mtrr_{add,del}_page() when mtrr_if is NULL. Ditch mtrr_init() in
favor of doing the initialization in mtrr_bp_init(), better matching
native initialization flow.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r d8a0a20fdf20 -r 896b47a37cf8 arch/i386/kernel/cpu/mtrr/main-xen.c
--- a/arch/i386/kernel/cpu/mtrr/main-xen.c      Fri Oct 07 12:03:13 2016 +0200
+++ b/arch/i386/kernel/cpu/mtrr/main-xen.c      Fri Oct 07 12:05:15 2016 +0200
@@ -67,6 +67,9 @@ int mtrr_add_page(unsigned long base, un
        int error;
        struct xen_platform_op op;
 
+       if (!mtrr_if)
+               return -ENXIO;
+
        mutex_lock(&mtrr_mutex);
 
        op.cmd = XENPF_add_memtype;
@@ -120,6 +123,9 @@ int mtrr_del_page(int reg, unsigned long
        int error = -EINVAL;
        struct xen_platform_op op;
 
+       if (!mtrr_if)
+               return -ENXIO;
+
        mutex_lock(&mtrr_mutex);
 
        if (reg < 0) {
@@ -170,29 +176,23 @@ EXPORT_SYMBOL(mtrr_del);
 
 void __init mtrr_bp_init(void)
 {
+       struct cpuinfo_x86 *c = &boot_cpu_data;
+
+       if (!is_initial_xendomain())
+               mtrr_if = NULL;
+
+       if (!cpu_has(c, X86_FEATURE_MTRR) &&
+           !cpu_has(c, X86_FEATURE_K6_MTRR) &&
+           !cpu_has(c, X86_FEATURE_CYRIX_ARR) &&
+           !cpu_has(c, X86_FEATURE_CENTAUR_MCR))
+               mtrr_if = NULL;
+
+       if (mtrr_if) {
+               set_num_var_ranges();
+               init_table();
+       }
 }
 
 void mtrr_ap_init(void)
 {
 }
-
-static int __init mtrr_init(void)
-{
-       struct cpuinfo_x86 *c = &boot_cpu_data;
-
-       if (!is_initial_xendomain())
-               return -ENODEV;
-
-       if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
-           (!cpu_has(c, X86_FEATURE_K6_MTRR)) &&
-           (!cpu_has(c, X86_FEATURE_CYRIX_ARR)) &&
-           (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
-               return -ENODEV;
-
-       set_num_var_ranges();
-       init_table();
-
-       return 0;
-}
-
-subsys_initcall(mtrr_init);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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