@@ -1280,8 +1280,8 @@ void __init e820__memory_setup(void)
void __init e820__memblock_setup(void)
{
+ u64 size, end, not_addressable = 0;
int i;
- u64 end;
/*
* The bootstrap memblock region count maximum is 128 entries
@@ -1307,7 +1307,22 @@ void __init e820__memblock_setup(void)
if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN)
continue;
- memblock_add(entry->addr, entry->size);
+ if (entry->addr >= MAXMEM) {
+ not_addressable += entry->size;
+ continue;
+ }
+
+ end = min_t(u64, end, MAXMEM - 1);
+ size = end - entry->addr;
+ not_addressable += entry->size - size;
+ memblock_add(entry->addr, size);
+ }
+
+ if (not_addressable) {
+ pr_err("%lldGB of physical memory is not addressable in the paging mode\n",
+ not_addressable >> 30);
+ if (!pgtable_l5_enabled())
+ pr_err("Consider enabling 5-level paging\n");
}
/* Throw away partial pages: */