1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2019 Fraunhofer AISEC,
4 * Lukas Auer <lukas.auer@aisec.fraunhofer.de>
7 #ifndef _ASM_RISCV_SMP_H
8 #define _ASM_RISCV_SMP_H
11 * struct ipi_data - Inter-processor interrupt (IPI) data structure
13 * IPIs are used for SMP support to communicate to other harts what function to
14 * call. Functions are in the form
15 * void (*addr)(ulong hart, ulong arg0, ulong arg1).
17 * The function address and the two arguments, arg0 and arg1, are stored in the
18 * IPI data structure. The hart ID is inserted by the hart handling the IPI and
19 * calling the function.
21 * @addr: Address of function
22 * @arg0: First argument of function
23 * @arg1: Second argument of function
32 * handle_ipi() - interrupt handler for software interrupts
34 * The IPI interrupt handler must be called to handle software interrupts. It
35 * calls the function specified in the hart's IPI data structure.
37 * @hart: Hart ID of the current hart
39 void handle_ipi(ulong hart);
42 * smp_call_function() - Call a function on all other harts
44 * Send IPIs with the specified function call to all harts.
46 * @addr: Address of function
47 * @arg0: First argument of function
48 * @arg1: Second argument of function
49 * @return 0 if OK, -ve on error
51 int smp_call_function(ulong addr, ulong arg0, ulong arg1);