ia64/xen-unstable
changeset 6660:d0a4f770a5f4
phys_to_mach and mach_to_phys tables contain long entries, not
32-bit entries.
Signed-off-by: Keir Fraser <keir@xensource.com>
32-bit entries.
Signed-off-by: Keir Fraser <keir@xensource.com>
line diff
1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Tue Sep 06 17:43:36 2005 +0000 1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Tue Sep 06 18:01:24 2005 +0000 1.3 @@ -359,7 +359,7 @@ static void __init probe_roms(void) 1.4 shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page; 1.5 EXPORT_SYMBOL(HYPERVISOR_shared_info); 1.6 1.7 -unsigned int *phys_to_machine_mapping, *pfn_to_mfn_frame_list; 1.8 +unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list; 1.9 EXPORT_SYMBOL(phys_to_machine_mapping); 1.10 1.11 /* Raw start-of-day parameters from the hypervisor. */ 1.12 @@ -1206,7 +1206,7 @@ void __init setup_bootmem_allocator(void 1.13 } 1.14 #endif 1.15 1.16 - phys_to_machine_mapping = (unsigned int *)xen_start_info->mfn_list; 1.17 + phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list; 1.18 } 1.19 1.20 /* 1.21 @@ -1638,15 +1638,15 @@ void __init setup_arch(char **cmdline_p) 1.22 /* Make sure we have a correctly sized P->M table. */ 1.23 if (max_pfn != xen_start_info->nr_pages) { 1.24 phys_to_machine_mapping = alloc_bootmem_low_pages( 1.25 - max_pfn * sizeof(unsigned int)); 1.26 + max_pfn * sizeof(unsigned long)); 1.27 1.28 if (max_pfn > xen_start_info->nr_pages) { 1.29 /* set to INVALID_P2M_ENTRY */ 1.30 memset(phys_to_machine_mapping, ~0, 1.31 - max_pfn * sizeof(unsigned int)); 1.32 + max_pfn * sizeof(unsigned long)); 1.33 memcpy(phys_to_machine_mapping, 1.34 - (unsigned int *)xen_start_info->mfn_list, 1.35 - xen_start_info->nr_pages * sizeof(unsigned int)); 1.36 + (unsigned long *)xen_start_info->mfn_list, 1.37 + xen_start_info->nr_pages * sizeof(unsigned long)); 1.38 } else { 1.39 struct xen_memory_reservation reservation = { 1.40 .extent_start = (unsigned long *)xen_start_info->mfn_list + max_pfn, 1.41 @@ -1656,9 +1656,8 @@ void __init setup_arch(char **cmdline_p) 1.42 }; 1.43 1.44 memcpy(phys_to_machine_mapping, 1.45 - (unsigned int *)xen_start_info->mfn_list, 1.46 - max_pfn * sizeof(unsigned int)); 1.47 - /* N.B. below relies on sizeof(int) == sizeof(long). */ 1.48 + (unsigned long *)xen_start_info->mfn_list, 1.49 + max_pfn * sizeof(unsigned long)); 1.50 BUG_ON(HYPERVISOR_memory_op( 1.51 XENMEM_decrease_reservation, 1.52 &reservation) != 1.53 @@ -1667,11 +1666,11 @@ void __init setup_arch(char **cmdline_p) 1.54 free_bootmem( 1.55 __pa(xen_start_info->mfn_list), 1.56 PFN_PHYS(PFN_UP(xen_start_info->nr_pages * 1.57 - sizeof(unsigned int)))); 1.58 + sizeof(unsigned long)))); 1.59 } 1.60 1.61 pfn_to_mfn_frame_list = alloc_bootmem_low_pages(PAGE_SIZE); 1.62 - for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned int)), j++ ) 1.63 + for ( i=0, j=0; i < max_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ ) 1.64 { 1.65 pfn_to_mfn_frame_list[j] = 1.66 virt_to_mfn(&phys_to_machine_mapping[i]);
2.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Tue Sep 06 17:43:36 2005 +0000 2.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Tue Sep 06 18:01:24 2005 +0000 2.3 @@ -81,7 +81,7 @@ static int __do_suspend(void *ignore) 2.4 extern void time_suspend(void); 2.5 extern void time_resume(void); 2.6 extern unsigned long max_pfn; 2.7 - extern unsigned int *pfn_to_mfn_frame_list; 2.8 + extern unsigned long *pfn_to_mfn_frame_list; 2.9 2.10 #ifdef CONFIG_SMP 2.11 extern void smp_suspend(void);
3.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c Tue Sep 06 17:43:36 2005 +0000 3.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c Tue Sep 06 18:01:24 2005 +0000 3.3 @@ -90,7 +90,7 @@ void __init x86_64_start_kernel(char * r 3.4 { 3.5 int i; 3.6 3.7 - phys_to_machine_mapping = (u32 *)xen_start_info->mfn_list; 3.8 + phys_to_machine_mapping = (unsigned long *)xen_start_info->mfn_list; 3.9 start_pfn = (__pa(xen_start_info->pt_base) >> PAGE_SHIFT) + 3.10 xen_start_info->nr_pt_frames; 3.11
4.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Tue Sep 06 17:43:36 2005 +0000 4.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c Tue Sep 06 18:01:24 2005 +0000 4.3 @@ -76,7 +76,7 @@ EXPORT_SYMBOL(HYPERVISOR_shared_info); 4.4 /* Allows setting of maximum possible memory size */ 4.5 unsigned long xen_override_max_pfn; 4.6 4.7 -u32 *phys_to_machine_mapping, *pfn_to_mfn_frame_list; 4.8 +unsigned long *phys_to_machine_mapping, *pfn_to_mfn_frame_list; 4.9 4.10 EXPORT_SYMBOL(phys_to_machine_mapping); 4.11 4.12 @@ -734,22 +734,22 @@ void __init setup_arch(char **cmdline_p) 4.13 /* Make sure we have a large enough P->M table. */ 4.14 if (end_pfn > xen_start_info->nr_pages) { 4.15 phys_to_machine_mapping = alloc_bootmem( 4.16 - end_pfn * sizeof(u32)); 4.17 + end_pfn * sizeof(unsigned long)); 4.18 memset(phys_to_machine_mapping, ~0, 4.19 - end_pfn * sizeof(u32)); 4.20 + end_pfn * sizeof(unsigned long)); 4.21 memcpy(phys_to_machine_mapping, 4.22 - (u32 *)xen_start_info->mfn_list, 4.23 - xen_start_info->nr_pages * sizeof(u32)); 4.24 + (unsigned long *)xen_start_info->mfn_list, 4.25 + xen_start_info->nr_pages * sizeof(unsigned long)); 4.26 free_bootmem( 4.27 __pa(xen_start_info->mfn_list), 4.28 PFN_PHYS(PFN_UP(xen_start_info->nr_pages * 4.29 - sizeof(u32)))); 4.30 + sizeof(unsigned long)))); 4.31 } 4.32 4.33 pfn_to_mfn_frame_list = alloc_bootmem(PAGE_SIZE); 4.34 4.35 - for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(u32)), j++ ) 4.36 - pfn_to_mfn_frame_list[j] = 4.37 + for ( i=0, j=0; i < end_pfn; i+=(PAGE_SIZE/sizeof(unsigned long)), j++ ) 4.38 + pfn_to_mfn_frame_list[j] = 4.39 virt_to_mfn(&phys_to_machine_mapping[i]); 4.40 } 4.41 #endif
5.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h Tue Sep 06 17:43:36 2005 +0000 5.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/page.h Tue Sep 06 18:01:24 2005 +0000 5.3 @@ -60,14 +60,14 @@ 5.4 #define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 5.5 5.6 /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/ 5.7 -#define INVALID_P2M_ENTRY (~0U) 5.8 -#define FOREIGN_FRAME(m) ((m) | 0x80000000U) 5.9 -extern unsigned int *phys_to_machine_mapping; 5.10 +#define INVALID_P2M_ENTRY (~0UL) 5.11 +#define FOREIGN_FRAME(m) ((m) | (1UL<<31)) 5.12 +extern unsigned long *phys_to_machine_mapping; 5.13 #define pfn_to_mfn(pfn) \ 5.14 -((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL) 5.15 +(phys_to_machine_mapping[(unsigned int)(pfn)] & ~(1UL<<31)) 5.16 static inline unsigned long mfn_to_pfn(unsigned long mfn) 5.17 { 5.18 - unsigned int pfn; 5.19 + unsigned long pfn; 5.20 5.21 /* 5.22 * The array access can fail (e.g., device space beyond end of RAM). 5.23 @@ -83,7 +83,7 @@ static inline unsigned long mfn_to_pfn(u 5.24 ".previous" 5.25 : "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) ); 5.26 5.27 - return (unsigned long)pfn; 5.28 + return pfn; 5.29 } 5.30 5.31 /* Definitions for machine and pseudophysical addresses. */
6.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h Tue Sep 06 17:43:36 2005 +0000 6.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/page.h Tue Sep 06 18:01:24 2005 +0000 6.3 @@ -62,14 +62,14 @@ void copy_page(void *, void *); 6.4 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE 6.5 6.6 /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/ 6.7 -#define INVALID_P2M_ENTRY (~0U) 6.8 -#define FOREIGN_FRAME(m) ((m) | 0x80000000U) 6.9 -extern u32 *phys_to_machine_mapping; 6.10 +#define INVALID_P2M_ENTRY (~0UL) 6.11 +#define FOREIGN_FRAME(m) ((m) | (1UL<<63)) 6.12 +extern unsigned long *phys_to_machine_mapping; 6.13 #define pfn_to_mfn(pfn) \ 6.14 -((unsigned long)phys_to_machine_mapping[(unsigned int)(pfn)] & 0x7FFFFFFFUL) 6.15 +(phys_to_machine_mapping[(unsigned int)(pfn)] & ~(1UL << 63)) 6.16 static inline unsigned long mfn_to_pfn(unsigned long mfn) 6.17 { 6.18 - unsigned int pfn; 6.19 + unsigned long pfn; 6.20 6.21 /* 6.22 * The array access can fail (e.g., device space beyond end of RAM). 6.23 @@ -77,7 +77,7 @@ static inline unsigned long mfn_to_pfn(u 6.24 * but we must handle the fault without crashing! 6.25 */ 6.26 asm ( 6.27 - "1: movl %1,%k0\n" 6.28 + "1: movq %1,%0\n" 6.29 "2:\n" 6.30 ".section __ex_table,\"a\"\n" 6.31 " .align 8\n" 6.32 @@ -85,7 +85,7 @@ static inline unsigned long mfn_to_pfn(u 6.33 ".previous" 6.34 : "=r" (pfn) : "m" (machine_to_phys_mapping[mfn]) ); 6.35 6.36 - return (unsigned long)pfn; 6.37 + return pfn; 6.38 } 6.39 6.40 /* Definitions for machine and pseudophysical addresses. */
7.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Tue Sep 06 17:43:36 2005 +0000 7.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Tue Sep 06 18:01:24 2005 +0000 7.3 @@ -307,7 +307,7 @@ inline static void set_pte_at(struct mm_ 7.4 #define pte_pfn(_pte) \ 7.5 ({ \ 7.6 unsigned long mfn = pte_mfn(_pte); \ 7.7 - unsigned pfn = mfn_to_pfn(mfn); \ 7.8 + unsigned long pfn = mfn_to_pfn(mfn); \ 7.9 if ((pfn >= max_mapnr) || (phys_to_machine_mapping[pfn] != mfn))\ 7.10 pfn = max_mapnr; /* special: force !pfn_valid() */ \ 7.11 pfn; \
8.1 --- a/tools/libxc/xc_linux_build.c Tue Sep 06 17:43:36 2005 +0000 8.2 +++ b/tools/libxc/xc_linux_build.c Tue Sep 06 18:01:24 2005 +0000 8.3 @@ -348,7 +348,7 @@ static int setup_guest(int xc_handle, 8.4 8.5 unsigned long nr_pt_pages; 8.6 unsigned long physmap_pfn; 8.7 - u32 *physmap, *physmap_e; 8.8 + unsigned long *physmap, *physmap_e; 8.9 8.10 struct load_funcs load_funcs; 8.11 struct domain_setup_info dsi;
9.1 --- a/xen/arch/x86/domain_build.c Tue Sep 06 17:43:36 2005 +0000 9.2 +++ b/xen/arch/x86/domain_build.c Tue Sep 06 18:01:24 2005 +0000 9.3 @@ -218,7 +218,7 @@ int construct_dom0(struct domain *d, 9.4 vinitrd_start = round_pgup(dsi.v_end); 9.5 vinitrd_end = vinitrd_start + initrd_len; 9.6 vphysmap_start = round_pgup(vinitrd_end); 9.7 - vphysmap_end = vphysmap_start + (nr_pages * sizeof(u32)); 9.8 + vphysmap_end = vphysmap_start + (nr_pages * sizeof(unsigned long)); 9.9 vstartinfo_start = round_pgup(vphysmap_end); 9.10 vstartinfo_end = vstartinfo_start + PAGE_SIZE; 9.11 vpt_start = vstartinfo_end; 9.12 @@ -613,7 +613,7 @@ int construct_dom0(struct domain *d, 9.13 if ( !opt_dom0_translate && (pfn > REVERSE_START) ) 9.14 mfn = alloc_epfn - (pfn - REVERSE_START); 9.15 #endif 9.16 - ((u32 *)vphysmap_start)[pfn] = mfn; 9.17 + ((unsigned long *)vphysmap_start)[pfn] = mfn; 9.18 set_pfn_from_mfn(mfn, pfn); 9.19 } 9.20 while ( pfn < nr_pages ) 9.21 @@ -626,7 +626,7 @@ int construct_dom0(struct domain *d, 9.22 #ifndef NDEBUG 9.23 #define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn))) 9.24 #endif 9.25 - ((u32 *)vphysmap_start)[pfn] = mfn; 9.26 + ((unsigned long *)vphysmap_start)[pfn] = mfn; 9.27 set_pfn_from_mfn(mfn, pfn); 9.28 #undef pfn 9.29 page++; pfn++;
10.1 --- a/xen/arch/x86/mm.c Tue Sep 06 17:43:36 2005 +0000 10.2 +++ b/xen/arch/x86/mm.c Tue Sep 06 18:01:24 2005 +0000 10.3 @@ -1450,7 +1450,7 @@ int get_page_type(struct pfn_info *page, 10.4 ((type & PGT_type_mask) != PGT_l1_page_table) ) 10.5 MEM_LOG("Bad type (saw %" PRtype_info 10.6 "!= exp %" PRtype_info ") " 10.7 - "for mfn %lx (pfn %x)", 10.8 + "for mfn %lx (pfn %lx)", 10.9 x, type, page_to_pfn(page), 10.10 get_pfn_from_mfn(page_to_pfn(page))); 10.11 return 0;
11.1 --- a/xen/arch/x86/x86_32/mm.c Tue Sep 06 17:43:36 2005 +0000 11.2 +++ b/xen/arch/x86/x86_32/mm.c Tue Sep 06 18:01:24 2005 +0000 11.3 @@ -95,7 +95,7 @@ void __init paging_init(void) 11.4 * Allocate and map the machine-to-phys table and create read-only mapping 11.5 * of MPT for guest-OS use. 11.6 */ 11.7 - mpt_size = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL; 11.8 + mpt_size = (max_page * BYTES_PER_LONG) + (1UL << L2_PAGETABLE_SHIFT) - 1; 11.9 mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL); 11.10 for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ ) 11.11 {
12.1 --- a/xen/arch/x86/x86_64/mm.c Tue Sep 06 17:43:36 2005 +0000 12.2 +++ b/xen/arch/x86/x86_64/mm.c Tue Sep 06 18:01:24 2005 +0000 12.3 @@ -98,7 +98,7 @@ void __init paging_init(void) 12.4 * Allocate and map the machine-to-phys table. 12.5 * This also ensures L3 is present for fixmaps. 12.6 */ 12.7 - mpt_size = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL; 12.8 + mpt_size = (max_page * BYTES_PER_LONG) + (1UL << L2_PAGETABLE_SHIFT) - 1; 12.9 mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL); 12.10 for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ ) 12.11 {
13.1 --- a/xen/include/asm-x86/mm.h Tue Sep 06 17:43:36 2005 +0000 13.2 +++ b/xen/include/asm-x86/mm.h Tue Sep 06 18:01:24 2005 +0000 13.3 @@ -255,9 +255,9 @@ int check_descriptor(struct desc_struct 13.4 * contiguous (or near contiguous) physical memory. 13.5 */ 13.6 #undef machine_to_phys_mapping 13.7 -#define machine_to_phys_mapping ((u32 *)RDWR_MPT_VIRT_START) 13.8 -#define INVALID_M2P_ENTRY (~0U) 13.9 -#define VALID_M2P(_e) (!((_e) & (1U<<31))) 13.10 +#define machine_to_phys_mapping ((unsigned long *)RDWR_MPT_VIRT_START) 13.11 +#define INVALID_M2P_ENTRY (~0UL) 13.12 +#define VALID_M2P(_e) (!((_e) & (1UL<<(BITS_PER_LONG-1)))) 13.13 #define IS_INVALID_M2P_ENTRY(_e) (!VALID_M2P(_e)) 13.14 13.15 #define set_pfn_from_mfn(mfn, pfn) (machine_to_phys_mapping[(mfn)] = (pfn))
14.1 --- a/xen/include/public/arch-x86_32.h Tue Sep 06 17:43:36 2005 +0000 14.2 +++ b/xen/include/public/arch-x86_32.h Tue Sep 06 18:01:24 2005 +0000 14.3 @@ -55,7 +55,7 @@ 14.4 # define HYPERVISOR_VIRT_START (0xFC000000UL) 14.5 #endif 14.6 #ifndef machine_to_phys_mapping 14.7 -#define machine_to_phys_mapping ((u32 *)HYPERVISOR_VIRT_START) 14.8 +#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) 14.9 #endif 14.10 14.11 /* Maximum number of virtual CPUs in multi-processor guests. */
15.1 --- a/xen/include/public/arch-x86_64.h Tue Sep 06 17:43:36 2005 +0000 15.2 +++ b/xen/include/public/arch-x86_64.h Tue Sep 06 18:01:24 2005 +0000 15.3 @@ -71,7 +71,7 @@ 15.4 15.5 /* The machine->physical mapping table starts at this address, read-only. */ 15.6 #ifndef machine_to_phys_mapping 15.7 -#define machine_to_phys_mapping ((u32 *)HYPERVISOR_VIRT_START) 15.8 +#define machine_to_phys_mapping ((unsigned long *)HYPERVISOR_VIRT_START) 15.9 #endif 15.10 15.11 /*