VirtualBox

Changeset 86482 in vbox for trunk/src


Ignore:
Timestamp:
Oct 8, 2020 6:53:02 AM (4 years ago)
Author:
vboxsync
Message:

AMD IOMMU: bugref:9654 BusLogic: Use PCI interfaces while reading/writing guest physical memory.

File:
1 edited

Legend:

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

    r85121 r86482  
    12501250}
    12511251
     1252/**
     1253 * Memory read helper to handle PCI/ISA differences - metadata reads.
     1254 *
     1255 * @returns nothing.
     1256 * @param   pDevIns     The device instance.
     1257 * @param   pThis       Pointer to the shared BusLogic instance data.
     1258 * @param   GCPhys      Guest physical memory address.
     1259 * @param   pvBuf       Host side buffer address.
     1260 * @param   cbRead      Number of bytes to read.
     1261 */
     1262static void blPhysReadMeta(PPDMDEVINS pDevIns, PBUSLOGIC pThis, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     1263{
     1264    if (!pThis->uIsaIrq)
     1265        PDMDevHlpPCIPhysReadMeta(pDevIns, GCPhys, pvBuf, cbRead);
     1266    else
     1267        PDMDevHlpPhysReadMeta(pDevIns, GCPhys, pvBuf, cbRead);
     1268}
     1269
    12521270#if defined(IN_RING3)
    12531271
     
    12681286    else
    12691287        PDMDevHlpPhysWriteUser(pDevIns, GCPhys, pvBuf, cbWrite);
     1288}
     1289
     1290/**
     1291 * Memory read helper to handle PCI/ISA differences - userdata reads.
     1292 *
     1293 * @returns nothing.
     1294 * @param   pDevIns     The device instance.
     1295 * @param   pThis       Pointer to the shared BusLogic instance data.
     1296 * @param   GCPhys      Guest physical memory address.
     1297 * @param   pvBuf       Host side buffer address.
     1298 * @param   cbRead      Number of bytes to read.
     1299 */
     1300static void blPhysReadUser(PPDMDEVINS pDevIns, PBUSLOGIC pThis, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead)
     1301{
     1302    if (!pThis->uIsaIrq)
     1303        PDMDevHlpPCIPhysReadUser(pDevIns, GCPhys, pvBuf, cbRead);
     1304    else
     1305        PDMDevHlpPhysReadUser(pDevIns, GCPhys, pvBuf, cbRead);
    12701306}
    12711307
     
    13431379    uint8_t     uCode;
    13441380    unsigned    uCodeOffs = pThis->fMbxIs24Bit ? RT_OFFSETOF(Mailbox24, uCmdState) : RT_OFFSETOF(Mailbox32, u.out.uActionCode);
    1345     PDMDevHlpPhysReadMeta(pDevIns, GCPhysAddrMailboxIncoming + uCodeOffs, &uCode, sizeof(uCode));
     1381    blPhysReadMeta(pDevIns, pThis, GCPhysAddrMailboxIncoming + uCodeOffs, &uCode, sizeof(uCode));
    13461382    Assert(uCode == BUSLOGIC_MAILBOX_INCOMING_COMPLETION_FREE);
    13471383# endif
     
    14581494{
    14591495    /* Read the S/G entries. Convert 24-bit entries to 32-bit format. */
     1496    PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);
    14601497    if (fIs24Bit)
    14611498    {
     
    14641501
    14651502        Log2(("Converting %u 24-bit S/G entries to 32-bit\n", cEntries));
    1466         PDMDevHlpPhysReadMeta(pDevIns, GCSGList, &aSGE24, cEntries * sizeof(SGE24));
     1503        blPhysReadMeta(pDevIns, pThis, GCSGList, &aSGE24, cEntries * sizeof(SGE24));
    14671504        for (uint32_t i = 0; i < cEntries; ++i)
    14681505        {
     
    14721509    }
    14731510    else
    1474         PDMDevHlpPhysReadMeta(pDevIns, GCSGList, pSGEList, cEntries * sizeof(SGE32));
     1511        blPhysReadMeta(pDevIns, pThis, GCSGList, pSGEList, cEntries * sizeof(SGE32));
    14751512}
    14761513
     
    15671604                                                              PRTSGBUF pSgBuf, size_t cbCopy, size_t *pcbSkip)
    15681605{
    1569     RT_NOREF(pThis);
    1570 
    15711606    size_t cbSkipped = RT_MIN(cbCopy, *pcbSkip);
    15721607    cbCopy   -= cbSkipped;
     
    15801615
    15811616        AssertPtr(pvSeg);
    1582         PDMDevHlpPhysReadUser(pDevIns, GCPhys, pvSeg, cbSeg);
     1617        blPhysReadUser(pDevIns, pThis, GCPhys, pvSeg, cbSeg);
    15831618        GCPhys += cbSeg;
    15841619        cbCopy -= cbSeg;
     
    23372372            GCPhysFifoBuf = (RTGCPHYS)ADDR_TO_U32(addr);
    23382373            Log(("Write busmaster FIFO at: %04X\n", ADDR_TO_U32(addr)));
    2339             PDMDevHlpPhysReadMeta(pDevIns, GCPhysFifoBuf,
    2340                                   &pThis->LocalRam.u8View[64], 64);
     2374            blPhysReadMeta(pDevIns, pThis, GCPhysFifoBuf, &pThis->LocalRam.u8View[64], 64);
    23412375            break;
    23422376        }
     
    32043238    /* Fetch the CCB from guest memory. */
    32053239    /** @todo How much do we really have to read? */
    3206     PDMDevHlpPhysReadMeta(pDevIns, GCPhysAddrCCB, &CCBGuest, sizeof(CCB32));
     3240    blPhysReadMeta(pDevIns, pThis, GCPhysAddrCCB, &CCBGuest, sizeof(CCB32));
    32073241
    32083242    uTargetIdCCB = pThis->fMbxIs24Bit ? CCBGuest.o.uTargetId : CCBGuest.n.uTargetId;
     
    32883322    CCBU     CCBGuest;
    32893323
    3290     PDMDevHlpPhysReadMeta(pDevIns, GCPhysAddrCCB, &CCBGuest, sizeof(CCB32));
     3324    blPhysReadMeta(pDevIns, pThis, GCPhysAddrCCB, &CCBGuest, sizeof(CCB32));
    32913325
    32923326    uTargetIdCCB = pThis->fMbxIs24Bit ? CCBGuest.o.uTargetId : CCBGuest.n.uTargetId;
     
    33233357
    33243358        GCMailbox = pThis->GCPhysAddrMailboxOutgoingBase + (pThis->uMailboxOutgoingPositionCurrent * sizeof(Mailbox24));
    3325         PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
     3359        blPhysReadMeta(pDevIns, pThis, GCMailbox, &Mbx24, sizeof(Mailbox24));
    33263360        pMbx->u32PhysAddrCCB    = ADDR_TO_U32(Mbx24.aPhysAddrCCB);
    33273361        pMbx->u.out.uActionCode = Mbx24.uCmdState;
     
    33303364    {
    33313365        GCMailbox = pThis->GCPhysAddrMailboxOutgoingBase + (pThis->uMailboxOutgoingPositionCurrent * sizeof(Mailbox32));
    3332         PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, pMbx, sizeof(Mailbox32));
     3366        blPhysReadMeta(pDevIns, pThis, GCMailbox, pMbx, sizeof(Mailbox32));
    33333367    }
    33343368
     
    38533887            for (i = 0; i < pThis->cMailbox; ++i)
    38543888            {
    3855                 PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
     3889                blPhysReadMeta(pDevIns, pThis, GCMailbox, &Mbx24, sizeof(Mailbox24));
    38563890                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %06X action code %02X", i, ADDR_TO_U32(Mbx24.aPhysAddrCCB), Mbx24.uCmdState);
    38573891                pHlp->pfnPrintf(pHlp, "%s\n", pThis->uMailboxOutgoingPositionCurrent == i ? " *" : "");
     
    38643898            for (i = 0; i < pThis->cMailbox; ++i)
    38653899            {
    3866                 PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx24, sizeof(Mailbox24));
     3900                blPhysReadMeta(pDevIns, pThis, GCMailbox, &Mbx24, sizeof(Mailbox24));
    38673901                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %06X completion code %02X", i, ADDR_TO_U32(Mbx24.aPhysAddrCCB), Mbx24.uCmdState);
    38683902                pHlp->pfnPrintf(pHlp, "%s\n", pThis->uMailboxIncomingPositionCurrent == i ? " *" : "");
     
    38803914            for (i = 0; i < pThis->cMailbox; ++i)
    38813915            {
    3882                 PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx32, sizeof(Mailbox32));
     3916                blPhysReadMeta(pDevIns, pThis, GCMailbox, &Mbx32, sizeof(Mailbox32));
    38833917                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %08X action code %02X", i, Mbx32.u32PhysAddrCCB, Mbx32.u.out.uActionCode);
    38843918                pHlp->pfnPrintf(pHlp, "%s\n", pThis->uMailboxOutgoingPositionCurrent == i ? " *" : "");
     
    38913925            for (i = 0; i < pThis->cMailbox; ++i)
    38923926            {
    3893                 PDMDevHlpPhysReadMeta(pDevIns, GCMailbox, &Mbx32, sizeof(Mailbox32));
     3927                blPhysReadMeta(pDevIns, pThis, GCMailbox, &Mbx32, sizeof(Mailbox32));
    38943928                pHlp->pfnPrintf(pHlp, "  slot %03d: CCB at %08X completion code %02X BTSTAT %02X SDSTAT %02X", i,
    38953929                                Mbx32.u32PhysAddrCCB, Mbx32.u.in.uCompletionCode, Mbx32.u.in.uHostAdapterStatus, Mbx32.u.in.uTargetDeviceStatus);
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