diff options
author | emaste <emaste@FreeBSD.org> | 2017-06-13 18:59:34 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2017-06-13 18:59:34 +0000 |
commit | 827871ba869d7ff8e7865971b2a24e11ff6dc200 (patch) | |
tree | 7c8db227b71b6ab9f73488287c0f3e5103ec27f4 /sys/arm | |
parent | 87d087165ebdfa868a01391ff519ae06f32f107e (diff) | |
download | FreeBSD-src-827871ba869d7ff8e7865971b2a24e11ff6dc200.zip FreeBSD-src-827871ba869d7ff8e7865971b2a24e11ff6dc200.tar.gz |
MFC r317428 (cognet): fix arm64 MSI
In arm_gicv2m_alloc_msi(), if we found a suitable irq range, leave the loop
before we increase irq again, or we'd end up choosing an irq, and then
really using the next one, even if it's not available.
Also in the inner loop, correct the end check so that we check every irq,
even the last one.
This makes the msk(4) adapter able to use MSI on Softiron Overdrive 1000.
PR: 219956
Approved by: re (gjb)
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/arm/gic.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/arm/arm/gic.c b/sys/arm/arm/gic.c index ce8c28e..7fe5f2d 100644 --- a/sys/arm/arm/gic.c +++ b/sys/arm/arm/gic.c @@ -1640,7 +1640,7 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, mtx_lock(&sc->sc_mutex); found = false; - for (irq = sc->sc_spi_start; irq < sc->sc_spi_end && !found; irq++) { + for (irq = sc->sc_spi_start; irq < sc->sc_spi_end; irq++) { /* Start on an aligned interrupt */ if ((irq & (maxcount - 1)) != 0) continue; @@ -1649,7 +1649,7 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, found = true; /* Check this range is valid */ - for (end_irq = irq; end_irq != irq + count - 1; end_irq++) { + for (end_irq = irq; end_irq != irq + count; end_irq++) { /* No free interrupts */ if (end_irq == sc->sc_spi_end) { found = false; @@ -1666,6 +1666,8 @@ arm_gicv2m_alloc_msi(device_t dev, device_t child, int count, int maxcount, break; } } + if (found) + break; } /* Not enough interrupts were found */ |