aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-06-25 00:19:12 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 07:11:01 -0400
commiteba0045ff87bab465d3c80c289f3bf709c1800f5 (patch)
treee015805494c1ddb427fa568619163913270963bd /include/asm-x86
parent67350a5c4514c280665cdb45439d32a008a264ba (diff)
x86/paravirt: add a pgd_alloc/free hooks
Add hooks which are called at pgd_alloc/free time. The pgd_alloc hook may return an error code, which if non-zero, causes the pgd allocation to be failed. The hooks may be used to allocate/free auxillary per-pgd information. also fix: > * Ingo Molnar <mingo@elte.hu> wrote: > > include/asm/pgalloc.h: In function ‘paravirt_pgd_free': > include/asm/pgalloc.h:14: error: parameter name omitted > arch/x86/kernel/entry_64.S: In file included from > arch/x86/kernel/traps_64.c:51:include/asm/pgalloc.h: In function ‘paravirt_pgd_free': > include/asm/pgalloc.h:14: error: parameter name omitted Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Cc: xen-devel <xen-devel@lists.xensource.com> Cc: Stephen Tweedie <sct@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86')
-rw-r--r--include/asm-x86/paravirt.h19
-rw-r--r--include/asm-x86/pgalloc.h4
2 files changed, 22 insertions, 1 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 41f5447efd88..5467e2cff4bc 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -219,7 +219,14 @@ struct pv_mmu_ops {
219 void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm, 219 void (*flush_tlb_others)(const cpumask_t *cpus, struct mm_struct *mm,
220 unsigned long va); 220 unsigned long va);
221 221
222 /* Hooks for allocating/releasing pagetable pages */ 222 /* Hooks for allocating and freeing a pagetable top-level */
223 int (*pgd_alloc)(struct mm_struct *mm);
224 void (*pgd_free)(struct mm_struct *mm, pgd_t *pgd);
225
226 /*
227 * Hooks for allocating/releasing pagetable pages when they're
228 * attached to a pagetable
229 */
223 void (*alloc_pte)(struct mm_struct *mm, u32 pfn); 230 void (*alloc_pte)(struct mm_struct *mm, u32 pfn);
224 void (*alloc_pmd)(struct mm_struct *mm, u32 pfn); 231 void (*alloc_pmd)(struct mm_struct *mm, u32 pfn);
225 void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); 232 void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count);
@@ -925,6 +932,16 @@ static inline void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
925 PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va); 932 PVOP_VCALL3(pv_mmu_ops.flush_tlb_others, &cpumask, mm, va);
926} 933}
927 934
935static inline int paravirt_pgd_alloc(struct mm_struct *mm)
936{
937 return PVOP_CALL1(int, pv_mmu_ops.pgd_alloc, mm);
938}
939
940static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd)
941{
942 PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd);
943}
944
928static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn) 945static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn)
929{ 946{
930 PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); 947 PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn);
diff --git a/include/asm-x86/pgalloc.h b/include/asm-x86/pgalloc.h
index 91e4641f3f31..d63ea431cb3b 100644
--- a/include/asm-x86/pgalloc.h
+++ b/include/asm-x86/pgalloc.h
@@ -5,9 +5,13 @@
5#include <linux/mm.h> /* for struct page */ 5#include <linux/mm.h> /* for struct page */
6#include <linux/pagemap.h> 6#include <linux/pagemap.h>
7 7
8static inline int __paravirt_pgd_alloc(struct mm_struct *mm) { return 0; }
9
8#ifdef CONFIG_PARAVIRT 10#ifdef CONFIG_PARAVIRT
9#include <asm/paravirt.h> 11#include <asm/paravirt.h>
10#else 12#else
13#define paravirt_pgd_alloc(mm) __paravirt_pgd_alloc(mm)
14static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd) {}
11static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) {} 15static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn) {}
12static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) {} 16static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn) {}
13static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn, 17static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn,