smp-gic.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2013 Imagination Technologies
  3. * Author: Paul Burton <paul.burton@imgtec.com>
  4. *
  5. * Based on smp-cmp.c:
  6. * Copyright (C) 2007 MIPS Technologies, Inc.
  7. * Author: Chris Dearman (chris@mips.com)
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. */
  14. #include <linux/irqchip/mips-gic.h>
  15. #include <linux/printk.h>
  16. #include <asm/mips-cpc.h>
  17. #include <asm/smp-ops.h>
  18. void gic_send_ipi_single(int cpu, unsigned int action)
  19. {
  20. unsigned long flags;
  21. unsigned int intr;
  22. unsigned int core = cpu_data[cpu].core;
  23. pr_debug("CPU%d: %s cpu %d action %u status %08x\n",
  24. smp_processor_id(), __func__, cpu, action, read_c0_status());
  25. local_irq_save(flags);
  26. switch (action) {
  27. case SMP_CALL_FUNCTION:
  28. intr = plat_ipi_call_int_xlate(cpu);
  29. break;
  30. case SMP_RESCHEDULE_YOURSELF:
  31. intr = plat_ipi_resched_int_xlate(cpu);
  32. break;
  33. default:
  34. BUG();
  35. }
  36. gic_send_ipi(intr);
  37. if (mips_cpc_present() && (core != current_cpu_data.core)) {
  38. while (!cpumask_test_cpu(cpu, &cpu_coherent_mask)) {
  39. mips_cpc_lock_other(core);
  40. write_cpc_co_cmd(CPC_Cx_CMD_PWRUP);
  41. mips_cpc_unlock_other();
  42. }
  43. }
  44. local_irq_restore(flags);
  45. }
  46. void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action)
  47. {
  48. unsigned int i;
  49. for_each_cpu(i, mask)
  50. gic_send_ipi_single(i, action);
  51. }