smp-gic.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/printk.h>
  15. #include <asm/gic.h>
  16. #include <asm/smp-ops.h>
  17. void gic_send_ipi_single(int cpu, unsigned int action)
  18. {
  19. unsigned long flags;
  20. unsigned int intr;
  21. pr_debug("CPU%d: %s cpu %d action %u status %08x\n",
  22. smp_processor_id(), __func__, cpu, action, read_c0_status());
  23. local_irq_save(flags);
  24. switch (action) {
  25. case SMP_CALL_FUNCTION:
  26. intr = plat_ipi_call_int_xlate(cpu);
  27. break;
  28. case SMP_RESCHEDULE_YOURSELF:
  29. intr = plat_ipi_resched_int_xlate(cpu);
  30. break;
  31. default:
  32. BUG();
  33. }
  34. gic_send_ipi(intr);
  35. local_irq_restore(flags);
  36. }
  37. void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action)
  38. {
  39. unsigned int i;
  40. for_each_cpu(i, mask)
  41. gic_send_ipi_single(i, action);
  42. }