ia64/xen-unstable

view xen/include/xen/sched-if.h @ 19800:78962f85c562

IOMMU: Add two generic functions to vendor neutral interface

Add 2 generic functions into the vendor neutral iommu interface, The
reason is that from changeset 19732, there is only one global flag
"iommu_enabled" that controls iommu enablement for both vtd and amd
systems, so we need different code paths for vtd and amd iommu systems
if this flag has been turned on. Also, the early checking of
"iommu_enabled" in iommu_setup() is removed to prevent iommu
functionalities from been disabled on amd systems.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 19 08:41:50 2009 +0100 (2009-06-19)
parents f6a2bf60d49c
children
line source
1 /******************************************************************************
2 * Additional declarations for the generic scheduler interface. This should
3 * only be included by files that implement conforming schedulers.
4 *
5 * Portions by Mark Williamson are (C) 2004 Intel Research Cambridge
6 */
8 #ifndef __XEN_SCHED_IF_H__
9 #define __XEN_SCHED_IF_H__
11 #include <xen/percpu.h>
13 struct schedule_data {
14 spinlock_t schedule_lock; /* spinlock protecting curr */
15 struct vcpu *curr; /* current task */
16 struct vcpu *idle; /* idle task for this cpu */
17 void *sched_priv;
18 struct timer s_timer; /* scheduling timer */
19 } __cacheline_aligned;
21 DECLARE_PER_CPU(struct schedule_data, schedule_data);
23 static inline void vcpu_schedule_lock(struct vcpu *v)
24 {
25 unsigned int cpu;
27 for ( ; ; )
28 {
29 cpu = v->processor;
30 spin_lock(&per_cpu(schedule_data, cpu).schedule_lock);
31 if ( likely(v->processor == cpu) )
32 break;
33 spin_unlock(&per_cpu(schedule_data, cpu).schedule_lock);
34 }
35 }
37 #define vcpu_schedule_lock_irq(v) \
38 do { local_irq_disable(); vcpu_schedule_lock(v); } while ( 0 )
39 #define vcpu_schedule_lock_irqsave(v, flags) \
40 do { local_irq_save(flags); vcpu_schedule_lock(v); } while ( 0 )
42 static inline void vcpu_schedule_unlock(struct vcpu *v)
43 {
44 spin_unlock(&per_cpu(schedule_data, v->processor).schedule_lock);
45 }
47 #define vcpu_schedule_unlock_irq(v) \
48 do { vcpu_schedule_unlock(v); local_irq_enable(); } while ( 0 )
49 #define vcpu_schedule_unlock_irqrestore(v, flags) \
50 do { vcpu_schedule_unlock(v); local_irq_restore(flags); } while ( 0 )
52 struct task_slice {
53 struct vcpu *task;
54 s_time_t time;
55 };
57 struct scheduler {
58 char *name; /* full name for this scheduler */
59 char *opt_name; /* option name for this scheduler */
60 unsigned int sched_id; /* ID for this scheduler */
62 void (*init) (void);
64 int (*init_domain) (struct domain *);
65 void (*destroy_domain) (struct domain *);
67 int (*init_vcpu) (struct vcpu *);
68 void (*destroy_vcpu) (struct vcpu *);
70 void (*sleep) (struct vcpu *);
71 void (*wake) (struct vcpu *);
73 struct task_slice (*do_schedule) (s_time_t);
75 int (*pick_cpu) (struct vcpu *);
76 int (*adjust) (struct domain *,
77 struct xen_domctl_scheduler_op *);
78 void (*dump_settings) (void);
79 void (*dump_cpu_state) (int);
81 void (*tick_suspend) (void);
82 void (*tick_resume) (void);
83 };
85 #endif /* __XEN_SCHED_IF_H__ */