octeon-irq.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2004-2008, 2009, 2010, 2011 Cavium Networks
  7. */
  8. #include <linux/interrupt.h>
  9. #include <linux/bitops.h>
  10. #include <linux/percpu.h>
  11. #include <linux/irq.h>
  12. #include <linux/smp.h>
  13. #include <asm/octeon/octeon.h>
  14. static DEFINE_RAW_SPINLOCK(octeon_irq_ciu0_lock);
  15. static DEFINE_RAW_SPINLOCK(octeon_irq_ciu1_lock);
  16. static DEFINE_PER_CPU(unsigned long, octeon_irq_ciu0_en_mirror);
  17. static DEFINE_PER_CPU(unsigned long, octeon_irq_ciu1_en_mirror);
  18. static __read_mostly u8 octeon_irq_ciu_to_irq[8][64];
  19. union octeon_ciu_chip_data {
  20. void *p;
  21. unsigned long l;
  22. struct {
  23. unsigned int line:6;
  24. unsigned int bit:6;
  25. } s;
  26. };
  27. struct octeon_core_chip_data {
  28. struct mutex core_irq_mutex;
  29. bool current_en;
  30. bool desired_en;
  31. u8 bit;
  32. };
  33. #define MIPS_CORE_IRQ_LINES 8
  34. static struct octeon_core_chip_data octeon_irq_core_chip_data[MIPS_CORE_IRQ_LINES];
  35. static void __init octeon_irq_set_ciu_mapping(int irq, int line, int bit,
  36. struct irq_chip *chip,
  37. irq_flow_handler_t handler)
  38. {
  39. union octeon_ciu_chip_data cd;
  40. irq_set_chip_and_handler(irq, chip, handler);
  41. cd.l = 0;
  42. cd.s.line = line;
  43. cd.s.bit = bit;
  44. irq_set_chip_data(irq, cd.p);
  45. octeon_irq_ciu_to_irq[line][bit] = irq;
  46. }
  47. static int octeon_coreid_for_cpu(int cpu)
  48. {
  49. #ifdef CONFIG_SMP
  50. return cpu_logical_map(cpu);
  51. #else
  52. return cvmx_get_core_num();
  53. #endif
  54. }
  55. static int octeon_cpu_for_coreid(int coreid)
  56. {
  57. #ifdef CONFIG_SMP
  58. return cpu_number_map(coreid);
  59. #else
  60. return smp_processor_id();
  61. #endif
  62. }
  63. static void octeon_irq_core_ack(struct irq_data *data)
  64. {
  65. struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);
  66. unsigned int bit = cd->bit;
  67. /*
  68. * We don't need to disable IRQs to make these atomic since
  69. * they are already disabled earlier in the low level
  70. * interrupt code.
  71. */
  72. clear_c0_status(0x100 << bit);
  73. /* The two user interrupts must be cleared manually. */
  74. if (bit < 2)
  75. clear_c0_cause(0x100 << bit);
  76. }
  77. static void octeon_irq_core_eoi(struct irq_data *data)
  78. {
  79. struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);
  80. /*
  81. * We don't need to disable IRQs to make these atomic since
  82. * they are already disabled earlier in the low level
  83. * interrupt code.
  84. */
  85. set_c0_status(0x100 << cd->bit);
  86. }
  87. static void octeon_irq_core_set_enable_local(void *arg)
  88. {
  89. struct irq_data *data = arg;
  90. struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);
  91. unsigned int mask = 0x100 << cd->bit;
  92. /*
  93. * Interrupts are already disabled, so these are atomic.
  94. */
  95. if (cd->desired_en)
  96. set_c0_status(mask);
  97. else
  98. clear_c0_status(mask);
  99. }
  100. static void octeon_irq_core_disable(struct irq_data *data)
  101. {
  102. struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);
  103. cd->desired_en = false;
  104. }
  105. static void octeon_irq_core_enable(struct irq_data *data)
  106. {
  107. struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);
  108. cd->desired_en = true;
  109. }
  110. static void octeon_irq_core_bus_lock(struct irq_data *data)
  111. {
  112. struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);
  113. mutex_lock(&cd->core_irq_mutex);
  114. }
  115. static void octeon_irq_core_bus_sync_unlock(struct irq_data *data)
  116. {
  117. struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data);
  118. if (cd->desired_en != cd->current_en) {
  119. on_each_cpu(octeon_irq_core_set_enable_local, data, 1);
  120. cd->current_en = cd->desired_en;
  121. }
  122. mutex_unlock(&cd->core_irq_mutex);
  123. }
  124. static struct irq_chip octeon_irq_chip_core = {
  125. .name = "Core",
  126. .irq_enable = octeon_irq_core_enable,
  127. .irq_disable = octeon_irq_core_disable,
  128. .irq_ack = octeon_irq_core_ack,
  129. .irq_eoi = octeon_irq_core_eoi,
  130. .irq_bus_lock = octeon_irq_core_bus_lock,
  131. .irq_bus_sync_unlock = octeon_irq_core_bus_sync_unlock,
  132. .irq_cpu_online = octeon_irq_core_eoi,
  133. .irq_cpu_offline = octeon_irq_core_ack,
  134. .flags = IRQCHIP_ONOFFLINE_ENABLED,
  135. };
  136. static void __init octeon_irq_init_core(void)
  137. {
  138. int i;
  139. int irq;
  140. struct octeon_core_chip_data *cd;
  141. for (i = 0; i < MIPS_CORE_IRQ_LINES; i++) {
  142. cd = &octeon_irq_core_chip_data[i];
  143. cd->current_en = false;
  144. cd->desired_en = false;
  145. cd->bit = i;
  146. mutex_init(&cd->core_irq_mutex);
  147. irq = OCTEON_IRQ_SW0 + i;
  148. switch (irq) {
  149. case OCTEON_IRQ_TIMER:
  150. case OCTEON_IRQ_SW0:
  151. case OCTEON_IRQ_SW1:
  152. case OCTEON_IRQ_5:
  153. case OCTEON_IRQ_PERF:
  154. irq_set_chip_data(irq, cd);
  155. irq_set_chip_and_handler(irq, &octeon_irq_chip_core,
  156. handle_percpu_irq);
  157. break;
  158. default:
  159. break;
  160. }
  161. }
  162. }
  163. static int next_cpu_for_irq(struct irq_data *data)
  164. {
  165. #ifdef CONFIG_SMP
  166. int cpu;
  167. int weight = cpumask_weight(data->affinity);
  168. if (weight > 1) {
  169. cpu = smp_processor_id();
  170. for (;;) {
  171. cpu = cpumask_next(cpu, data->affinity);
  172. if (cpu >= nr_cpu_ids) {
  173. cpu = -1;
  174. continue;
  175. } else if (cpumask_test_cpu(cpu, cpu_online_mask)) {
  176. break;
  177. }
  178. }
  179. } else if (weight == 1) {
  180. cpu = cpumask_first(data->affinity);
  181. } else {
  182. cpu = smp_processor_id();
  183. }
  184. return cpu;
  185. #else
  186. return smp_processor_id();
  187. #endif
  188. }
  189. static void octeon_irq_ciu_enable(struct irq_data *data)
  190. {
  191. int cpu = next_cpu_for_irq(data);
  192. int coreid = octeon_coreid_for_cpu(cpu);
  193. unsigned long *pen;
  194. unsigned long flags;
  195. union octeon_ciu_chip_data cd;
  196. cd.p = irq_data_get_irq_chip_data(data);
  197. if (cd.s.line == 0) {
  198. raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
  199. pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);
  200. set_bit(cd.s.bit, pen);
  201. cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);
  202. raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
  203. } else {
  204. raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
  205. pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
  206. set_bit(cd.s.bit, pen);
  207. cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);
  208. raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
  209. }
  210. }
  211. static void octeon_irq_ciu_enable_local(struct irq_data *data)
  212. {
  213. unsigned long *pen;
  214. unsigned long flags;
  215. union octeon_ciu_chip_data cd;
  216. cd.p = irq_data_get_irq_chip_data(data);
  217. if (cd.s.line == 0) {
  218. raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
  219. pen = &__get_cpu_var(octeon_irq_ciu0_en_mirror);
  220. set_bit(cd.s.bit, pen);
  221. cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2), *pen);
  222. raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
  223. } else {
  224. raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
  225. pen = &__get_cpu_var(octeon_irq_ciu1_en_mirror);
  226. set_bit(cd.s.bit, pen);
  227. cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1), *pen);
  228. raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
  229. }
  230. }
  231. static void octeon_irq_ciu_disable_local(struct irq_data *data)
  232. {
  233. unsigned long *pen;
  234. unsigned long flags;
  235. union octeon_ciu_chip_data cd;
  236. cd.p = irq_data_get_irq_chip_data(data);
  237. if (cd.s.line == 0) {
  238. raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
  239. pen = &__get_cpu_var(octeon_irq_ciu0_en_mirror);
  240. clear_bit(cd.s.bit, pen);
  241. cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2), *pen);
  242. raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
  243. } else {
  244. raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
  245. pen = &__get_cpu_var(octeon_irq_ciu1_en_mirror);
  246. clear_bit(cd.s.bit, pen);
  247. cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1), *pen);
  248. raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
  249. }
  250. }
  251. static void octeon_irq_ciu_disable_all(struct irq_data *data)
  252. {
  253. unsigned long flags;
  254. unsigned long *pen;
  255. int cpu;
  256. union octeon_ciu_chip_data cd;
  257. wmb(); /* Make sure flag changes arrive before register updates. */
  258. cd.p = irq_data_get_irq_chip_data(data);
  259. if (cd.s.line == 0) {
  260. raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
  261. for_each_online_cpu(cpu) {
  262. int coreid = octeon_coreid_for_cpu(cpu);
  263. pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);
  264. clear_bit(cd.s.bit, pen);
  265. cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);
  266. }
  267. raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
  268. } else {
  269. raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
  270. for_each_online_cpu(cpu) {
  271. int coreid = octeon_coreid_for_cpu(cpu);
  272. pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
  273. clear_bit(cd.s.bit, pen);
  274. cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);
  275. }
  276. raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
  277. }
  278. }
  279. static void octeon_irq_ciu_enable_all(struct irq_data *data)
  280. {
  281. unsigned long flags;
  282. unsigned long *pen;
  283. int cpu;
  284. union octeon_ciu_chip_data cd;
  285. cd.p = irq_data_get_irq_chip_data(data);
  286. if (cd.s.line == 0) {
  287. raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
  288. for_each_online_cpu(cpu) {
  289. int coreid = octeon_coreid_for_cpu(cpu);
  290. pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);
  291. set_bit(cd.s.bit, pen);
  292. cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);
  293. }
  294. raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
  295. } else {
  296. raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
  297. for_each_online_cpu(cpu) {
  298. int coreid = octeon_coreid_for_cpu(cpu);
  299. pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
  300. set_bit(cd.s.bit, pen);
  301. cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);
  302. }
  303. raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
  304. }
  305. }
  306. /*
  307. * Enable the irq on the next core in the affinity set for chips that
  308. * have the EN*_W1{S,C} registers.
  309. */
  310. static void octeon_irq_ciu_enable_v2(struct irq_data *data)
  311. {
  312. u64 mask;
  313. int cpu = next_cpu_for_irq(data);
  314. union octeon_ciu_chip_data cd;
  315. cd.p = irq_data_get_irq_chip_data(data);
  316. mask = 1ull << (cd.s.bit);
  317. /*
  318. * Called under the desc lock, so these should never get out
  319. * of sync.
  320. */
  321. if (cd.s.line == 0) {
  322. int index = octeon_coreid_for_cpu(cpu) * 2;
  323. set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu));
  324. cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
  325. } else {
  326. int index = octeon_coreid_for_cpu(cpu) * 2 + 1;
  327. set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));
  328. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
  329. }
  330. }
  331. /*
  332. * Enable the irq on the current CPU for chips that
  333. * have the EN*_W1{S,C} registers.
  334. */
  335. static void octeon_irq_ciu_enable_local_v2(struct irq_data *data)
  336. {
  337. u64 mask;
  338. union octeon_ciu_chip_data cd;
  339. cd.p = irq_data_get_irq_chip_data(data);
  340. mask = 1ull << (cd.s.bit);
  341. if (cd.s.line == 0) {
  342. int index = cvmx_get_core_num() * 2;
  343. set_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu0_en_mirror));
  344. cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
  345. } else {
  346. int index = cvmx_get_core_num() * 2 + 1;
  347. set_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu1_en_mirror));
  348. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
  349. }
  350. }
  351. static void octeon_irq_ciu_disable_local_v2(struct irq_data *data)
  352. {
  353. u64 mask;
  354. union octeon_ciu_chip_data cd;
  355. cd.p = irq_data_get_irq_chip_data(data);
  356. mask = 1ull << (cd.s.bit);
  357. if (cd.s.line == 0) {
  358. int index = cvmx_get_core_num() * 2;
  359. clear_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu0_en_mirror));
  360. cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
  361. } else {
  362. int index = cvmx_get_core_num() * 2 + 1;
  363. clear_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu1_en_mirror));
  364. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
  365. }
  366. }
  367. /*
  368. * Write to the W1C bit in CVMX_CIU_INTX_SUM0 to clear the irq.
  369. */
  370. static void octeon_irq_ciu_ack(struct irq_data *data)
  371. {
  372. u64 mask;
  373. union octeon_ciu_chip_data cd;
  374. cd.p = data->chip_data;
  375. mask = 1ull << (cd.s.bit);
  376. if (cd.s.line == 0) {
  377. int index = cvmx_get_core_num() * 2;
  378. cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);
  379. } else {
  380. cvmx_write_csr(CVMX_CIU_INT_SUM1, mask);
  381. }
  382. }
  383. /*
  384. * Disable the irq on the all cores for chips that have the EN*_W1{S,C}
  385. * registers.
  386. */
  387. static void octeon_irq_ciu_disable_all_v2(struct irq_data *data)
  388. {
  389. int cpu;
  390. u64 mask;
  391. union octeon_ciu_chip_data cd;
  392. wmb(); /* Make sure flag changes arrive before register updates. */
  393. cd.p = data->chip_data;
  394. mask = 1ull << (cd.s.bit);
  395. if (cd.s.line == 0) {
  396. for_each_online_cpu(cpu) {
  397. int index = octeon_coreid_for_cpu(cpu) * 2;
  398. clear_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu));
  399. cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
  400. }
  401. } else {
  402. for_each_online_cpu(cpu) {
  403. int index = octeon_coreid_for_cpu(cpu) * 2 + 1;
  404. clear_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));
  405. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
  406. }
  407. }
  408. }
  409. /*
  410. * Enable the irq on the all cores for chips that have the EN*_W1{S,C}
  411. * registers.
  412. */
  413. static void octeon_irq_ciu_enable_all_v2(struct irq_data *data)
  414. {
  415. int cpu;
  416. u64 mask;
  417. union octeon_ciu_chip_data cd;
  418. cd.p = data->chip_data;
  419. mask = 1ull << (cd.s.bit);
  420. if (cd.s.line == 0) {
  421. for_each_online_cpu(cpu) {
  422. int index = octeon_coreid_for_cpu(cpu) * 2;
  423. set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu));
  424. cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
  425. }
  426. } else {
  427. for_each_online_cpu(cpu) {
  428. int index = octeon_coreid_for_cpu(cpu) * 2 + 1;
  429. set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));
  430. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
  431. }
  432. }
  433. }
  434. #ifdef CONFIG_SMP
  435. static void octeon_irq_cpu_offline_ciu(struct irq_data *data)
  436. {
  437. int cpu = smp_processor_id();
  438. cpumask_t new_affinity;
  439. if (!cpumask_test_cpu(cpu, data->affinity))
  440. return;
  441. if (cpumask_weight(data->affinity) > 1) {
  442. /*
  443. * It has multi CPU affinity, just remove this CPU
  444. * from the affinity set.
  445. */
  446. cpumask_copy(&new_affinity, data->affinity);
  447. cpumask_clear_cpu(cpu, &new_affinity);
  448. } else {
  449. /* Otherwise, put it on lowest numbered online CPU. */
  450. cpumask_clear(&new_affinity);
  451. cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);
  452. }
  453. __irq_set_affinity_locked(data, &new_affinity);
  454. }
  455. static int octeon_irq_ciu_set_affinity(struct irq_data *data,
  456. const struct cpumask *dest, bool force)
  457. {
  458. int cpu;
  459. bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data);
  460. unsigned long flags;
  461. union octeon_ciu_chip_data cd;
  462. cd.p = data->chip_data;
  463. /*
  464. * For non-v2 CIU, we will allow only single CPU affinity.
  465. * This removes the need to do locking in the .ack/.eoi
  466. * functions.
  467. */
  468. if (cpumask_weight(dest) != 1)
  469. return -EINVAL;
  470. if (!enable_one)
  471. return 0;
  472. if (cd.s.line == 0) {
  473. raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
  474. for_each_online_cpu(cpu) {
  475. int coreid = octeon_coreid_for_cpu(cpu);
  476. unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);
  477. if (cpumask_test_cpu(cpu, dest) && enable_one) {
  478. enable_one = false;
  479. set_bit(cd.s.bit, pen);
  480. } else {
  481. clear_bit(cd.s.bit, pen);
  482. }
  483. cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen);
  484. }
  485. raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
  486. } else {
  487. raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
  488. for_each_online_cpu(cpu) {
  489. int coreid = octeon_coreid_for_cpu(cpu);
  490. unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
  491. if (cpumask_test_cpu(cpu, dest) && enable_one) {
  492. enable_one = false;
  493. set_bit(cd.s.bit, pen);
  494. } else {
  495. clear_bit(cd.s.bit, pen);
  496. }
  497. cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);
  498. }
  499. raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
  500. }
  501. return 0;
  502. }
  503. /*
  504. * Set affinity for the irq for chips that have the EN*_W1{S,C}
  505. * registers.
  506. */
  507. static int octeon_irq_ciu_set_affinity_v2(struct irq_data *data,
  508. const struct cpumask *dest,
  509. bool force)
  510. {
  511. int cpu;
  512. bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data);
  513. u64 mask;
  514. union octeon_ciu_chip_data cd;
  515. if (!enable_one)
  516. return 0;
  517. cd.p = data->chip_data;
  518. mask = 1ull << cd.s.bit;
  519. if (cd.s.line == 0) {
  520. for_each_online_cpu(cpu) {
  521. unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu);
  522. int index = octeon_coreid_for_cpu(cpu) * 2;
  523. if (cpumask_test_cpu(cpu, dest) && enable_one) {
  524. enable_one = false;
  525. set_bit(cd.s.bit, pen);
  526. cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
  527. } else {
  528. clear_bit(cd.s.bit, pen);
  529. cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
  530. }
  531. }
  532. } else {
  533. for_each_online_cpu(cpu) {
  534. unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
  535. int index = octeon_coreid_for_cpu(cpu) * 2 + 1;
  536. if (cpumask_test_cpu(cpu, dest) && enable_one) {
  537. enable_one = false;
  538. set_bit(cd.s.bit, pen);
  539. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
  540. } else {
  541. clear_bit(cd.s.bit, pen);
  542. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
  543. }
  544. }
  545. }
  546. return 0;
  547. }
  548. #endif
  549. /*
  550. * The v1 CIU code already masks things, so supply a dummy version to
  551. * the core chip code.
  552. */
  553. static void octeon_irq_dummy_mask(struct irq_data *data)
  554. {
  555. }
  556. /*
  557. * Newer octeon chips have support for lockless CIU operation.
  558. */
  559. static struct irq_chip octeon_irq_chip_ciu_v2 = {
  560. .name = "CIU",
  561. .irq_enable = octeon_irq_ciu_enable_v2,
  562. .irq_disable = octeon_irq_ciu_disable_all_v2,
  563. .irq_mask = octeon_irq_ciu_disable_local_v2,
  564. .irq_unmask = octeon_irq_ciu_enable_v2,
  565. #ifdef CONFIG_SMP
  566. .irq_set_affinity = octeon_irq_ciu_set_affinity_v2,
  567. .irq_cpu_offline = octeon_irq_cpu_offline_ciu,
  568. #endif
  569. };
  570. static struct irq_chip octeon_irq_chip_ciu_edge_v2 = {
  571. .name = "CIU-E",
  572. .irq_enable = octeon_irq_ciu_enable_v2,
  573. .irq_disable = octeon_irq_ciu_disable_all_v2,
  574. .irq_ack = octeon_irq_ciu_ack,
  575. .irq_mask = octeon_irq_ciu_disable_local_v2,
  576. .irq_unmask = octeon_irq_ciu_enable_v2,
  577. #ifdef CONFIG_SMP
  578. .irq_set_affinity = octeon_irq_ciu_set_affinity_v2,
  579. .irq_cpu_offline = octeon_irq_cpu_offline_ciu,
  580. #endif
  581. };
  582. static struct irq_chip octeon_irq_chip_ciu = {
  583. .name = "CIU",
  584. .irq_enable = octeon_irq_ciu_enable,
  585. .irq_disable = octeon_irq_ciu_disable_all,
  586. .irq_mask = octeon_irq_dummy_mask,
  587. #ifdef CONFIG_SMP
  588. .irq_set_affinity = octeon_irq_ciu_set_affinity,
  589. .irq_cpu_offline = octeon_irq_cpu_offline_ciu,
  590. #endif
  591. };
  592. static struct irq_chip octeon_irq_chip_ciu_edge = {
  593. .name = "CIU-E",
  594. .irq_enable = octeon_irq_ciu_enable,
  595. .irq_disable = octeon_irq_ciu_disable_all,
  596. .irq_mask = octeon_irq_dummy_mask,
  597. .irq_ack = octeon_irq_ciu_ack,
  598. #ifdef CONFIG_SMP
  599. .irq_set_affinity = octeon_irq_ciu_set_affinity,
  600. .irq_cpu_offline = octeon_irq_cpu_offline_ciu,
  601. #endif
  602. };
  603. /* The mbox versions don't do any affinity or round-robin. */
  604. static struct irq_chip octeon_irq_chip_ciu_mbox_v2 = {
  605. .name = "CIU-M",
  606. .irq_enable = octeon_irq_ciu_enable_all_v2,
  607. .irq_disable = octeon_irq_ciu_disable_all_v2,
  608. .irq_ack = octeon_irq_ciu_disable_local_v2,
  609. .irq_eoi = octeon_irq_ciu_enable_local_v2,
  610. .irq_cpu_online = octeon_irq_ciu_enable_local_v2,
  611. .irq_cpu_offline = octeon_irq_ciu_disable_local_v2,
  612. .flags = IRQCHIP_ONOFFLINE_ENABLED,
  613. };
  614. static struct irq_chip octeon_irq_chip_ciu_mbox = {
  615. .name = "CIU-M",
  616. .irq_enable = octeon_irq_ciu_enable_all,
  617. .irq_disable = octeon_irq_ciu_disable_all,
  618. .irq_cpu_online = octeon_irq_ciu_enable_local,
  619. .irq_cpu_offline = octeon_irq_ciu_disable_local,
  620. .flags = IRQCHIP_ONOFFLINE_ENABLED,
  621. };
  622. /*
  623. * Watchdog interrupts are special. They are associated with a single
  624. * core, so we hardwire the affinity to that core.
  625. */
  626. static void octeon_irq_ciu_wd_enable(struct irq_data *data)
  627. {
  628. unsigned long flags;
  629. unsigned long *pen;
  630. int coreid = data->irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */
  631. int cpu = octeon_cpu_for_coreid(coreid);
  632. raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
  633. pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu);
  634. set_bit(coreid, pen);
  635. cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen);
  636. raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
  637. }
  638. /*
  639. * Watchdog interrupts are special. They are associated with a single
  640. * core, so we hardwire the affinity to that core.
  641. */
  642. static void octeon_irq_ciu1_wd_enable_v2(struct irq_data *data)
  643. {
  644. int coreid = data->irq - OCTEON_IRQ_WDOG0;
  645. int cpu = octeon_cpu_for_coreid(coreid);
  646. set_bit(coreid, &per_cpu(octeon_irq_ciu1_en_mirror, cpu));
  647. cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(coreid * 2 + 1), 1ull << coreid);
  648. }
  649. static struct irq_chip octeon_irq_chip_ciu_wd_v2 = {
  650. .name = "CIU-W",
  651. .irq_enable = octeon_irq_ciu1_wd_enable_v2,
  652. .irq_disable = octeon_irq_ciu_disable_all_v2,
  653. .irq_mask = octeon_irq_ciu_disable_local_v2,
  654. .irq_unmask = octeon_irq_ciu_enable_local_v2,
  655. };
  656. static struct irq_chip octeon_irq_chip_ciu_wd = {
  657. .name = "CIU-W",
  658. .irq_enable = octeon_irq_ciu_wd_enable,
  659. .irq_disable = octeon_irq_ciu_disable_all,
  660. .irq_mask = octeon_irq_dummy_mask,
  661. };
  662. static void octeon_irq_ip2_v1(void)
  663. {
  664. const unsigned long core_id = cvmx_get_core_num();
  665. u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INTX_SUM0(core_id * 2));
  666. ciu_sum &= __get_cpu_var(octeon_irq_ciu0_en_mirror);
  667. clear_c0_status(STATUSF_IP2);
  668. if (likely(ciu_sum)) {
  669. int bit = fls64(ciu_sum) - 1;
  670. int irq = octeon_irq_ciu_to_irq[0][bit];
  671. if (likely(irq))
  672. do_IRQ(irq);
  673. else
  674. spurious_interrupt();
  675. } else {
  676. spurious_interrupt();
  677. }
  678. set_c0_status(STATUSF_IP2);
  679. }
  680. static void octeon_irq_ip2_v2(void)
  681. {
  682. const unsigned long core_id = cvmx_get_core_num();
  683. u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INTX_SUM0(core_id * 2));
  684. ciu_sum &= __get_cpu_var(octeon_irq_ciu0_en_mirror);
  685. if (likely(ciu_sum)) {
  686. int bit = fls64(ciu_sum) - 1;
  687. int irq = octeon_irq_ciu_to_irq[0][bit];
  688. if (likely(irq))
  689. do_IRQ(irq);
  690. else
  691. spurious_interrupt();
  692. } else {
  693. spurious_interrupt();
  694. }
  695. }
  696. static void octeon_irq_ip3_v1(void)
  697. {
  698. u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INT_SUM1);
  699. ciu_sum &= __get_cpu_var(octeon_irq_ciu1_en_mirror);
  700. clear_c0_status(STATUSF_IP3);
  701. if (likely(ciu_sum)) {
  702. int bit = fls64(ciu_sum) - 1;
  703. int irq = octeon_irq_ciu_to_irq[1][bit];
  704. if (likely(irq))
  705. do_IRQ(irq);
  706. else
  707. spurious_interrupt();
  708. } else {
  709. spurious_interrupt();
  710. }
  711. set_c0_status(STATUSF_IP3);
  712. }
  713. static void octeon_irq_ip3_v2(void)
  714. {
  715. u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INT_SUM1);
  716. ciu_sum &= __get_cpu_var(octeon_irq_ciu1_en_mirror);
  717. if (likely(ciu_sum)) {
  718. int bit = fls64(ciu_sum) - 1;
  719. int irq = octeon_irq_ciu_to_irq[1][bit];
  720. if (likely(irq))
  721. do_IRQ(irq);
  722. else
  723. spurious_interrupt();
  724. } else {
  725. spurious_interrupt();
  726. }
  727. }
  728. static void octeon_irq_ip4_mask(void)
  729. {
  730. clear_c0_status(STATUSF_IP4);
  731. spurious_interrupt();
  732. }
  733. static void (*octeon_irq_ip2)(void);
  734. static void (*octeon_irq_ip3)(void);
  735. static void (*octeon_irq_ip4)(void);
  736. void __cpuinitdata (*octeon_irq_setup_secondary)(void);
  737. static void __cpuinit octeon_irq_percpu_enable(void)
  738. {
  739. irq_cpu_online();
  740. }
  741. static void __cpuinit octeon_irq_init_ciu_percpu(void)
  742. {
  743. int coreid = cvmx_get_core_num();
  744. /*
  745. * Disable All CIU Interrupts. The ones we need will be
  746. * enabled later. Read the SUM register so we know the write
  747. * completed.
  748. */
  749. cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2)), 0);
  750. cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2 + 1)), 0);
  751. cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2)), 0);
  752. cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2 + 1)), 0);
  753. cvmx_read_csr(CVMX_CIU_INTX_SUM0((coreid * 2)));
  754. }
  755. static void __cpuinit octeon_irq_setup_secondary_ciu(void)
  756. {
  757. __get_cpu_var(octeon_irq_ciu0_en_mirror) = 0;
  758. __get_cpu_var(octeon_irq_ciu1_en_mirror) = 0;
  759. octeon_irq_init_ciu_percpu();
  760. octeon_irq_percpu_enable();
  761. /* Enable the CIU lines */
  762. set_c0_status(STATUSF_IP3 | STATUSF_IP2);
  763. clear_c0_status(STATUSF_IP4);
  764. }
  765. static void __init octeon_irq_init_ciu(void)
  766. {
  767. unsigned int i;
  768. struct irq_chip *chip;
  769. struct irq_chip *chip_edge;
  770. struct irq_chip *chip_mbox;
  771. struct irq_chip *chip_wd;
  772. octeon_irq_init_ciu_percpu();
  773. octeon_irq_setup_secondary = octeon_irq_setup_secondary_ciu;
  774. if (OCTEON_IS_MODEL(OCTEON_CN58XX_PASS2_X) ||
  775. OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) ||
  776. OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X) ||
  777. OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
  778. octeon_irq_ip2 = octeon_irq_ip2_v2;
  779. octeon_irq_ip3 = octeon_irq_ip3_v2;
  780. chip = &octeon_irq_chip_ciu_v2;
  781. chip_edge = &octeon_irq_chip_ciu_edge_v2;
  782. chip_mbox = &octeon_irq_chip_ciu_mbox_v2;
  783. chip_wd = &octeon_irq_chip_ciu_wd_v2;
  784. } else {
  785. octeon_irq_ip2 = octeon_irq_ip2_v1;
  786. octeon_irq_ip3 = octeon_irq_ip3_v1;
  787. chip = &octeon_irq_chip_ciu;
  788. chip_edge = &octeon_irq_chip_ciu_edge;
  789. chip_mbox = &octeon_irq_chip_ciu_mbox;
  790. chip_wd = &octeon_irq_chip_ciu_wd;
  791. }
  792. octeon_irq_ip4 = octeon_irq_ip4_mask;
  793. /* Mips internal */
  794. octeon_irq_init_core();
  795. /* CIU_0 */
  796. for (i = 0; i < 16; i++)
  797. octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WORKQ0, 0, i + 0, chip, handle_level_irq);
  798. for (i = 0; i < 16; i++)
  799. octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GPIO0, 0, i + 16, chip, handle_level_irq);
  800. octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq);
  801. octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq);
  802. octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART0, 0, 34, chip, handle_level_irq);
  803. octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART1, 0, 35, chip, handle_level_irq);
  804. for (i = 0; i < 4; i++)
  805. octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_INT0, 0, i + 36, chip, handle_level_irq);
  806. for (i = 0; i < 4; i++)
  807. octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_MSI0, 0, i + 40, chip, handle_level_irq);
  808. octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI, 0, 45, chip, handle_level_irq);
  809. octeon_irq_set_ciu_mapping(OCTEON_IRQ_RML, 0, 46, chip, handle_level_irq);
  810. octeon_irq_set_ciu_mapping(OCTEON_IRQ_TRACE0, 0, 47, chip, handle_level_irq);
  811. for (i = 0; i < 2; i++)
  812. octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GMX_DRP0, 0, i + 48, chip_edge, handle_edge_irq);
  813. octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD_DRP, 0, 50, chip_edge, handle_edge_irq);
  814. octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY_ZERO, 0, 51, chip_edge, handle_edge_irq);
  815. for (i = 0; i < 4; i++)
  816. octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip_edge, handle_edge_irq);
  817. octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB0, 0, 56, chip, handle_level_irq);
  818. octeon_irq_set_ciu_mapping(OCTEON_IRQ_PCM, 0, 57, chip, handle_level_irq);
  819. octeon_irq_set_ciu_mapping(OCTEON_IRQ_MPI, 0, 58, chip, handle_level_irq);
  820. octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI2, 0, 59, chip, handle_level_irq);
  821. octeon_irq_set_ciu_mapping(OCTEON_IRQ_POWIQ, 0, 60, chip, handle_level_irq);
  822. octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPDPPTHR, 0, 61, chip, handle_level_irq);
  823. octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII0, 0, 62, chip, handle_level_irq);
  824. octeon_irq_set_ciu_mapping(OCTEON_IRQ_BOOTDMA, 0, 63, chip, handle_level_irq);
  825. /* CIU_1 */
  826. for (i = 0; i < 16; i++)
  827. octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq);
  828. octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART2, 1, 16, chip, handle_level_irq);
  829. octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB1, 1, 17, chip, handle_level_irq);
  830. octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII1, 1, 18, chip, handle_level_irq);
  831. octeon_irq_set_ciu_mapping(OCTEON_IRQ_NAND, 1, 19, chip, handle_level_irq);
  832. octeon_irq_set_ciu_mapping(OCTEON_IRQ_MIO, 1, 20, chip, handle_level_irq);
  833. octeon_irq_set_ciu_mapping(OCTEON_IRQ_IOB, 1, 21, chip, handle_level_irq);
  834. octeon_irq_set_ciu_mapping(OCTEON_IRQ_FPA, 1, 22, chip, handle_level_irq);
  835. octeon_irq_set_ciu_mapping(OCTEON_IRQ_POW, 1, 23, chip, handle_level_irq);
  836. octeon_irq_set_ciu_mapping(OCTEON_IRQ_L2C, 1, 24, chip, handle_level_irq);
  837. octeon_irq_set_ciu_mapping(OCTEON_IRQ_IPD, 1, 25, chip, handle_level_irq);
  838. octeon_irq_set_ciu_mapping(OCTEON_IRQ_PIP, 1, 26, chip, handle_level_irq);
  839. octeon_irq_set_ciu_mapping(OCTEON_IRQ_PKO, 1, 27, chip, handle_level_irq);
  840. octeon_irq_set_ciu_mapping(OCTEON_IRQ_ZIP, 1, 28, chip, handle_level_irq);
  841. octeon_irq_set_ciu_mapping(OCTEON_IRQ_TIM, 1, 29, chip, handle_level_irq);
  842. octeon_irq_set_ciu_mapping(OCTEON_IRQ_RAD, 1, 30, chip, handle_level_irq);
  843. octeon_irq_set_ciu_mapping(OCTEON_IRQ_KEY, 1, 31, chip, handle_level_irq);
  844. octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFA, 1, 32, chip, handle_level_irq);
  845. octeon_irq_set_ciu_mapping(OCTEON_IRQ_USBCTL, 1, 33, chip, handle_level_irq);
  846. octeon_irq_set_ciu_mapping(OCTEON_IRQ_SLI, 1, 34, chip, handle_level_irq);
  847. octeon_irq_set_ciu_mapping(OCTEON_IRQ_DPI, 1, 35, chip, handle_level_irq);
  848. octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGX0, 1, 36, chip, handle_level_irq);
  849. octeon_irq_set_ciu_mapping(OCTEON_IRQ_AGL, 1, 46, chip, handle_level_irq);
  850. octeon_irq_set_ciu_mapping(OCTEON_IRQ_PTP, 1, 47, chip_edge, handle_edge_irq);
  851. octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM0, 1, 48, chip, handle_level_irq);
  852. octeon_irq_set_ciu_mapping(OCTEON_IRQ_PEM1, 1, 49, chip, handle_level_irq);
  853. octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO0, 1, 50, chip, handle_level_irq);
  854. octeon_irq_set_ciu_mapping(OCTEON_IRQ_SRIO1, 1, 51, chip, handle_level_irq);
  855. octeon_irq_set_ciu_mapping(OCTEON_IRQ_LMC0, 1, 52, chip, handle_level_irq);
  856. octeon_irq_set_ciu_mapping(OCTEON_IRQ_DFM, 1, 56, chip, handle_level_irq);
  857. octeon_irq_set_ciu_mapping(OCTEON_IRQ_RST, 1, 63, chip, handle_level_irq);
  858. /* Enable the CIU lines */
  859. set_c0_status(STATUSF_IP3 | STATUSF_IP2);
  860. clear_c0_status(STATUSF_IP4);
  861. }
  862. void __init arch_init_irq(void)
  863. {
  864. #ifdef CONFIG_SMP
  865. /* Set the default affinity to the boot cpu. */
  866. cpumask_clear(irq_default_affinity);
  867. cpumask_set_cpu(smp_processor_id(), irq_default_affinity);
  868. #endif
  869. octeon_irq_init_ciu();
  870. }
  871. asmlinkage void plat_irq_dispatch(void)
  872. {
  873. unsigned long cop0_cause;
  874. unsigned long cop0_status;
  875. while (1) {
  876. cop0_cause = read_c0_cause();
  877. cop0_status = read_c0_status();
  878. cop0_cause &= cop0_status;
  879. cop0_cause &= ST0_IM;
  880. if (unlikely(cop0_cause & STATUSF_IP2))
  881. octeon_irq_ip2();
  882. else if (unlikely(cop0_cause & STATUSF_IP3))
  883. octeon_irq_ip3();
  884. else if (unlikely(cop0_cause & STATUSF_IP4))
  885. octeon_irq_ip4();
  886. else if (likely(cop0_cause))
  887. do_IRQ(fls(cop0_cause) - 9 + MIPS_CPU_IRQ_BASE);
  888. else
  889. break;
  890. }
  891. }
  892. #ifdef CONFIG_HOTPLUG_CPU
  893. void fixup_irqs(void)
  894. {
  895. irq_cpu_offline();
  896. }
  897. #endif /* CONFIG_HOTPLUG_CPU */