Changeset 82961 in vbox for trunk/src/VBox/Devices/VirtIO
- Timestamp:
- Feb 3, 2020 4:59:10 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
r82864 r82961 40 40 *********************************************************************************************************************************/ 41 41 #define INSTANCE(a_pVirtio) ((a_pVirtio)->szInstance) 42 #define QUEUE_NAME(a_pVirtio, a_idxQueue)((a_pVirtio)->virtqState[(a_idxQueue)].szVirtqName)42 #define VIRTQNAME(a_pVirtio, a_idxQueue) ((a_pVirtio)->virtqState[(a_idxQueue)].szVirtqName) 43 43 #define IS_DRIVER_OK(a_pVirtio) ((a_pVirtio)->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK) 44 44 … … 174 174 DECLINLINE(bool) virtqIsEmpty(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue) 175 175 { 176 uint16_t uAvailGst = virtioReadAvailRingIdx(pDevIns, pVirtio, idxQueue); 177 bool fEmpty = uAvailGst == pVirtio->virtqState[idxQueue].uAvailIdx; 178 179 Log6Func(("Q<%u>: uAvailGst=%u uAvailIdx=%u -> fEmpty=%RTbool\n", 180 idxQueue, uAvailGst, pVirtio->virtqState[idxQueue].uAvailIdx, fEmpty)); 176 uint16_t uAvailGuest = virtioReadAvailRingIdx(pDevIns, pVirtio, idxQueue); 177 bool fEmpty = uAvailGuest == pVirtio->virtqState[idxQueue].uAvailIdx; 178 179 Log6Func(("%s: uAvailGuest=%u uAvailIdx=%u. (%s)\n", 180 VIRTQNAME(pVirtio, idxQueue), uAvailGuest, pVirtio->virtqState[idxQueue].uAvailIdx, 181 fEmpty ? "Queue empty" : "Queue has available descriptors")); 181 182 return fEmpty; 182 183 } … … 618 619 if (desc.fFlags & VIRTQ_DESC_F_WRITE) 619 620 { 620 Log3Func(("%s IN desc_idx=%u seg=%u addr=%RGp cb=%u\n", QUEUE_NAME(pVirtio, idxQueue), uDescIdx, cSegsIn, desc.GCPhysBuf, desc.cb));621 Log3Func(("%s IN desc_idx=%u seg=%u addr=%RGp cb=%u\n", VIRTQNAME(pVirtio, idxQueue), uDescIdx, cSegsIn, desc.GCPhysBuf, desc.cb)); 621 622 cbIn += desc.cb; 622 623 pSeg = &(paSegsIn[cSegsIn++]); … … 624 625 else 625 626 { 626 Log3Func(("%s OUT desc_idx=%u seg=%u addr=%RGp cb=%u\n", QUEUE_NAME(pVirtio, idxQueue), uDescIdx, cSegsOut, desc.GCPhysBuf, desc.cb));627 Log3Func(("%s OUT desc_idx=%u seg=%u addr=%RGp cb=%u\n", VIRTQNAME(pVirtio, idxQueue), uDescIdx, cSegsOut, desc.GCPhysBuf, desc.cb)); 627 628 cbOut += desc.cb; 628 629 pSeg = &(paSegsOut[cSegsOut++]); … … 668 669 { 669 670 virtioKick(pVirtio->pDevIns, pVirtio, VIRTIO_ISR_DEVICE_CONFIG, pVirtio->uMsixConfig, false); 670 671 671 } 672 672 … … 680 680 void virtioCoreQueueSetNotify(PVIRTIOCORE pVirtio, uint16_t idxQueue, bool fEnabled) 681 681 { 682 uint16_t fFlags = virtioReadUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue); 683 684 if (fEnabled) 685 fFlags &= ~ VIRTQ_USED_F_NO_NOTIFY; 686 else 687 fFlags |= VIRTQ_USED_F_NO_NOTIFY; 688 689 virtioWriteUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue, fFlags); 682 if (pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK) 683 { 684 uint16_t fFlags = virtioReadUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue); 685 686 if (fEnabled) 687 fFlags &= ~ VIRTQ_USED_F_NO_NOTIFY; 688 else 689 fFlags |= VIRTQ_USED_F_NO_NOTIFY; 690 691 virtioWriteUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue, fFlags); 692 } 690 693 } 691 694 … … 858 861 859 862 Log3Func(("Copying client data to %s, desc chain (head desc_idx %d)\n", 860 QUEUE_NAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue)));863 VIRTQNAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue))); 861 864 862 865 /* … … 906 909 907 910 Log6Func(("Write ahead used_idx=%u, %s used_idx=%u\n", 908 pVirtq->uUsedIdx, QUEUE_NAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue)));911 pVirtq->uUsedIdx, VIRTQNAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue))); 909 912 910 913 RTMemFree((void *)pDescChain->pSgPhysSend->paSegs); … … 946 949 947 950 Log6Func(("Updating %s used_idx from %u to %u\n", 948 QUEUE_NAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue), pVirtq->uUsedIdx));951 VIRTQNAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue), pVirtq->uUsedIdx)); 949 952 950 953 virtioWriteUsedRingIdx(pDevIns, pVirtio, idxQueue, pVirtq->uUsedIdx); … … 1162 1165 #ifdef LOG_ENABLED 1163 1166 # define LOG_COMMON_CFG_ACCESS(member, a_offIntra) \ 1164 virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \ 1165 pv, cb, a_offIntra, fWrite, false, 0); 1167 if (LogIs7Enabled()) { \ 1168 virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \ 1169 pv, cb, a_offIntra, fWrite, false, 0); \ 1170 } 1166 1171 # define LOG_COMMON_CFG_ACCESS_INDEXED(member, idx, a_offIntra) \ 1167 virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \ 1168 pv, cb, a_offIntra, fWrite, true, idx); 1172 if (LogIs7Enabled()) { \ 1173 virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \ 1174 pv, cb, a_offIntra, fWrite, true, idx); \ 1175 } 1169 1176 #else 1170 1177 # define LOG_COMMON_CFG_ACCESS(member, a_offIntra) do { } while (0) … … 1310 1317 { 1311 1318 uint8_t const fNewStatus = *(uint8_t *)pv; 1312 Log 6Func(("Guest wrote uDeviceStatus (%#x, was %#x, change #%x) ................ (",1319 Log7Func(("Guest wrote uDeviceStatus (%#x, was %#x, change #%x) ................ (", 1313 1320 fNewStatus, pVirtio->uDeviceStatus, fNewStatus ^ pVirtio->uDeviceStatus)); 1314 virtioLogDeviceStatus(fNewStatus); 1315 Log6((")\n")); 1321 if (LogIs7Enabled()) 1322 virtioLogDeviceStatus(fNewStatus); 1323 Log7((")\n")); 1316 1324 1317 1325 /* If the status changed or we were reset, we need to go to ring-3 as … … 1344 1352 else /* Guest READ pCommonCfg->uDeviceStatus */ 1345 1353 { 1346 Log 6Func(("Guest read uDeviceStatus ................ ("));1354 Log7Func(("Guest read uDeviceStatus ................ (")); 1347 1355 *(uint8_t *)pv = pVirtio->uDeviceStatus; 1348 virtioLogDeviceStatus(pVirtio->uDeviceStatus); 1349 Log6((")\n")); 1356 if (LogIs7Enabled()) 1357 virtioLogDeviceStatus(pVirtio->uDeviceStatus); 1358 Log7((")\n")); 1350 1359 } 1351 1360 } … … 1451 1460 } 1452 1461 1453 if (pVirtio->fMsiSupport) 1454 PDMDevHlpPCISetIrq(pDevIns, pVirtio->uMsixConfig, PDM_IRQ_LEVEL_LOW); 1455 1462 virtioLowerInterrupt(pDevIns, 0); 1456 1463 return rcStrict; 1457 1464 #else … … 1546 1553 RT_NOREF(pPciDev); 1547 1554 1548 Log FlowFunc(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u pu32Value=%p\n",1555 Log7Func(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u pu32Value=%p\n", 1549 1556 pDevIns, pPciDev, uAddress, cb, pu32Value)); 1550 1557 if (uAddress == pVirtio->uPciCfgDataOff) … … 1586 1593 RT_NOREF(pPciDev); 1587 1594 1588 Log FlowFunc(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u u32Value=%#x\n", pDevIns, pPciDev, uAddress, cb, u32Value));1595 Log7Func(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u u32Value=%#x\n", pDevIns, pPciDev, uAddress, cb, u32Value)); 1589 1596 if (uAddress == pVirtio->uPciCfgDataOff) 1590 1597 {
Note:
See TracChangeset
for help on using the changeset viewer.