android_kernel_xiaomi_sdm845/arch/x86/kernel/cpu
Jesse Barnes 99fc8d424b x86, 32-bit: trim memory not covered by wb mtrrs
On some machines, buggy BIOSes don't properly setup WB MTRRs to cover all
available RAM, meaning the last few megs (or even gigs) of memory will be
marked uncached.  Since Linux tends to allocate from high memory addresses
first, this causes the machine to be unusably slow as soon as the kernel
starts really using memory (i.e.  right around init time).

This patch works around the problem by scanning the MTRRs at boot and
figuring out whether the current end_pfn value (setup by early e820 code)
goes beyond the highest WB MTRR range, and if so, trimming it to match.  A
fairly obnoxious KERN_WARNING is printed too, letting the user know that
not all of their memory is available due to a likely BIOS bug.

Something similar could be done on i386 if needed, but the boot ordering
would be slightly different, since the MTRR code on i386 depends on the
boot_cpu_data structure being setup.

This patch fixes a bug in the last patch that caused the code to run on
non-Intel machines (AMD machines apparently don't need it and it's untested
on other non-Intel machines, so best keep it off).

Further enhancements and fixes from:

  Yinghai Lu <Yinghai.Lu@Sun.COM>
  Andi Kleen <ak@suse.de>

Signed-off-by: Jesse Barnes <jesse.barnes@intel.com>
Tested-by: Justin Piszcz <jpiszcz@lucidpixels.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2008-01-30 13:33:18 +01:00
..
cpufreq x86: change NR_CPUS arrays in acpi-cpufreq 2008-01-30 13:33:12 +01:00
mcheck x86: change x86 machine check handler to use unlocked_ioctl instead 2008-01-30 13:32:59 +01:00
mtrr x86, 32-bit: trim memory not covered by wb mtrrs 2008-01-30 13:33:18 +01:00
addon_cpuid_features.c x86: add set/clear_cpu_cap operations 2008-01-30 13:30:55 +01:00
amd.c x86: use the correct cpuid method to detect MWAIT support for C states 2008-01-30 13:33:16 +01:00
bugs.c x86: use CR0 defines. 2008-01-30 13:30:39 +01:00
centaur.c spelling fixes: arch/i386/ 2007-10-20 01:13:56 +02:00
common.c x86: move MWAIT idle check to generic CPU initialization on 32-bit 2008-01-30 13:33:16 +01:00
cpu.h x86: move X86_FEATURE_CONSTANT_TSC into early cpu feature detection 2008-01-30 13:32:40 +01:00
cyrix.c x86: use CR0 defines. 2008-01-30 13:30:39 +01:00
intel_cacheinfo.c Kobject: convert arch/* from kobject_unregister() to kobject_put() 2008-01-24 20:40:39 -08:00
intel.c x86: move MWAIT idle check to generic CPU initialization on 32-bit 2008-01-30 13:33:16 +01:00
Makefile x86: prepare consolidation of cpu/ related Makefiles 2007-10-23 22:37:23 +02:00
nexgen.c i386: move kernel/cpu 2007-10-11 11:16:58 +02:00
perfctr-watchdog.c x86: nuke a ton of unused exports 2008-01-30 13:30:28 +01:00
proc.c x86: show cpuinfo only for online CPUs 2007-11-17 16:27:00 +01:00
transmeta.c i386: move kernel/cpu 2007-10-11 11:16:58 +02:00
umc.c i386: move kernel/cpu 2007-10-11 11:16:58 +02:00