13 #include <linux/types.h>
14 #include <linux/kernel.h>
19 #include <linux/slab.h>
26 #include <asm/machdep.h>
30 #include "../../../kernel/irq/settings.h"
32 static struct ehv_pic *global_ehv_pic;
38 #define IRQ_TYPE_MPIC_DIRECT 4
39 #define MPIC_EOI 0x00B0
49 ev_int_set_mask(src, 0);
56 ev_int_set_mask(src, 1);
80 ev_int_get_config(src, &config, &prio, &cpu_dest);
81 ev_int_set_config(src, config, prio, cpuid);
82 spin_unlock_irqrestore(&ehv_pic_lock, flags);
87 static unsigned int ehv_pic_type_to_vecpri(
unsigned int type)
116 unsigned int vecpri, vold, vnew,
prio, cpu_dest;
122 irq_settings_clr_level(desc);
123 irq_settings_set_trigger_mask(desc, flow_type);
125 irq_settings_set_level(desc);
127 vecpri = ehv_pic_type_to_vecpri(flow_type);
130 ev_int_get_config(src, &vold, &prio, &cpu_dest);
143 ev_int_set_config(src, vecpri, prio, cpu_dest);
145 spin_unlock_irqrestore(&ehv_pic_lock, flags);
149 static struct irq_chip ehv_pic_irq_chip = {
156 static struct irq_chip ehv_pic_direct_eoi_irq_chip = {
171 irq =
mfspr(SPRN_EPR);
173 ev_int_iack(0, &irq);
191 static int ehv_pic_host_map(
struct irq_domain *
h,
unsigned int virq,
200 if (mpic_percpu_base_vaddr)
202 chip = &ehv_pic_direct_eoi_irq_chip;
221 const u32 *intspec,
unsigned int intsize,
232 static unsigned char map_of_senses_to_linux_irqtype[4] = {
239 *out_hwirq = intspec[0];
241 hwirq_intspec[intspec[0]] = intspec[1];
242 *out_flags = map_of_senses_to_linux_irqtype[intspec[1] &
252 .match = ehv_pic_host_match,
253 .map = ehv_pic_host_map,
254 .xlate = ehv_pic_host_xlate,
260 struct ehv_pic *ehv_pic;
265 pr_err(
"ehv_pic_init: could not find epapr,hv-pic node\n");
272 ehv_pic = kzalloc(
sizeof(
struct ehv_pic),
GFP_KERNEL);
279 &ehv_pic_host_ops, ehv_pic);
288 mpic_percpu_base_vaddr =
of_iomap(np2, 0);
289 if (!mpic_percpu_base_vaddr)
290 pr_err(
"ehv_pic_init: of_iomap failed\n");
295 ehv_pic->
hc_irq = ehv_pic_irq_chip;
299 global_ehv_pic = ehv_pic;