VirtualBox

Changeset 82183 in vbox


Ignore:
Timestamp:
Nov 25, 2019 4:14:33 PM (5 years ago)
Author:
vboxsync
Message:

Storage/DevVirtioSCSI.cpp: Fixed sizeof() calc in virtioScsiR3ReqErr() that probably caused problems with response code. After fix still works booting Linux with non-bootable virtio SCSI disks, but now failes in BIOS boot with bad INQUIRY, which should fail if testing 16 SCSI disks and failing to boot if any of them fail

Location:
trunk/src/VBox/Devices
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp

    r82151 r82183  
    775775    AssertReturn(pabSenseBuf, VERR_NO_MEMORY);
    776776
    777     Log2Func(("   status: %s    response: %s\n", SCSIStatusText(pRespHdr->uStatus), virtioGetReqRespText(pRespHdr->uResponse)));
     777    Log2Func(("   status: %s    response: %s\n",
     778        SCSIStatusText(pRespHdr->uStatus), virtioGetReqRespText(pRespHdr->uResponse)));
    778779
    779780    PRTSGBUF pReqSegBuf = (PRTSGBUF)RTMemAllocZ(sizeof(RTSGBUF));
     
    783784    AssertReturn(paReqSegs, VERR_NO_MEMORY);
    784785
    785     paReqSegs[0].cbSeg = sizeof(pRespHdr);
     786    paReqSegs[0].cbSeg = sizeof(*pRespHdr);
    786787    paReqSegs[0].pvSeg = pRespHdr;
    787788    paReqSegs[1].cbSeg = pThis->virtioScsiConfig.uSenseSize;
     
    842843            break;
    843844        case SCSI_SENSE_NOT_READY:
    844             respHdr->uResponse = VIRTIOSCSI_S_BUSY; /* e.g. re-tryable */
     845            /* Not sure what to return for this. See choices at VirtIO 1.0,  5.6.6.1.1 */
     846            respHdr->uResponse = VIRTIOSCSI_S_FAILURE;
     847            /* respHdr->uResponse = VIRTIOSCSI_S_BUSY; */ /* BUSY is VirtIO's 'retryable' response */
    845848            break;
    846849        default:
     
    871874    AssertRC(rc);
    872875
    873     /* Masking used to deal with datatype size differences between APIs (Windows complains otherwise) */
     876    /* Masking deals with data type size discrepancies between
     877     * The APIs (virtio and VBox). Windows C-compiler complains otherwise */
    874878    Assert(!(cbXfer & 0xffffffff00000000));
    875879    uint32_t cbXfer32 = cbXfer & 0xffffffff;
     
    11261130    {
    11271131        LogRel(("* * * REPORT LUNS LU ACCESSED * * * "));
    1128         uScsiLun = 0xff; /* Force rejection. todo: figure out right way to handle, r=paul */
     1132        /* Force rejection. todo: figure out right way to handle. Note this is a very
     1133         * vague and confusing part of the VirtIO spec which deviates from the SCSI standard
     1134         * as Klaus has pointed out on numerous occasions. I have not been able to determine
     1135         * how to implement this properly. Nor do I see any of the guest drivers at this
     1136         * point making use of it, hence the loud log message so we can catch it if/when a guest
     1137         * does access it and can resume the investigation at that point.  r=paul */
     1138        uScsiLun = 0xff;
    11291139    }
    11301140    else
     
    11661176    }
    11671177
    1168     if (RT_LIKELY(uTarget < pThis->cTargets
    1169                   &&  pThisCC->paTargetInstances[uTarget].fPresent
    1170                   &&  pThisCC->paTargetInstances[uTarget].pDrvMediaEx))
     1178    if (RT_LIKELY(   uTarget < pThis->cTargets
     1179                  && pThisCC->paTargetInstances[uTarget].fPresent
     1180                  && pThisCC->paTargetInstances[uTarget].pDrvMediaEx))
    11711181    { /*  likely */ }
    11721182    else
     
    15511561                if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING))
    15521562                    return VINF_SUCCESS;
     1563                if (rc == VERR_INTERRUPTED)
     1564                    continue;
    15531565                Log6Func(("%s worker woken\n", VIRTQNAME(qIdx)));
    15541566                ASMAtomicWriteBool(&pWorkerR3->fNotified, false);
     
    19982010    pHlp->pfnSSMGetU32(pSSM,  &pThis->fResetting);
    19992011
    2000     /** @todo Ask aeichner about BIOS-related changes */
    2001 
    20022012    pHlp->pfnSSMGetU32(pSSM, &pThis->cTargets);
    20032013
     
    20782088    pHlp->pfnSSMPutU32(pSSM,  pThis->fHasLunChange);
    20792089    pHlp->pfnSSMPutU32(pSSM,  pThis->fResetting);
    2080 
    2081     /** @todo Ask aeichner about BIOS-related changes */
    20822090
    20832091    AssertMsg(!pThis->cActiveReqs, ("There are still outstanding requests on this device\n"));
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp

    r82151 r82183  
    170170DECLINLINE(bool) virtqIsEmpty(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue)
    171171{
    172     return virtioReadAvailRingIdx(pDevIns, pVirtio, idxQueue) == pVirtio->virtqState[idxQueue].uAvailIdx;
     172    uint16_t uAvailGst = virtioReadAvailRingIdx(pDevIns, pVirtio, idxQueue);
     173    bool fEmpty = uAvailGst == pVirtio->virtqState[idxQueue].uAvailIdx;
     174
     175    LogFlow(("Q<%u>: uAvailGst=%u uAvailIdx=%u -> fEmpty=%RTbool\n",
     176             idxQueue, uAvailGst, pVirtio->virtqState[idxQueue].uAvailIdx, fEmpty));
     177    return fEmpty;
    173178}
    174179
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette