]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen: check memory area against e820 map
authorJuergen Gross <jgross@suse.com>
Fri, 17 Jul 2015 04:51:28 +0000 (06:51 +0200)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 30 Nov 2015 19:38:46 +0000 (14:38 -0500)
Provide a service routine to check a physical memory area against the
E820 map. The routine will return false if the complete area is RAM
according to the E820 map and true otherwise.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Acked-by: Konrad Rzeszutek Wilk <Konrad.wilk@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
(cherry picked from commit e612b4a7db4ae1dd8c2bbe171e10c21723de95b2)
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
arch/x86/xen/setup.c
arch/x86/xen/xen-ops.h

index 87251b4c2e303d0c18a37c9e0b82445ec373a150..99ef82cc4edc3bd8c6e2b2674b0ce1c565998398 100644 (file)
@@ -573,6 +573,29 @@ static unsigned long __init xen_count_remap_pages(unsigned long max_pfn)
        return extra;
 }
 
+bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size)
+{
+       struct e820entry *entry;
+       unsigned mapcnt;
+       phys_addr_t end;
+
+       if (!size)
+               return false;
+
+       end = start + size;
+       entry = xen_e820_map;
+
+       for (mapcnt = 0; mapcnt < xen_e820_map_entries; mapcnt++) {
+               if (entry->type == E820_RAM && entry->addr <= start &&
+                   (entry->addr + entry->size) >= end)
+                       return false;
+
+               entry++;
+       }
+
+       return true;
+}
+
 /*
  * Reserve Xen mfn_list.
  * See comment above "struct start_info" in <xen/interface/xen.h>
index bef30cbb56c4775e6ae1faad32d63becbd8699ce..738c58f7a0b826e6124fcf74436a25c7ea15b56d 100644 (file)
@@ -39,6 +39,7 @@ void xen_reserve_top(void);
 void xen_mm_pin_all(void);
 void xen_mm_unpin_all(void);
 
+bool __init xen_is_e820_reserved(phys_addr_t start, phys_addr_t size);
 unsigned long __ref xen_chk_extra_mem(unsigned long pfn);
 void __init xen_inv_extra_mem(void);
 void __init xen_remap_memory(void);