bcm2835_dma: Mark IRQs shareable

On the RPi4, some of these IRQs are shared. Start moving toward a mode where
we accept that shared IRQs happen and simply ignore interrupts that are
seemingly for no reason.

I would like to be more verbose here, but my 30-minute assessment of the
current world order is that mapping a resource/rid to an actual IRQ number
(as found in FDT) data is not a simple matter. Determining if more than one
handler is attached to an IRQ is closer to feasible, but it's unclear which
way is the cleaner path. Beyond that, we're only really using it to be
slightly more verbose when something's going wrong, so for now just suppress
and drop a complaint-comment.

This was originally submitted (via freebsd-arm@) by Robert Crowston; the
additional verbosity was dropped by kevans@.

Submitted by:	Robert Crowston <crowston@protonmail.com>
This commit is contained in:
kevans 2019-11-08 03:27:56 +00:00
parent bfcbe6b575
commit 8dc188276e

View File

@ -619,18 +619,18 @@ bcm_dma_intr(void *arg)
/* my interrupt? */
cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch->ch));
if (!(cs & (CS_INT | CS_ERR))) {
device_printf(sc->sc_dev,
"unexpected DMA intr CH=%d, CS=%x\n", ch->ch, cs);
/*
* Is it an active channel? Our diagnostics could be better here, but
* it's not necessarily an easy task to resolve a rid/resource to an
* actual irq number. We'd want to do this to set a flag indicating
* whether the irq is shared or not, so we know to complain.
*/
if (!(ch->flags & BCM_DMA_CH_USED))
return;
}
/* running? */
if (!(ch->flags & BCM_DMA_CH_USED)) {
device_printf(sc->sc_dev,
"unused DMA intr CH=%d, CS=%x\n", ch->ch, cs);
/* Again, we can't complain here. The same logic applies. */
if (!(cs & (CS_INT | CS_ERR)))
return;
}
if (cs & CS_ERR) {
debug = bus_read_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch));
@ -715,7 +715,7 @@ bcm_dma_attach(device_t dev)
continue;
sc->sc_irq[rid] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_ACTIVE);
RF_ACTIVE | RF_SHAREABLE);
if (sc->sc_irq[rid] == NULL) {
device_printf(dev, "cannot allocate interrupt\n");
err = ENXIO;