irq_ia64.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. /*
  2. * linux/arch/ia64/kernel/irq_ia64.c
  3. *
  4. * Copyright (C) 1998-2001 Hewlett-Packard Co
  5. * Stephane Eranian <eranian@hpl.hp.com>
  6. * David Mosberger-Tang <davidm@hpl.hp.com>
  7. *
  8. * 6/10/99: Updated to bring in sync with x86 version to facilitate
  9. * support for SMP and different interrupt controllers.
  10. *
  11. * 09/15/00 Goutham Rao <goutham.rao@intel.com> Implemented pci_irq_to_vector
  12. * PCI to vector allocation routine.
  13. * 04/14/2004 Ashok Raj <ashok.raj@intel.com>
  14. * Added CPU Hotplug handling for IPF.
  15. */
  16. #include <linux/module.h>
  17. #include <linux/jiffies.h>
  18. #include <linux/errno.h>
  19. #include <linux/init.h>
  20. #include <linux/interrupt.h>
  21. #include <linux/ioport.h>
  22. #include <linux/kernel_stat.h>
  23. #include <linux/ptrace.h>
  24. #include <linux/random.h> /* for rand_initialize_irq() */
  25. #include <linux/signal.h>
  26. #include <linux/smp.h>
  27. #include <linux/threads.h>
  28. #include <linux/bitops.h>
  29. #include <linux/irq.h>
  30. #include <linux/ratelimit.h>
  31. #include <linux/acpi.h>
  32. #include <linux/sched.h>
  33. #include <asm/delay.h>
  34. #include <asm/intrinsics.h>
  35. #include <asm/io.h>
  36. #include <asm/hw_irq.h>
  37. #include <asm/machvec.h>
  38. #include <asm/pgtable.h>
  39. #include <asm/tlbflush.h>
  40. #ifdef CONFIG_PERFMON
  41. # include <asm/perfmon.h>
  42. #endif
  43. #define IRQ_DEBUG 0
  44. #define IRQ_VECTOR_UNASSIGNED (0)
  45. #define IRQ_UNUSED (0)
  46. #define IRQ_USED (1)
  47. #define IRQ_RSVD (2)
  48. /* These can be overridden in platform_irq_init */
  49. int ia64_first_device_vector = IA64_DEF_FIRST_DEVICE_VECTOR;
  50. int ia64_last_device_vector = IA64_DEF_LAST_DEVICE_VECTOR;
  51. /* default base addr of IPI table */
  52. void __iomem *ipi_base_addr = ((void __iomem *)
  53. (__IA64_UNCACHED_OFFSET | IA64_IPI_DEFAULT_BASE_ADDR));
  54. static cpumask_t vector_allocation_domain(int cpu);
  55. /*
  56. * Legacy IRQ to IA-64 vector translation table.
  57. */
  58. __u8 isa_irq_to_vector_map[16] = {
  59. /* 8259 IRQ translation, first 16 entries */
  60. 0x2f, 0x20, 0x2e, 0x2d, 0x2c, 0x2b, 0x2a, 0x29,
  61. 0x28, 0x27, 0x26, 0x25, 0x24, 0x23, 0x22, 0x21
  62. };
  63. EXPORT_SYMBOL(isa_irq_to_vector_map);
  64. DEFINE_SPINLOCK(vector_lock);
  65. struct irq_cfg irq_cfg[NR_IRQS] __read_mostly = {
  66. [0 ... NR_IRQS - 1] = {
  67. .vector = IRQ_VECTOR_UNASSIGNED,
  68. .domain = CPU_MASK_NONE
  69. }
  70. };
  71. DEFINE_PER_CPU(int[IA64_NUM_VECTORS], vector_irq) = {
  72. [0 ... IA64_NUM_VECTORS - 1] = -1
  73. };
  74. static cpumask_t vector_table[IA64_NUM_VECTORS] = {
  75. [0 ... IA64_NUM_VECTORS - 1] = CPU_MASK_NONE
  76. };
  77. static int irq_status[NR_IRQS] = {
  78. [0 ... NR_IRQS -1] = IRQ_UNUSED
  79. };
  80. int check_irq_used(int irq)
  81. {
  82. if (irq_status[irq] == IRQ_USED)
  83. return 1;
  84. return -1;
  85. }
  86. static inline int find_unassigned_irq(void)
  87. {
  88. int irq;
  89. for (irq = IA64_FIRST_DEVICE_VECTOR; irq < NR_IRQS; irq++)
  90. if (irq_status[irq] == IRQ_UNUSED)
  91. return irq;
  92. return -ENOSPC;
  93. }
  94. static inline int find_unassigned_vector(cpumask_t domain)
  95. {
  96. cpumask_t mask;
  97. int pos, vector;
  98. cpumask_and(&mask, &domain, cpu_online_mask);
  99. if (cpus_empty(mask))
  100. return -EINVAL;
  101. for (pos = 0; pos < IA64_NUM_DEVICE_VECTORS; pos++) {
  102. vector = IA64_FIRST_DEVICE_VECTOR + pos;
  103. cpus_and(mask, domain, vector_table[vector]);
  104. if (!cpus_empty(mask))
  105. continue;
  106. return vector;
  107. }
  108. return -ENOSPC;
  109. }
  110. static int __bind_irq_vector(int irq, int vector, cpumask_t domain)
  111. {
  112. cpumask_t mask;
  113. int cpu;
  114. struct irq_cfg *cfg = &irq_cfg[irq];
  115. BUG_ON((unsigned)irq >= NR_IRQS);
  116. BUG_ON((unsigned)vector >= IA64_NUM_VECTORS);
  117. cpumask_and(&mask, &domain, cpu_online_mask);
  118. if (cpus_empty(mask))
  119. return -EINVAL;
  120. if ((cfg->vector == vector) && cpus_equal(cfg->domain, domain))
  121. return 0;
  122. if (cfg->vector != IRQ_VECTOR_UNASSIGNED)
  123. return -EBUSY;
  124. for_each_cpu_mask(cpu, mask)
  125. per_cpu(vector_irq, cpu)[vector] = irq;
  126. cfg->vector = vector;
  127. cfg->domain = domain;
  128. irq_status[irq] = IRQ_USED;
  129. cpus_or(vector_table[vector], vector_table[vector], domain);
  130. return 0;
  131. }
  132. int bind_irq_vector(int irq, int vector, cpumask_t domain)
  133. {
  134. unsigned long flags;
  135. int ret;
  136. spin_lock_irqsave(&vector_lock, flags);
  137. ret = __bind_irq_vector(irq, vector, domain);
  138. spin_unlock_irqrestore(&vector_lock, flags);
  139. return ret;
  140. }
  141. static void __clear_irq_vector(int irq)
  142. {
  143. int vector, cpu;
  144. cpumask_t mask;
  145. cpumask_t domain;
  146. struct irq_cfg *cfg = &irq_cfg[irq];
  147. BUG_ON((unsigned)irq >= NR_IRQS);
  148. BUG_ON(cfg->vector == IRQ_VECTOR_UNASSIGNED);
  149. vector = cfg->vector;
  150. domain = cfg->domain;
  151. cpumask_and(&mask, &cfg->domain, cpu_online_mask);
  152. for_each_cpu_mask(cpu, mask)
  153. per_cpu(vector_irq, cpu)[vector] = -1;
  154. cfg->vector = IRQ_VECTOR_UNASSIGNED;
  155. cfg->domain = CPU_MASK_NONE;
  156. irq_status[irq] = IRQ_UNUSED;
  157. cpus_andnot(vector_table[vector], vector_table[vector], domain);
  158. }
  159. static void clear_irq_vector(int irq)
  160. {
  161. unsigned long flags;
  162. spin_lock_irqsave(&vector_lock, flags);
  163. __clear_irq_vector(irq);
  164. spin_unlock_irqrestore(&vector_lock, flags);
  165. }
  166. int
  167. ia64_native_assign_irq_vector (int irq)
  168. {
  169. unsigned long flags;
  170. int vector, cpu;
  171. cpumask_t domain = CPU_MASK_NONE;
  172. vector = -ENOSPC;
  173. spin_lock_irqsave(&vector_lock, flags);
  174. for_each_online_cpu(cpu) {
  175. domain = vector_allocation_domain(cpu);
  176. vector = find_unassigned_vector(domain);
  177. if (vector >= 0)
  178. break;
  179. }
  180. if (vector < 0)
  181. goto out;
  182. if (irq == AUTO_ASSIGN)
  183. irq = vector;
  184. BUG_ON(__bind_irq_vector(irq, vector, domain));
  185. out:
  186. spin_unlock_irqrestore(&vector_lock, flags);
  187. return vector;
  188. }
  189. void
  190. ia64_native_free_irq_vector (int vector)
  191. {
  192. if (vector < IA64_FIRST_DEVICE_VECTOR ||
  193. vector > IA64_LAST_DEVICE_VECTOR)
  194. return;
  195. clear_irq_vector(vector);
  196. }
  197. int
  198. reserve_irq_vector (int vector)
  199. {
  200. if (vector < IA64_FIRST_DEVICE_VECTOR ||
  201. vector > IA64_LAST_DEVICE_VECTOR)
  202. return -EINVAL;
  203. return !!bind_irq_vector(vector, vector, CPU_MASK_ALL);
  204. }
  205. /*
  206. * Initialize vector_irq on a new cpu. This function must be called
  207. * with vector_lock held.
  208. */
  209. void __setup_vector_irq(int cpu)
  210. {
  211. int irq, vector;
  212. /* Clear vector_irq */
  213. for (vector = 0; vector < IA64_NUM_VECTORS; ++vector)
  214. per_cpu(vector_irq, cpu)[vector] = -1;
  215. /* Mark the inuse vectors */
  216. for (irq = 0; irq < NR_IRQS; ++irq) {
  217. if (!cpu_isset(cpu, irq_cfg[irq].domain))
  218. continue;
  219. vector = irq_to_vector(irq);
  220. per_cpu(vector_irq, cpu)[vector] = irq;
  221. }
  222. }
  223. #if defined(CONFIG_SMP) && (defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG))
  224. static enum vector_domain_type {
  225. VECTOR_DOMAIN_NONE,
  226. VECTOR_DOMAIN_PERCPU
  227. } vector_domain_type = VECTOR_DOMAIN_NONE;
  228. static cpumask_t vector_allocation_domain(int cpu)
  229. {
  230. if (vector_domain_type == VECTOR_DOMAIN_PERCPU)
  231. return cpumask_of_cpu(cpu);
  232. return CPU_MASK_ALL;
  233. }
  234. static int __irq_prepare_move(int irq, int cpu)
  235. {
  236. struct irq_cfg *cfg = &irq_cfg[irq];
  237. int vector;
  238. cpumask_t domain;
  239. if (cfg->move_in_progress || cfg->move_cleanup_count)
  240. return -EBUSY;
  241. if (cfg->vector == IRQ_VECTOR_UNASSIGNED || !cpu_online(cpu))
  242. return -EINVAL;
  243. if (cpu_isset(cpu, cfg->domain))
  244. return 0;
  245. domain = vector_allocation_domain(cpu);
  246. vector = find_unassigned_vector(domain);
  247. if (vector < 0)
  248. return -ENOSPC;
  249. cfg->move_in_progress = 1;
  250. cfg->old_domain = cfg->domain;
  251. cfg->vector = IRQ_VECTOR_UNASSIGNED;
  252. cfg->domain = CPU_MASK_NONE;
  253. BUG_ON(__bind_irq_vector(irq, vector, domain));
  254. return 0;
  255. }
  256. int irq_prepare_move(int irq, int cpu)
  257. {
  258. unsigned long flags;
  259. int ret;
  260. spin_lock_irqsave(&vector_lock, flags);
  261. ret = __irq_prepare_move(irq, cpu);
  262. spin_unlock_irqrestore(&vector_lock, flags);
  263. return ret;
  264. }
  265. void irq_complete_move(unsigned irq)
  266. {
  267. struct irq_cfg *cfg = &irq_cfg[irq];
  268. cpumask_t cleanup_mask;
  269. int i;
  270. if (likely(!cfg->move_in_progress))
  271. return;
  272. if (unlikely(cpu_isset(smp_processor_id(), cfg->old_domain)))
  273. return;
  274. cpumask_and(&cleanup_mask, &cfg->old_domain, cpu_online_mask);
  275. cfg->move_cleanup_count = cpus_weight(cleanup_mask);
  276. for_each_cpu_mask(i, cleanup_mask)
  277. platform_send_ipi(i, IA64_IRQ_MOVE_VECTOR, IA64_IPI_DM_INT, 0);
  278. cfg->move_in_progress = 0;
  279. }
  280. static irqreturn_t smp_irq_move_cleanup_interrupt(int irq, void *dev_id)
  281. {
  282. int me = smp_processor_id();
  283. ia64_vector vector;
  284. unsigned long flags;
  285. for (vector = IA64_FIRST_DEVICE_VECTOR;
  286. vector < IA64_LAST_DEVICE_VECTOR; vector++) {
  287. int irq;
  288. struct irq_desc *desc;
  289. struct irq_cfg *cfg;
  290. irq = __get_cpu_var(vector_irq)[vector];
  291. if (irq < 0)
  292. continue;
  293. desc = irq_to_desc(irq);
  294. cfg = irq_cfg + irq;
  295. raw_spin_lock(&desc->lock);
  296. if (!cfg->move_cleanup_count)
  297. goto unlock;
  298. if (!cpu_isset(me, cfg->old_domain))
  299. goto unlock;
  300. spin_lock_irqsave(&vector_lock, flags);
  301. __get_cpu_var(vector_irq)[vector] = -1;
  302. cpu_clear(me, vector_table[vector]);
  303. spin_unlock_irqrestore(&vector_lock, flags);
  304. cfg->move_cleanup_count--;
  305. unlock:
  306. raw_spin_unlock(&desc->lock);
  307. }
  308. return IRQ_HANDLED;
  309. }
  310. static struct irqaction irq_move_irqaction = {
  311. .handler = smp_irq_move_cleanup_interrupt,
  312. .flags = IRQF_DISABLED,
  313. .name = "irq_move"
  314. };
  315. static int __init parse_vector_domain(char *arg)
  316. {
  317. if (!arg)
  318. return -EINVAL;
  319. if (!strcmp(arg, "percpu")) {
  320. vector_domain_type = VECTOR_DOMAIN_PERCPU;
  321. no_int_routing = 1;
  322. }
  323. return 0;
  324. }
  325. early_param("vector", parse_vector_domain);
  326. #else
  327. static cpumask_t vector_allocation_domain(int cpu)
  328. {
  329. return CPU_MASK_ALL;
  330. }
  331. #endif
  332. void destroy_and_reserve_irq(unsigned int irq)
  333. {
  334. unsigned long flags;
  335. dynamic_irq_cleanup(irq);
  336. spin_lock_irqsave(&vector_lock, flags);
  337. __clear_irq_vector(irq);
  338. irq_status[irq] = IRQ_RSVD;
  339. spin_unlock_irqrestore(&vector_lock, flags);
  340. }
  341. /*
  342. * Dynamic irq allocate and deallocation for MSI
  343. */
  344. int create_irq(void)
  345. {
  346. unsigned long flags;
  347. int irq, vector, cpu;
  348. cpumask_t domain = CPU_MASK_NONE;
  349. irq = vector = -ENOSPC;
  350. spin_lock_irqsave(&vector_lock, flags);
  351. for_each_online_cpu(cpu) {
  352. domain = vector_allocation_domain(cpu);
  353. vector = find_unassigned_vector(domain);
  354. if (vector >= 0)
  355. break;
  356. }
  357. if (vector < 0)
  358. goto out;
  359. irq = find_unassigned_irq();
  360. if (irq < 0)
  361. goto out;
  362. BUG_ON(__bind_irq_vector(irq, vector, domain));
  363. out:
  364. spin_unlock_irqrestore(&vector_lock, flags);
  365. if (irq >= 0)
  366. dynamic_irq_init(irq);
  367. return irq;
  368. }
  369. void destroy_irq(unsigned int irq)
  370. {
  371. dynamic_irq_cleanup(irq);
  372. clear_irq_vector(irq);
  373. }
  374. #ifdef CONFIG_SMP
  375. # define IS_RESCHEDULE(vec) (vec == IA64_IPI_RESCHEDULE)
  376. # define IS_LOCAL_TLB_FLUSH(vec) (vec == IA64_IPI_LOCAL_TLB_FLUSH)
  377. #else
  378. # define IS_RESCHEDULE(vec) (0)
  379. # define IS_LOCAL_TLB_FLUSH(vec) (0)
  380. #endif
  381. /*
  382. * That's where the IVT branches when we get an external
  383. * interrupt. This branches to the correct hardware IRQ handler via
  384. * function ptr.
  385. */
  386. void
  387. ia64_handle_irq (ia64_vector vector, struct pt_regs *regs)
  388. {
  389. struct pt_regs *old_regs = set_irq_regs(regs);
  390. unsigned long saved_tpr;
  391. #if IRQ_DEBUG
  392. {
  393. unsigned long bsp, sp;
  394. /*
  395. * Note: if the interrupt happened while executing in
  396. * the context switch routine (ia64_switch_to), we may
  397. * get a spurious stack overflow here. This is
  398. * because the register and the memory stack are not
  399. * switched atomically.
  400. */
  401. bsp = ia64_getreg(_IA64_REG_AR_BSP);
  402. sp = ia64_getreg(_IA64_REG_SP);
  403. if ((sp - bsp) < 1024) {
  404. static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
  405. if (__ratelimit(&ratelimit)) {
  406. printk("ia64_handle_irq: DANGER: less than "
  407. "1KB of free stack space!!\n"
  408. "(bsp=0x%lx, sp=%lx)\n", bsp, sp);
  409. }
  410. }
  411. }
  412. #endif /* IRQ_DEBUG */
  413. /*
  414. * Always set TPR to limit maximum interrupt nesting depth to
  415. * 16 (without this, it would be ~240, which could easily lead
  416. * to kernel stack overflows).
  417. */
  418. irq_enter();
  419. saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
  420. ia64_srlz_d();
  421. while (vector != IA64_SPURIOUS_INT_VECTOR) {
  422. int irq = local_vector_to_irq(vector);
  423. struct irq_desc *desc = irq_to_desc(irq);
  424. if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
  425. smp_local_flush_tlb();
  426. kstat_incr_irqs_this_cpu(irq, desc);
  427. } else if (unlikely(IS_RESCHEDULE(vector))) {
  428. scheduler_ipi();
  429. kstat_incr_irqs_this_cpu(irq, desc);
  430. } else {
  431. ia64_setreg(_IA64_REG_CR_TPR, vector);
  432. ia64_srlz_d();
  433. if (unlikely(irq < 0)) {
  434. printk(KERN_ERR "%s: Unexpected interrupt "
  435. "vector %d on CPU %d is not mapped "
  436. "to any IRQ!\n", __func__, vector,
  437. smp_processor_id());
  438. } else
  439. generic_handle_irq(irq);
  440. /*
  441. * Disable interrupts and send EOI:
  442. */
  443. local_irq_disable();
  444. ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
  445. }
  446. ia64_eoi();
  447. vector = ia64_get_ivr();
  448. }
  449. /*
  450. * This must be done *after* the ia64_eoi(). For example, the keyboard softirq
  451. * handler needs to be able to wait for further keyboard interrupts, which can't
  452. * come through until ia64_eoi() has been done.
  453. */
  454. irq_exit();
  455. set_irq_regs(old_regs);
  456. }
  457. #ifdef CONFIG_HOTPLUG_CPU
  458. /*
  459. * This function emulates a interrupt processing when a cpu is about to be
  460. * brought down.
  461. */
  462. void ia64_process_pending_intr(void)
  463. {
  464. ia64_vector vector;
  465. unsigned long saved_tpr;
  466. extern unsigned int vectors_in_migration[NR_IRQS];
  467. vector = ia64_get_ivr();
  468. irq_enter();
  469. saved_tpr = ia64_getreg(_IA64_REG_CR_TPR);
  470. ia64_srlz_d();
  471. /*
  472. * Perform normal interrupt style processing
  473. */
  474. while (vector != IA64_SPURIOUS_INT_VECTOR) {
  475. int irq = local_vector_to_irq(vector);
  476. struct irq_desc *desc = irq_to_desc(irq);
  477. if (unlikely(IS_LOCAL_TLB_FLUSH(vector))) {
  478. smp_local_flush_tlb();
  479. kstat_incr_irqs_this_cpu(irq, desc);
  480. } else if (unlikely(IS_RESCHEDULE(vector))) {
  481. kstat_incr_irqs_this_cpu(irq, desc);
  482. } else {
  483. struct pt_regs *old_regs = set_irq_regs(NULL);
  484. ia64_setreg(_IA64_REG_CR_TPR, vector);
  485. ia64_srlz_d();
  486. /*
  487. * Now try calling normal ia64_handle_irq as it would have got called
  488. * from a real intr handler. Try passing null for pt_regs, hopefully
  489. * it will work. I hope it works!.
  490. * Probably could shared code.
  491. */
  492. if (unlikely(irq < 0)) {
  493. printk(KERN_ERR "%s: Unexpected interrupt "
  494. "vector %d on CPU %d not being mapped "
  495. "to any IRQ!!\n", __func__, vector,
  496. smp_processor_id());
  497. } else {
  498. vectors_in_migration[irq]=0;
  499. generic_handle_irq(irq);
  500. }
  501. set_irq_regs(old_regs);
  502. /*
  503. * Disable interrupts and send EOI
  504. */
  505. local_irq_disable();
  506. ia64_setreg(_IA64_REG_CR_TPR, saved_tpr);
  507. }
  508. ia64_eoi();
  509. vector = ia64_get_ivr();
  510. }
  511. irq_exit();
  512. }
  513. #endif
  514. #ifdef CONFIG_SMP
  515. static irqreturn_t dummy_handler (int irq, void *dev_id)
  516. {
  517. BUG();
  518. }
  519. static struct irqaction ipi_irqaction = {
  520. .handler = handle_IPI,
  521. .flags = IRQF_DISABLED,
  522. .name = "IPI"
  523. };
  524. /*
  525. * KVM uses this interrupt to force a cpu out of guest mode
  526. */
  527. static struct irqaction resched_irqaction = {
  528. .handler = dummy_handler,
  529. .flags = IRQF_DISABLED,
  530. .name = "resched"
  531. };
  532. static struct irqaction tlb_irqaction = {
  533. .handler = dummy_handler,
  534. .flags = IRQF_DISABLED,
  535. .name = "tlb_flush"
  536. };
  537. #endif
  538. void
  539. ia64_native_register_percpu_irq (ia64_vector vec, struct irqaction *action)
  540. {
  541. unsigned int irq;
  542. irq = vec;
  543. BUG_ON(bind_irq_vector(irq, vec, CPU_MASK_ALL));
  544. irq_set_status_flags(irq, IRQ_PER_CPU);
  545. irq_set_chip(irq, &irq_type_ia64_lsapic);
  546. if (action)
  547. setup_irq(irq, action);
  548. irq_set_handler(irq, handle_percpu_irq);
  549. }
  550. void __init
  551. ia64_native_register_ipi(void)
  552. {
  553. #ifdef CONFIG_SMP
  554. register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
  555. register_percpu_irq(IA64_IPI_RESCHEDULE, &resched_irqaction);
  556. register_percpu_irq(IA64_IPI_LOCAL_TLB_FLUSH, &tlb_irqaction);
  557. #endif
  558. }
  559. void __init
  560. init_IRQ (void)
  561. {
  562. #ifdef CONFIG_ACPI
  563. acpi_boot_init();
  564. #endif
  565. ia64_register_ipi();
  566. register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
  567. #ifdef CONFIG_SMP
  568. #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_DIG)
  569. if (vector_domain_type != VECTOR_DOMAIN_NONE)
  570. register_percpu_irq(IA64_IRQ_MOVE_VECTOR, &irq_move_irqaction);
  571. #endif
  572. #endif
  573. #ifdef CONFIG_PERFMON
  574. pfm_init_percpu();
  575. #endif
  576. platform_irq_init();
  577. }
  578. void
  579. ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect)
  580. {
  581. void __iomem *ipi_addr;
  582. unsigned long ipi_data;
  583. unsigned long phys_cpu_id;
  584. phys_cpu_id = cpu_physical_id(cpu);
  585. /*
  586. * cpu number is in 8bit ID and 8bit EID
  587. */
  588. ipi_data = (delivery_mode << 8) | (vector & 0xff);
  589. ipi_addr = ipi_base_addr + ((phys_cpu_id << 4) | ((redirect & 1) << 3));
  590. writeq(ipi_data, ipi_addr);
  591. }