Restructure the IPI code a little, allowing multiple IPIs to be sent at

once.  Add a way to broadcast an IPI to all processors (except the sender,
obviously).  Add an IPI for TLB shootdown.
This commit is contained in:
thorpej 1999-02-24 19:17:09 +00:00
parent 8ef8f5c8fb
commit 911465b54c
2 changed files with 47 additions and 26 deletions

View File

@ -1,7 +1,7 @@
/* $NetBSD: ipifuncs.c,v 1.4 1999/02/23 03:20:01 thorpej Exp $ */
/* $NetBSD: ipifuncs.c,v 1.5 1999/02/24 19:17:09 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -39,7 +39,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.4 1999/02/23 03:20:01 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.5 1999/02/24 19:17:09 thorpej Exp $");
/*
* Interprocessor interrupt handlers.
@ -49,6 +49,8 @@ __KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.4 1999/02/23 03:20:01 thorpej Exp $")
#include <sys/device.h>
#include <sys/systm.h>
#include <vm/vm.h>
#include <machine/alpha_cpu.h>
#include <machine/cpu.h>
#include <machine/intr.h>
@ -57,42 +59,58 @@ __KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.4 1999/02/23 03:20:01 thorpej Exp $")
#include <alpha/alpha/cpuvar.h>
void alpha_ipi_halt __P((void));
void alpha_ipi_imb __P((void));
void alpha_ipi_tbia __P((void));
void alpha_ipi_tbiap __P((void));
void alpha_ipi_imb __P((void));
/*
* NOTE: This table must be kept in order with the bit definitions
* in <machine/intr.h>.
*/
ipifunc_t ipifuncs[ALPHA_NIPIS] = {
alpha_ipi_halt,
alpha_ipi_imb,
alpha_ipi_tbia,
alpha_ipi_tbiap,
pmap_do_tlb_shootdown,
alpha_pal_imb,
};
/*
* Send an interprocessor interrupt.
*/
void
alpha_send_ipi(cpu_id, ipinum)
u_long cpu_id, ipinum;
alpha_send_ipi(cpu_id, ipimask)
u_long cpu_id, ipimask;
{
u_long ipimask;
#ifdef DIAGNOSTIC
if (ipinum >= ALPHA_NIPIS)
panic("alpha_sched_ipi: bogus ipinum");
if (cpu_id >= hwrpb->rpb_pcs_cnt ||
cpu_info[cpu_id].ci_dev == NULL)
panic("alpha_sched_ipi: bogus cpu_id");
#endif
ipimask = (1UL << ipinum);
alpha_atomic_setbits_q(&cpu_info[cpu_id].ci_ipis, ipimask);
printf("SENDING IPI TO %lu\n", cpu_id);
alpha_pal_wripir(cpu_id);
printf("IPI SENT\n");
}
/*
* Broadcast an IPI to all but ourselves.
*/
void
alpha_broadcast_ipi(ipimask)
u_long ipimask;
{
u_long i;
for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) {
if (cpu_info[i].ci_dev == NULL)
continue;
alpha_send_ipi(i, ipimask);
}
}
void
alpha_ipi_halt()
{
@ -111,16 +129,14 @@ alpha_ipi_halt()
/* NOTREACHED */
}
void
alpha_ipi_imb()
{
alpha_pal_imb();
}
void
alpha_ipi_tbia()
{
u_long cpu_id = alpha_pal_whami();
/* If we're doing a TBIA, we don't need to do a TBIAP or a SHOOTDOWN. */
alpha_atomic_clearbits_q(&cpu_info[cpu_id].ci_ipis,
ALPHA_IPI_TBIAP|ALPHA_IPI_SHOOTDOWN);
ALPHA_TBIA();
}
@ -129,5 +145,7 @@ void
alpha_ipi_tbiap()
{
/* Can't clear SHOOTDOWN here; might have PG_ASM mappings. */
ALPHA_TBIAP();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.18 1998/09/26 00:03:52 thorpej Exp $ */
/* $NetBSD: intr.h,v 1.19 1999/02/24 19:17:12 thorpej Exp $ */
/*
* Copyright (c) 1997 Christopher G. Demetriou. All rights reserved.
@ -91,18 +91,21 @@ extern u_int64_t ssir;
#define setsoftserial() ssir |= SIR_SERIAL
/*
* Interprocessor interrupts.
* Interprocessor interrupts. In order how we want them processed.
*/
#define ALPHA_IPI_HALT 0UL /* halt processor */
#define ALPHA_IPI_IMB 1UL /* perform an I-stream barrier */
#define ALPHA_IPI_TBIA 2UL /* TBI all TB entries */
#define ALPHA_IPI_TBIAP 3UL /* TBI all per-process TB entries */
#define ALPHA_NIPIS 4UL /* must not exceed 64 */
#define ALPHA_IPI_HALT 0x0000000000000000UL
#define ALPHA_IPI_TBIA 0x0000000000000001UL
#define ALPHA_IPI_TBIAP 0x0000000000000002UL
#define ALPHA_IPI_SHOOTDOWN 0x0000000000000004UL
#define ALPHA_IPI_IMB 0x0000000000000008UL
#define ALPHA_NIPIS 5 /* must not exceed 64 */
typedef void (*ipifunc_t) __P((void));
extern ipifunc_t ipifuncs[ALPHA_NIPIS];
void alpha_send_ipi __P((unsigned long, unsigned long));
void alpha_broadcast_ipi __P((unsigned long));
/*
* Alpha shared-interrupt-line common code.