Changeset 82559 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Dec 12, 2019 6:55:29 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevVirtioSCSI.cpp
r82183 r82559 80 80 #define VIRTIOSCSI_HOST_SCSI_FEATURES_OFFERED VIRTIOSCSI_HOST_SCSI_FEATURES_NONE 81 81 82 #define VIRTIOSCSI_REQ_QUEUE_CNT 1/**< T.B.D. Consider increasing */82 #define VIRTIOSCSI_REQ_QUEUE_CNT 4 /**< T.B.D. Consider increasing */ 83 83 #define VIRTIOSCSI_QUEUE_CNT (VIRTIOSCSI_REQ_QUEUE_CNT + 2) 84 84 #define VIRTIOSCSI_MAX_TARGETS 256 /**< T.B.D. Figure out a a good value for this. */ … … 109 109 #define VIRTQ_REQ_BASE 2 /**< Spec-defined base index of request queues */ 110 110 111 #define VIRTQNAME(qIdx) (pThis->aszV IRTQNAMEs[qIdx]) /**< Macro to get queue name from its index */111 #define VIRTQNAME(qIdx) (pThis->aszVirtqNames[qIdx]) /**< Macro to get queue name from its index */ 112 112 #define CBVIRTQNAME(qIdx) RTStrNLen(VIRTQNAME(qIdx), sizeof(VIRTQNAME(qIdx))) 113 113 … … 126 126 /** 127 127 * VirtIO SCSI Host Device device-specific configuration (see VirtIO 1.0, section 5.6.4) 128 * VBox VirtIO framework issues callback to this client (device) to handle MMIO accesses 129 * to the device-specific configuration parameters. uNumQueues is constant, readonly, 130 * but maintained in this struct due to the design of local MMIO and logging handling. 131 * The named constant will be used instead to wherever feasible. 128 * VBox VirtIO core issues callback to this VirtIO device-specific implementation to handle 129 * MMIO accesses to device-specific configuration parameters. 132 130 */ 133 131 typedef struct virtio_scsi_config … … 160 158 { 161 159 // Device-writable part 162 uint32_t uEvent; /**< event :*/160 uint32_t uEvent; /**< event */ 163 161 uint8_t abVirtioLun[8]; /**< lun */ 164 162 uint32_t uReason; /**< reason */ … … 427 425 428 426 /** Device-specific spec-based VirtIO VIRTQNAMEs */ 429 char aszV IRTQNAMEs[VIRTIOSCSI_QUEUE_CNT][VIRTIO_MAX_QUEUE_NAME_SIZE];427 char aszVirtqNames[VIRTIOSCSI_QUEUE_CNT][VIRTIO_MAX_QUEUE_NAME_SIZE]; 430 428 431 429 /** Track which VirtIO queues we've attached to */ … … 554 552 typedef struct VIRTIOSCSIREQ 555 553 { 556 struct VIRTIOSCSIREQ *next; /**< When linked into redo queue */557 554 PDMMEDIAEXIOREQ hIoReq; /**< Handle of I/O request */ 558 555 PVIRTIOSCSITARGET pTarget; /**< Target */ … … 577 574 DECLINLINE(void) virtioScsiSetVirtqNames(PVIRTIOSCSI pThis) 578 575 { 579 RTStrCopy(pThis->aszV IRTQNAMEs[CONTROLQ_IDX], VIRTIO_MAX_QUEUE_NAME_SIZE, "controlq");580 RTStrCopy(pThis->aszV IRTQNAMEs[EVENTQ_IDX], VIRTIO_MAX_QUEUE_NAME_SIZE, "eventq");576 RTStrCopy(pThis->aszVirtqNames[CONTROLQ_IDX], VIRTIO_MAX_QUEUE_NAME_SIZE, "controlq"); 577 RTStrCopy(pThis->aszVirtqNames[EVENTQ_IDX], VIRTIO_MAX_QUEUE_NAME_SIZE, "eventq"); 581 578 for (uint16_t qIdx = VIRTQ_REQ_BASE; qIdx < VIRTQ_REQ_BASE + VIRTIOSCSI_REQ_QUEUE_CNT; qIdx++) 582 RTStrPrintf(pThis->aszV IRTQNAMEs[qIdx], VIRTIO_MAX_QUEUE_NAME_SIZE,579 RTStrPrintf(pThis->aszVirtqNames[qIdx], VIRTIO_MAX_QUEUE_NAME_SIZE, 583 580 "requestq<%d>", qIdx - VIRTQ_REQ_BASE); 584 581 } … … 1045 1042 RT_UNTRUSTED_NONVOLATILE_COPY_FENCE(); /* needed? */ 1046 1043 1047 Log 2Func((".... Copied %lu bytes from %lu byte guest buffer, residual=%lu\n",1044 Log3Func((".... Copied %lu bytes from %lu byte guest buffer, residual=%lu\n", 1048 1045 cbCopy, pReq->pDescChain->cbPhysReturn, pReq->pDescChain->cbPhysReturn - cbCopy)); 1049 1046 … … 1132 1129 /* Force rejection. todo: figure out right way to handle. Note this is a very 1133 1130 * vague and confusing part of the VirtIO spec which deviates from the SCSI standard 1134 * as Klaus has pointed out on numerous occasions. I have not been able to determine 1135 * how to implement this properly. Nor do I see any of the guest drivers at this 1136 * point making use of it, hence the loud log message so we can catch it if/when a guest 1137 * does access it and can resume the investigation at that point. r=paul */ 1131 * I have not been able to determine how to implement this properly. Guest drivers 1132 * whose source code has been checked, so far, don't seem to use it. If it starts 1133 * showing up in the logs can try to work */ 1138 1134 uScsiLun = 0xff; 1139 1135 } … … 1160 1156 * Handle submission errors 1161 1157 */ 1162 1163 1158 if (RT_LIKELY(!fBadLUNFormat)) 1164 1159 { /* likely */ } … … 1581 1576 PVIRTIO_DESC_CHAIN_T pDescChain; 1582 1577 int rc = virtioCoreR3DescChainGet(pDevIns, &pThis->Virtio, qIdx, 1583 pWorkerR3->auRedoDescs[i], &pDescChain);1578 pWorkerR3->auRedoDescs[i], &pDescChain); 1584 1579 if (RT_FAILURE(rc)) 1585 1580 LogRel(("Error fetching desc chain to redo, %Rrc", rc)); … … 2355 2350 PVIRTIOSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVIRTIOSCSICC); 2356 2351 2357 #if 0 /* need more info about how to use this event */ 2352 #if 0 /* need more info about how to use this event. The VirtIO 1.0 specification 2353 * lists several SCSI related event types but presumes the reader knows 2354 * how to use them without providing references. */ 2358 2355 virtioScsiR3ReportMediaChange(pDevIns, pThis, pTarget->uTarget); 2359 2356 #endif … … 2662 2659 /* .uReserved0 = */ 0, 2663 2660 /* .szName = */ "virtio-scsi", 2664 /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS /** @todo | PDM_DEVREG_FLAGS_RZ */| PDM_DEVREG_FLAGS_NEW_STYLE2661 /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE 2665 2662 | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION 2666 2663 | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION,
Note:
See TracChangeset
for help on using the changeset viewer.