2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 17:53:56 +08:00

tile: support arch_irq_work_raise

Tile includes a hypervisor hook to deliver messages to arbitrary
tiles, so we can use that to raise an interrupt as soon as
possible on our own core.  Unfortunately the Tilera hypervisor
disabled that support on principle in previous releases, but
it will be available in MDE 4.3.4 and later.

Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
Chris Metcalf 2015-03-23 11:21:23 -04:00
parent 9088616fb3
commit b340c656af
4 changed files with 46 additions and 2 deletions

View File

@ -16,7 +16,6 @@ generic-y += ioctl.h
generic-y += ioctls.h generic-y += ioctls.h
generic-y += ipcbuf.h generic-y += ipcbuf.h
generic-y += irq_regs.h generic-y += irq_regs.h
generic-y += irq_work.h
generic-y += local.h generic-y += local.h
generic-y += local64.h generic-y += local64.h
generic-y += mcs_spinlock.h generic-y += mcs_spinlock.h

View File

@ -0,0 +1,14 @@
#ifndef __ASM_IRQ_WORK_H
#define __ASM_IRQ_WORK_H
static inline bool arch_irq_work_has_interrupt(void)
{
#ifdef CONFIG_SMP
extern bool self_interrupt_ok;
return self_interrupt_ok;
#else
return false;
#endif
}
#endif /* __ASM_IRQ_WORK_H */

View File

@ -69,6 +69,7 @@ static inline int xy_to_cpu(int x, int y)
#define MSG_TAG_STOP_CPU 2 #define MSG_TAG_STOP_CPU 2
#define MSG_TAG_CALL_FUNCTION_MANY 3 #define MSG_TAG_CALL_FUNCTION_MANY 3
#define MSG_TAG_CALL_FUNCTION_SINGLE 4 #define MSG_TAG_CALL_FUNCTION_SINGLE 4
#define MSG_TAG_IRQ_WORK 5
/* Hook for the generic smp_call_function_many() routine. */ /* Hook for the generic smp_call_function_many() routine. */
static inline void arch_send_call_function_ipi_mask(struct cpumask *mask) static inline void arch_send_call_function_ipi_mask(struct cpumask *mask)

View File

@ -18,6 +18,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/irq_work.h>
#include <linux/module.h> #include <linux/module.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/homecache.h> #include <asm/homecache.h>
@ -33,6 +34,8 @@ EXPORT_SYMBOL(smp_topology);
static unsigned long __iomem *ipi_mappings[NR_CPUS]; static unsigned long __iomem *ipi_mappings[NR_CPUS];
#endif #endif
/* Does messaging work correctly to the local cpu? */
bool self_interrupt_ok;
/* /*
* Top-level send_IPI*() functions to send messages to other cpus. * Top-level send_IPI*() functions to send messages to other cpus.
@ -147,6 +150,10 @@ void evaluate_message(int tag)
generic_smp_call_function_single_interrupt(); generic_smp_call_function_single_interrupt();
break; break;
case MSG_TAG_IRQ_WORK: /* Invoke IRQ work */
irq_work_run();
break;
default: default:
panic("Unknown IPI message tag %d", tag); panic("Unknown IPI message tag %d", tag);
break; break;
@ -186,6 +193,15 @@ void flush_icache_range(unsigned long start, unsigned long end)
EXPORT_SYMBOL(flush_icache_range); EXPORT_SYMBOL(flush_icache_range);
#ifdef CONFIG_IRQ_WORK
void arch_irq_work_raise(void)
{
if (arch_irq_work_has_interrupt())
send_IPI_single(smp_processor_id(), MSG_TAG_IRQ_WORK);
}
#endif
/* Called when smp_send_reschedule() triggers IRQ_RESCHEDULE. */ /* Called when smp_send_reschedule() triggers IRQ_RESCHEDULE. */
static irqreturn_t handle_reschedule_ipi(int irq, void *token) static irqreturn_t handle_reschedule_ipi(int irq, void *token)
{ {
@ -203,8 +219,22 @@ static struct irqaction resched_action = {
void __init ipi_init(void) void __init ipi_init(void)
{ {
int cpu = smp_processor_id();
HV_Recipient recip = { .y = cpu_y(cpu), .x = cpu_x(cpu),
.state = HV_TO_BE_SENT };
int tag = MSG_TAG_CALL_FUNCTION_SINGLE;
/*
* Test if we can message ourselves for arch_irq_work_raise.
* This functionality is only available in the Tilera hypervisor
* in versions 4.3.4 and following.
*/
if (hv_send_message(&recip, 1, (HV_VirtAddr)&tag, sizeof(tag)) == 1)
self_interrupt_ok = true;
else
pr_warn("Older hypervisor: disabling fast irq_work_raise\n");
#if CHIP_HAS_IPI() #if CHIP_HAS_IPI()
int cpu;
/* Map IPI trigger MMIO addresses. */ /* Map IPI trigger MMIO addresses. */
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
HV_Coord tile; HV_Coord tile;