diff options
author | Keir Fraser <keir@xen.org> | 2010-12-14 09:54:10 +0000 |
---|---|---|
committer | Keir Fraser <keir@xen.org> | 2010-12-14 09:54:10 +0000 |
commit | 467a09d50d6768c8637e532a960f940fb9df2233 (patch) | |
tree | 5e0d1d21f9b7ac6751dd1b922e6988e1bc2b1756 /xen/arch/x86/domain_build.c | |
parent | ae33959c12092e3b9cc6a72a79722b942ad725f6 (diff) | |
download | xen-467a09d50d6768c8637e532a960f940fb9df2233.tar.gz xen-467a09d50d6768c8637e532a960f940fb9df2233.tar.bz2 xen-467a09d50d6768c8637e532a960f940fb9df2233.zip |
x86/iommu: account for necessary allocations when calculating Dom0's initial allocation size
As of c/s 21812:e382656e4dcc, IOMMU related allocations for Dom0
happen only after it got all of its memory allocated, and hence the
reserve (mainly for setting up its swiotlb) may get exhausted without
accounting for the necessary allocations up front.
While not precise, the estimate has been found to be within a couple
of pages for the systems it got tested on.
For the calculation to be reasonably correct, this depends on the
patch titled "x86/iommu: don't map RAM holes above 4G" sent out
yesterday.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/arch/x86/domain_build.c')
-rw-r--r-- | xen/arch/x86/domain_build.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c index aaf7055c8e..57b9bef421 100644 --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -191,6 +191,15 @@ static unsigned long __init compute_dom0_nr_pages( if ( is_pv_32on64_domain(d) ) avail -= opt_dom0_max_vcpus - 1; + /* Reserve memory for iommu_dom0_init() (rough estimate). */ + if ( iommu_enabled ) + { + unsigned int s; + + for ( s = 9; s < BITS_PER_LONG; s += 9 ) + avail -= max_pdx >> s; + } + /* * If domain 0 allocation isn't specified, reserve 1/16th of available * memory for things like DMA buffers. This reservation is clamped to |