VirtualBox

Changeset 80201 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Aug 8, 2019 5:36:15 PM (5 years ago)
Author:
vboxsync
Message:

Fix doxygen burn and fixed MMIO related macros, and notification area configuration

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

Legend:

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

    r80194 r80201  
    6767 *
    6868 * @param   member   - Member of VIRTIO_PCI_COMMON_CFG_T
    69  * @param   uOffset  - Implied parameter: Offset into VIRTIO_PCI_COMMON_CFG_T
    70  * @param   cb       - Implied parameter: Number of bytes to access
    7169 * @result           - true or false
    7270 */
    7371#define MATCH_SCSI_CONFIG(member) \
    74             (RT_SIZEOFMEMB(VIRTIO_SCSI_CONFIG_T, member) == 64 \
     72            (RT_SIZEOFMEMB(VIRTIO_SCSI_CONFIG_T, member) == 8 \
    7573             && (   uOffset == RT_OFFSETOF(VIRTIO_SCSI_CONFIG_T, member) \
    7674                 || uOffset == RT_OFFSETOF(VIRTIO_SCSI_CONFIG_T, member) + sizeof(uint32_t)) \
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp

    r80194 r80201  
    771771    else
    772772    {
    773         LogFunc(("Bad access by guest to virtio_pci_common_cfg: uOffset=%d, cb=%d\n", uOffset, cb));
     773        LogFunc(("Bad guest %s access to virtio_pci_common_cfg: uOffset=%d, cb=%d\n",
     774            fWrite ? "write" : "read ", uOffset, cb));
    774775        rc = VERR_ACCESS_DENIED;
    775776    }
     
    12091210
    12101211    PVIRTIO_PCI_CAP_T pCfg;
    1211 
    1212     /* Common capability (VirtIO 1.0 spec) */
     1212    uint32_t cbRegion = 0;
     1213
     1214    /* Common capability (VirtIO 1.0 spec, section 4.1.4.3) */
    12131215    pCfg = (PVIRTIO_PCI_CAP_T)&pVirtio->dev.abConfig[0x40];
    12141216    pCfg->uCfgType = VIRTIO_PCI_CAP_COMMON_CFG;
     
    12191221    pCfg->uOffset  = 0;
    12201222    pCfg->uLength  = sizeof(VIRTIO_PCI_COMMON_CFG_T);
     1223    cbRegion += pCfg->uLength;
    12211224    pVirtio->pCommonCfgCap = pCfg;
    12221225
    1223     /* Notify capability (VirtIO 1.0 spec) */
     1226    /* Notify capability (VirtIO 1.0 spec, section 4.1.4.4). Note: uLength is based on assumption
     1227     * that each queue's uQueueNotifyOff is set equal to uQueueSelect's ordinal
     1228     * value of the queue */
    12241229    pCfg = (PVIRTIO_PCI_CAP_T)&pVirtio->dev.abConfig[pCfg->uCapNext];
    12251230    pCfg->uCfgType = VIRTIO_PCI_CAP_NOTIFY_CFG;
     
    12291234    pCfg->uBar     = uVirtioCapBar;
    12301235    pCfg->uOffset  = pVirtio->pCommonCfgCap->uOffset + pVirtio->pCommonCfgCap->uLength;
    1231     pCfg->uLength  = 4; /* This needs to be calculated differently */
     1236    pCfg->uLength  = VIRTIO_MAX_QUEUES * uNotifyOffMultiplier + 2;  /* will change in VirtIO 1.1 */
     1237    cbRegion += pCfg->uLength;
    12321238    pVirtio->pNotifyCap = (PVIRTIO_PCI_NOTIFY_CAP_T)pCfg;
    12331239    pVirtio->pNotifyCap->uNotifyOffMultiplier = uNotifyOffMultiplier;
    12341240
    1235     /* ISR capability (VirtIO 1.0 spec) */
     1241    /* ISR capability (VirtIO 1.0 spec, section 4.1.4.5) */
    12361242    pCfg = (PVIRTIO_PCI_CAP_T)&pVirtio->dev.abConfig[pCfg->uCapNext];
    12371243    pCfg->uCfgType = VIRTIO_PCI_CAP_ISR_CFG;
     
    12421248    pCfg->uOffset  = pVirtio->pNotifyCap->pciCap.uOffset + pVirtio->pNotifyCap->pciCap.uLength;
    12431249    pCfg->uLength  = sizeof(uint32_t);
     1250    cbRegion += pCfg->uLength;
    12441251    pVirtio->pIsrCap = pCfg;
    12451252
    1246     /* PCI Cfg capability (VirtIO 1.0 spec) */
     1253    /* PCI Cfg capability (VirtIO 1.0 spec, section 4.1.4.7) */
    12471254    pCfg = (PVIRTIO_PCI_CAP_T)&pVirtio->dev.abConfig[pCfg->uCapNext];
    12481255    pCfg->uCfgType = VIRTIO_PCI_CAP_PCI_CFG;
     
    12531260    pCfg->uOffset  = pVirtio->pIsrCap->uOffset + pVirtio->pIsrCap->uLength;
    12541261    pCfg->uLength  = 4;  /* Initialize a non-zero 4-byte aligned so Linux virtio_pci module recognizes this cap */
     1262    cbRegion += pCfg->uLength;
    12551263    pVirtio->pPciCfgCap = (PVIRTIO_PCI_CFG_CAP_T)pCfg;
    12561264
    12571265    if (pVirtio->pDevSpecificCap)
    12581266    {
    1259         /* Following capability mapped via VirtIO 1.0: struct virtio_pci_dev_cap (VIRTIODEVCAP)*/
     1267        /* Following capability (via VirtIO 1.0, section 4.1.4.6). Client defines the
     1268         * device specific configuration struct and passes its params to this constructor */
    12601269        pCfg = (PVIRTIO_PCI_CAP_T)&pVirtio->dev.abConfig[pCfg->uCapNext];
    12611270        pCfg->uCfgType = VIRTIO_PCI_CAP_DEVICE_CFG;
     
    12661275        pCfg->uOffset  = pVirtio->pIsrCap->uOffset + pVirtio->pIsrCap->uLength;
    12671276        pCfg->uLength  = cbDevSpecificCap;
     1277        cbRegion += pCfg->uLength;
    12681278        pVirtio->pDeviceCap = pCfg;
    12691279    }
     
    12871297    }
    12881298
    1289     rc = PDMDevHlpPCIIORegionRegister(pDevIns, uVirtioCapBar, 4096,
     1299    Log(("cbRegion = %d (0x%x)\n", cbRegion, cbRegion));
     1300    rc = PDMDevHlpPCIIORegionRegister(pDevIns, uVirtioCapBar, cbRegion,
    12901301                                      PCI_ADDRESS_SPACE_MEM, virtioR3Map);
    12911302    if (RT_FAILURE(rc))
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0_impl.h

    r80194 r80201  
    269269 */
    270270#define COMMON_CFG(member) \
    271         (RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member) == 64 \
     271        (RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member) == 8 \
    272272         && (   uOffset == RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member) \
    273273             || uOffset == RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member) + sizeof(uint32_t)) \
     
    286286        uint32_t uIntraOff = uOffset - RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member); \
    287287        if (fWrite) \
    288             memcpy(((char *)&pVirtio->member) + uOffset, (const char *)pv, cb); \
     288            memcpy(((char *)&pVirtio->member) + uIntraOff, (const char *)pv, cb); \
    289289        else \
    290             memcpy((char *)pv, (const char *)(((char *)&pVirtio->member) + uOffset), cb); \
     290            memcpy((char *)pv, (const char *)(((char *)&pVirtio->member) + uIntraOff), cb); \
    291291        LOG_ACCESSOR(member); \
    292292    }
     
    296296        uint32_t uIntraOff = uOffset - RT_OFFSETOF(VIRTIO_PCI_COMMON_CFG_T, member); \
    297297        if (fWrite) \
    298             memcpy(((char *)(pVirtio->member + idx)) + uOffset, (const char *)pv, cb); \
     298            memcpy(((char *)(pVirtio->member + idx)) + uIntraOff, (const char *)pv, cb); \
    299299        else \
    300             memcpy((char *)pv, (const char *)(((char *)(pVirtio->member + idx)) + uOffset), cb); \
     300            memcpy((char *)pv, (const char *)(((char *)(pVirtio->member + idx)) + uIntraOff), cb); \
    301301        LOG_INDEXED_ACCESSOR(member, idx); \
    302302    }
     
    309309        else \
    310310        { \
    311             memcpy((char *)pv, (const char *)(((char *)&pVirtio->member) + uOffset), cb); \
     311            memcpy((char *)pv, (const char *)(((char *)&pVirtio->member) + uIntraOff), cb); \
    312312            LOG_ACCESSOR(member); \
    313313        } \
     
    351351        if (status & VIRTIO_STATUS_DRIVER)
    352352            Log(("%sDRIVER",      primed++ ? " | " : ""));
     353        if (status & VIRTIO_STATUS_FEATURES_OK)
     354            Log(("%sFEATURES_OK", primed++ ? " | " : ""));
    353355        if (status & VIRTIO_STATUS_DRIVER_OK)
    354356            Log(("%sDRIVER_OK",   primed++ ? " | " : ""));
    355         if (status & VIRTIO_STATUS_FEATURES_OK)
    356             Log(("%sFEATURES_OK", primed++ ? " | " : ""));
    357357        if (status & VIRTIO_STATUS_FAILED)
    358358            Log(("%sFAILED",      primed++ ? " | " : ""));
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