1 /* 2 * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12 #ifndef IRQ_IPI_H 13 #define IRQ_IPI_H 14 15 #include <irq/irq.h> 16 #include <common/types.h> 17 #include <common/lock.h> 18 #include <arch/ipi.h> 19 20 void arch_send_ipi(u32 cpu, u32 ipi); 21 22 /* 7 u64 arg and 2 u32 (start/finish, vector) occupy one cacheline */ 23 #define IPI_DATA_ARG_NUM (7) 24 25 void init_ipi_data(void); 26 27 /* IPI interfaces for achieving cross-core communication */ 28 29 /* Sender side */ 30 void prepare_ipi_tx(u32 target_cpu); 31 void set_ipi_tx_arg(u32 target_cpu, u32 arg_index, unsigned long val); 32 void start_ipi_tx(u32 target_cpu, u32 ipi_vector); 33 void wait_finish_ipi_tx(u32 target_cpu); 34 void send_ipi(u32 target_cpu, u32 ipi_vector); 35 36 /* Receiver side */ 37 unsigned long get_ipi_tx_arg(u32 arg_index); 38 void handle_ipi(void); 39 void arch_handle_ipi(u32 ipi_vector); 40 41 #endif /* IRQ_IPI_H */