On Thursday 24 January 2008 05:49:00 pm H. Peter Anvin wrote:
please try this
[PATCH] x86: trim RAM need to check if mtrr is there
Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index a1551d0..a0b6f55 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -646,9 +646,6 @@ static __init int amd_special_default_mtrr(unsigned long end_pfn)
{
u32 l, h;
- /* Doesn't apply to memory < 4GB */
- if (end_pfn <= (0xffffffff >> PAGE_SHIFT))
- return 0;
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
return 0;
if (boot_cpu_data.x86 < 0xf || boot_cpu_data.x86 > 0x11)
@@ -682,6 +679,12 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
mtrr_type type;
u64 trim_start, trim_size;
+ /* Doesn't apply to memory < 4GB */
+ if (end_pfn <= (0xffffffffUL >> PAGE_SHIFT))
+ return 0;
+
+ if (!cpu_has_mtrr)
+ return 0;
/*
* Make sure we only trim uncachable memory on machines that
* support the Intel MTRR architecture:
--