return __va(memblock_alloc(size, align));
}
- /*
- * Limit the memory size that was specified via FDT.
- */
- static int __init early_mem(char *p)
- {
- phys_addr_t limit;
-
- if (!p)
- return 1;
-
- limit = memparse(p, &p) & PAGE_MASK;
- pr_notice("Memory limited to %lldMB\n", limit >> 20);
-
- memblock_enforce_memory_limit(limit);
-
- return 0;
- }
- early_param("mem", early_mem);
-
static void __init request_standard_resources(void)
{
struct memblock_region *region;
seq_puts(m, "\n");
seq_printf(m, "CPU implementer\t: 0x%02x\n", (midr >> 24));
- seq_printf(m, "CPU architecture: 8\n");
+ seq_printf(m, "CPU architecture: %s\n",
+#if IS_ENABLED(CONFIG_ARMV7_COMPAT_CPUINFO)
+ is_compat_task() ? "8" :
+#endif
+ "AArch64");
seq_printf(m, "CPU variant\t: 0x%x\n", ((midr >> 20) & 0xf));
seq_printf(m, "CPU part\t: 0x%03x\n", ((midr >> 4) & 0xfff));
seq_printf(m, "CPU revision\t: %d\n\n", (midr & 0xf));
}
#ifdef CONFIG_HAVE_ARCH_PFN_VALID
+#define PFN_MASK ((1UL << (64 - PAGE_SHIFT)) - 1)
+
int pfn_valid(unsigned long pfn)
{
- return memblock_is_memory(pfn << PAGE_SHIFT);
+ return (pfn & PFN_MASK) == pfn && memblock_is_memory(pfn << PAGE_SHIFT);
}
EXPORT_SYMBOL(pfn_valid);
#endif
}
#endif
+ static phys_addr_t memory_limit = (phys_addr_t)ULLONG_MAX;
+
+ /*
+ * Limit the memory size that was specified via FDT.
+ */
+ static int __init early_mem(char *p)
+ {
+ if (!p)
+ return 1;
+
+ memory_limit = memparse(p, &p) & PAGE_MASK;
+ pr_notice("Memory limited to %lldMB\n", memory_limit >> 20);
+
+ return 0;
+ }
+ early_param("mem", early_mem);
+
void __init arm64_memblock_init(void)
{
u64 *reserve_map, base, size;
phys_addr_t dma_phys_limit = 0;
+ memblock_enforce_memory_limit(memory_limit);
+
/*
* Register the kernel text, kernel data, initrd, and initial
* pagetables with memblock.