virtio: set FeaturesOk flag after feature negotiation, and enable queues before DriverOk flag

This commit is contained in:
cinap_lenrek 2021-07-11 21:49:15 +00:00
parent ad37339a1c
commit e8259861da
2 changed files with 10 additions and 5 deletions

View file

@ -40,7 +40,7 @@ enum {
Sacknowledge = 1, Sacknowledge = 1,
Sdriver = 2, Sdriver = 2,
Sdriverok = 4, Sdriverok = 4,
Sfeatureok = 8, Sfeaturesok = 8,
Sfailed = 128, Sfailed = 128,
/* flags in Qnetstatus */ /* flags in Qnetstatus */
@ -466,14 +466,15 @@ attach(Ether* edev)
} }
ctlr->attached = 1; ctlr->attached = 1;
/* driver is ready */
ctlr->cfg->status |= Sdriverok;
/* enable the queues */ /* enable the queues */
for(i = 0; i < ctlr->nqueue; i++){ for(i = 0; i < ctlr->nqueue; i++){
ctlr->cfg->queuesel = i; ctlr->cfg->queuesel = i;
ctlr->cfg->queueenable = 1; ctlr->cfg->queueenable = 1;
} }
/* driver is ready */
ctlr->cfg->status |= Sdriverok;
iunlock(ctlr); iunlock(ctlr);
/* start kprocs */ /* start kprocs */
@ -692,6 +693,8 @@ pciprobe(void)
cfg->drvfeatsel = 0; cfg->drvfeatsel = 0;
cfg->drvfeat = c->feat[0] & (Fmac|Fctrlvq|Fctrlrx); cfg->drvfeat = c->feat[0] & (Fmac|Fctrlvq|Fctrlrx);
cfg->status |= Sfeaturesok;
for(i=0; i<nelem(c->queue); i++){ for(i=0; i<nelem(c->queue); i++){
cfg->queuesel = i; cfg->queuesel = i;
n = cfg->queuesize; n = cfg->queuesize;

View file

@ -46,6 +46,7 @@ enum {
enum { enum {
Acknowledge = 1, Acknowledge = 1,
Driver = 2, Driver = 2,
FeaturesOk = 8,
DriverOk = 4, DriverOk = 4,
Failed = 0x80, Failed = 0x80,
}; };
@ -335,6 +336,7 @@ Baddev:
cfg->drvfeat = vd->feat[1] & 1; cfg->drvfeat = vd->feat[1] & 1;
cfg->drvfeatsel = 0; cfg->drvfeatsel = 0;
cfg->drvfeat = 0; cfg->drvfeat = 0;
cfg->status |= FeaturesOk;
for(i=0; i<nelem(vd->queue); i++){ for(i=0; i<nelem(vd->queue); i++){
cfg->queuesel = i; cfg->queuesel = i;
@ -698,11 +700,11 @@ vioenable(SDev *sd)
intrenable(vd->pci->intl, viointerrupt, vd, vd->pci->tbdf, name); intrenable(vd->pci->intl, viointerrupt, vd, vd->pci->tbdf, name);
coherence(); coherence();
vd->cfg->status |= DriverOk;
for(i = 0; i < vd->nqueue; i++){ for(i = 0; i < vd->nqueue; i++){
vd->cfg->queuesel = i; vd->cfg->queuesel = i;
vd->cfg->queueenable = 1; vd->cfg->queueenable = 1;
} }
vd->cfg->status |= DriverOk;
return 1; return 1;
} }