Skip to content

Commit

Permalink
csky: Add irq_work support
Browse files Browse the repository at this point in the history
Running work in hardware interrupt context for csky. Implement:
 - arch_irq_work_raise()
 - arch_irq_work_has_interrupt()

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Guo Ren committed Jul 31, 2020
1 parent 667b932 commit 2c81b07
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/csky/include/asm/irq_work.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0 */

#ifndef __ASM_CSKY_IRQ_WORK_H
#define __ASM_CSKY_IRQ_WORK_H

static inline bool arch_irq_work_has_interrupt(void)
{
return true;
}
extern void arch_irq_work_raise(void);
#endif /* __ASM_CSKY_IRQ_WORK_H */
12 changes: 12 additions & 0 deletions arch/csky/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/irq.h>
#include <linux/irq_work.h>
#include <linux/irqdomain.h>
#include <linux/of.h>
#include <linux/sched/task_stack.h>
Expand All @@ -35,6 +36,7 @@ enum ipi_message_type {
IPI_EMPTY,
IPI_RESCHEDULE,
IPI_CALL_FUNC,
IPI_IRQ_WORK,
IPI_MAX
};

Expand All @@ -53,6 +55,9 @@ static irqreturn_t handle_ipi(int irq, void *dev)
if (ops & (1 << IPI_CALL_FUNC))
generic_smp_call_function_interrupt();

if (ops & (1 << IPI_IRQ_WORK))
irq_work_run();

BUG_ON((ops >> IPI_MAX) != 0);
}

Expand Down Expand Up @@ -108,6 +113,13 @@ void smp_send_reschedule(int cpu)
send_ipi_message(cpumask_of(cpu), IPI_RESCHEDULE);
}

#ifdef CONFIG_IRQ_WORK
void arch_irq_work_raise(void)
{
send_ipi_message(cpumask_of(smp_processor_id()), IPI_IRQ_WORK);
}
#endif

void __init smp_prepare_boot_cpu(void)
{
}
Expand Down

0 comments on commit 2c81b07

Please sign in to comment.