aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/rangeset.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-11-03 12:40:28 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-11-03 12:40:28 +0000
commitb8a456caedf2424255b585032fc9eac51d2a895d (patch)
treeae48840b556556d30ad579ece5ea4de70ebd9818 /xen/common/rangeset.c
parentb95beb185810484d5afe91b994d2c2d1670af74c (diff)
downloadxen-b8a456caedf2424255b585032fc9eac51d2a895d.tar.gz
xen-b8a456caedf2424255b585032fc9eac51d2a895d.tar.bz2
xen-b8a456caedf2424255b585032fc9eac51d2a895d.zip
x86: improve reporting through XENMEM_machine_memory_map
Since Dom0 derives machine address ranges usable for assigning PCI device resources from the output of this sub-hypercall, Xen should make sure it properly reports all ranges not suitable for this (as either reserved or unusable): - RAM regions excluded via command line option - memory regions used by Xen itself (LAPIC, IOAPICs) While the latter should generally already be excluded by the BIOS provided E820 table, this apparently isn't always the case at least for IOAPICs, and with Linux having got changed to account for this it seems to make sense to also do so in Xen. Generally the HPET range should also be excluded here, but since it isn't being reflected in Dom0's iomem_caps (and can't be, as it's a sub-page range) I wasn't sure whether adding explicit code for doing so would be reasonable. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/common/rangeset.c')
-rw-r--r--xen/common/rangeset.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c
index befeff23dc..78d0647acc 100644
--- a/xen/common/rangeset.c
+++ b/xen/common/rangeset.c
@@ -251,6 +251,24 @@ int rangeset_contains_range(
return contains;
}
+int rangeset_report_ranges(
+ struct rangeset *r, unsigned long s, unsigned long e,
+ int (*cb)(unsigned long s, unsigned long e, void *), void *ctxt)
+{
+ struct range *x;
+ int rc = 0;
+
+ spin_lock(&r->lock);
+
+ for ( x = find_range(r, s); x && (x->s <= e) && !rc; x = next_range(r, x) )
+ if ( x->e >= s )
+ rc = cb(max(x->s, s), min(x->e, e), ctxt);
+
+ spin_unlock(&r->lock);
+
+ return rc;
+}
+
int rangeset_add_singleton(
struct rangeset *r, unsigned long s)
{