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