[PowerPC] [Book-E] Fix dpaa interrupt binding.

After the network epoch was added, we lost the ability to migrate the
ithread in the middle of dispatch, as being in the network epoch will pin
the current thread (for safety reasons.)

Luckily, we don't actually have to do this workaround in the first place,
as we can just bind it to the correct cpu when we preallocate it.

Pass dev through to XX_PreallocAndBindIntr() and actually bind it to the
cpu like it was supposed to in the first place, instad of leaving it
floating and moving it to the correct cpu the first time it fires.

This fixes panics while bringing up dtsec on my X5000.

Reviewed by:	jhibbits
Sponsored by:	Tag1 Consulting, Inc.
Differential Revision:	https://reviews.freebsd.org/D23826
This commit is contained in:
Brandon Bergren 2020-02-25 03:35:52 +00:00
parent d029e3b3f7
commit b9931c0786
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=358307
3 changed files with 8 additions and 16 deletions

View File

@ -205,7 +205,7 @@ uint32_t XX_DisableAllIntr(void);
void XX_RestoreAllIntr(uint32_t flags);
t_Error XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu);
t_Error XX_PreallocAndBindIntr(device_t dev, uintptr_t irq, unsigned int cpu);
t_Error XX_DeallocIntr(uintptr_t irq);
/**************************************************************************//**

View File

@ -95,8 +95,7 @@ MTX_SYSINIT(XX_MallocTrackLockInit, &XX_MallocTrackLock,
/* Interrupt info */
#define XX_INTR_FLAG_PREALLOCATED (1 << 0)
#define XX_INTR_FLAG_BOUND (1 << 1)
#define XX_INTR_FLAG_FMAN_FIX (1 << 2)
#define XX_INTR_FLAG_FMAN_FIX (1 << 1)
struct XX_IntrInfo {
driver_intr_t *handler;
@ -320,16 +319,6 @@ XX_Dispatch(void *arg)
info = arg;
/* Bind this thread to proper CPU when SMP has been already started. */
if ((info->flags & XX_INTR_FLAG_BOUND) == 0 && smp_started &&
info->cpu >= 0) {
thread_lock(curthread);
sched_bind(curthread, info->cpu);
thread_unlock(curthread);
info->flags |= XX_INTR_FLAG_BOUND;
}
if (info->handler == NULL) {
printf("%s(): IRQ handler is NULL!\n", __func__);
return;
@ -339,7 +328,7 @@ XX_Dispatch(void *arg)
}
t_Error
XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu)
XX_PreallocAndBindIntr(device_t dev, uintptr_t irq, unsigned int cpu)
{
struct resource *r;
unsigned int inum;
@ -352,6 +341,10 @@ XX_PreallocAndBindIntr(uintptr_t irq, unsigned int cpu)
if (error != 0)
return (error);
error = bus_bind_intr(dev, r, cpu);
if (error != 0)
return (error);
XX_IntrInfo[inum].flags = XX_INTR_FLAG_PREALLOCATED;
XX_IntrInfo[inum].cpu = cpu;

View File

@ -120,8 +120,7 @@ dpaa_portal_alloc_res(device_t dev, struct dpaa_portals_devinfo *di, int cpu)
device_printf(dev, "Could not allocate irq.\n");
return (ENXIO);
}
err = XX_PreallocAndBindIntr((uintptr_t)sc->sc_dp[cpu].dp_ires, cpu);
err = XX_PreallocAndBindIntr(dev, (uintptr_t)sc->sc_dp[cpu].dp_ires, cpu);
if (err != E_OK) {
device_printf(dev, "Could not prealloc and bind interrupt\n");