VirtualBox

Changeset 71788 in vbox


Ignore:
Timestamp:
Apr 9, 2018 4:06:34 PM (6 years ago)
Author:
vboxsync
Message:

DevVirtioNet: A couple of todos and paranoia.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevE1000.cpp

    r71456 r71788  
    58805880    if (index != -1)
    58815881    {
     5882        RT_UNTRUSTED_VALIDATED_FENCE(); /* paranoia because of port I/O. */
    58825883        if (g_aE1kRegMap[index].readable)
    58835884        {
     
    59445945    if (RT_LIKELY(idxReg != -1))
    59455946    {
     5947        RT_UNTRUSTED_VALIDATED_FENCE(); /* paranoia because of port I/O. */
    59465948        if (RT_UNLIKELY(g_aE1kRegMap[idxReg].readable))
    59475949        {
     
    59905992    if (RT_LIKELY(index != -1))
    59915993    {
     5994        RT_UNTRUSTED_VALIDATED_FENCE(); /* paranoia because of port I/O. */
    59925995        if (RT_LIKELY(g_aE1kRegMap[index].writable))
    59935996        {
  • trunk/src/VBox/Devices/Network/DevVirtioNet.cpp

    r69500 r71788  
    515515        STAM_COUNTER_INC(&pThis->StatRxOverflowWakeup);
    516516        Log(("%s Waking up Out-of-RX-space semaphore\n",  INSTANCE(pThis)));
     517/**
     518 * @todo r=bird: We can wake stuff up from ring-0 too, see vmsvga, nvme,
     519 *        buslogic, lsilogic, ata, ahci, xhci.  Also, please address similar
     520 *        TODO in E1000.
     521 *
     522 *        The API Is SUPSem*, btw.
     523 */
    517524        RTSemEventSignal(pThis->hEventMoreRxDescAvail);
    518525    }
     
    587594    PVNETSTATE pThis = (PVNETSTATE)pvState;
    588595    Log(("%s Driver became ready, waking up RX thread...\n", INSTANCE(pThis)));
     596/**
     597 * @todo r=bird: We can wake stuff up from ring-0 too, see vmsvga, nvme,
     598 *        buslogic, lsilogic, ata, ahci, xhci.  Also, please address similar
     599 *        TODO in E1000.
     600 *
     601 *        The API Is SUPSem*, btw.
     602 */
    589603#ifdef IN_RING3
    590604    vnetWakeupReceive(pThis->VPCI.CTX_SUFF(pDevIns));
     
    12881302    vpciSetWriteLed(&pThis->VPCI, true);
    12891303
    1290     VQUEUEELEM elem;
    12911304    /*
    12921305     * Do not remove descriptors from available ring yet, try to allocate the
    12931306     * buffer first.
    12941307     */
     1308    VQUEUEELEM elem; /* This bugger is big! ~48KB on 64-bit hosts. */
    12951309    while (vqueuePeek(&pThis->VPCI, pQueue, &elem))
    12961310    {
     
    19932007static DECLCALLBACK(int) vnetDestruct(PPDMDEVINS pDevIns)
    19942008{
     2009    PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
    19952010    PVNETSTATE pThis = PDMINS_2_DATA(pDevIns, PVNETSTATE);
    1996     PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
    19972011
    19982012    LogRel(("TxTimer stats (avg/min/max): %7d usec %7d usec %7d usec\n",
     
    20182032static DECLCALLBACK(int) vnetConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
    20192033{
     2034    PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    20202035    PVNETSTATE pThis = PDMINS_2_DATA(pDevIns, PVNETSTATE);
    20212036    int        rc;
    2022     PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
    20232037
    20242038    /* Initialize the instance data suffiencently for the destructor not to blow up. */
     
    20442058     */
    20452059    if (!CFGMR3AreValuesValid(pCfg, "MAC\0" "CableConnected\0" "LineSpeed\0" "LinkUpDelay\0"))
    2046                     return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
    2047                                             N_("Invalid configuration for VirtioNet device"));
     2060        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, N_("Invalid configuration for VirtioNet device"));
    20482061
    20492062    /* Get config params */
  • trunk/src/VBox/Devices/VirtIO/Virtio.cpp

    r71112 r71788  
    165165            break;
    166166        }
     167        RT_UNTRUSTED_VALIDATED_FENCE();
    167168
    168169        vringReadDesc(pState, &pQueue->VRing, idx, &desc);
     
    551552            u32 &= 0xFFFF;
    552553            if (u32 < pState->nQueues)
     554            {
     555                RT_UNTRUSTED_VALIDATED_FENCE();
    553556                if (pState->Queues[u32].VRing.addrDescriptors)
    554557                {
     
    563566                    Log(("%s The queue (#%d) being notified has not been initialized.\n",
    564567                         INSTANCE(pState), u32));
     568            }
    565569            else
    566570                Log(("%s Invalid queue number (%d)\n", INSTANCE(pState), u32));
     
    799803        else
    800804            pState->nQueues = nQueues;
     805        AssertLogRelMsgReturn(pState->nQueues <= VIRTIO_MAX_NQUEUES, ("%#x\n", pState->nQueues), VERR_SSM_LOAD_CONFIG_MISMATCH);
     806        AssertLogRelMsgReturn(pState->uQueueSelector < pState->nQueues || (pState->nQueues == 0 && pState->uQueueSelector),
     807                              ("uQueueSelector=%u nQueues=%u\n", pState->uQueueSelector, pState->nQueues),
     808                              VERR_SSM_LOAD_CONFIG_MISMATCH);
     809
    801810        for (unsigned i = 0; i < pState->nQueues; i++)
    802811        {
     
    10101019
    10111020#endif /* VBOX_DEVICE_STRUCT_TESTCASE */
     1021
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