Magellan Linux

Contents of /tags/kernel26-xen-2_6_25_r1-fedora9-patches/kernel26-xen/patches-2.6.25-r1/1019-2.6.25-xen-dom0-Add-set_fixmap-pv_mmu_ops.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 608 - (show annotations) (download)
Fri May 23 12:17:32 2008 UTC (16 years ago) by (unknown author)
File size: 4877 byte(s)
This commit was manufactured by cvs2svn to create tag
'kernel26-xen-2_6_25_r1-fedora9-patches'.
1 From 4975fbff3f18ca2cbb3019bf428cb9507ca66466 Mon Sep 17 00:00:00 2001
2 From: Mark McLoughlin <markmc@redhat.com>
3 Date: Mon, 28 Jan 2008 15:42:08 +0000
4 Subject: [PATCH] xen dom0: Add set_fixmap pv_mmu_ops.
5
6 Adds the logic necessary to map by mfn rather than pfn when we set up
7 fixmaps to point to IO space.
8
9 Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
10 Signed-off-by: Juan Quintela <quintela@redhat.com>
11 Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
12 Signed-off-by: Mark McLoughlin <markmc@redhat.com>
13 ---
14 arch/x86/kernel/paravirt.c | 2 ++
15 arch/x86/mm/pgtable_32.c | 9 +++++++--
16 arch/x86/xen/enlighten.c | 28 ++++++++++++++++++++++++++++
17 include/asm-x86/fixmap_32.h | 13 +++++++++++--
18 include/asm-x86/paravirt.h | 13 +++++++++++++
19 5 files changed, 61 insertions(+), 4 deletions(-)
20
21 diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
22 index c845947..47f42bf 100644
23 --- a/arch/x86/kernel/paravirt.c
24 +++ b/arch/x86/kernel/paravirt.c
25 @@ -433,6 +433,8 @@ struct pv_mmu_ops pv_mmu_ops = {
26 .enter = paravirt_nop,
27 .leave = paravirt_nop,
28 },
29 +
30 + .set_fixmap = native_set_fixmap,
31 };
32
33 EXPORT_SYMBOL_GPL(pv_time_ops);
34 diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
35 index fca936b..c1c7c36 100644
36 --- a/arch/x86/mm/pgtable_32.c
37 +++ b/arch/x86/mm/pgtable_32.c
38 @@ -150,7 +150,7 @@ static int fixmaps;
39 unsigned long __FIXADDR_TOP = 0xfffff000;
40 EXPORT_SYMBOL(__FIXADDR_TOP);
41
42 -void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
43 +void __native_set_fixmap(enum fixed_addresses idx, pte_t pte)
44 {
45 unsigned long address = __fix_to_virt(idx);
46
47 @@ -158,10 +158,15 @@ void __set_fixmap (enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
48 BUG();
49 return;
50 }
51 - set_pte_vaddr(address, pfn_pte(phys >> PAGE_SHIFT, flags));
52 + set_pte_vaddr(address, pte);
53 fixmaps++;
54 }
55
56 +void native_set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
57 +{
58 + __native_set_fixmap(idx, pfn_pte(phys >> PAGE_SHIFT, flags));
59 +}
60 +
61 /**
62 * reserve_top_address - reserves a hole in the top of kernel address space
63 * @reserve - size of hole to reserve
64 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
65 index 907567d..22e0d41 100644
66 --- a/arch/x86/xen/enlighten.c
67 +++ b/arch/x86/xen/enlighten.c
68 @@ -965,6 +965,32 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
69 return ret;
70 }
71
72 +static void xen_set_fixmap(unsigned idx, unsigned long phys, pgprot_t prot)
73 +{
74 + pte_t pte;
75 +
76 + phys >>= PAGE_SHIFT;
77 +
78 + switch (idx) {
79 +#ifdef CONFIG_X86_F00F_BUG
80 + case FIX_F00F_IDT:
81 +#endif
82 + case FIX_WP_TEST:
83 + case FIX_VDSO:
84 +#ifdef CONFIG_X86_LOCAL_APIC
85 + case FIX_APIC_BASE: /* maps dummy local APIC */
86 +#endif
87 + pte = pfn_pte(phys, prot);
88 + break;
89 +
90 + default:
91 + pte = mfn_pte(phys, prot);
92 + break;
93 + }
94 +
95 + __native_set_fixmap(idx, pte);
96 +}
97 +
98 static const struct pv_info xen_info __initdata = {
99 .paravirt_enabled = 1,
100 .shared_kernel_pmd = 0,
101 @@ -1120,6 +1146,8 @@ static const struct pv_mmu_ops xen_mmu_ops __initdata = {
102 .enter = paravirt_enter_lazy_mmu,
103 .leave = xen_leave_lazy,
104 },
105 +
106 + .set_fixmap = xen_set_fixmap,
107 };
108
109 #ifdef CONFIG_SMP
110 diff --git a/include/asm-x86/fixmap_32.h b/include/asm-x86/fixmap_32.h
111 index a7404d5..c2e450a 100644
112 --- a/include/asm-x86/fixmap_32.h
113 +++ b/include/asm-x86/fixmap_32.h
114 @@ -110,8 +110,17 @@ enum fixed_addresses {
115 __end_of_fixed_addresses
116 };
117
118 -extern void __set_fixmap (enum fixed_addresses idx,
119 - unsigned long phys, pgprot_t flags);
120 +void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
121 +void native_set_fixmap(enum fixed_addresses idx,
122 + unsigned long phys, pgprot_t flags);
123 +
124 +#ifndef CONFIG_PARAVIRT
125 +static inline void __set_fixmap(enum fixed_addresses idx,
126 + unsigned long phys, pgprot_t flags)
127 +{
128 + native_set_fixmap(idx, phys, flags);
129 +}
130 +#endif
131 extern void reserve_top_address(unsigned long reserve);
132
133 #define set_fixmap(idx, phys) \
134 diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
135 index 7d7070a..c7c4e34 100644
136 --- a/include/asm-x86/paravirt.h
137 +++ b/include/asm-x86/paravirt.h
138 @@ -272,6 +272,13 @@ struct pv_mmu_ops {
139 #endif
140
141 struct pv_lazy_ops lazy_mode;
142 +
143 + /* dom0 ops */
144 +
145 + /* Sometimes the physical address is a pfn, and sometimes its
146 + an mfn. We can tell which is which from the index. */
147 + void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
148 + unsigned long phys, pgprot_t flags);
149 };
150
151 /* This contains all the paravirt structures: we get a convenient
152 @@ -1235,6 +1242,12 @@ static inline void arch_flush_lazy_mmu_mode(void)
153 }
154 }
155
156 +static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
157 + unsigned long phys, pgprot_t flags)
158 +{
159 + pv_mmu_ops.set_fixmap(idx, phys, flags);
160 +}
161 +
162 void _paravirt_nop(void);
163 #define paravirt_nop ((void *)_paravirt_nop)
164
165 --
166 1.5.4.1
167