ia64/xen-unstable

annotate xen/include/asm-ia64/linux-xen/asm/pgalloc.h @ 9770:ced37bea0647

[IA64] FPH enabling + cleanup

Move contents of switch_to macro from xensystem.h to context_switch function.
Initialize FPU on all processors. FPH is always enabled in Xen.
Speed up context-switch (a little bit!) by not enabling/disabling FPH.
Cleanup (unused function/variablesi/fields, debug printf...)
vmx_ia64_switch_to removed (was unused).

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Tue Apr 25 22:35:41 2006 -0600 (2006-04-25)
parents 1055f276cc4d
children 666bc6079577
rev   line source
adsharma@5974 1 #ifndef _ASM_IA64_PGALLOC_H
adsharma@5974 2 #define _ASM_IA64_PGALLOC_H
adsharma@5974 3
adsharma@5974 4 /*
adsharma@5974 5 * This file contains the functions and defines necessary to allocate
adsharma@5974 6 * page tables.
adsharma@5974 7 *
adsharma@5974 8 * This hopefully works with any (fixed) ia-64 page-size, as defined
adsharma@5974 9 * in <asm/page.h> (currently 8192).
adsharma@5974 10 *
adsharma@5974 11 * Copyright (C) 1998-2001 Hewlett-Packard Co
adsharma@5974 12 * David Mosberger-Tang <davidm@hpl.hp.com>
adsharma@5974 13 * Copyright (C) 2000, Goutham Rao <goutham.rao@intel.com>
adsharma@5974 14 */
adsharma@5974 15
adsharma@5974 16 #include <linux/config.h>
adsharma@5974 17
adsharma@5974 18 #include <linux/compiler.h>
adsharma@5974 19 #include <linux/mm.h>
adsharma@5974 20 #include <linux/page-flags.h>
adsharma@5974 21 #include <linux/threads.h>
adsharma@5974 22
adsharma@5974 23 #include <asm/mmu_context.h>
adsharma@5974 24
djm@6457 25 #ifndef XEN
djm@6457 26 DECLARE_PER_CPU(unsigned long *, __pgtable_quicklist);
djm@6457 27 #define pgtable_quicklist __ia64_per_cpu_var(__pgtable_quicklist)
djm@6457 28 DECLARE_PER_CPU(long, __pgtable_quicklist_size);
djm@6457 29 #define pgtable_quicklist_size __ia64_per_cpu_var(__pgtable_quicklist_size)
adsharma@5974 30
djm@6457 31 static inline long pgtable_quicklist_total_size(void)
adsharma@5974 32 {
djm@6457 33 long ql_size = 0;
djm@6457 34 int cpuid;
adsharma@5974 35
djm@6457 36 for_each_online_cpu(cpuid) {
djm@6457 37 ql_size += per_cpu(__pgtable_quicklist_size, cpuid);
djm@6457 38 }
djm@6457 39 return ql_size;
adsharma@5974 40 }
adsharma@5974 41
djm@6457 42 static inline void *pgtable_quicklist_alloc(void)
adsharma@5974 43 {
adsharma@5974 44 unsigned long *ret = NULL;
adsharma@5974 45
adsharma@5974 46 preempt_disable();
adsharma@5974 47
djm@6457 48 ret = pgtable_quicklist;
adsharma@5974 49 if (likely(ret != NULL)) {
djm@6457 50 pgtable_quicklist = (unsigned long *)(*ret);
adsharma@5974 51 ret[0] = 0;
djm@6457 52 --pgtable_quicklist_size;
djm@6457 53 preempt_enable();
djm@6457 54 } else {
djm@6457 55 preempt_enable();
djm@6457 56 ret = (unsigned long *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
adsharma@5974 57 }
adsharma@5974 58
djm@6457 59 return ret;
adsharma@5974 60 }
adsharma@5974 61
djm@6457 62 static inline void pgtable_quicklist_free(void *pgtable_entry)
adsharma@5974 63 {
djm@6457 64 #ifdef CONFIG_NUMA
djm@6457 65 unsigned long nid = page_to_nid(virt_to_page(pgtable_entry));
djm@6457 66
djm@6457 67 if (unlikely(nid != numa_node_id())) {
djm@6457 68 free_page((unsigned long)pgtable_entry);
djm@6457 69 return;
djm@6457 70 }
adsharma@5974 71 #endif
adsharma@5974 72
djm@6457 73 preempt_disable();
djm@6457 74 *(unsigned long *)pgtable_entry = (unsigned long)pgtable_quicklist;
djm@6457 75 pgtable_quicklist = (unsigned long *)pgtable_entry;
djm@6457 76 ++pgtable_quicklist_size;
djm@6457 77 preempt_enable();
djm@6457 78 }
djm@6457 79 #endif
djm@6457 80
djm@6457 81 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
djm@6457 82 {
djm@6457 83 return pgtable_quicklist_alloc();
djm@6457 84 }
djm@6457 85
djm@6457 86 static inline void pgd_free(pgd_t * pgd)
djm@6457 87 {
djm@6457 88 pgtable_quicklist_free(pgd);
adsharma@5974 89 }
adsharma@5974 90
adsharma@5974 91 static inline void
djm@6457 92 pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)
djm@6457 93 {
djm@6457 94 pud_val(*pud_entry) = __pa(pmd);
djm@6457 95 }
djm@6457 96
djm@6457 97 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
adsharma@5974 98 {
djm@6457 99 return pgtable_quicklist_alloc();
djm@6457 100 }
djm@6457 101
djm@6457 102 static inline void pmd_free(pmd_t * pmd)
djm@6457 103 {
djm@6457 104 pgtable_quicklist_free(pmd);
adsharma@5974 105 }
adsharma@5974 106
adsharma@5974 107 #define __pmd_free_tlb(tlb, pmd) pmd_free(pmd)
adsharma@5974 108
awilliam@9276 109 #ifndef XEN
adsharma@5974 110 static inline void
djm@6457 111 pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
adsharma@5974 112 {
kaf24@8726 113 pmd_val(*pmd_entry) = page_to_maddr(pte);
adsharma@5974 114 }
awilliam@9276 115 #endif
adsharma@5974 116
adsharma@5974 117 static inline void
djm@6457 118 pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
adsharma@5974 119 {
adsharma@5974 120 pmd_val(*pmd_entry) = __pa(pte);
adsharma@5974 121 }
adsharma@5974 122
awilliam@9276 123 #ifndef XEN
djm@6457 124 static inline struct page *pte_alloc_one(struct mm_struct *mm,
djm@6457 125 unsigned long addr)
adsharma@5974 126 {
djm@6457 127 return virt_to_page(pgtable_quicklist_alloc());
adsharma@5974 128 }
awilliam@9276 129 #endif
adsharma@5974 130
djm@6457 131 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
djm@6457 132 unsigned long addr)
adsharma@5974 133 {
djm@6457 134 return pgtable_quicklist_alloc();
adsharma@5974 135 }
adsharma@5974 136
awilliam@9276 137 #ifndef XEN
djm@6457 138 static inline void pte_free(struct page *pte)
adsharma@5974 139 {
djm@6457 140 pgtable_quicklist_free(page_address(pte));
adsharma@5974 141 }
adsharma@5974 142
djm@6457 143 static inline void pte_free_kernel(pte_t * pte)
adsharma@5974 144 {
djm@6457 145 pgtable_quicklist_free(pte);
adsharma@5974 146 }
adsharma@5974 147
djm@6457 148 #define __pte_free_tlb(tlb, pte) pte_free(pte)
awilliam@9276 149 #endif
adsharma@5974 150
djm@6457 151 extern void check_pgt_cache(void);
adsharma@5974 152
djm@6457 153 #endif /* _ASM_IA64_PGALLOC_H */