diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2008-05-19 09:13:43 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2008-05-27 18:11:10 -0400 |
commit | 85cbc503787d577c215f9540c57294e1ec799144 (patch) | |
tree | 040eabd9681d2691f777574283de9963aa8f2e05 | |
parent | 33b39e84209b0308b572dce017df7ee9b63f086c (diff) |
[IA64] pvops: add hooks, pv_irq_ops, to paravirtualized irq related operations.
introduce pv_irq_ops which adds hooks to paravirtualize irq related
operations.
On virtualized environment, interruption may be replaced by something
virtualization friendly. So the irq related operation also may need
paravirtualization.
This patch adds necessary hooks to paravirtualize irq related operations.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | arch/ia64/kernel/irq_ia64.c | 18 | ||||
-rw-r--r-- | arch/ia64/kernel/paravirt.c | 15 | ||||
-rw-r--r-- | include/asm-ia64/hw_irq.h | 23 | ||||
-rw-r--r-- | include/asm-ia64/paravirt.h | 48 |
4 files changed, 95 insertions, 9 deletions
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c index c48171bc7969..28d3d483db92 100644 --- a/arch/ia64/kernel/irq_ia64.c +++ b/arch/ia64/kernel/irq_ia64.c | |||
@@ -196,7 +196,7 @@ static void clear_irq_vector(int irq) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | int | 198 | int |
199 | assign_irq_vector (int irq) | 199 | ia64_native_assign_irq_vector (int irq) |
200 | { | 200 | { |
201 | unsigned long flags; | 201 | unsigned long flags; |
202 | int vector, cpu; | 202 | int vector, cpu; |
@@ -222,7 +222,7 @@ assign_irq_vector (int irq) | |||
222 | } | 222 | } |
223 | 223 | ||
224 | void | 224 | void |
225 | free_irq_vector (int vector) | 225 | ia64_native_free_irq_vector (int vector) |
226 | { | 226 | { |
227 | if (vector < IA64_FIRST_DEVICE_VECTOR || | 227 | if (vector < IA64_FIRST_DEVICE_VECTOR || |
228 | vector > IA64_LAST_DEVICE_VECTOR) | 228 | vector > IA64_LAST_DEVICE_VECTOR) |
@@ -622,7 +622,7 @@ static struct irqaction tlb_irqaction = { | |||
622 | #endif | 622 | #endif |
623 | 623 | ||
624 | void | 624 | void |
625 | register_percpu_irq (ia64_vector vec, struct irqaction *action) | 625 | ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action) |
626 | { | 626 | { |
627 | irq_desc_t *desc; | 627 | irq_desc_t *desc; |
628 | unsigned int irq; | 628 | unsigned int irq; |
@@ -637,13 +637,21 @@ register_percpu_irq (ia64_vector vec, struct irqaction *action) | |||
637 | } | 637 | } |
638 | 638 | ||
639 | void __init | 639 | void __init |
640 | init_IRQ (void) | 640 | ia64_native_register_ipi(void) |
641 | { | 641 | { |
642 | register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL); | ||
643 | #ifdef CONFIG_SMP | 642 | #ifdef CONFIG_SMP |
644 | register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction); | 643 | register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction); |
645 | register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction); | 644 | register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction); |
646 | register_percpu_irq(IA64_IPI_LOCAL_TLB_FLUSH, &tlb_irqaction); | 645 | register_percpu_irq(IA64_IPI_LOCAL_TLB_FLUSH, &tlb_irqaction); |
646 | #endif | ||
647 | } | ||
648 | |||
649 | void __init | ||
650 | init_IRQ (void) | ||
651 | { | ||
652 | ia64_register_ipi(); | ||
653 | register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL); | ||
654 | #ifdef CONFIG_SMP | ||
647 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG) | 655 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG) |
648 | if (vector_domain_type != VECTOR_DOMAIN_NONE) { | 656 | if (vector_domain_type != VECTOR_DOMAIN_NONE) { |
649 | BUG_ON(IA64_FIRST_DEVICE_VECTOR != IA64_IRQ_MOVE_VECTOR); | 657 | BUG_ON(IA64_FIRST_DEVICE_VECTOR != IA64_IRQ_MOVE_VECTOR); |
diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c index 65c211b2f985..ba5383be03cb 100644 --- a/arch/ia64/kernel/paravirt.c +++ b/arch/ia64/kernel/paravirt.c | |||
@@ -337,3 +337,18 @@ struct pv_iosapic_ops pv_iosapic_ops = { | |||
337 | .__read = ia64_native_iosapic_read, | 337 | .__read = ia64_native_iosapic_read, |
338 | .__write = ia64_native_iosapic_write, | 338 | .__write = ia64_native_iosapic_write, |
339 | }; | 339 | }; |
340 | |||
341 | /*************************************************************************** | ||
342 | * pv_irq_ops | ||
343 | * irq operations | ||
344 | */ | ||
345 | |||
346 | struct pv_irq_ops pv_irq_ops = { | ||
347 | .register_ipi = ia64_native_register_ipi, | ||
348 | |||
349 | .assign_irq_vector = ia64_native_assign_irq_vector, | ||
350 | .free_irq_vector = ia64_native_free_irq_vector, | ||
351 | .register_percpu_irq = ia64_native_register_percpu_irq, | ||
352 | |||
353 | .resend_irq = ia64_native_resend_irq, | ||
354 | }; | ||
diff --git a/include/asm-ia64/hw_irq.h b/include/asm-ia64/hw_irq.h index 76366dc9c1a0..5c99cbcb8a0d 100644 --- a/include/asm-ia64/hw_irq.h +++ b/include/asm-ia64/hw_irq.h | |||
@@ -15,7 +15,11 @@ | |||
15 | #include <asm/ptrace.h> | 15 | #include <asm/ptrace.h> |
16 | #include <asm/smp.h> | 16 | #include <asm/smp.h> |
17 | 17 | ||
18 | #ifndef CONFIG_PARAVIRT | ||
18 | typedef u8 ia64_vector; | 19 | typedef u8 ia64_vector; |
20 | #else | ||
21 | typedef u16 ia64_vector; | ||
22 | #endif | ||
19 | 23 | ||
20 | /* | 24 | /* |
21 | * 0 special | 25 | * 0 special |
@@ -104,13 +108,24 @@ DECLARE_PER_CPU(int[IA64_NUM_VECTORS], vector_irq); | |||
104 | 108 | ||
105 | extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ | 109 | extern struct hw_interrupt_type irq_type_ia64_lsapic; /* CPU-internal interrupt controller */ |
106 | 110 | ||
111 | #ifdef CONFIG_PARAVIRT_GUEST | ||
112 | #include <asm/paravirt.h> | ||
113 | #else | ||
114 | #define ia64_register_ipi ia64_native_register_ipi | ||
115 | #define assign_irq_vector ia64_native_assign_irq_vector | ||
116 | #define free_irq_vector ia64_native_free_irq_vector | ||
117 | #define register_percpu_irq ia64_native_register_percpu_irq | ||
118 | #define ia64_resend_irq ia64_native_resend_irq | ||
119 | #endif | ||
120 | |||
121 | extern void ia64_native_register_ipi(void); | ||
107 | extern int bind_irq_vector(int irq, int vector, cpumask_t domain); | 122 | extern int bind_irq_vector(int irq, int vector, cpumask_t domain); |
108 | extern int assign_irq_vector (int irq); /* allocate a free vector */ | 123 | extern int ia64_native_assign_irq_vector (int irq); /* allocate a free vector */ |
109 | extern void free_irq_vector (int vector); | 124 | extern void ia64_native_free_irq_vector (int vector); |
110 | extern int reserve_irq_vector (int vector); | 125 | extern int reserve_irq_vector (int vector); |
111 | extern void __setup_vector_irq(int cpu); | 126 | extern void __setup_vector_irq(int cpu); |
112 | extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); | 127 | extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect); |
113 | extern void register_percpu_irq (ia64_vector vec, struct irqaction *action); | 128 | extern void ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action); |
114 | extern int check_irq_used (int irq); | 129 | extern int check_irq_used (int irq); |
115 | extern void destroy_and_reserve_irq (unsigned int irq); | 130 | extern void destroy_and_reserve_irq (unsigned int irq); |
116 | 131 | ||
@@ -122,7 +137,7 @@ static inline int irq_prepare_move(int irq, int cpu) { return 0; } | |||
122 | static inline void irq_complete_move(unsigned int irq) {} | 137 | static inline void irq_complete_move(unsigned int irq) {} |
123 | #endif | 138 | #endif |
124 | 139 | ||
125 | static inline void ia64_resend_irq(unsigned int vector) | 140 | static inline void ia64_native_resend_irq(unsigned int vector) |
126 | { | 141 | { |
127 | platform_send_ipi(smp_processor_id(), vector, IA64_IPI_DM_INT, 0); | 142 | platform_send_ipi(smp_processor_id(), vector, IA64_IPI_DM_INT, 0); |
128 | } | 143 | } |
diff --git a/include/asm-ia64/paravirt.h b/include/asm-ia64/paravirt.h index 3a40f624e86e..ee15646b6d66 100644 --- a/include/asm-ia64/paravirt.h +++ b/include/asm-ia64/paravirt.h | |||
@@ -152,6 +152,54 @@ __iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val) | |||
152 | return pv_iosapic_ops.__write(iosapic, reg, val); | 152 | return pv_iosapic_ops.__write(iosapic, reg, val); |
153 | } | 153 | } |
154 | 154 | ||
155 | /****************************************************************************** | ||
156 | * replacement of irq operations. | ||
157 | */ | ||
158 | |||
159 | struct pv_irq_ops { | ||
160 | void (*register_ipi)(void); | ||
161 | |||
162 | int (*assign_irq_vector)(int irq); | ||
163 | void (*free_irq_vector)(int vector); | ||
164 | |||
165 | void (*register_percpu_irq)(ia64_vector vec, | ||
166 | struct irqaction *action); | ||
167 | |||
168 | void (*resend_irq)(unsigned int vector); | ||
169 | }; | ||
170 | |||
171 | extern struct pv_irq_ops pv_irq_ops; | ||
172 | |||
173 | static inline void | ||
174 | ia64_register_ipi(void) | ||
175 | { | ||
176 | pv_irq_ops.register_ipi(); | ||
177 | } | ||
178 | |||
179 | static inline int | ||
180 | assign_irq_vector(int irq) | ||
181 | { | ||
182 | return pv_irq_ops.assign_irq_vector(irq); | ||
183 | } | ||
184 | |||
185 | static inline void | ||
186 | free_irq_vector(int vector) | ||
187 | { | ||
188 | return pv_irq_ops.free_irq_vector(vector); | ||
189 | } | ||
190 | |||
191 | static inline void | ||
192 | register_percpu_irq(ia64_vector vec, struct irqaction *action) | ||
193 | { | ||
194 | pv_irq_ops.register_percpu_irq(vec, action); | ||
195 | } | ||
196 | |||
197 | static inline void | ||
198 | ia64_resend_irq(unsigned int vector) | ||
199 | { | ||
200 | pv_irq_ops.resend_irq(vector); | ||
201 | } | ||
202 | |||
155 | #endif /* !__ASSEMBLY__ */ | 203 | #endif /* !__ASSEMBLY__ */ |
156 | 204 | ||
157 | #else | 205 | #else |