diff options
author | Juergen Gross <jgross@suse.com> | 2015-07-17 07:51:28 +0300 |
---|---|---|
committer | David Vrabel <david.vrabel@citrix.com> | 2015-08-20 14:24:20 +0300 |
commit | e612b4a7db4ae1dd8c2bbe171e10c21723de95b2 (patch) | |
tree | b8f5cba2c3ebb89e15e15704b907ae701f92eb59 /arch/x86/xen/setup.c | |
parent | 5097cdf6cef15439f971df54f9abcf143d7ca698 (diff) | |
download | linux-e612b4a7db4ae1dd8c2bbe171e10c21723de95b2.tar.xz |
xen: check memory area against e820 map
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>
Diffstat (limited to 'arch/x86/xen/setup.c')
-rw-r--r-- | arch/x86/xen/setup.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 87251b4c2e30..99ef82cc4edc 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -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> |