irq_ia64.c 15 KB

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