# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
# Date 1302203926 14400
# Node ID 546d8a03d5cbe0ceddadf701174f2417a0b72891
# Parent 01d0d338b97491a3aa816dab43cc709a234214f7
x86: adjust the size of the e820 for pv guest to be dynamic.
Instead of using the E820MAX we will use the amount of
E820 entries on the machine, plus the number three.
Considering the use cases, which is the toolstack retrieving
the E820, sanitizing it, and then setting it for the PV guest
(for PCI passthrough), this dynamic number of E820 is just
right.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
diff -r 01d0d338b974 -r 546d8a03d5cb xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c Thu Apr 07 14:58:17 2011 -0400
+++ b/xen/arch/x86/domain.c Thu Apr 07 15:18:46 2011 -0400
@@ -636,13 +636,13 @@
d->arch.emuirq_pirq[i] = IRQ_UNBOUND;
} else
{
- d->arch.pv_domain.e820 = xmalloc_array(struct e820entry, E820MAX);
+ d->arch.pv_domain.e820 = xmalloc_array(struct e820entry, E820NR);
if ( !d->arch.pv_domain.e820 )
goto fail;
memset(d->arch.pv_domain.e820, 0,
- E820MAX * sizeof(*d->arch.pv_domain.e820));
+ E820NR * sizeof(*d->arch.pv_domain.e820));
}
if ( (rc = iommu_domain_init(d)) != 0 )
diff -r 01d0d338b974 -r 546d8a03d5cb xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Apr 07 14:58:17 2011 -0400
+++ b/xen/arch/x86/mm.c Thu Apr 07 15:18:46 2011 -0400
@@ -4710,7 +4710,7 @@
if ( copy_from_guest(&fmap, arg, 1) )
return -EFAULT;
- if ( fmap.map.nr_entries > E820MAX )
+ if ( fmap.map.nr_entries > E820NR )
return -EINVAL;
rc = rcu_lock_target_domain_by_id(fmap.domid, &d);
diff -r 01d0d338b974 -r 546d8a03d5cb xen/include/asm-x86/e820.h
--- a/xen/include/asm-x86/e820.h Thu Apr 07 14:58:17 2011 -0400
+++ b/xen/include/asm-x86/e820.h Thu Apr 07 15:18:46 2011 -0400
@@ -39,4 +39,6 @@
#define e820_raw bootsym(e820map)
#define e820_raw_nr bootsym(e820nr)
+/* The +3 is for guest RAM entries */
+#define E820NR (e820.nr_map + 3)
#endif /*__E820_HEADER*/
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|