summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/smp-gic.c
blob: 3bb1f92ab525b766317e3d5ffcbb8a9e696230f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (C) 2013 Imagination Technologies
 * Author: Paul Burton <paul.burton@imgtec.com>
 *
 * Based on smp-cmp.c:
 *  Copyright (C) 2007 MIPS Technologies, Inc.
 *  Author: Chris Dearman (chris@mips.com)
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation;  either version 2 of the  License, or (at your
 * option) any later version.
 */

#include <linux/printk.h>

#include <asm/gic.h>
#include <asm/smp-ops.h>

void gic_send_ipi_single(int cpu, unsigned int action)
{
	unsigned long flags;
	unsigned int intr;

	pr_debug("CPU%d: %s cpu %d action %u status %08x\n",
		 smp_processor_id(), __func__, cpu, action, read_c0_status());

	local_irq_save(flags);

	switch (action) {
	case SMP_CALL_FUNCTION:
		intr = plat_ipi_call_int_xlate(cpu);
		break;

	case SMP_RESCHEDULE_YOURSELF:
		intr = plat_ipi_resched_int_xlate(cpu);
		break;

	default:
		BUG();
	}

	gic_send_ipi(intr);
	local_irq_restore(flags);
}

void gic_send_ipi_mask(const struct cpumask *mask, unsigned int action)
{
	unsigned int i;

	for_each_cpu(i, mask)
		gic_send_ipi_single(i, action);
}