Changeset 83545 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- Apr 4, 2020 6:34:01 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r83542 r83545 353 353 #define IOMMU_MMIO_REGION_SIZE _16K /**< Size of the MMIO region in bytes. */ 354 354 /** @} */ 355 356 /** 357 * Acquires the IOMMU lock or returns. 358 */ 359 #define IOMMU_LOCK_RET(a_pDevIns, a_pThis, a_rcBusy) \ 360 do { \ 361 int rcLock = PDMDevHlpCritSectEnter((a_pDevIns), &(a_pThis)->CritSect, (a_rcBusy)); \ 362 if (RT_LIKELY(rcLock == VINF_SUCCESS)) \ 363 { /* likely */ } \ 364 else \ 365 return rcLock; \ 366 } while (0) 367 368 /** 369 * Releases the IOMMU lock. 370 */ 371 #define IOMMU_UNLOCK(a_pDevIns, a_pThis) \ 372 do { PDMDevHlpCritSectLeave((a_pDevIns), &(a_pThis)->CritSect); } while (0) 355 373 356 374 … … 1964 1982 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 1965 1983 1966 static VBOXSTRICTRC iommuAmdReadRegister(PCIOMMU pThis, uint32_t off, uint 8_t cb, uint64_t *puResult)1984 static VBOXSTRICTRC iommuAmdReadRegister(PCIOMMU pThis, uint32_t off, uint64_t *puResult) 1967 1985 { 1968 1986 Assert(off < _16K); 1969 Assert(cb == 4 || cb == 8); 1970 Assert(cb == 4 || !(off & 7)); 1971 Assert(cb == 8 || !(off & 3)); 1972 1987 Assert(!(off & 7) || !(off & 3)); 1988 1989 /** @todo locking? */ 1973 1990 switch (off) 1974 1991 { … … 2061 2078 case IOMMU_MMIO_OFF_SMI_FLT_LAST: 2062 2079 { 2080 Log((IOMMU_LOG_PFX ": iommuAmdReadRegister: Reading unsupported register: SMI filter %u\n", 2081 (off - IOMMU_MMIO_OFF_SMI_FLT_FIRST) >> 3)); 2063 2082 *puResult = 0; 2064 2083 break; … … 2068 2087 default: 2069 2088 { 2089 Log((IOMMU_LOG_PFX ": iommuAmdReadRegister: Trying to read unknown register at %u (%#x)\n", off, off)); 2070 2090 *puResult = 0; 2071 ASSERT_GUEST_MSG_FAILED((IOMMU_LOG_PFX ": iommuAmdReadRegister: Unknown offset %u (cb=%u)\n", off, cb)); 2072 break; 2091 return VINF_IOM_MMIO_UNUSED_00; 2073 2092 } 2074 2093 } 2094 return VINF_SUCCESS; 2075 2095 } 2076 2096 … … 2094 2114 NOREF(pvUser); 2095 2115 Assert(cb == 4 || cb == 8); 2096 2097 uint64_t uResult = 0; 2098 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 2099 VBOXSTRICTRC rcStrict = iommuAmdReadRegister(pThis, off, cb, &uResult); 2116 Assert(cb == 4 || !(off & 7)); 2117 Assert(cb == 8 || !(off & 3)); 2118 2119 uint64_t uResult = 0; 2120 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 2121 VBOXSTRICTRC rcStrict = iommuAmdReadRegister(pThis, off, &uResult); 2100 2122 if (cb == 8) 2101 2123 *(uint64_t *)pv = uResult;
Note:
See TracChangeset
for help on using the changeset viewer.