ref: 8691b52954e9a93aa41561bccf1b0e230cea359e
parent: 3af8b2a9419db81d68c25759a40f4942be579e35
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Dec 12 13:00:41 EST 2020
sdiahci: enable pci busmaster before ahciconfigdrive() (fix qemu crash) enable pci busmaster before set the fis-receive-enable bit in the port command register. not doing so triggers a crash in qemu like: address_space_unmap: Assertion `mr != NULL' failed. as qemu tries to process the dma command list as soon as we set that flag and busmaster dma needs to be enabled at this point.
--- a/sys/src/9/pc/sdiahci.c
+++ b/sys/src/9/pc/sdiahci.c
@@ -1553,7 +1553,6 @@
}
if(c->ndrive == 0)
panic("iaenable: zero s->ctlr->ndrive");- pcisetbme(c->pci);
snprint(name, sizeof name, "%s (%s)", s->name, s->ifc->name);
intrenable(c->pci->intl, iainterrupt, c, c->pci->tbdf, name);
/* supposed to squelch leftover interrupts here. */
@@ -2228,6 +2227,7 @@
c->drive[d->driveno] = d;
iadrive[niadrive + d->driveno] = d;
}
+ pcisetbme(c->pci);
for(i = 0; i < n; i++){c->drive[i]->mode = DMautoneg;
configdrive(c->drive[i]);
--
⑨