diff options
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/events.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index e0767ff35d6c..ed7527b3745a 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -75,7 +75,14 @@ enum { | |||
75 | static int evtchn_to_irq[NR_EVENT_CHANNELS] = { | 75 | static int evtchn_to_irq[NR_EVENT_CHANNELS] = { |
76 | [0 ... NR_EVENT_CHANNELS-1] = -1 | 76 | [0 ... NR_EVENT_CHANNELS-1] = -1 |
77 | }; | 77 | }; |
78 | static unsigned long cpu_evtchn_mask[NR_CPUS][NR_EVENT_CHANNELS/BITS_PER_LONG]; | 78 | struct cpu_evtchn_s { |
79 | unsigned long bits[NR_EVENT_CHANNELS/BITS_PER_LONG]; | ||
80 | }; | ||
81 | static struct cpu_evtchn_s *cpu_evtchn_mask_p; | ||
82 | static inline unsigned long *cpu_evtchn_mask(int cpu) | ||
83 | { | ||
84 | return cpu_evtchn_mask_p[cpu].bits; | ||
85 | } | ||
79 | static u8 cpu_evtchn[NR_EVENT_CHANNELS]; | 86 | static u8 cpu_evtchn[NR_EVENT_CHANNELS]; |
80 | 87 | ||
81 | /* Reference counts for bindings to IRQs. */ | 88 | /* Reference counts for bindings to IRQs. */ |
@@ -115,7 +122,7 @@ static inline unsigned long active_evtchns(unsigned int cpu, | |||
115 | unsigned int idx) | 122 | unsigned int idx) |
116 | { | 123 | { |
117 | return (sh->evtchn_pending[idx] & | 124 | return (sh->evtchn_pending[idx] & |
118 | cpu_evtchn_mask[cpu][idx] & | 125 | cpu_evtchn_mask(cpu)[idx] & |
119 | ~sh->evtchn_mask[idx]); | 126 | ~sh->evtchn_mask[idx]); |
120 | } | 127 | } |
121 | 128 | ||
@@ -128,8 +135,8 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) | |||
128 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); | 135 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); |
129 | #endif | 136 | #endif |
130 | 137 | ||
131 | __clear_bit(chn, cpu_evtchn_mask[cpu_evtchn[chn]]); | 138 | __clear_bit(chn, cpu_evtchn_mask(cpu_evtchn[chn])); |
132 | __set_bit(chn, cpu_evtchn_mask[cpu]); | 139 | __set_bit(chn, cpu_evtchn_mask(cpu)); |
133 | 140 | ||
134 | cpu_evtchn[chn] = cpu; | 141 | cpu_evtchn[chn] = cpu; |
135 | } | 142 | } |
@@ -147,7 +154,7 @@ static void init_evtchn_cpu_bindings(void) | |||
147 | #endif | 154 | #endif |
148 | 155 | ||
149 | memset(cpu_evtchn, 0, sizeof(cpu_evtchn)); | 156 | memset(cpu_evtchn, 0, sizeof(cpu_evtchn)); |
150 | memset(cpu_evtchn_mask[0], ~0, sizeof(cpu_evtchn_mask[0])); | 157 | memset(cpu_evtchn_mask(0), ~0, sizeof(cpu_evtchn_mask(0))); |
151 | } | 158 | } |
152 | 159 | ||
153 | static inline unsigned int cpu_from_evtchn(unsigned int evtchn) | 160 | static inline unsigned int cpu_from_evtchn(unsigned int evtchn) |
@@ -822,6 +829,10 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { | |||
822 | void __init xen_init_IRQ(void) | 829 | void __init xen_init_IRQ(void) |
823 | { | 830 | { |
824 | int i; | 831 | int i; |
832 | size_t size = nr_cpu_ids * sizeof(struct cpu_evtchn_s); | ||
833 | |||
834 | cpu_evtchn_mask_p = kmalloc(size, GFP_KERNEL); | ||
835 | BUG_ON(cpu_evtchn_mask == NULL); | ||
825 | 836 | ||
826 | init_evtchn_cpu_bindings(); | 837 | init_evtchn_cpu_bindings(); |
827 | 838 | ||