hvm: Fix max_mapped_pfn when using 2MB super pages.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 13 Jun 2008 08:56:49 +0000 (09:56 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 13 Jun 2008 08:56:49 +0000 (09:56 +0100)
Fixes booting Linux guest allocated more than 4G memory.
  - The p2m table will track the max_mapped_pfn, and while doing
    p2m_gfn_to_mfn(), if the gfn is higher than max_mapped_pfn, the
    function will return _mfn(INVALID_MFN). This makes the Linux guest
    kernel panic.

Signed-off-by: Xu Dongxiao <dongxiao.xu@intel.com>
xen/arch/x86/mm/p2m.c

index 9311bde1265688635b46acaa9bbbf8674154b692..dba676d57a73939a95b46fb51ecf40f7c3ed9f00 100644 (file)
@@ -323,7 +323,7 @@ p2m_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn,
 
     /* Track the highest gfn for which we have ever had a valid mapping */
     if ( mfn_valid(mfn) && (gfn > d->arch.p2m->max_mapped_pfn) )
-        d->arch.p2m->max_mapped_pfn = gfn;
+        d->arch.p2m->max_mapped_pfn = gfn + (1UL << page_order) - 1;
 
     if ( iommu_enabled && (is_hvm_domain(d) || need_iommu(d)) )
     {