1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (C) 2020 Loongson Technology Corporation Limited 4 */ 5#ifndef _ASM_IRQ_H 6#define _ASM_IRQ_H 7 8#include <linux/irqdomain.h> 9#include <irq.h> 10#include <asm-generic/irq.h> 11 12#define IRQ_STACK_SIZE THREAD_SIZE 13#define IRQ_STACK_START (IRQ_STACK_SIZE - 16) 14 15DECLARE_PER_CPU(unsigned long, irq_stack); 16 17/* 18 * The highest address on the IRQ stack contains a dummy frame put down in 19 * genex.S (except_vec_vi_handler) which is structured as follows: 20 * 21 * top ------------ 22 * | task sp | <- irq_stack[cpu] + IRQ_STACK_START 23 * ------------ 24 * | | <- First frame of IRQ context 25 * ------------ 26 * 27 * task sp holds a copy of the task stack pointer where the struct pt_regs 28 * from exception entry can be found. 29 */ 30 31static inline bool on_irq_stack(int cpu, unsigned long sp) 32{ 33 unsigned long low = per_cpu(irq_stack, cpu); 34 unsigned long high = low + IRQ_STACK_SIZE; 35 36 return (low <= sp && sp <= high); 37} 38 39struct irq_data; 40struct device_node; 41 42int get_ipi_irq(void); 43int get_pmc_irq(void); 44int get_timer_irq(void); 45void arch_init_irq(void); 46void spurious_interrupt(void); 47struct irq_domain *loongarch_cpu_irq_init(void); 48 49#define NR_IRQS_LEGACY 16 50 51void arch_trigger_cpumask_backtrace(const struct cpumask *mask, 52 bool exclude_self); 53#define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace 54 55#endif /* _ASM_IRQ_H */ 56