aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir@xensource.com>2007-11-13 20:08:39 +0000
committerKeir Fraser <keir@xensource.com>2007-11-13 20:08:39 +0000
commit39b6f0629adacfc86819c26074c79ddb34acc326 (patch)
treecb45cbd9e5d0a14a53f666014d82dd91954cf77c
parent3192c29b6aa686e1c3f1a63aa3489331a21f0967 (diff)
downloadxen-39b6f0629adacfc86819c26074c79ddb34acc326.tar.gz
xen-39b6f0629adacfc86819c26074c79ddb34acc326.tar.bz2
xen-39b6f0629adacfc86819c26074c79ddb34acc326.zip
x86: Do not read/write EFER MSR if it doesn't exist.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
-rw-r--r--xen/arch/x86/acpi/power.c3
-rw-r--r--xen/arch/x86/boot/head.S1
-rw-r--r--xen/arch/x86/setup.c3
-rw-r--r--xen/arch/x86/smpboot.c3
-rw-r--r--xen/arch/x86/x86_32/asm-offsets.c3
-rw-r--r--xen/arch/x86/x86_64/asm-offsets.c3
-rw-r--r--xen/include/asm-x86/cpufeature.h2
7 files changed, 15 insertions, 3 deletions
diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c
index 7a24e35d2a..f70bf096fc 100644
--- a/xen/arch/x86/acpi/power.c
+++ b/xen/arch/x86/acpi/power.c
@@ -166,7 +166,8 @@ static int enter_state(u32 state)
/* Restore CR4 and EFER from cached values. */
write_cr4(read_cr4());
- write_efer(read_efer());
+ if ( cpu_has_efer )
+ write_efer(read_efer());
device_power_up();
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 168bedefd4..775c89a45b 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -98,6 +98,7 @@ __start:
mov $0x80000001,%eax
cpuid
1: mov %edx,sym_phys(cpuid_ext_features)
+ mov %edx,sym_phys(boot_cpu_data)+CPUINFO_ext_features
#if defined(__x86_64__)
/* Check for availability of long mode. */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 733ff2974a..5ab40978b4 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -416,7 +416,8 @@ void __init __start_xen(unsigned long mbi_p)
set_current((struct vcpu *)0xfffff000); /* debug sanity */
idle_vcpu[0] = current;
set_processor_id(0); /* needed early, for smp_processor_id() */
- rdmsrl(MSR_EFER, this_cpu(efer));
+ if ( cpu_has_efer )
+ rdmsrl(MSR_EFER, this_cpu(efer));
asm volatile ( "mov %%cr4,%0" : "=r" (this_cpu(cr4)) );
smp_prepare_boot_cpu();
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 101918ac8f..32668e9455 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -495,7 +495,8 @@ void __devinit start_secondary(void *unused)
set_processor_id(cpu);
set_current(idle_vcpu[cpu]);
this_cpu(curr_vcpu) = idle_vcpu[cpu];
- rdmsrl(MSR_EFER, this_cpu(efer));
+ if ( cpu_has_efer )
+ rdmsrl(MSR_EFER, this_cpu(efer));
asm volatile ( "mov %%cr4,%0" : "=r" (this_cpu(cr4)) );
percpu_traps_init();
diff --git a/xen/arch/x86/x86_32/asm-offsets.c b/xen/arch/x86/x86_32/asm-offsets.c
index 2b757c18e2..92b25ad9a4 100644
--- a/xen/arch/x86/x86_32/asm-offsets.c
+++ b/xen/arch/x86/x86_32/asm-offsets.c
@@ -115,4 +115,7 @@ void __dummy__(void)
BLANK();
DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
+ BLANK();
+
+ OFFSET(CPUINFO_ext_features, struct cpuinfo_x86, x86_capability[1]);
}
diff --git a/xen/arch/x86/x86_64/asm-offsets.c b/xen/arch/x86/x86_64/asm-offsets.c
index 9bb41bc794..e91dbc1f51 100644
--- a/xen/arch/x86/x86_64/asm-offsets.c
+++ b/xen/arch/x86/x86_64/asm-offsets.c
@@ -137,4 +137,7 @@ void __dummy__(void)
#endif
DEFINE(IRQSTAT_shift, LOG_2(sizeof(irq_cpustat_t)));
+ BLANK();
+
+ OFFSET(CPUINFO_ext_features, struct cpuinfo_x86, x86_capability[1]);
}
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
index 62b17e4a80..58c1f9e41f 100644
--- a/xen/include/asm-x86/cpufeature.h
+++ b/xen/include/asm-x86/cpufeature.h
@@ -146,6 +146,7 @@
#define cpu_has_centaur_mcr boot_cpu_has(X86_FEATURE_CENTAUR_MCR)
#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
#define cpu_has_page1gb 0
+#define cpu_has_efer (boot_cpu_data.x86_capability[1] & 0x20100800)
#else /* __x86_64__ */
#define cpu_has_vme 0
#define cpu_has_de 1
@@ -171,6 +172,7 @@
#define cpu_has_centaur_mcr 0
#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
#define cpu_has_page1gb boot_cpu_has(X86_FEATURE_PAGE1GB)
+#define cpu_has_efer 1
#endif
#define cpu_has_ffxsr ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) \