Re: x86.git: mtrr trimming removes all memory under kvm

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yinghai Lu
Date: Thursday, January 24, 2008 - 7:32 pm

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:
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
x86.git: mtrr trimming removes all memory under kvm, Jeremy Fitzhardinge, (Thu Jan 24, 6:44 pm)
Re: x86.git: mtrr trimming removes all memory under kvm, H. Peter Anvin, (Thu Jan 24, 6:49 pm)
Re: x86.git: mtrr trimming removes all memory under kvm, Yinghai Lu, (Thu Jan 24, 7:32 pm)
Re: [PATCH] x86: trim ram need to check if mtrr is there v2, H. Peter Anvin, (Thu Jan 24, 10:44 pm)
Re: [PATCH] x86: trim ram need to check if mtrr is there v2, Jeremy Fitzhardinge, (Fri Jan 25, 12:43 am)
Re: [PATCH] x86: trim ram need to check if mtrr is there v3, Jeremy Fitzhardinge, (Fri Jan 25, 11:55 am)
Re: [PATCH] x86: trim ram need to check if mtrr is there v3, Jeremy Fitzhardinge, (Fri Jan 25, 11:59 am)
Re: [PATCH] x86: trim ram need to check if mtrr is there v3, Jeremy Fitzhardinge, (Fri Jan 25, 12:01 pm)
Re: [PATCH] x86: trim ram need to check if mtrr is there v3, Jeremy Fitzhardinge, (Fri Jan 25, 12:04 pm)
Re: [PATCH] x86: trim ram need to check if mtrr is there v3, Jeremy Fitzhardinge, (Fri Jan 25, 12:27 pm)
Re: [PATCH] x86: trim ram need to check if mtrr is there v3, Jeremy Fitzhardinge, (Fri Jan 25, 12:39 pm)