Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1014-2.6.25-xen-auto-arch-x86_64.patch
Parent Directory | Revision Log
Revision 609 -
(show annotations)
(download)
Fri May 23 17:35:37 2008 UTC (16 years, 4 months ago) by niro
File size: 8407 byte(s)
Fri May 23 17:35:37 2008 UTC (16 years, 4 months ago) by niro
File size: 8407 byte(s)
-using opensuse xen patchset, updated kernel configs
1 | Subject: xen3 arch-x86_64 |
2 | From: http://xenbits.xensource.com/linux-2.6.18-xen.hg (tip 517:d71965a78c20) |
3 | Patch-mainline: obsolete |
4 | Acked-by: jbeulich@novell.com |
5 | |
6 | Index: head-2008-04-15/arch/x86/kernel/asm-offsets_64.c |
7 | =================================================================== |
8 | --- head-2008-04-15.orig/arch/x86/kernel/asm-offsets_64.c 2008-04-15 09:41:09.000000000 +0200 |
9 | +++ head-2008-04-15/arch/x86/kernel/asm-offsets_64.c 2008-04-15 09:59:32.000000000 +0200 |
10 | @@ -124,8 +124,10 @@ int main(void) |
11 | ENTRY(cr8); |
12 | BLANK(); |
13 | #undef ENTRY |
14 | +#ifndef CONFIG_X86_NO_TSS |
15 | DEFINE(TSS_ist, offsetof(struct tss_struct, x86_tss.ist)); |
16 | BLANK(); |
17 | +#endif |
18 | DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx)); |
19 | BLANK(); |
20 | DEFINE(__NR_syscall_max, sizeof(syscalls) - 1); |
21 | Index: head-2008-04-15/arch/x86/kernel/machine_kexec_64.c |
22 | =================================================================== |
23 | --- head-2008-04-15.orig/arch/x86/kernel/machine_kexec_64.c 2008-04-15 09:41:09.000000000 +0200 |
24 | +++ head-2008-04-15/arch/x86/kernel/machine_kexec_64.c 2008-04-15 09:59:32.000000000 +0200 |
25 | @@ -25,6 +25,119 @@ static u64 kexec_pud1[512] PAGE_ALIGNED; |
26 | static u64 kexec_pmd1[512] PAGE_ALIGNED; |
27 | static u64 kexec_pte1[512] PAGE_ALIGNED; |
28 | |
29 | +#ifdef CONFIG_XEN |
30 | + |
31 | +/* In the case of Xen, override hypervisor functions to be able to create |
32 | + * a regular identity mapping page table... |
33 | + */ |
34 | + |
35 | +#include <xen/interface/kexec.h> |
36 | +#include <xen/interface/memory.h> |
37 | + |
38 | +#define x__pmd(x) ((pmd_t) { (x) } ) |
39 | +#define x__pud(x) ((pud_t) { (x) } ) |
40 | +#define x__pgd(x) ((pgd_t) { (x) } ) |
41 | + |
42 | +#define x_pmd_val(x) ((x).pmd) |
43 | +#define x_pud_val(x) ((x).pud) |
44 | +#define x_pgd_val(x) ((x).pgd) |
45 | + |
46 | +static inline void x_set_pmd(pmd_t *dst, pmd_t val) |
47 | +{ |
48 | + x_pmd_val(*dst) = x_pmd_val(val); |
49 | +} |
50 | + |
51 | +static inline void x_set_pud(pud_t *dst, pud_t val) |
52 | +{ |
53 | + x_pud_val(*dst) = phys_to_machine(x_pud_val(val)); |
54 | +} |
55 | + |
56 | +static inline void x_pud_clear (pud_t *pud) |
57 | +{ |
58 | + x_pud_val(*pud) = 0; |
59 | +} |
60 | + |
61 | +static inline void x_set_pgd(pgd_t *dst, pgd_t val) |
62 | +{ |
63 | + x_pgd_val(*dst) = phys_to_machine(x_pgd_val(val)); |
64 | +} |
65 | + |
66 | +static inline void x_pgd_clear (pgd_t * pgd) |
67 | +{ |
68 | + x_pgd_val(*pgd) = 0; |
69 | +} |
70 | + |
71 | +#define X__PAGE_KERNEL_LARGE_EXEC \ |
72 | + _PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_PSE |
73 | +#define X_KERNPG_TABLE _PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY |
74 | + |
75 | +#define __ma(x) (pfn_to_mfn(__pa((x)) >> PAGE_SHIFT) << PAGE_SHIFT) |
76 | + |
77 | +#if PAGES_NR > KEXEC_XEN_NO_PAGES |
78 | +#error PAGES_NR is greater than KEXEC_XEN_NO_PAGES - Xen support will break |
79 | +#endif |
80 | + |
81 | +#if PA_CONTROL_PAGE != 0 |
82 | +#error PA_CONTROL_PAGE is non zero - Xen support will break |
83 | +#endif |
84 | + |
85 | +void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, struct kimage *image) |
86 | +{ |
87 | + void *control_page; |
88 | + void *table_page; |
89 | + |
90 | + memset(xki->page_list, 0, sizeof(xki->page_list)); |
91 | + |
92 | + control_page = page_address(image->control_code_page) + PAGE_SIZE; |
93 | + memcpy(control_page, relocate_kernel, PAGE_SIZE); |
94 | + |
95 | + table_page = page_address(image->control_code_page); |
96 | + |
97 | + xki->page_list[PA_CONTROL_PAGE] = __ma(control_page); |
98 | + xki->page_list[PA_TABLE_PAGE] = __ma(table_page); |
99 | + |
100 | + xki->page_list[PA_PGD] = __ma(kexec_pgd); |
101 | + xki->page_list[PA_PUD_0] = __ma(kexec_pud0); |
102 | + xki->page_list[PA_PUD_1] = __ma(kexec_pud1); |
103 | + xki->page_list[PA_PMD_0] = __ma(kexec_pmd0); |
104 | + xki->page_list[PA_PMD_1] = __ma(kexec_pmd1); |
105 | + xki->page_list[PA_PTE_0] = __ma(kexec_pte0); |
106 | + xki->page_list[PA_PTE_1] = __ma(kexec_pte1); |
107 | +} |
108 | + |
109 | +int __init machine_kexec_setup_resources(struct resource *hypervisor, |
110 | + struct resource *phys_cpus, |
111 | + int nr_phys_cpus) |
112 | +{ |
113 | + int k; |
114 | + |
115 | + /* The per-cpu crash note resources belong to the hypervisor resource */ |
116 | + for (k = 0; k < nr_phys_cpus; k++) |
117 | + request_resource(hypervisor, phys_cpus + k); |
118 | + |
119 | + return 0; |
120 | +} |
121 | + |
122 | +void machine_kexec_register_resources(struct resource *res) { ; } |
123 | + |
124 | +#else /* CONFIG_XEN */ |
125 | + |
126 | +#define x__pmd(x) __pmd(x) |
127 | +#define x__pud(x) __pud(x) |
128 | +#define x__pgd(x) __pgd(x) |
129 | + |
130 | +#define x_set_pmd(x, y) set_pmd(x, y) |
131 | +#define x_set_pud(x, y) set_pud(x, y) |
132 | +#define x_set_pgd(x, y) set_pgd(x, y) |
133 | + |
134 | +#define x_pud_clear(x) pud_clear(x) |
135 | +#define x_pgd_clear(x) pgd_clear(x) |
136 | + |
137 | +#define X__PAGE_KERNEL_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC |
138 | +#define X_KERNPG_TABLE _KERNPG_TABLE |
139 | + |
140 | +#endif /* CONFIG_XEN */ |
141 | + |
142 | static void init_level2_page(pmd_t *level2p, unsigned long addr) |
143 | { |
144 | unsigned long end_addr; |
145 | @@ -32,7 +145,7 @@ static void init_level2_page(pmd_t *leve |
146 | addr &= PAGE_MASK; |
147 | end_addr = addr + PUD_SIZE; |
148 | while (addr < end_addr) { |
149 | - set_pmd(level2p++, __pmd(addr | __PAGE_KERNEL_LARGE_EXEC)); |
150 | + x_set_pmd(level2p++, x__pmd(addr | X__PAGE_KERNEL_LARGE_EXEC)); |
151 | addr += PMD_SIZE; |
152 | } |
153 | } |
154 | @@ -57,12 +170,12 @@ static int init_level3_page(struct kimag |
155 | } |
156 | level2p = (pmd_t *)page_address(page); |
157 | init_level2_page(level2p, addr); |
158 | - set_pud(level3p++, __pud(__pa(level2p) | _KERNPG_TABLE)); |
159 | + x_set_pud(level3p++, x__pud(__pa(level2p) | X_KERNPG_TABLE)); |
160 | addr += PUD_SIZE; |
161 | } |
162 | /* clear the unused entries */ |
163 | while (addr < end_addr) { |
164 | - pud_clear(level3p++); |
165 | + x_pud_clear(level3p++); |
166 | addr += PUD_SIZE; |
167 | } |
168 | out: |
169 | @@ -93,12 +206,12 @@ static int init_level4_page(struct kimag |
170 | if (result) { |
171 | goto out; |
172 | } |
173 | - set_pgd(level4p++, __pgd(__pa(level3p) | _KERNPG_TABLE)); |
174 | + x_set_pgd(level4p++, x__pgd(__pa(level3p) | X_KERNPG_TABLE)); |
175 | addr += PGDIR_SIZE; |
176 | } |
177 | /* clear the unused entries */ |
178 | while (addr < end_addr) { |
179 | - pgd_clear(level4p++); |
180 | + x_pgd_clear(level4p++); |
181 | addr += PGDIR_SIZE; |
182 | } |
183 | out: |
184 | @@ -109,8 +222,14 @@ out: |
185 | static int init_pgtable(struct kimage *image, unsigned long start_pgtable) |
186 | { |
187 | pgd_t *level4p; |
188 | + unsigned long x_end_pfn = end_pfn; |
189 | + |
190 | +#ifdef CONFIG_XEN |
191 | + x_end_pfn = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL); |
192 | +#endif |
193 | + |
194 | level4p = (pgd_t *)__va(start_pgtable); |
195 | - return init_level4_page(image, level4p, 0, end_pfn << PAGE_SHIFT); |
196 | + return init_level4_page(image, level4p, 0, x_end_pfn << PAGE_SHIFT); |
197 | } |
198 | |
199 | int machine_kexec_prepare(struct kimage *image) |
200 | @@ -134,6 +253,7 @@ void machine_kexec_cleanup(struct kimage |
201 | return; |
202 | } |
203 | |
204 | +#ifndef CONFIG_XEN |
205 | /* |
206 | * Do not allocate memory (or fail in any way) in machine_kexec(). |
207 | * We are past the point of no return, committed to rebooting now. |
208 | @@ -172,6 +292,7 @@ NORET_TYPE void machine_kexec(struct kim |
209 | relocate_kernel((unsigned long)image->head, (unsigned long)page_list, |
210 | image->start); |
211 | } |
212 | +#endif |
213 | |
214 | void arch_crash_save_vmcoreinfo(void) |
215 | { |
216 | Index: head-2008-04-15/arch/x86/pci/Makefile_64 |
217 | =================================================================== |
218 | --- head-2008-04-15.orig/arch/x86/pci/Makefile_64 2008-04-15 09:41:09.000000000 +0200 |
219 | +++ head-2008-04-15/arch/x86/pci/Makefile_64 2008-04-15 09:59:32.000000000 +0200 |
220 | @@ -15,3 +15,7 @@ obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_6 |
221 | |
222 | obj-$(CONFIG_NUMA) += k8-bus_64.o |
223 | |
224 | +# pcifront should be after mmconfig.o and direct.o as it should only |
225 | +# take over if direct access to the PCI bus is unavailable |
226 | +obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += pcifront.o |
227 | + |
228 | Index: head-2008-04-15/arch/x86/power/cpu_64.c |
229 | =================================================================== |
230 | --- head-2008-04-15.orig/arch/x86/power/cpu_64.c 2008-04-15 09:41:09.000000000 +0200 |
231 | +++ head-2008-04-15/arch/x86/power/cpu_64.c 2008-04-15 09:59:32.000000000 +0200 |
232 | @@ -135,6 +135,7 @@ void restore_processor_state(void) |
233 | |
234 | static void fix_processor_context(void) |
235 | { |
236 | +#ifndef CONFIG_X86_NO_TSS |
237 | int cpu = smp_processor_id(); |
238 | struct tss_struct *t = &per_cpu(init_tss, cpu); |
239 | |
240 | @@ -146,6 +147,7 @@ static void fix_processor_context(void) |
241 | set_tss_desc(cpu, t); |
242 | |
243 | get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9; |
244 | +#endif |
245 | |
246 | syscall_init(); /* This sets MSR_*STAR and related */ |
247 | load_TR_desc(); /* This does ltr */ |
248 | Index: head-2008-04-15/arch/x86/vdso/Makefile |
249 | =================================================================== |
250 | --- head-2008-04-15.orig/arch/x86/vdso/Makefile 2008-04-15 09:41:09.000000000 +0200 |
251 | +++ head-2008-04-15/arch/x86/vdso/Makefile 2008-04-15 09:59:32.000000000 +0200 |
252 | @@ -64,6 +64,8 @@ obj-$(VDSO32-y) += vdso32-syms.lds |
253 | vdso32.so-$(CONFIG_X86_32) += int80 |
254 | vdso32.so-$(CONFIG_COMPAT) += syscall |
255 | vdso32.so-$(VDSO32-y) += sysenter |
256 | +xen-vdso32-$(subst 1,$(CONFIG_COMPAT),$(shell expr $(CONFIG_XEN_COMPAT)0 '<' 0x0302000)) += int80 |
257 | +vdso32.so-$(CONFIG_XEN) += $(xen-vdso32-y) |
258 | |
259 | vdso32-images = $(vdso32.so-y:%=vdso32-%.so) |
260 |