Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123036
b: refs/heads/master
c: 25ddd73
h: refs/heads/master
v: v3
  • Loading branch information
Milton Miller authored and Paul Mackerras committed Nov 19, 2008
1 parent dcaca12 commit 95ba6ba
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a6326e98a28d8a57f693369c82559543c6950f09
refs/heads/master: 25ddd738c2ebffb6c2d3cf29c91b986d1bb39c99
7 changes: 7 additions & 0 deletions trunk/arch/powerpc/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ extern int cpu_to_core_id(int cpu);
#define PPC_MSG_CALL_FUNC_SINGLE 2
#define PPC_MSG_DEBUGGER_BREAK 3

/*
* irq controllers that have dedicated ipis per message and don't
* need additional code in the action handler may use this
*/
extern int smp_request_message_ipi(int virq, int message);
extern const char *smp_ipi_name[];

void smp_init_iSeries(void);
void smp_init_pSeries(void);
void smp_init_cell(void);
Expand Down
59 changes: 59 additions & 0 deletions trunk/arch/powerpc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,65 @@ void smp_message_recv(int msg)
}
}

static irqreturn_t call_function_action(int irq, void *data)
{
generic_smp_call_function_interrupt();
return IRQ_HANDLED;
}

static irqreturn_t reschedule_action(int irq, void *data)
{
/* we just need the return path side effect of checking need_resched */
return IRQ_HANDLED;
}

static irqreturn_t call_function_single_action(int irq, void *data)
{
generic_smp_call_function_single_interrupt();
return IRQ_HANDLED;
}

static irqreturn_t debug_ipi_action(int irq, void *data)
{
smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
return IRQ_HANDLED;
}

static irq_handler_t smp_ipi_action[] = {
[PPC_MSG_CALL_FUNCTION] = call_function_action,
[PPC_MSG_RESCHEDULE] = reschedule_action,
[PPC_MSG_CALL_FUNC_SINGLE] = call_function_single_action,
[PPC_MSG_DEBUGGER_BREAK] = debug_ipi_action,
};

const char *smp_ipi_name[] = {
[PPC_MSG_CALL_FUNCTION] = "ipi call function",
[PPC_MSG_RESCHEDULE] = "ipi reschedule",
[PPC_MSG_CALL_FUNC_SINGLE] = "ipi call function single",
[PPC_MSG_DEBUGGER_BREAK] = "ipi debugger",
};

/* optional function to request ipi, for controllers with >= 4 ipis */
int smp_request_message_ipi(int virq, int msg)
{
int err;

if (msg < 0 || msg > PPC_MSG_DEBUGGER_BREAK) {
return -EINVAL;
}
#if !defined(CONFIG_DEBUGGER) && !defined(CONFIG_KEXEC)
if (msg == PPC_MSG_DEBUGGER_BREAK) {
return 1;
}
#endif
err = request_irq(virq, smp_ipi_action[msg], IRQF_DISABLED|IRQF_PERCPU,
smp_ipi_name[msg], 0);
WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n",
virq, smp_ipi_name[msg], err);

return err;
}

void smp_send_reschedule(int cpu)
{
if (likely(smp_ops))
Expand Down

0 comments on commit 95ba6ba

Please sign in to comment.