ia64/xen-unstable

view xen/include/xen/irq.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 6705898f768d
children
line source
1 #ifndef __XEN_IRQ_H__
2 #define __XEN_IRQ_H__
4 #include <xen/config.h>
5 #include <xen/cpumask.h>
6 #include <xen/spinlock.h>
7 #include <asm/regs.h>
8 #include <asm/hardirq.h>
10 struct irqaction
11 {
12 void (*handler)(int, void *, struct cpu_user_regs *);
13 const char *name;
14 void *dev_id;
15 };
17 /*
18 * IRQ line status.
19 */
20 #define IRQ_INPROGRESS 1 /* IRQ handler active - do not enter! */
21 #define IRQ_DISABLED 2 /* IRQ disabled - do not enter! */
22 #define IRQ_PENDING 4 /* IRQ pending - replay on enable */
23 #define IRQ_REPLAY 8 /* IRQ has been replayed but not acked yet */
24 #define IRQ_GUEST 16 /* IRQ is handled by guest OS(es) */
25 #define IRQ_GUEST_EOI_PENDING 32 /* IRQ was disabled, pending a guest EOI */
26 #define IRQ_PER_CPU 256 /* IRQ is per CPU */
28 /* Special IRQ numbers. */
29 #define AUTO_ASSIGN_IRQ (-1)
30 #define NEVER_ASSIGN_IRQ (-2)
31 #define FREE_TO_ASSIGN_IRQ (-3)
33 /*
34 * Interrupt controller descriptor. This is all we need
35 * to describe about the low-level hardware.
36 */
37 struct hw_interrupt_type {
38 const char *typename;
39 unsigned int (*startup)(unsigned int irq);
40 void (*shutdown)(unsigned int irq);
41 void (*enable)(unsigned int irq);
42 void (*disable)(unsigned int irq);
43 void (*ack)(unsigned int irq);
44 void (*end)(unsigned int irq);
45 void (*set_affinity)(unsigned int irq, cpumask_t mask);
46 };
48 typedef struct hw_interrupt_type hw_irq_controller;
50 #include <asm/irq.h>
52 #ifdef NR_IRQS
53 # define nr_irqs NR_IRQS
54 #else
55 extern unsigned int nr_irqs;
56 #endif
58 struct msi_desc;
59 /*
60 * This is the "IRQ descriptor", which contains various information
61 * about the irq, including what kind of hardware handling it has,
62 * whether it is disabled etc etc.
63 *
64 * Pad this out to 32 bytes for cache and indexing reasons.
65 */
66 typedef struct {
67 unsigned int status; /* IRQ status */
68 hw_irq_controller *handler;
69 struct msi_desc *msi_desc;
70 struct irqaction *action; /* IRQ action list */
71 unsigned int depth; /* nested irq disables */
72 spinlock_t lock;
73 cpumask_t affinity;
74 } __cacheline_aligned irq_desc_t;
76 extern irq_desc_t irq_desc[NR_VECTORS];
78 extern int setup_irq_vector(unsigned int, struct irqaction *);
79 extern void release_irq_vector(unsigned int);
80 extern int request_irq_vector(unsigned int vector,
81 void (*handler)(int, void *, struct cpu_user_regs *),
82 unsigned long irqflags, const char * devname, void *dev_id);
84 #define setup_irq(irq, action) \
85 setup_irq_vector(irq_to_vector(irq), action)
87 #define release_irq(irq) \
88 release_irq_vector(irq_to_vector(irq))
90 #define request_irq(irq, handler, irqflags, devname, devid) \
91 request_irq_vector(irq_to_vector(irq), handler, irqflags, devname, devid)
93 extern hw_irq_controller no_irq_type;
94 extern void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs);
96 struct domain;
97 struct vcpu;
98 extern int pirq_guest_eoi(struct domain *d, int irq);
99 extern int pirq_guest_unmask(struct domain *d);
100 extern int pirq_guest_bind(struct vcpu *v, int irq, int will_share);
101 extern void pirq_guest_unbind(struct domain *d, int irq);
102 extern irq_desc_t *domain_spin_lock_irq_desc(
103 struct domain *d, int irq, unsigned long *pflags);
105 static inline void set_native_irq_info(unsigned int vector, cpumask_t mask)
106 {
107 irq_desc[vector].affinity = mask;
108 }
110 #ifdef irq_to_vector
111 static inline void set_irq_info(int irq, cpumask_t mask)
112 {
113 set_native_irq_info(irq_to_vector(irq), mask);
114 }
115 #endif
117 #endif /* __XEN_IRQ_H__ */