[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] [IA64] Fix p2m_size calculation in p2m_expose_init()



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1181932812 21600
# Node ID e00077e5b9a399ece201cd9c6afe5eae37cac5e7
# Parent  f59e6fad7c506dbb5103f059143877c60782b640
[IA64] Fix p2m_size calculation in p2m_expose_init()

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 arch/ia64/xen/hypervisor.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff -r f59e6fad7c50 -r e00077e5b9a3 arch/ia64/xen/hypervisor.c
--- a/arch/ia64/xen/hypervisor.c        Fri Jun 15 12:37:00 2007 -0600
+++ b/arch/ia64/xen/hypervisor.c        Fri Jun 15 12:40:12 2007 -0600
@@ -1014,7 +1014,8 @@ p2m_expose_init(void)
 #ifdef CONFIG_XEN_IA64_EXPOSE_P2M_USE_DTR
        if (xen_ia64_p2m_expose_use_dtr) {
                unsigned long granule_pfn = 0;
-               p2m_size = p2m_max_low_pfn - p2m_min_low_pfn;
+               p2m_size = ((p2m_max_low_pfn - p2m_min_low_pfn +
+                            PTRS_PER_PTE - 1) / PTRS_PER_PTE) << PAGE_SHIFT;
                for (i = 0;
                     i < sizeof(p2m_page_shifts)/sizeof(p2m_page_shifts[0]);
                     i++) {
@@ -1031,7 +1032,8 @@ p2m_expose_init(void)
                                                      granule_pfn);
                        num_pfn = p2m_convert_max_pfn - p2m_convert_min_pfn;
                        p2m_expose_size = num_pfn << PAGE_SHIFT;
-                       p2m_size = num_pfn / PTRS_PER_PTE;
+                       p2m_size = ((num_pfn + PTRS_PER_PTE - 1) /
+                                   PTRS_PER_PTE) << PAGE_SHIFT;
                        p2m_size = ROUNDUP(p2m_size, granule_pfn << PAGE_SHIFT);
                        if (p2m_size == page_size)
                                break;
@@ -1051,7 +1053,8 @@ p2m_expose_init(void)
                p2m_convert_max_pfn = ROUNDUP(p2m_max_low_pfn, p2m_granule_pfn);
                num_pfn = p2m_convert_max_pfn - p2m_convert_min_pfn;
                p2m_expose_size = num_pfn << PAGE_SHIFT;
-               p2m_size = num_pfn / PTRS_PER_PTE;
+               p2m_size = ((num_pfn + PTRS_PER_PTE - 1) / PTRS_PER_PTE) <<
+                       PAGE_SHIFT;
                p2m_size = ROUNDUP(p2m_size, p2m_granule_pfn << PAGE_SHIFT);
                align = max(privcmd_resource_align,
                            p2m_granule_pfn << PAGE_SHIFT);
@@ -1064,7 +1067,7 @@ p2m_expose_init(void)
        if (error) {
                printk(KERN_ERR P2M_PREFIX
                       "can't allocate region for p2m exposure "
-                      "[0x%016lx, 0x%016lx) 0x%016lx\n",
+                      "[0x%016lx, 0x%016lx] 0x%016lx\n",
                       p2m_convert_min_pfn, p2m_convert_max_pfn, p2m_size);
                goto out;
        }
@@ -1102,10 +1105,10 @@ p2m_expose_init(void)
        p2m_initialized = 1;
        printk(P2M_PREFIX "assign p2m table of [0x%016lx, 0x%016lx)\n",
               p2m_convert_min_pfn << PAGE_SHIFT,
-              p2m_convert_max_pfn << PAGE_SHIFT);
+              (p2m_convert_max_pfn << PAGE_SHIFT) + PAGE_SIZE);
        printk(P2M_PREFIX "to [0x%016lx, 0x%016lx) (%ld KBytes)\n",
               p2m_assign_start_pfn << PAGE_SHIFT,
-              p2m_assign_end_pfn << PAGE_SHIFT,
+              (p2m_assign_end_pfn << PAGE_SHIFT) + PAGE_SIZE,
               p2m_size / 1024);
 out:
        unlock_cpu_hotplug();

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.