Changeset 87692 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- Feb 10, 2021 4:50:02 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142735
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r87691 r87692 1221 1221 1222 1222 1223 DECLINLINE(IOMMU_STATUS_T) iommuAmdGetStatus(PCIOMMU pThis) 1224 { 1225 IOMMU_STATUS_T Status; 1226 Status.u64 = ASMAtomicReadU64((volatile uint64_t *)&pThis->Status.u64); 1227 return Status; 1228 } 1229 1230 1231 DECLINLINE(IOMMU_CTRL_T) iommuAmdGetCtrl(PCIOMMU pThis) 1223 DECL_FORCE_INLINE(IOMMU_CTRL_T) iommuAmdGetCtrlUnlocked(PCIOMMU pThis) 1232 1224 { 1233 1225 IOMMU_CTRL_T Ctrl; … … 1272 1264 * @param pDevIns The IOMMU device instance. 1273 1265 * 1274 * @remarks The IOMMU lock must be held .1266 * @remarks The IOMMU lock must be held while calling this! 1275 1267 */ 1276 1268 static void iommuAmdCmdThreadWakeUpIfNeeded(PPDMDEVINS pDevIns) 1277 1269 { 1278 IOMMU_ASSERT_LOCKED(pDevIns);1279 1270 Log4Func(("\n")); 1280 1271 1281 1272 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 1282 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis); 1283 if (Status.n.u1CmdBufRunning) 1273 if (pThis->Status.n.u1CmdBufRunning) 1284 1274 { 1285 1275 Log4Func(("Signaling command thread\n")); … … 1622 1612 * Inconsistent specs :/ 1623 1613 */ 1624 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis); 1625 if (Status.n.u1CmdBufRunning) 1614 if (pThis->Status.n.u1CmdBufRunning) 1626 1615 { 1627 1616 LogFunc(("Setting CmdBufBar (%#RX64) when command buffer is running -> Ignored\n", u64Value)); … … 1665 1654 * See AMD IOMMU spec. "Event Log Base Address Register". 1666 1655 */ 1667 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis); 1668 if (Status.n.u1EvtLogRunning) 1656 if (pThis->Status.n.u1EvtLogRunning) 1669 1657 { 1670 1658 LogFunc(("Setting EvtLogBar (%#RX64) when event logging is running -> Ignored\n", u64Value)); … … 1712 1700 if (NewCtrl.n.u3DevTabSegEn <= pThis->ExtFeat.n.u2DevTabSegSup) 1713 1701 { 1714 IOMMU_CTRL_T const OldCtrl = iommuAmdGetCtrl(pThis);1702 IOMMU_CTRL_T const OldCtrl = pThis->Ctrl; 1715 1703 1716 1704 /* Update the register. */ … … 1962 1950 * See AMD IOMMU spec. 3.3.13 "Command and Event Log Pointer Registers". 1963 1951 */ 1964 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis); 1965 if (Status.n.u1CmdBufRunning) 1952 if (pThis->Status.n.u1CmdBufRunning) 1966 1953 { 1967 1954 LogFunc(("Setting CmdBufHeadPtr (%#RX64) when command buffer is running -> Ignored\n", u64Value)); … … 2075 2062 * See AMD IOMMU spec. 3.3.13 "Command and Event Log Pointer Registers". 2076 2063 */ 2077 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis); 2078 if (Status.n.u1EvtLogRunning) 2064 if (pThis->Status.n.u1EvtLogRunning) 2079 2065 { 2080 2066 LogFunc(("Setting EvtLogTailPtr (%#RX64) when event log is running -> Ignored\n", u64Value)); … … 2117 2103 * Writing 0 to an RW1C bit has no effect. Writing 1 to an RW1C bit, clears the bit if it's already 1. 2118 2104 */ 2119 IOMMU_STATUS_T const OldStatus = iommuAmdGetStatus(pThis);2105 IOMMU_STATUS_T const OldStatus = pThis->Status; 2120 2106 uint64_t const fOldRw1cBits = (OldStatus.u64 & IOMMU_STATUS_RW1C_MASK); 2121 2107 uint64_t const fOldRoBits = (OldStatus.u64 & ~IOMMU_STATUS_RW1C_MASK); … … 2523 2509 2524 2510 /* Check if event logging is active and the log has not overflowed. */ 2525 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis);2511 IOMMU_STATUS_T const Status = pThis->Status; 2526 2512 if ( Status.n.u1EvtLogRunning 2527 2513 && !Status.n.u1EvtOverflow) … … 2553 2539 2554 2540 /* Check and signal an interrupt if software wants to receive one when an event log entry is written. */ 2555 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrl(pThis); 2556 if (Ctrl.n.u1EvtIntrEn) 2541 if (pThis->Ctrl.n.u1EvtIntrEn) 2557 2542 iommuAmdMsiInterruptRaise(pDevIns); 2558 2543 } … … 2563 2548 2564 2549 /* Check and signal an interrupt if software wants to receive one when the event log has overflowed. */ 2565 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrl(pThis); 2566 if (Ctrl.n.u1EvtIntrEn) 2550 if (pThis->Ctrl.n.u1EvtIntrEn) 2567 2551 iommuAmdMsiInterruptRaise(pDevIns); 2568 2552 } … … 3062 3046 3063 3047 /* Figure out which device table segment is being accessed. */ 3064 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrl(pThis); 3065 uint8_t const idxSegsEn = Ctrl.n.u3DevTabSegEn; 3048 uint8_t const idxSegsEn = pThis->Ctrl.n.u3DevTabSegEn; 3066 3049 Assert(idxSegsEn < RT_ELEMENTS(g_auDevTabSegShifts)); 3067 3050 … … 3776 3759 3777 3760 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 3778 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrl (pThis);3761 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrlUnlocked(pThis); 3779 3762 if (Ctrl.n.u1IommuEn) 3780 3763 { … … 3852 3835 3853 3836 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 3854 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrl (pThis);3837 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrlUnlocked(pThis); 3855 3838 if (Ctrl.n.u1IommuEn) 3856 3839 { … … 4207 4190 4208 4191 /* Interrupts are forwarded with remapping when the IOMMU is disabled. */ 4209 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrl (pThis);4192 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrlUnlocked(pThis); 4210 4193 if (Ctrl.n.u1IommuEn) 4211 4194 { … … 4313 4296 IOMMU_LOCK(pDevIns, pThisCC); 4314 4297 ASMAtomicOrU64(&pThis->Status.u64, IOMMU_STATUS_COMPLETION_WAIT_INTR); 4315 IOMMU_CTRL_T const Ctrl = iommuAmdGetCtrl(pThis); 4316 bool const fRaiseInt = Ctrl.n.u1CompWaitIntrEn; 4298 bool const fRaiseInt = pThis->Ctrl.n.u1CompWaitIntrEn; 4317 4299 IOMMU_UNLOCK(pDevIns, pThisCC); 4318 4300 … … 4547 4529 IOMMU_LOCK(pDevIns, pThisCC); 4548 4530 4549 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis); 4550 if (Status.n.u1CmdBufRunning) 4531 if (pThis->Status.n.u1CmdBufRunning) 4551 4532 { 4552 4533 /* Get the offsets we need to read commands from memory (circular buffer offset). */ … … 5916 5897 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatIotlbeCacheMiss, STAMTYPE_COUNTER, "IOTLB/CacheMiss", STAMUNIT_OCCURENCES, "Number of IOTLB cache misses."); 5917 5898 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatIotlbeLazyEvictReuse, STAMTYPE_COUNTER, "IOTLB/LazyEvictReuse", STAMUNIT_OCCURENCES, "Number of IOTLB entries reused after lazy eviction."); 5918 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatIotlbeLookup, STAMTYPE_PROFILE, " IOTLB/Lookup", STAMUNIT_TICKS_PER_CALL, "Profiling IOTLB entry lookup.");5899 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatIotlbeLookup, STAMTYPE_PROFILE, "Profile/IotlbeLookup", STAMUNIT_TICKS_PER_CALL, "Profiling IOTLB entry lookup."); 5919 5900 5920 5901 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatDteLookupNonContig, STAMTYPE_COUNTER, "DTE/LookupNonContig", STAMUNIT_OCCURENCES, "DTE lookups that resulted in non-contiguous translated regions."); 5921 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatIoPageWalkLookup, STAMTYPE_PROFILE, " DTE/Lookup", STAMUNIT_TICKS_PER_CALL, "Profiling I/O page walk lookup.");5902 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatIoPageWalkLookup, STAMTYPE_PROFILE, "Profile/IoPageWalk", STAMUNIT_TICKS_PER_CALL, "Profiling I/O page walk lookup."); 5922 5903 # endif 5923 5904
Note:
See TracChangeset
for help on using the changeset viewer.