ARM: kexec: advertise location of bootable RAM
[cascardo/linux.git] / arch / arm / kernel / setup.c
index 6c8c888..df7f2a7 100644 (file)
@@ -848,10 +848,29 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
        kernel_data.end     = virt_to_phys(_end - 1);
 
        for_each_memblock(memory, region) {
+               phys_addr_t start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
+               phys_addr_t end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
+               unsigned long boot_alias_start;
+
+               /*
+                * Some systems have a special memory alias which is only
+                * used for booting.  We need to advertise this region to
+                * kexec-tools so they know where bootable RAM is located.
+                */
+               boot_alias_start = phys_to_idmap(start);
+               if (arm_has_idmap_alias() && boot_alias_start != IDMAP_INVALID_ADDR) {
+                       res = memblock_virt_alloc(sizeof(*res), 0);
+                       res->name = "System RAM (boot alias)";
+                       res->start = boot_alias_start;
+                       res->end = phys_to_idmap(end);
+                       res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+                       request_resource(&iomem_resource, res);
+               }
+
                res = memblock_virt_alloc(sizeof(*res), 0);
                res->name  = "System RAM";
-               res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
-               res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
+               res->start = start;
+               res->end = end;
                res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
 
                request_resource(&iomem_resource, res);