aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-06-17 14:42:01 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-20 09:09:56 -0400
commitaeaaa59c7e15dcfaaf57ce069ef81683067d575d (patch)
tree5d3197156381360027d414625fe26ab2d67c6a07
parentd494a96125c99f1e37b1f831b29b42c9b712ee05 (diff)
x86/paravirt/xen: add set_fixmap pv_mmu_ops
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/paravirt.c2
-rw-r--r--arch/x86/mm/pgtable.c9
-rw-r--r--arch/x86/xen/enlighten.c29
-rw-r--r--include/asm-x86/fixmap.h14
-rw-r--r--include/asm-x86/paravirt.h13
5 files changed, 63 insertions, 4 deletions
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 74f0c5ea2a03..cf06670349dc 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -416,6 +416,8 @@ struct pv_mmu_ops pv_mmu_ops = {
416 .enter = paravirt_nop, 416 .enter = paravirt_nop,
417 .leave = paravirt_nop, 417 .leave = paravirt_nop,
418 }, 418 },
419
420 .set_fixmap = native_set_fixmap,
419}; 421};
420 422
421EXPORT_SYMBOL_GPL(pv_time_ops); 423EXPORT_SYMBOL_GPL(pv_time_ops);
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 7498124e30fc..e9fb66361fc8 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -277,7 +277,7 @@ int ptep_clear_flush_young(struct vm_area_struct *vma,
277 277
278int fixmaps_set; 278int fixmaps_set;
279 279
280void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags) 280void __native_set_fixmap(enum fixed_addresses idx, pte_t pte)
281{ 281{
282 unsigned long address = __fix_to_virt(idx); 282 unsigned long address = __fix_to_virt(idx);
283 283
@@ -285,6 +285,11 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
285 BUG(); 285 BUG();
286 return; 286 return;
287 } 287 }
288 set_pte_vaddr(address, pfn_pte(phys >> PAGE_SHIFT, flags)); 288 set_pte_vaddr(address, pte);
289 fixmaps_set++; 289 fixmaps_set++;
290} 290}
291
292void native_set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
293{
294 __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags));
295}
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c8a56e457d61..0ad8a64a2e05 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -960,6 +960,33 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
960 return ret; 960 return ret;
961} 961}
962 962
963static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
964{
965 pte_t pte;
966
967 phys >>= PAGE_SHIFT;
968
969 switch (idx) {
970 case FIX_BTMAP_END ... FIX_BTMAP_BEGIN:
971#ifdef CONFIG_X86_F00F_BUG
972 case FIX_F00F_IDT:
973#endif
974 case FIX_WP_TEST:
975 case FIX_VDSO:
976#ifdef CONFIG_X86_LOCAL_APIC
977 case FIX_APIC_BASE: /* maps dummy local APIC */
978#endif
979 pte = pfn_pte(phys, prot);
980 break;
981
982 default:
983 pte = mfn_pte(phys, prot);
984 break;
985 }
986
987 __native_set_fixmap(idx, pte);
988}
989
963static const struct pv_info xen_info __initdata = { 990static const struct pv_info xen_info __initdata = {
964 .paravirt_enabled = 1, 991 .paravirt_enabled = 1,
965 .shared_kernel_pmd = 0, 992 .shared_kernel_pmd = 0,
@@ -1112,6 +1139,8 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
1112 .enter = paravirt_enter_lazy_mmu, 1139 .enter = paravirt_enter_lazy_mmu,
1113 .leave = xen_leave_lazy, 1140 .leave = xen_leave_lazy,
1114 }, 1141 },
1142
1143 .set_fixmap = xen_set_fixmap,
1115}; 1144};
1116 1145
1117#ifdef CONFIG_SMP 1146#ifdef CONFIG_SMP
diff --git a/include/asm-x86/fixmap.h b/include/asm-x86/fixmap.h
index 934d6b49b530..44d4f8217349 100644
--- a/include/asm-x86/fixmap.h
+++ b/include/asm-x86/fixmap.h
@@ -9,8 +9,18 @@
9 9
10extern int fixmaps_set; 10extern int fixmaps_set;
11 11
12extern void __set_fixmap(enum fixed_addresses idx, 12void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
13 unsigned long phys, pgprot_t flags); 13void native_set_fixmap(enum fixed_addresses idx,
14 unsigned long phys, pgprot_t flags);
15
16#ifndef CONFIG_PARAVIRT
17static inline void __set_fixmap(enum fixed_addresses idx,
18 unsigned long phys, pgprot_t flags)
19{
20 native_set_fixmap(idx, phys, flags);
21}
22#endif
23
14#define set_fixmap(idx, phys) \ 24#define set_fixmap(idx, phys) \
15 __set_fixmap(idx, phys, PAGE_KERNEL) 25 __set_fixmap(idx, phys, PAGE_KERNEL)
16 26
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 0f13b945e240..af85caf9a799 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -273,6 +273,13 @@ struct pv_mmu_ops {
273#endif 273#endif
274 274
275 struct pv_lazy_ops lazy_mode; 275 struct pv_lazy_ops lazy_mode;
276
277 /* dom0 ops */
278
279 /* Sometimes the physical address is a pfn, and sometimes its
280 an mfn. We can tell which is which from the index. */
281 void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
282 unsigned long phys, pgprot_t flags);
276}; 283};
277 284
278/* This contains all the paravirt structures: we get a convenient 285/* This contains all the paravirt structures: we get a convenient
@@ -1252,6 +1259,12 @@ static inline void arch_flush_lazy_mmu_mode(void)
1252 } 1259 }
1253} 1260}
1254 1261
1262static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
1263 unsigned long phys, pgprot_t flags)
1264{
1265 pv_mmu_ops.set_fixmap(idx, phys, flags);
1266}
1267
1255void _paravirt_nop(void); 1268void _paravirt_nop(void);
1256#define paravirt_nop ((void *)_paravirt_nop) 1269#define paravirt_nop ((void *)_paravirt_nop)
1257 1270