ia64/linux-2.6.18-xen.hg

changeset 62:e00077e5b9a3

[IA64] Fix p2m_size calculation in p2m_expose_init()

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Fri Jun 15 12:40:12 2007 -0600 (2007-06-15)
parents f59e6fad7c50
children a413dd61e7e5
files arch/ia64/xen/hypervisor.c
line diff
     1.1 --- a/arch/ia64/xen/hypervisor.c	Fri Jun 15 12:37:00 2007 -0600
     1.2 +++ b/arch/ia64/xen/hypervisor.c	Fri Jun 15 12:40:12 2007 -0600
     1.3 @@ -1014,7 +1014,8 @@ p2m_expose_init(void)
     1.4  #ifdef CONFIG_XEN_IA64_EXPOSE_P2M_USE_DTR
     1.5  	if (xen_ia64_p2m_expose_use_dtr) {
     1.6  		unsigned long granule_pfn = 0;
     1.7 -		p2m_size = p2m_max_low_pfn - p2m_min_low_pfn;
     1.8 +		p2m_size = ((p2m_max_low_pfn - p2m_min_low_pfn +
     1.9 +			     PTRS_PER_PTE - 1) / PTRS_PER_PTE) << PAGE_SHIFT;
    1.10  		for (i = 0;
    1.11  		     i < sizeof(p2m_page_shifts)/sizeof(p2m_page_shifts[0]);
    1.12  		     i++) {
    1.13 @@ -1031,7 +1032,8 @@ p2m_expose_init(void)
    1.14  			                              granule_pfn);
    1.15  			num_pfn = p2m_convert_max_pfn - p2m_convert_min_pfn;
    1.16  			p2m_expose_size = num_pfn << PAGE_SHIFT;
    1.17 -			p2m_size = num_pfn / PTRS_PER_PTE;
    1.18 +			p2m_size = ((num_pfn + PTRS_PER_PTE - 1) /
    1.19 +				    PTRS_PER_PTE) << PAGE_SHIFT;
    1.20  			p2m_size = ROUNDUP(p2m_size, granule_pfn << PAGE_SHIFT);
    1.21  			if (p2m_size == page_size)
    1.22  				break;
    1.23 @@ -1051,7 +1053,8 @@ p2m_expose_init(void)
    1.24  		p2m_convert_max_pfn = ROUNDUP(p2m_max_low_pfn, p2m_granule_pfn);
    1.25  		num_pfn = p2m_convert_max_pfn - p2m_convert_min_pfn;
    1.26  		p2m_expose_size = num_pfn << PAGE_SHIFT;
    1.27 -		p2m_size = num_pfn / PTRS_PER_PTE;
    1.28 +		p2m_size = ((num_pfn + PTRS_PER_PTE - 1) / PTRS_PER_PTE) <<
    1.29 +			PAGE_SHIFT;
    1.30  		p2m_size = ROUNDUP(p2m_size, p2m_granule_pfn << PAGE_SHIFT);
    1.31  		align = max(privcmd_resource_align,
    1.32  		            p2m_granule_pfn << PAGE_SHIFT);
    1.33 @@ -1064,7 +1067,7 @@ p2m_expose_init(void)
    1.34  	if (error) {
    1.35  		printk(KERN_ERR P2M_PREFIX
    1.36  		       "can't allocate region for p2m exposure "
    1.37 -		       "[0x%016lx, 0x%016lx) 0x%016lx\n",
    1.38 +		       "[0x%016lx, 0x%016lx] 0x%016lx\n",
    1.39  		       p2m_convert_min_pfn, p2m_convert_max_pfn, p2m_size);
    1.40  		goto out;
    1.41  	}
    1.42 @@ -1102,10 +1105,10 @@ p2m_expose_init(void)
    1.43  	p2m_initialized = 1;
    1.44  	printk(P2M_PREFIX "assign p2m table of [0x%016lx, 0x%016lx)\n",
    1.45  	       p2m_convert_min_pfn << PAGE_SHIFT,
    1.46 -	       p2m_convert_max_pfn << PAGE_SHIFT);
    1.47 +	       (p2m_convert_max_pfn << PAGE_SHIFT) + PAGE_SIZE);
    1.48  	printk(P2M_PREFIX "to [0x%016lx, 0x%016lx) (%ld KBytes)\n",
    1.49  	       p2m_assign_start_pfn << PAGE_SHIFT,
    1.50 -	       p2m_assign_end_pfn << PAGE_SHIFT,
    1.51 +	       (p2m_assign_end_pfn << PAGE_SHIFT) + PAGE_SIZE,
    1.52  	       p2m_size / 1024);
    1.53  out:
    1.54  	unlock_cpu_hotplug();