Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 83709
b: refs/heads/master
c: 20651af
h: refs/heads/master
i:
  83707: ccea871
v: v3
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Feb 6, 2008
1 parent ca238ee commit 871a152
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 971a52d66a3e87d4d2f5d3455e62680447cdb8e9
refs/heads/master: 20651af9ac60fd6e31360688ad44861a7d05256a
19 changes: 9 additions & 10 deletions trunk/arch/x86/kernel/cpu/mtrr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ static __init int amd_special_default_mtrr(void)
*/
int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
{
unsigned long i, base, size, highest_addr = 0, def, dummy;
unsigned long i, base, size, highest_pfn = 0, def, dummy;
mtrr_type type;
u64 trim_start, trim_size;

Expand All @@ -682,28 +682,27 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn)
mtrr_if->get(i, &base, &size, &type);
if (type != MTRR_TYPE_WRBACK)
continue;
base <<= PAGE_SHIFT;
size <<= PAGE_SHIFT;
if (highest_addr < base + size)
highest_addr = base + size;
if (highest_pfn < base + size)
highest_pfn = base + size;
}

/* kvm/qemu doesn't have mtrr set right, don't trim them all */
if (!highest_addr) {
if (!highest_pfn) {
printk(KERN_WARNING "WARNING: strange, CPU MTRRs all blank?\n");
WARN_ON(1);
return 0;
}

if ((highest_addr >> PAGE_SHIFT) < end_pfn) {
if (highest_pfn < end_pfn) {
printk(KERN_WARNING "WARNING: BIOS bug: CPU MTRRs don't cover"
" all of memory, losing %LdMB of RAM.\n",
(((u64)end_pfn << PAGE_SHIFT) - highest_addr) >> 20);
" all of memory, losing %luMB of RAM.\n",
(end_pfn - highest_pfn) >> (20 - PAGE_SHIFT));

WARN_ON(1);

printk(KERN_INFO "update e820 for mtrr\n");
trim_start = highest_addr;
trim_start = highest_pfn;
trim_start <<= PAGE_SHIFT;
trim_size = end_pfn;
trim_size <<= PAGE_SHIFT;
trim_size -= trim_start;
Expand Down

0 comments on commit 871a152

Please sign in to comment.