aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/enlighten.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-07-28 14:53:57 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-31 06:39:39 -0400
commit0d1edf46ba229b46efacf75c0544b88c05a7b266 (patch)
treea26262e9f4e85ba7150dfa4e06998a37daa6a984 /arch/x86/xen/enlighten.c
parenteac4345be6d17541039791f15f173d0426423df1 (diff)
xen: compile irq functions without -pg for ftrace
For some reason I managed to miss a bunch of irq-related functions which also need to be compiled without -pg when using ftrace. This patch moves them into their own file, and starts a cleanup process I've been meaning to do anyway. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: "Alex Nixon (Intern)" <Alex.Nixon@eu.citrix.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r--arch/x86/xen/enlighten.c122
1 files changed, 2 insertions, 120 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index b795470ec069..cf8b3a93122b 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -30,7 +30,6 @@
30#include <xen/interface/xen.h> 30#include <xen/interface/xen.h>
31#include <xen/interface/physdev.h> 31#include <xen/interface/physdev.h>
32#include <xen/interface/vcpu.h> 32#include <xen/interface/vcpu.h>
33#include <xen/interface/sched.h>
34#include <xen/features.h> 33#include <xen/features.h>
35#include <xen/page.h> 34#include <xen/page.h>
36#include <xen/hvc-console.h> 35#include <xen/hvc-console.h>
@@ -226,94 +225,6 @@ static unsigned long xen_get_debugreg(int reg)
226 return HYPERVISOR_get_debugreg(reg); 225 return HYPERVISOR_get_debugreg(reg);
227} 226}
228 227
229static unsigned long xen_save_fl(void)
230{
231 struct vcpu_info *vcpu;
232 unsigned long flags;
233
234 vcpu = x86_read_percpu(xen_vcpu);
235
236 /* flag has opposite sense of mask */
237 flags = !vcpu->evtchn_upcall_mask;
238
239 /* convert to IF type flag
240 -0 -> 0x00000000
241 -1 -> 0xffffffff
242 */
243 return (-flags) & X86_EFLAGS_IF;
244}
245
246static void xen_restore_fl(unsigned long flags)
247{
248 struct vcpu_info *vcpu;
249
250 /* convert from IF type flag */
251 flags = !(flags & X86_EFLAGS_IF);
252
253 /* There's a one instruction preempt window here. We need to
254 make sure we're don't switch CPUs between getting the vcpu
255 pointer and updating the mask. */
256 preempt_disable();
257 vcpu = x86_read_percpu(xen_vcpu);
258 vcpu->evtchn_upcall_mask = flags;
259 preempt_enable_no_resched();
260
261 /* Doesn't matter if we get preempted here, because any
262 pending event will get dealt with anyway. */
263
264 if (flags == 0) {
265 preempt_check_resched();
266 barrier(); /* unmask then check (avoid races) */
267 if (unlikely(vcpu->evtchn_upcall_pending))
268 force_evtchn_callback();
269 }
270}
271
272static void xen_irq_disable(void)
273{
274 /* There's a one instruction preempt window here. We need to
275 make sure we're don't switch CPUs between getting the vcpu
276 pointer and updating the mask. */
277 preempt_disable();
278 x86_read_percpu(xen_vcpu)->evtchn_upcall_mask = 1;
279 preempt_enable_no_resched();
280}
281
282static void xen_irq_enable(void)
283{
284 struct vcpu_info *vcpu;
285
286 /* We don't need to worry about being preempted here, since
287 either a) interrupts are disabled, so no preemption, or b)
288 the caller is confused and is trying to re-enable interrupts
289 on an indeterminate processor. */
290
291 vcpu = x86_read_percpu(xen_vcpu);
292 vcpu->evtchn_upcall_mask = 0;
293
294 /* Doesn't matter if we get preempted here, because any
295 pending event will get dealt with anyway. */
296
297 barrier(); /* unmask then check (avoid races) */
298 if (unlikely(vcpu->evtchn_upcall_pending))
299 force_evtchn_callback();
300}
301
302static void xen_safe_halt(void)
303{
304 /* Blocking includes an implicit local_irq_enable(). */
305 if (HYPERVISOR_sched_op(SCHEDOP_block, NULL) != 0)
306 BUG();
307}
308
309static void xen_halt(void)
310{
311 if (irqs_disabled())
312 HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL);
313 else
314 xen_safe_halt();
315}
316
317static void xen_leave_lazy(void) 228static void xen_leave_lazy(void)
318{ 229{
319 paravirt_leave_lazy(paravirt_get_lazy_mode()); 230 paravirt_leave_lazy(paravirt_get_lazy_mode());
@@ -1308,36 +1219,6 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
1308 }, 1219 },
1309}; 1220};
1310 1221
1311static void __init __xen_init_IRQ(void)
1312{
1313#ifdef CONFIG_X86_64
1314 int i;
1315
1316 /* Create identity vector->irq map */
1317 for(i = 0; i < NR_VECTORS; i++) {
1318 int cpu;
1319
1320 for_each_possible_cpu(cpu)
1321 per_cpu(vector_irq, cpu)[i] = i;
1322 }
1323#endif /* CONFIG_X86_64 */
1324
1325 xen_init_IRQ();
1326}
1327
1328static const struct pv_irq_ops xen_irq_ops __initdata = {
1329 .init_IRQ = __xen_init_IRQ,
1330 .save_fl = xen_save_fl,
1331 .restore_fl = xen_restore_fl,
1332 .irq_disable = xen_irq_disable,
1333 .irq_enable = xen_irq_enable,
1334 .safe_halt = xen_safe_halt,
1335 .halt = xen_halt,
1336#ifdef CONFIG_X86_64
1337 .adjust_exception_frame = xen_adjust_exception_frame,
1338#endif
1339};
1340
1341static const struct pv_apic_ops xen_apic_ops __initdata = { 1222static const struct pv_apic_ops xen_apic_ops __initdata = {
1342#ifdef CONFIG_X86_LOCAL_APIC 1223#ifdef CONFIG_X86_LOCAL_APIC
1343 .apic_write = xen_apic_write, 1224 .apic_write = xen_apic_write,
@@ -1740,10 +1621,11 @@ asmlinkage void __init xen_start_kernel(void)
1740 pv_init_ops = xen_init_ops; 1621 pv_init_ops = xen_init_ops;
1741 pv_time_ops = xen_time_ops; 1622 pv_time_ops = xen_time_ops;
1742 pv_cpu_ops = xen_cpu_ops; 1623 pv_cpu_ops = xen_cpu_ops;
1743 pv_irq_ops = xen_irq_ops;
1744 pv_apic_ops = xen_apic_ops; 1624 pv_apic_ops = xen_apic_ops;
1745 pv_mmu_ops = xen_mmu_ops; 1625 pv_mmu_ops = xen_mmu_ops;
1746 1626
1627 xen_init_irq_ops();
1628
1747 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { 1629 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
1748 pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; 1630 pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
1749 pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; 1631 pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit;