Changeset 84468 in vbox for trunk/src/VBox/Devices/VirtIO
- Timestamp:
- May 23, 2020 7:17:02 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices/VirtIO
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
r84430 r84468 129 129 /* Internal Functions */ 130 130 131 static void virtioNotifyGuestDriver(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue , bool fForce);132 static int virtioKick(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint8_t uCause, uint16_t uVec , bool fForce);131 static void virtioNotifyGuestDriver(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue); 132 static int virtioKick(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint8_t uCause, uint16_t uVec); 133 133 134 134 /** @name Internal queue operations … … 812 812 void virtioCoreNotifyConfigChanged(PVIRTIOCORE pVirtio) 813 813 { 814 virtioKick(pVirtio->pDevInsR3, pVirtio, VIRTIO_ISR_DEVICE_CONFIG, pVirtio->uMsixConfig , false);814 virtioKick(pVirtio->pDevInsR3, pVirtio, VIRTIO_ISR_DEVICE_CONFIG, pVirtio->uMsixConfig); 815 815 } 816 816 … … 850 850 { 851 851 pVirtio->fGenUpdatePending = true; 852 virtioKick(pVirtio->pDevInsR3, pVirtio, VIRTIO_ISR_DEVICE_CONFIG, pVirtio->uMsixConfig , false /* fForce */);852 virtioKick(pVirtio->pDevInsR3, pVirtio, VIRTIO_ISR_DEVICE_CONFIG, pVirtio->uMsixConfig); 853 853 } 854 854 } … … 1078 1078 * @param pVirtio Pointer to the shared virtio state. 1079 1079 * @param idxQueue Queue number 1080 * @param fForce Force guest notification even if VIRTQ_USED_F_NO_NOTIFY is set1081 1080 * 1082 1081 * @returns VBox status code. … … 1084 1083 * @retval VERR_INVALID_STATE VirtIO not in ready state 1085 1084 */ 1086 int virtioCoreQueueSync(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue , bool fForce)1085 int virtioCoreQueueSync(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue) 1087 1086 { 1088 1087 Assert(idxQueue < RT_ELEMENTS(pVirtio->virtqState)); … … 1096 1095 1097 1096 virtioWriteUsedRingIdx(pDevIns, pVirtio, idxQueue, pVirtq->uUsedIdx); 1098 virtioNotifyGuestDriver(pDevIns, pVirtio, idxQueue , fForce);1097 virtioNotifyGuestDriver(pDevIns, pVirtio, idxQueue); 1099 1098 1100 1099 return VINF_SUCCESS; … … 1134 1133 * @param pVirtio Pointer to the shared virtio state. 1135 1134 * @param idxQueue Queue to check for guest interrupt handling preference 1136 * @param fForce Overrides idxQueue, forcing notification regardless of driver's 1137 * notification preferences. This is a safeguard to prevent 1138 * stalls upon resuming the VM. VirtIO 1.0 specification Section 4.1.5.5 1139 * indicates spurious interrupts are harmless to guest driver's state, 1140 * as they only cause the guest driver to [re]scan queues for work to do. 1141 */ 1142 static void virtioNotifyGuestDriver(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue, bool fForce) 1135 */ 1136 static void virtioNotifyGuestDriver(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue) 1143 1137 { 1144 1138 … … 1160 1154 VIRTQNAME(pVirtio, idxQueue), (uint16_t)virtioReadAvailUsedEvent(pDevIns, pVirtio, idxQueue))); 1161 1155 #endif 1162 virtioKick(pDevIns, pVirtio, VIRTIO_ISR_VIRTQ_INTERRUPT, pVirtio->uQueueMsixVector[idxQueue] , fForce);1156 virtioKick(pDevIns, pVirtio, VIRTIO_ISR_VIRTQ_INTERRUPT, pVirtio->uQueueMsixVector[idxQueue]); 1163 1157 pVirtq->fEventThresholdReached = false; 1164 1158 return; … … 1172 1166 { 1173 1167 /** If guest driver hasn't suppressed interrupts, interrupt */ 1174 if (fForce || !(virtioReadAvailRingFlags(pDevIns, pVirtio, idxQueue) & VIRTQ_AVAIL_F_NO_INTERRUPT)) 1175 { 1176 if (fForce) 1177 Log6Func(("... kicking guest, queue %s, because force flag set\n", VIRTQNAME(pVirtio, idxQueue))); 1178 virtioKick(pDevIns, pVirtio, VIRTIO_ISR_VIRTQ_INTERRUPT, pVirtio->uQueueMsixVector[idxQueue], fForce); 1168 if (!(virtioReadAvailRingFlags(pDevIns, pVirtio, idxQueue) & VIRTQ_AVAIL_F_NO_INTERRUPT)) 1169 { 1170 virtioKick(pDevIns, pVirtio, VIRTIO_ISR_VIRTQ_INTERRUPT, pVirtio->uQueueMsixVector[idxQueue]); 1179 1171 return; 1180 1172 } … … 1191 1183 * @param uCause Interrupt cause bit mask to set in PCI ISR port. 1192 1184 * @param uVec MSI-X vector, if enabled 1193 * @param uForce True of out-of-band 1194 */ 1195 static int virtioKick(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint8_t uCause, uint16_t uMsixVector, bool fForce) 1196 { 1197 if (fForce) 1198 Log6Func(("reason: forced\n")); 1199 else 1185 */ 1186 static int virtioKick(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint8_t uCause, uint16_t uMsixVector) 1187 { 1200 1188 if (uCause == VIRTIO_ISR_VIRTQ_INTERRUPT) 1201 1189 Log6Func(("reason: buffer added to 'used' ring.\n")); … … 1908 1896 break; 1909 1897 case kvirtIoVmStateChangedResume: 1910 virtioNotifyGuestDriver(pVirtio->pDevInsR3, pVirtio, 0 /* idxQueue */ , true /* fForce */);1898 virtioNotifyGuestDriver(pVirtio->pDevInsR3, pVirtio, 0 /* idxQueue */); 1911 1899 break; 1912 1900 default: -
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.h
r84384 r84468 402 402 403 403 404 /** @name virtq related flags405 * @{ */406 #define VIRTQ_DESC_F_NEXT 1 /**< Indicates this descriptor chains to next */407 #define VIRTQ_DESC_F_WRITE 2 /**< Marks buffer as write-only (default ro) */408 #define VIRTQ_DESC_F_INDIRECT 4 /**< Buffer is list of buffer descriptors */409 410 #define VIRTQ_USED_F_NO_NOTIFY 1 /**< Dev to Drv: Don't notify when buf added */411 #define VIRTQ_AVAIL_F_NO_INTERRUPT 1 /**< Drv to Dev: Don't notify when buf eaten */412 /** @} */413 414 415 404 /** @name API for VirtIO parent device 416 405 * @{ */ … … 435 424 436 425 int virtioCoreR3QueuePendingCount(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue); 437 int virtioCoreQueueSync(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue , bool fForce);426 int virtioCoreQueueSync(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue); 438 427 bool virtioCoreQueueIsEmpty(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue); 439 428 void virtioCoreQueueEnable(PVIRTIOCORE pVirtio, uint16_t idxQueue, bool fEnabled);
Note:
See TracChangeset
for help on using the changeset viewer.