svn commit: r354524 - head/sys/arm/broadcom/bcm2835

Kyle Evans kevans at FreeBSD.org
Fri Nov 8 03:27:57 UTC 2019


Author: kevans
Date: Fri Nov  8 03:27:56 2019
New Revision: 354524
URL: https://svnweb.freebsd.org/changeset/base/354524

Log:
  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 at .
  
  Submitted by:	Robert Crowston <crowston at protonmail.com>

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_dma.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_dma.c	Fri Nov  8 03:14:06 2019	(r354523)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c	Fri Nov  8 03:27:56 2019	(r354524)
@@ -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;


More information about the svn-src-head mailing list