I think I would say:

--
Now use the hypervisor-supplied memory map to build our final e820 table:
* Add regions for BIOS ranges and other special mappings not in the
hypervisor map
* Add in the hypervisor regions
* Adjust the lowmem and highmem regions if we've had to relocate
memory (adding a highmem region if necessary)
* Sort all the ranges so that they appear in memory order.
--

I'll update this and thanks a lot.



CC: Keir Fraser <k...@xen.org>
CC: Jan Beulich <jbeul...@suse.com>
CC: Andrew Cooper <andrew.coop...@citrix.com>
CC: Ian Jackson <ian.jack...@eu.citrix.com>
CC: Stefano Stabellini <stefano.stabell...@eu.citrix.com>
CC: Ian Campbell <ian.campb...@citrix.com>
CC: Wei Liu <wei.l...@citrix.com>
Signed-off-by: Tiejun Chen <tiejun.c...@intel.com>
---

[snip]

+    /* Low RAM goes here. Reserve space for special pages. */
+    BUG_ON(low_mem_end < (2u << 20));

Won't this BUG if the guest was actually given less than 2GiB of RAM?

2u << 20 = 0x200000, so this is 2M, not 2G :)


+
+    /*
+     * We may need to adjust real lowmem end since we may
+     * populate RAM to get enough MMIO previously.
+     */

[snip]

+
+    /*
+     * And then we also need to adjust highmem.
+     */
+    if ( add_high_mem )
+    {
+        for ( i = 0; i < memory_map.nr_map; i++ )
+        {
+            if ( e820[i].type == E820_RAM &&
+                 e820[i].addr > (1ull << 32))
+                e820[i].size += add_high_mem;
+        }
+    }

What if there was originally no high memory, but resizing the pci hole
meant we had to create a high memory region?


You're right. We need to consider this case.

Thanks
Tiejun


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to