VirtualBox

Changeset 84504 in vbox


Ignore:
Timestamp:
May 25, 2020 2:51:42 PM (5 years ago)
Author:
vboxsync
Message:

Devices/Storage: Convert to use new PDMDevHlp guest memory read/write helpers differentiating between metadata/userdata transfers for tracing, bugref:9210

Location:
trunk/src/VBox/Devices/Storage
Files:
4 edited

Legend:

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

    r82968 r84504  
    56115611        else
    56125612        {
    5613             PDMDevHlpPhysRead(pDevIns, GCPhysDesc, &DMADesc, sizeof(BMDMADesc));
     5613            PDMDevHlpPhysReadMeta(pDevIns, GCPhysDesc, &DMADesc, sizeof(BMDMADesc));
    56145614            GCPhysBuffer = RT_LE2H_U32(DMADesc.GCPhysBuffer);
    56155615            cbBuffer = RT_LE2H_U32(DMADesc.cbBuffer);
     
    56325632
    56335633                if (uTxDir == PDMMEDIATXDIR_FROM_DEVICE)
    5634                     PDMDevHlpPCIPhysWrite(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
     5634                    PDMDevHlpPCIPhysWriteUser(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
    56355635                else
    5636                     PDMDevHlpPCIPhysRead(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
     5636                    PDMDevHlpPCIPhysReadUser(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer);
    56375637
    56385638                iIOBufferCur    += cbXfer;
  • trunk/src/VBox/Devices/Storage/DevBusLogic.cpp

    r83141 r84504  
    12331233
    12341234/**
    1235  * Memory write helper to handle PCI/ISA differences.
     1235 * Memory write helper to handle PCI/ISA differences - metadata writes.
    12361236 *
    12371237 * @returns nothing.
     
    12421242 * @param   cbWrite     Number of bytes to write
    12431243 */
    1244 static void blPhysWrite(PPDMDEVINS pDevIns, PBUSLOGIC pThis, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
     1244static void blPhysWriteMeta(PPDMDEVINS pDevIns, PBUSLOGIC pThis, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
    12451245{
    12461246    if (!pThis->uIsaIrq)
    1247         PDMDevHlpPCIPhysWrite(pDevIns, GCPhys, pvBuf, cbWrite);
     1247        PDMDevHlpPCIPhysWriteMeta(pDevIns, GCPhys, pvBuf, cbWrite);
    12481248    else
    1249         PDMDevHlpPhysWrite(pDevIns, GCPhys, pvBuf, cbWrite);
     1249        PDMDevHlpPhysWriteMeta(pDevIns, GCPhys, pvBuf, cbWrite);
    12501250}
    12511251
    12521252#if defined(IN_RING3)
     1253
     1254/**
     1255 * Memory write helper to handle PCI/ISA differences - userdata writes.
     1256 *
     1257 * @returns nothing.
     1258 * @param   pDevIns     The device instance.
     1259 * @param   pThis       Pointer to the shared BusLogic instance data.
     1260 * @param   GCPhys      Guest physical memory address
     1261 * @param   pvBuf       Host side buffer address
     1262 * @param   cbWrite     Number of bytes to write
     1263 */
     1264static void blPhysWriteUser(PPDMDEVINS pDevIns, PBUSLOGIC pThis, RTGCPHYS GCPhys, const void *pvBuf, size_t cbWrite)
     1265{
     1266    if (!pThis->uIsaIrq)
     1267        PDMDevHlpPCIPhysWriteUser(pDevIns, GCPhys, pvBuf, cbWrite);
     1268    else
     1269        PDMDevHlpPhysWriteUser(pDevIns, GCPhys, pvBuf, cbWrite);
     1270}
    12531271
    12541272/**
     
    13181336        pCCBGuest->c.uDeviceStatus      = uDeviceStatus;
    13191337        /* Rewrite CCB up to the CDB; perhaps more than necessary. */
    1320         blPhysWrite(pDevIns, pThis, GCPhysAddrCCB, pCCBGuest, RT_UOFFSETOF(CCBC, abCDB));
     1338        blPhysWriteMeta(pDevIns, pThis, GCPhysAddrCCB, pCCBGuest, RT_UOFFSETOF(CCBC, abCDB));
    13211339    }
    13221340
     
    13241342    uint8_t     uCode;
    13251343    unsigned    uCodeOffs = pThis->fMbxIs24Bit ? RT_OFFSETOF(Mailbox24, uCmdState) : RT_OFFSETOF(Mailbox32, u.out.uActionCode);
    1326     PDMDevHlpPhysRead(pDevIns, GCPhysAddrMailboxIncoming + uCodeOffs, &uCode, sizeof(uCode));
     1344    PDMDevHlpPhysReadMeta(pDevIns, GCPhysAddrMailboxIncoming + uCodeOffs, &uCode, sizeof(uCode));
    13271345    Assert(uCode == BUSLOGIC_MAILBOX_INCOMING_COMPLETION_FREE);
    13281346# endif
     
    13361354        U32_TO_ADDR(Mbx24.aPhysAddrCCB, MbxIn.u32PhysAddrCCB);
    13371355        Log(("24-bit mailbox: completion code=%u, CCB at %RGp\n", Mbx24.uCmdState, (RTGCPHYS)ADDR_TO_U32(Mbx24.aPhysAddrCCB)));
    1338         blPhysWrite(pDevIns, pThis, GCPhysAddrMailboxIncoming, &Mbx24, sizeof(Mailbox24));
     1356        blPhysWriteMeta(pDevIns, pThis, GCPhysAddrMailboxIncoming, &Mbx24, sizeof(Mailbox24));
    13391357    }
    13401358    else
    13411359    {
    13421360        Log(("32-bit mailbox: completion code=%u, CCB at %RGp\n", MbxIn.u.in.uCompletionCode, GCPhysAddrCCB));
    1343         blPhysWrite(pDevIns, pThis, GCPhysAddrMailboxIncoming, &MbxIn, sizeof(Mailbox32));
     1361        blPhysWriteMeta(pDevIns, pThis, GCPhysAddrMailboxIncoming, &MbxIn, sizeof(Mailbox32));
    13441362    }
    13451363
     
    14451463
    14461464        Log2(("Converting %u 24-bit S/G entries to 32-bit\n", cEntries));
    1447         PDMDevHlpPhysRead(pDevIns, GCSGList, &aSGE24, cEntries * sizeof(SGE24));
     1465        PDMDevHlpPhysReadMeta(pDevIns, GCSGList, &aSGE24, cEntries * sizeof(SGE24));
    14481466        for (uint32_t i = 0; i < cEntries; ++i)
    14491467        {
     
    14531471    }
    14541472    else
    1455         PDMDevHlpPhysRead(pDevIns, GCSGList, pSGEList, cEntries * sizeof(SGE32));
     1473        PDMDevHlpPhysReadMeta(pDevIns, GCSGList, pSGEList, cEntries * sizeof(SGE32));
    14561474}
    14571475
     
    15611579
    15621580        AssertPtr(pvSeg);
    1563         PDMDevHlpPhysRead(pDevIns, GCPhys, pvSeg, cbSeg);
     1581        PDMDevHlpPhysReadUser(pDevIns, GCPhys, pvSeg, cbSeg);
    15641582        GCPhys += cbSeg;
    15651583        cbCopy -= cbSeg;
     
    15861604
    15871605        AssertPtr(pvSeg);
    1588         blPhysWrite(pDevIns, pThis, GCPhys, pvSeg, cbSeg);
     1606        blPhysWriteUser(pDevIns, pThis, GCPhys, pvSeg, cbSeg);
    15891607        GCPhys += cbSeg;
    15901608        cbCopy -= cbSeg;
     
    17911809
    17921810        Log3(("%s: sense buffer: %.*Rhxs\n", __FUNCTION__, cbSenseBuffer, pReq->pbSenseBuffer));
    1793         blPhysWrite(pDevIns, pThis, GCPhysAddrSenseBuffer, pReq->pbSenseBuffer, cbSenseBuffer);
     1811        blPhysWriteMeta(pDevIns, pThis, GCPhysAddrSenseBuffer, pReq->pbSenseBuffer, cbSenseBuffer);
    17941812    }
    17951813
     
    23182336            GCPhysFifoBuf = (RTGCPHYS)ADDR_TO_U32(addr);
    23192337            Log(("Write busmaster FIFO at: %04X\n", ADDR_TO_U32(addr)));
    2320             PDMDevHlpPhysRead(pDevIns, GCPhysFifoBuf,
    2321                               &pThis->LocalRam.u8View[64], 64);
     2338            PDMDevHlpPhysReadMeta(pDevIns, GCPhysFifoBuf,
     2339                                  &pThis->LocalRam.u8View[64], 64);
    23222340            break;
    23232341        }
     
    23332351            GCPhysFifoBuf = (RTGCPHYS)ADDR_TO_U32(addr);
    23342352            Log(("Read busmaster FIFO at: %04X\n", ADDR_TO_U32(addr)));
    2335             blPhysWrite(pDevIns, pThis, GCPhysFifoBuf, &pThis->LocalRam.u8View[64], 64);
     2353            blPhysWriteMeta(pDevIns, pThis, GCPhysFifoBuf, &pThis->LocalRam.u8View[64], 64);
    23362354            break;
    23372355        }
     
    31723190    /* Fetch the CCB from guest memory. */
    31733191    /** @todo How much do we really have to read? */
    3174     PDMDevHlpPhysRead(pDevIns, GCPhysAddrCCB,
    3175                       &CCBGuest, sizeof(CCB32));
     3192    PDMDevHlpPhysReadMeta(pDevIns, GCPhysAddrCCB, &CCBGuest, sizeof(CCB32));
    31763193
    31773194    uTargetIdCCB = pThis->fMbxIs24Bit ? CCBGuest.o.uTargetId : CCBGuest.n.uTargetId;
     
    32573274    CCBU     CCBGuest;
    32583275
    3259     PDMDevHlpPhysRead(pDevIns, GCPhysAddrCCB,
    3260                       &CCBGuest, sizeof(CCB32));
     3276    PDMDevHlpPhysReadMeta(pDevIns, GCPhysAddrCCB, &CCBGuest, sizeof(CCB32));
    32613277
    32623278    uTargetIdCCB = pThis->fMbxIs24Bit ? CCBGuest.o.uTargetId : CCBGuest.n.uTargetId;
     
    32933309
    32943310        GCMailbox = pThis->GCPhysAddrMailboxOutgoingBase + (pThis->uMailboxOutgoingPositionCurrent * sizeof(Mailbox24));
    3295         PDMDevHlpPhysRead(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
     3311        PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
    32963312        pMbx->u32PhysAddrCCB    = ADDR_TO_U32(Mbx24.aPhysAddrCCB);
    32973313        pMbx->u.out.uActionCode = Mbx24.uCmdState;
     
    33003316    {
    33013317        GCMailbox = pThis->GCPhysAddrMailboxOutgoingBase + (pThis->uMailboxOutgoingPositionCurrent * sizeof(Mailbox32));
    3302         PDMDevHlpPhysRead(pDevIns, GCMailbox, pMbx, sizeof(Mailbox32));
     3318        PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, pMbx, sizeof(Mailbox32));
    33033319    }
    33043320
     
    33613377    uint8_t uActionCode = BUSLOGIC_MAILBOX_OUTGOING_ACTION_FREE;
    33623378    unsigned uCodeOffs = pThis->fMbxIs24Bit ? RT_OFFSETOF(Mailbox24, uCmdState) : RT_OFFSETOF(Mailbox32, u.out.uActionCode);
    3363     blPhysWrite(pDevIns, pThis, GCPhysAddrMailboxCurrent + uCodeOffs, &uActionCode, sizeof(uActionCode));
     3379    blPhysWriteMeta(pDevIns, pThis, GCPhysAddrMailboxCurrent + uCodeOffs, &uActionCode, sizeof(uActionCode));
    33643380
    33653381    if (MailboxGuest.u.out.uActionCode == BUSLOGIC_MAILBOX_OUTGOING_ACTION_START_COMMAND)
     
    38233839            for (i = 0; i < pThis->cMailbox; ++i)
    38243840            {
    3825                 PDMDevHlpPhysRead(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
     3841                PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
    38263842                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %06X action code %02X", i, ADDR_TO_U32(Mbx24.aPhysAddrCCB), Mbx24.uCmdState);
    38273843                pHlp->pfnPrintf(pHlp, "%s\n", pThis->uMailboxOutgoingPositionCurrent == i ? " *" : "");
     
    38343850            for (i = 0; i < pThis->cMailbox; ++i)
    38353851            {
    3836                 PDMDevHlpPhysRead(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
     3852                PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
    38373853                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %06X completion code %02X", i, ADDR_TO_U32(Mbx24.aPhysAddrCCB), Mbx24.uCmdState);
    38383854                pHlp->pfnPrintf(pHlp, "%s\n", pThis->uMailboxIncomingPositionCurrent == i ? " *" : "");
     
    38503866            for (i = 0; i < pThis->cMailbox; ++i)
    38513867            {
    3852                 PDMDevHlpPhysRead(pDevIns, GCMailbox, &Mbx32, sizeof(Mailbox32));
     3868                PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx32, sizeof(Mailbox32));
    38533869                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %08X action code %02X", i, Mbx32.u32PhysAddrCCB, Mbx32.u.out.uActionCode);
    38543870                pHlp->pfnPrintf(pHlp, "%s\n", pThis->uMailboxOutgoingPositionCurrent == i ? " *" : "");
     
    38613877            for (i = 0; i < pThis->cMailbox; ++i)
    38623878            {
    3863                 PDMDevHlpPhysRead(pDevIns, GCMailbox, &Mbx32, sizeof(Mailbox32));
     3879                PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx32, sizeof(Mailbox32));
    38643880                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %08X completion code %02X BTSTAT %02X SDSTAT %02X", i,
    38653881                                Mbx32.u32PhysAddrCCB, Mbx32.u.in.uCompletionCode, Mbx32.u.in.uHostAdapterStatus, Mbx32.u.in.uTargetDeviceStatus);
  • trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp

    r82968 r84504  
    747747
    748748        /* Write reply to guest memory. */
    749         PDMDevHlpPCIPhysWrite(pDevIns, GCPhysReplyMessage, pReply, cbReplyCopied);
     749        PDMDevHlpPCIPhysWriteMeta(pDevIns, GCPhysReplyMessage, pReply, cbReplyCopied);
    750750
    751751        /* Write low 32bits of reply frame into post reply queue. */
     
    18911891
    18921892        AssertPtr(pvSeg);
    1893         PDMDevHlpPhysRead(pDevIns, GCPhys, pvSeg, cbSeg);
     1893        PDMDevHlpPhysReadUser(pDevIns, GCPhys, pvSeg, cbSeg);
    18941894        GCPhys += cbSeg;
    18951895        cbCopy -= cbSeg;
     
    19161916
    19171917        AssertPtr(pvSeg);
    1918         PDMDevHlpPCIPhysWrite(pDevIns, GCPhys, pvSeg, cbSeg);
     1918        PDMDevHlpPCIPhysWriteUser(pDevIns, GCPhys, pvSeg, cbSeg);
    19191919        GCPhys += cbSeg;
    19201920        cbCopy -= cbSeg;
     
    19641964
    19651965            /* Read the entry. */
    1966             PDMDevHlpPhysRead(pDevIns, GCPhysSgEntryNext, &SGEntry, sizeof(MptSGEntryUnion));
     1966            PDMDevHlpPhysReadMeta(pDevIns, GCPhysSgEntryNext, &SGEntry, sizeof(MptSGEntryUnion));
    19671967
    19681968# ifdef LOG_ENABLED
     
    20092009            MptSGEntryChain SGEntryChain;
    20102010
    2011             PDMDevHlpPhysRead(pDevIns, GCPhysSegmentStart + cChainOffsetNext, &SGEntryChain, sizeof(MptSGEntryChain));
     2011            PDMDevHlpPhysReadMeta(pDevIns, GCPhysSegmentStart + cChainOffsetNext, &SGEntryChain, sizeof(MptSGEntryChain));
    20122012
    20132013            AssertMsg(SGEntryChain.u2ElementType == MPTSGENTRYTYPE_CHAIN, ("Invalid SG entry type\n"));
     
    21482148
    21492149        /* Copy the sense buffer over. */
    2150         PDMDevHlpPCIPhysWrite(pDevIns, GCPhysAddrSenseBuffer, pReq->abSenseBuffer,
    2151                               RT_UNLIKELY(  pReq->GuestRequest.SCSIIO.u8SenseBufferLength
    2152                                           < sizeof(pReq->abSenseBuffer))
    2153                               ? pReq->GuestRequest.SCSIIO.u8SenseBufferLength
    2154                               : sizeof(pReq->abSenseBuffer));
     2150        PDMDevHlpPCIPhysWriteMeta(pDevIns, GCPhysAddrSenseBuffer, pReq->abSenseBuffer,
     2151                                  RT_UNLIKELY(  pReq->GuestRequest.SCSIIO.u8SenseBufferLength
     2152                                              < sizeof(pReq->abSenseBuffer))
     2153                                  ? pReq->GuestRequest.SCSIIO.u8SenseBufferLength
     2154                                  : sizeof(pReq->abSenseBuffer));
    21552155
    21562156        if (RT_SUCCESS(rcReq) && RT_LIKELY(pReq->u8ScsiSts == SCSI_STATUS_OK))
     
    32413241                    GCPhysAddrPageBuffer |= (uint64_t)pConfigurationReq->SimpleSGElement.u32DataBufferAddressHigh << 32;
    32423242
    3243                 PDMDevHlpPCIPhysWrite(pDevIns, GCPhysAddrPageBuffer, pbPageData, RT_MIN(cbBuffer, cbPage));
     3243                PDMDevHlpPCIPhysWriteMeta(pDevIns, GCPhysAddrPageBuffer, pbPageData, RT_MIN(cbBuffer, cbPage));
    32443244            }
    32453245            break;
     
    32573257                LogFlow(("cbBuffer=%u cbPage=%u\n", cbBuffer, cbPage));
    32583258
    3259                 PDMDevHlpPhysRead(pDevIns, GCPhysAddrPageBuffer, pbPageData,
    3260                                   RT_MIN(cbBuffer, cbPage));
     3259                PDMDevHlpPhysReadMeta(pDevIns, GCPhysAddrPageBuffer, pbPageData,
     3260                                      RT_MIN(cbBuffer, cbPage));
    32613261            }
    32623262            break;
     
    41414141
    41424142            /* Read the message header from the guest first. */
    4143             PDMDevHlpPhysRead(pDevIns, GCPhysMessageFrameAddr, &GuestRequest, sizeof(MptMessageHdr));
     4143            PDMDevHlpPhysReadMeta(pDevIns, GCPhysMessageFrameAddr, &GuestRequest, sizeof(MptMessageHdr));
    41444144
    41454145            /* Determine the size of the request. */
     
    41894189            {
    41904190                /* Read the complete message frame from guest memory now. */
    4191                 PDMDevHlpPhysRead(pDevIns, GCPhysMessageFrameAddr, &GuestRequest, cbRequest);
     4191                PDMDevHlpPhysReadMeta(pDevIns, GCPhysMessageFrameAddr, &GuestRequest, cbRequest);
    41924192
    41934193                /* Handle SCSI I/O requests now. */
  • trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp

    r84468 r84504  
    10851085        cbCopied = RT_MIN(pSgBuf->cbSegLeft,  pSgPhysReturn->cbSegLeft);
    10861086        Assert(cbCopied > 0);
    1087         PDMDevHlpPCIPhysWrite(pDevIns, pSgPhysReturn->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
     1087        PDMDevHlpPCIPhysWriteUser(pDevIns, pSgPhysReturn->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
    10881088        RTSgBufAdvance(pSgBuf, cbCopied);
    10891089        virtioCoreSgBufAdvance(pSgPhysReturn, cbCopied);
     
    11231123        cbCopied = RT_MIN(pSgBuf->cbSegLeft, pSgPhysSend->cbSegLeft);
    11241124        Assert(cbCopied > 0);
    1125         PDMDevHlpPCIPhysRead(pDevIns, pSgPhysSend->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
     1125        PDMDevHlpPCIPhysReadUser(pDevIns, pSgPhysSend->gcPhysCur, pSgBuf->pvSegCur, cbCopied);
    11261126        RTSgBufAdvance(pSgBuf, cbCopied);
    11271127        virtioCoreSgBufAdvance(pSgPhysSend, cbCopied);
     
    11801180        size_t cbSeg = cbReqHdr - offReq;
    11811181        RTGCPHYS GCPhys = virtioCoreSgBufGetNextSegment(pDescChain->pSgPhysSend, &cbSeg);
    1182         PDMDevHlpPCIPhysRead(pDevIns, GCPhys, &VirtqReq.ab[offReq], cbSeg);
     1182        PDMDevHlpPCIPhysReadMeta(pDevIns, GCPhys, &VirtqReq.ab[offReq], cbSeg);
    11831183        offReq += cbSeg;
    11841184    }
     
    13731373        size_t cbSeg = cbCtrl - offCtrl;
    13741374        RTGCPHYS GCPhys = virtioCoreSgBufGetNextSegment(pDescChain->pSgPhysSend, &cbSeg);
    1375         PDMDevHlpPCIPhysRead(pDevIns, GCPhys, &ScsiCtrlUnion.ab[offCtrl], cbSeg);
     1375        PDMDevHlpPCIPhysReadMeta(pDevIns, GCPhys, &ScsiCtrlUnion.ab[offCtrl], cbSeg);
    13761376        offCtrl += cbSeg;
    13771377    }
     
    26242624     * Status driver (optional).
    26252625     */
    2626     PPDMIBASE pUpBase;
     2626    PPDMIBASE pUpBase = NULL;
    26272627    AssertCompile(PDM_STATUS_LUN >= VIRTIOSCSI_MAX_TARGETS);
    26282628    rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThisCC->IBase, &pUpBase, "Status Port");
    26292629    if (RT_FAILURE(rc) && rc != VERR_PDM_NO_ATTACHED_DRIVER)
    26302630        return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to attach the status LUN"));
    2631     pThisCC->pMediaNotify = PDMIBASE_QUERY_INTERFACE(pUpBase, PDMIMEDIANOTIFY);
     2631    if (RT_SUCCESS(rc) && pUpBase)
     2632        pThisCC->pMediaNotify = PDMIBASE_QUERY_INTERFACE(pUpBase, PDMIMEDIANOTIFY);
    26322633
    26332634
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