/* SPDX-License-Identifier: GPL-2.0+ */ #ifndef __RTE_H__ #define __RTE_H__ #include #include #include enum { /* * This means the IPI is handles in secure mode and therefore is an FIQ. */ AVM_RTE_IPI_SECURE = (1 << 0), }; typedef irqreturn_t (*avm_rte_ipi_handler_t)(unsigned int ipi, struct pt_regs *regs, void *ctx); #define AVM_RTE_IPI_ALLOC_NR -1 /** * Request an IPI * * This function can be used to request an ipi and install a handler for it. * * Pass AVM_RTE_IPI_ALLOC_NR to ipi to automatically assign one * * @note Not RTE safe * * @param ipi Desired IPI number or AVM_RTE_IPI_ALLOC_NR * @param handler Handler called when the IPI is triggered * @param ctx Context passed to the handler * @param flags Flags for this IPI. See AVM_RTE_IPI_* * @param prio The Interrupt priority of this ipi * @param name Informal name used in procfs * @returns Positive IPI number or negative error */ extern int avm_rte_ipi_request(int ipi, avm_rte_ipi_handler_t handler, void *ctx, int flags, unsigned int prio, const char *name); /** * Free a previously requested IPI. * * @note Not RTE Safe */ extern int avm_rte_ipi_free(int ipi); /** * Trigger an IPI * * RTE safe. * * @param mask The cpu mask on with the IPI should be triggered * @param ipi IPI number to be triggered * @returns 0 on success, -EINVAL on invalid mask or ipi number */ extern int avm_rte_ipi_trigger(const struct cpumask *mask, unsigned int ipi); static inline void avm_rte_ipi_trigger_on(int cpu, unsigned int ipi) { avm_rte_ipi_trigger(get_cpu_mask(cpu), ipi); } /* * The next functions are for RTE integration only and should not be used by RTE users */ extern int __init avm_rte_init(void); /* * Call this in the IRQ/FIQ handlers to handle IPI * * RTE safe. */ extern irqreturn_t avm_rte_ipi_handle(unsigned int ipi, struct pt_regs *regs); /* * Call this for IRQ/FIQ procfs output. * * Is compatible with semi seq_file * * @note Not RTE safe * * @param seq_file The seq_file to print to * @param prec Width of IRQ number * @param secure True to only print IRQ with secure flag, False to only print without secure flag. */ extern void avm_rte_ipi_show_list(struct seq_file *p, int prec, bool secure); #endif