Changeset 80308 in vbox for trunk/src/VBox/Devices/VirtIO
- Timestamp:
- Aug 15, 2019 7:48:27 PM (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
r80307 r80308 105 105 { 106 106 PVIRTIOSTATE pVirtio = (PVIRTIOSTATE)hVirtio; 107 PVIRTQ_SHADOW_T pVirtqShadow = &(pVirtio-> queueShadow[qIdx]);107 PVIRTQ_SHADOW_T pVirtqShadow = &(pVirtio->virtqShadow[qIdx]); 108 108 if (pVirtio->uQueueEnable[qIdx]) 109 109 { … … 120 120 const char *virtioQueueGetName(VIRTIOHANDLE hVirtio, uint16_t qIdx) 121 121 { 122 return (const char *)((PVIRTIOSTATE)hVirtio)-> queueShadow[qIdx].pcszName;122 return (const char *)((PVIRTIOSTATE)hVirtio)->virtqShadow[qIdx].pcszName; 123 123 } 124 124 … … 127 127 { 128 128 PVIRTIOSTATE pVirtio = (PVIRTIOSTATE)hVirtio; 129 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio-> queueShadow[qIdx];129 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio->virtqShadow[qIdx]; 130 130 131 131 if (virtioQueueIsEmpty(pVirtio, qIdx)) … … 141 141 { 142 142 PVIRTIOSTATE pVirtio = (PVIRTIOSTATE)hVirtio; 143 return vqReadAvailDescIdx(pVirtio, qIdx) == pVirtio-> queueShadow->uAvailIdx;143 return vqReadAvailDescIdx(pVirtio, qIdx) == pVirtio->virtqShadow->uAvailIdx; 144 144 } 145 145 … … 157 157 158 158 PVIRTIOSTATE pVirtio = (PVIRTIOSTATE)hVirtio; 159 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio-> queueShadow[qIdx];159 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio->virtqShadow[qIdx]; 160 160 161 161 if (!(pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK)) … … 243 243 { 244 244 PVIRTIOSTATE pVirtio = (PVIRTIOSTATE)hVirtio; 245 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio-> queueShadow[qIdx];245 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio->virtqShadow[qIdx]; 246 246 247 247 Log2Func(("%s: %s desc_idx=%u acb=%u\n", … … 289 289 { 290 290 PVIRTIOSTATE pVirtio = (PVIRTIOSTATE)hVirtio; 291 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio-> queueShadow[qIdx];291 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio->virtqShadow[qIdx]; 292 292 293 293 uint16_t uDescIdx = vqReadUsedDescIdx(pVirtio, qIdx); … … 296 296 297 297 vqWriteUsedRingDescIdx(pVirtio, qIdx, pVirtqShadow->uUsedIdx); 298 vqNotify (pVirtio, qIdx);298 vqNotifyDriver(pVirtio, qIdx); 299 299 } 300 300 … … 302 302 * This is called when MMIO handler detects guest write to a virtq's notification address 303 303 */ 304 static void vq Notified(PVIRTIOSTATE pVirtio, uint16_t qIdx, uint16_t uNotifyIdx)304 static void vqDeviceNotified(PVIRTIOSTATE pVirtio, uint16_t qIdx, uint16_t uNotifyIdx) 305 305 { 306 306 Assert(uNotifyIdx == qIdx); 307 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio-> queueShadow[qIdx];307 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio->virtqShadow[qIdx]; 308 308 Log2Func(("%s: %s notified\n", INSTANCE(pVirtio), pVirtqShadow->pcszName)); 309 309 … … 318 318 * See VirtIO 1.0 specification (see section 2.4.7). 319 319 */ 320 static void vqNotify (PVIRTIOSTATE pVirtio, uint16_t qIdx)321 { 322 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio-> queueShadow[qIdx];320 static void vqNotifyDriver(PVIRTIOSTATE pVirtio, uint16_t qIdx) 321 { 322 PVIRTQ_SHADOW_T pVirtqShadow = &pVirtio->virtqShadow[qIdx]; 323 323 324 324 if (!(pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK)) … … 417 417 static void vqReset(PVIRTIOSTATE pVirtio, uint16_t qIdx) 418 418 { 419 PVIRTQ_SHADOW_T pVirtQ = &pVirtio-> queueShadow[qIdx];419 PVIRTQ_SHADOW_T pVirtQ = &pVirtio->virtqShadow[qIdx]; 420 420 pVirtQ->uAvailIdx = 0; 421 421 pVirtQ->uUsedIdx = 0; … … 782 782 uint16_t qIdx = uNotifyBaseOffset / VIRTIO_NOTIFY_OFFSET_MULTIPLIER; 783 783 uint16_t uNotifiedIdx = *(uint16_t *)pv; 784 vq Notified(pVirtio, qIdx, uNotifiedIdx);784 vqDeviceNotified(pVirtio, qIdx, uNotifiedIdx); 785 785 } 786 786 else … … 1259 1259 { 1260 1260 Log2Func(("%s queue:\n", 1261 " queueShadow[%u].uAvailIdx = %u\n"1262 " queueShadow[%u].uUsedIdx = %u\n"1261 " virtqShadow[%u].uAvailIdx = %u\n" 1262 " virtqShadow[%u].uUsedIdx = %u\n" 1263 1263 " uQueueSize[%u] = %u\n" 1264 1264 " uQueueNotifyOff[%u] = %04x\n" … … 1268 1268 " pGcPhysQueueAvail[%u] = %RGp\n" 1269 1269 " pGcPhysQueueUsed[%u] = %RGp\n", 1270 i, pVirtio-> queueShadow[i].pcszName,1271 i, pVirtio-> queueShadow[i].uAvailIdx,1272 i, pVirtio-> queueShadow[i].uUsedIdx,1270 i, pVirtio->virtqShadow[i].pcszName, 1271 i, pVirtio->virtqShadow[i].uAvailIdx, 1272 i, pVirtio->virtqShadow[i].uUsedIdx, 1273 1273 i, pVirtio->uQueueSize[i], 1274 1274 i, pVirtio->uQueueNotifyOff[i], … … 1332 1332 rc = SSMR3PutU16(pSSM, pVirtio->uQueueEnable[i]); 1333 1333 rc = SSMR3PutU16(pSSM, pVirtio->uQueueSize[i]); 1334 rc = SSMR3PutU16(pSSM, pVirtio-> queueShadow[i].uAvailIdx);1335 rc = SSMR3PutU16(pSSM, pVirtio-> queueShadow[i].uUsedIdx);1336 rc = SSMR3PutMem(pSSM, pVirtio-> queueShadow[i].pcszName, 32);1334 rc = SSMR3PutU16(pSSM, pVirtio->virtqShadow[i].uAvailIdx); 1335 rc = SSMR3PutU16(pSSM, pVirtio->virtqShadow[i].uUsedIdx); 1336 rc = SSMR3PutMem(pSSM, pVirtio->virtqShadow[i].pcszName, 32); 1337 1337 } 1338 1338 … … 1391 1391 rc = SSMR3GetU16(pSSM, &pVirtio->uQueueEnable[i]); 1392 1392 rc = SSMR3GetU16(pSSM, &pVirtio->uQueueSize[i]); 1393 rc = SSMR3GetU16(pSSM, &pVirtio-> queueShadow[i].uAvailIdx);1394 rc = SSMR3GetU16(pSSM, &pVirtio-> queueShadow[i].uUsedIdx);1395 rc = SSMR3GetMem(pSSM, pVirtio-> queueShadow[i].pcszName, 32);1393 rc = SSMR3GetU16(pSSM, &pVirtio->virtqShadow[i].uAvailIdx); 1394 rc = SSMR3GetU16(pSSM, &pVirtio->virtqShadow[i].uUsedIdx); 1395 rc = SSMR3GetMem(pSSM, pVirtio->virtqShadow[i].pcszName, 32); 1396 1396 } 1397 1397 } -
trunk/src/VBox/Devices/VirtIO/Virtio_1_0_impl.h
r80306 r80308 177 177 uint8_t uConfigGeneration; /**< (MMIO) Device config sequencer HOST */ 178 178 179 VIRTQ_SHADOW_T queueShadow[VIRTQ_MAX_CNT];/**< Local impl-specific queue context */179 VIRTQ_SHADOW_T virtqShadow[VIRTQ_MAX_CNT]; /**< Local impl-specific queue context */ 180 180 VIRTIOCALLBACKS virtioCallbacks; /**< Callback vectors to client */ 181 181 … … 356 356 DECLINLINE(bool) vqIsEmpty(PVIRTIOSTATE pVirtio, uint16_t qIdx) 357 357 { 358 return vqReadAvailDescIdx(pVirtio, qIdx) == pVirtio-> queueShadow->uAvailIdx;358 return vqReadAvailDescIdx(pVirtio, qIdx) == pVirtio->virtqShadow->uAvailIdx; 359 359 } 360 360 … … 511 511 } 512 512 513 void vqNotified (PVIRTIOSTATE pVirtio, uint32_t qidx, uint16_t uDescIdx);514 static void vqNotify (PVIRTIOSTATE pVirtio, uint16_t qIdx);515 513 static void vqReset (PVIRTIOSTATE pVirtio, uint16_t qIdx); 514 static void vqDeviceNotified (PVIRTIOSTATE pVirtio, uint16_t qidx, uint16_t uDescIdx); 515 static void vqNotifyDriver (PVIRTIOSTATE pVirtio, uint16_t qIdx); 516 516 static int virtioRaiseInterrupt (PVIRTIOSTATE pVirtio, uint8_t uCause); 517 517 static void virtioLowerInterrupt (PVIRTIOSTATE pVirtio);
Note:
See TracChangeset
for help on using the changeset viewer.