Index: linux-2.6.18-mm3/arch/ia64/mm/init.c =================================================================== --- linux-2.6.18-mm3.orig/arch/ia64/mm/init.c 2006-10-09 19:32:47.205892204 -0700 +++ linux-2.6.18-mm3/arch/ia64/mm/init.c 2006-10-09 22:03:33.929731832 -0700 @@ -484,7 +484,14 @@ create_mem_map_page_table (u64 start, u6 map_end = virt_to_page(end); #ifdef CONFIG_VIRTUAL_MEM_MAP_HUGE - vkp_page_size = 1UL << VKP_ADDR_TO_SHIFT(VIRTUAL_MEM_MAP); +/* Default page size is 1 megabyte */ + if (VIRTUAL_MEM_MAP != VKP_AREA(20)) + panic("VIRTUAL_MEM_MAP=%lx VKP_AREA(%d)=%lx mismatch!\n", VIRTUAL_MEM_MAP, VIRTUAL_MEM_MAP_PAGE_SHIFT, VKP_AREA(VIRTUAL_MEM_MAP_PAGE_SHIFT)); +#endif + + +#ifdef CONFIG_VIRTUAL_MEM_MAP_HUGE + vkp_page_size = 1UL << VIRTUAL_MEM_MAP_PAGE_SHIFT; #else vkp_page_size = PAGE_SIZE; #endif @@ -495,7 +502,7 @@ create_mem_map_page_table (u64 start, u6 for (address = start_page; address < end_page; address += vkp_page_size) { #ifdef CONFIG_VIRTUAL_MEM_MAP_HUGE - unsigned long taddr = KVP_PAGE_TO_PAGE(address); + unsigned long taddr = VKP_PAGE_TO_PAGE(address); pgd = pgd_offset_vkp(taddr); #else unsigned long taddr = address; Index: linux-2.6.18-mm3/include/asm-ia64/page.h =================================================================== --- linux-2.6.18-mm3.orig/include/asm-ia64/page.h 2006-10-09 20:03:49.547889128 -0700 +++ linux-2.6.18-mm3/include/asm-ia64/page.h 2006-10-09 23:19:13.410082887 -0700 @@ -105,11 +105,6 @@ extern int ia64_pfn_valid (unsigned long # define ia64_pfn_valid(pfn) 1 #endif -#ifdef CONFIG_VIRTUAL_MEM_MAP_HUGE -#define VIRTUAL_MEM_MAP IA64_MEM_MAP -#else -#define VIRTUAL_MEM_MAP (RGN_BASE(RGN_GATE) + 0x200000000UL) -#endif #ifdef CONFIG_VIRTUAL_MEM_MAP #define VMMAP ((struct page *)VIRTUAL_MEM_MAP) #define page_to_pfn(page) ((unsigned long) (page - VMMAP)) Index: linux-2.6.18-mm3/arch/ia64/kernel/gate.lds =================================================================== --- linux-2.6.18-mm3.orig/arch/ia64/kernel/gate.lds 2006-10-09 19:33:05.008503055 -0700 +++ linux-2.6.18-mm3/arch/ia64/kernel/gate.lds 2006-10-09 23:52:18.462435717 -0700 @@ -1,7 +1,7 @@ /* * Automatically generated C config: don't edit * Linux kernel version: 2.6.18-mm3 - * Mon Oct 9 19:32:53 2006 + * Mon Oct 9 20:29:48 2006 */ /* * Linker script for gate DSO. The gate pages are an ELF shared object prelinked to its Index: linux-2.6.18-mm3/arch/ia64/kernel/vmlinux.lds =================================================================== --- linux-2.6.18-mm3.orig/arch/ia64/kernel/vmlinux.lds 2006-10-09 19:33:40.953547671 -0700 +++ linux-2.6.18-mm3/arch/ia64/kernel/vmlinux.lds 2006-10-09 23:48:46.420830837 -0700 @@ -1,7 +1,7 @@ /* * Automatically generated C config: don't edit * Linux kernel version: 2.6.18-mm3 - * Mon Oct 9 19:32:53 2006 + * Mon Oct 9 20:29:48 2006 */ /* * Copyright (C) 1998-2000 Hewlett-Packard Co @@ -430,6 +430,7 @@ SECTIONS v = (7<<(61)); /* this symbol is here to make debugging easier... */ phys_start = _start - (((5<<(61))+0x100000000) - (1 << 26)); + mem_map = 1; code : { } :code . = ((5<<(61))+0x100000000); Index: linux-2.6.18-mm3/arch/ia64/mm/fault.c =================================================================== --- linux-2.6.18-mm3.orig/arch/ia64/mm/fault.c 2006-10-09 19:32:47.207845208 -0700 +++ linux-2.6.18-mm3/arch/ia64/mm/fault.c 2006-10-09 21:06:31.068729341 -0700 @@ -68,7 +68,7 @@ mapped_kernel_page_is_present (unsigned #ifdef CONFIG_VIRTUAL_MEM_MAP_HUGE if (VKP_VALID(address)) { address = VKP_PAGE_TO_PAGE(address); - pgd = pgd_offset_vkp(&init_mm, address); + pgd = pgd_offset_vkp(address); } else #endif pgd = pgd_offset_k(address); Index: linux-2.6.18-mm3/arch/ia64/kernel/ivt.S =================================================================== --- linux-2.6.18-mm3.orig/arch/ia64/kernel/ivt.S 2006-10-09 19:11:56.319339702 -0700 +++ linux-2.6.18-mm3/arch/ia64/kernel/ivt.S 2006-10-10 10:28:15.766472713 -0700 @@ -375,7 +375,6 @@ ENTRY(alt_dtlb_miss) mov r21=cr.ipsr mov r31=pr ;; -#ifdef CONFIG_DISABLE_VHPT shr.u r22=r16,61 // get the region number into r21 ;; cmp.gt p8,p0=6,r22 // access to region 0-5 @@ -385,7 +384,6 @@ ENTRY(alt_dtlb_miss) (p8) mov cr.iha=r17 (p8) mov r29=b0 // save b0 (p8) br.cond.dptk dtlb_fault -#endif extr.u r23=r21,IA64_PSR_CPL0_BIT,2 // extract psr.cpl and r22=IA64_ISR_CODE_MASK,r20 // get the isr.code field tbit.nz p6,p7=r20,IA64_ISR_SP_BIT // is speculation bit on? @@ -440,7 +438,7 @@ ENTRY(nested_dtlb_miss) shl r21=r16,3 // shift bit 60 into sign bit mov r18=cr.itir shr.u r17=r16,61 // get the region number into r17 - movl r22=(1 << (PGDIR_SHIFT+PAGE_SHIFT))// End of mappable space + movl r22=(1<> RGN_MAP_SHIFT) & 7UL) +#define VKP_ADDR_TO_SHIFT(addr) (VKP_ADDR_TO_INDEX(addr) * 2UL + VKP_FIRST_SHIFT - 2UL) + +#define VKP_ADDR_TO_OFFSET(addr) ((addr) & (RGN_MAP_LIMIT -1UL)) +#define VKP_ADDR_TO_AREA(addr) ((addr) & ~(RGN_MAP_LIMIT -1UL)) + +#define VKP_PAGE_TO_PAGE(addr) (VKP_ADDR_TO_OFFSET(addr) >> (VKP_ADDR_TO_SHIFT(addr) - PAGE_SHIFT) | \ + VKP_ADDR_TO_AREA(addr)) + +#define VKP_VALID(addr) (REGION_NUMBER(addr) == RGN_HPAGE && VKP_ADDR_TO_INDEX(addr)) + +#define pgd_offset_vkp(addr) (sizes_pg_dir + (VKP_ADDR_TO_INDEX(addr) << (PAGE_SHIFT - 6)) +\ + ((VKP_ADDR_TO_OFFSET(addr) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))) + +#define VIRTUAL_MEM_MAP_PAGE_SHIFT 20 +#ifdef CONFIG_VIRTUAL_MEM_MAP_HUGE +#define VIRTUAL_MEM_MAP VKP_AREA(VIRTUAL_MEM_MAP_PAGE_SHIFT) +#else +#define VIRTUAL_MEM_MAP (RGN_BASE(RGN_GATE) + 0x200000000UL) +#endif + + # ifndef __ASSEMBLY__ #include /* for mm_struct */ @@ -244,11 +287,6 @@ ia64_phys_addr_valid (unsigned long addr #define VIRTUAL_MEM_MAP_SIZE 0 #endif -#ifdef CONFIG_VIRTUAL_MEM_MAP_HUGE -/* Default page size is 1 megabyte */ -#define VIRTUAL_MEM_MAP KVP_AREA(20) -#endif - #define VMALLOC_START (VIRTUAL_MEM_MAP + VIRTUAL_MEM_MAP_SIZE) #define VMALLOC_END (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9))) @@ -256,9 +294,6 @@ ia64_phys_addr_valid (unsigned long addr #define kc_vaddr_to_offset(v) ((v) - RGN_BASE(RGN_GATE)) #define kc_offset_to_vaddr(o) ((o) + RGN_BASE(RGN_GATE)) -#define RGN_MAP_SHIFT (PGDIR_SHIFT + PTRS_PER_PGD_SHIFT - 3) -#define RGN_MAP_LIMIT ((1UL << RGN_MAP_SHIFT) - PAGE_SIZE) /* per region addr limit */ - /* * Conversion functions: convert page frame number (pfn) and a protection value to a page * table entry (pte). @@ -372,34 +407,6 @@ pgd_offset (struct mm_struct *mm, unsign here. */ #define pgd_offset_gate(mm, addr) pgd_offset_k(addr) -/* - * Definitions to support various sizes of kernel pages - * that can be used to reduce TLB pressure. - * - * Supported lage page shifts and sizes are: - * - * 18(256k) 20(1M) 22(4M) 24(16M) 26(64M) 28(256M) 30(1GB) - */ -#define VKP_FIRST_SHIFT 18 /* First supported page size (256k) */ - -#define VKP_SHIFT_TO_INDEX(x) (((x)-VKP_FIRST_SHIFT) / 2 + 1) - -#define VKP_AREA(shift) (RGN_BASE(RGN_HPAGE) + \ - (VKP_INDEX(shift) << RGN_MAP_SHIFT)) - -/* Extract variuos things from a VKP address */ -#define VKP_ADDR_TO_INDEX(addr) (((x) >> RGN_MAP_SHIFT) & 0x7) - -#define VKP_ADDR_TO_OFFSET(addr) ((addr) & (RGN_MAP_LIMIT -1)) -#define VKP_ADDR_TO_AREA(adrd) ((addr) & ~(RGN_MAP_LIMIT -1)) - -#define VKP_PAGE_TO_PAGE(addr) (VKP_OFFSET(addr) >> (VKP_INDEX_TO_SHIFT(addr) - PAGE_SHIFT) \ - VKP_ADDR_TO_AREA(addr)) - -#define VKP_VALID(addr) (REGION(addr) == HPAGE && VKP_ADDR_TO_INDEX(addr)) - -#define pgd_offset_vkp(addr) (sizes_pg_dir + (VKP_ADDR_TO_INDEX(addr) << (PAGE_SIZE-6)) +\ - ((VKP_ADDR_TO_OFFSET(addr) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))) #ifdef CONFIG_PGTABLE_4 /* Find an entry in the second-level page table.. */ Index: linux-2.6.18-mm3/arch/ia64/kernel/vmlinux.lds.S =================================================================== --- linux-2.6.18-mm3.orig/arch/ia64/kernel/vmlinux.lds.S 2006-10-09 17:38:54.421670750 -0700 +++ linux-2.6.18-mm3/arch/ia64/kernel/vmlinux.lds.S 2006-10-09 23:47:32.446878263 -0700 @@ -34,6 +34,7 @@ SECTIONS v = PAGE_OFFSET; /* this symbol is here to make debugging easier... */ phys_start = _start - LOAD_OFFSET; + mem_map = VIRTUAL_MEM_MAP; code : { } :code . = KERNEL_START;