Changeset 83666 in vbox for trunk/src/VBox
- Timestamp:
- Apr 10, 2020 12:53:12 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137139
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r83665 r83666 1131 1131 } IOMMU_EXCL_RANGE_BAR_T; 1132 1132 AssertCompileSize(IOMMU_EXCL_RANGE_BAR_T, 8); 1133 #define IOMMU_EXCL_RANGE_BAR_VALID_MASK UINT64_C(0x000ffffffffff003) 1133 1134 1134 1135 /** … … 1148 1149 } IOMMU_EXCL_RANGE_LIMIT_T; 1149 1150 AssertCompileSize(IOMMU_EXCL_RANGE_LIMIT_T, 8); 1151 #define IOMMU_EXCL_RANGE_LIMIT_VALID_MASK UINT64_C(0x000ffffffffff000) 1152 1150 1153 1151 1154 /** … … 1222 1225 } PPR_LOG_BAR_T; 1223 1226 AssertCompileSize(PPR_LOG_BAR_T, 8); 1227 #define IOMMU_PPR_LOG_BAR_VALID_MASK UINT64_C(0x0f0ffffffffff000) 1224 1228 1225 1229 /** … … 2053 2057 2054 2058 /** 2059 * Logs if the buffer length is invalid. 2060 * 2061 * @param uEncodedLen The length to decode. 2062 * @param pszFunc Name of the calling function for logging purposes. 2063 */ 2064 DECLINLINE(void) iommuAmdCheckBufferLength(uint8_t uEncodedLen, const char *pszFunc) 2065 { 2066 #ifdef VBOX_STRICT 2067 uint32_t cEntries; 2068 iommuAmdDecodeBufferLength(uEncodedLen, &cEntries, NULL /* pcbBuffer */); 2069 if (!cEntries) 2070 Log((IOMMU_LOG_PFX ": %s: Invalid length %#x\n", pszFunc, uEncodedLen)); 2071 #else 2072 RT_NOREF(uEncodedLen, pszFunc); 2073 #endif 2074 } 2075 2076 2077 /** 2078 * Writes to a read-only register. 2079 */ 2080 static VBOXSTRICTRC iommuAmdIgnore_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t iReg, uint64_t u64Value) 2081 { 2082 RT_NOREF(pDevIns, pThis, iReg); 2083 Log((IOMMU_LOG_PFX ": iommuAmdIgnore_w: Write to read-only register (%#x) with value %#RX64 ignored\n", iReg, u64Value)); 2084 return VINF_SUCCESS; 2085 } 2086 2087 2088 /** 2055 2089 * Writes the Device Table Base Address Register. 2056 2090 */ … … 2070 2104 RT_NOREF(pDevIns, pThis, iReg); 2071 2105 pThis->CmdBufBaseAddr.u64 = u64Value & IOMMU_CMD_BUF_BAR_VALID_MASK; 2072 2073 #ifdef VBOX_STRICT 2074 uint32_t cEntries; 2075 uint8_t const uLen = pThis->CmdBufBaseAddr.n.u4CmdLen; 2076 iommuAmdDecodeBufferLength(uLen, &cEntries, NULL /* pcbBuffer */); 2077 if (!cEntries) 2078 Log((IOMMU_LOG_PFX ": iommuAmdCmdBufBar_w: Invalid length %#x\n", uLen)); 2079 #endif 2106 iommuAmdCheckBufferLength(pThis->CmdBufBaseAddr.n.u4CmdLen, __PRETTY_FUNCTION__); 2080 2107 return VINF_SUCCESS; 2081 2108 } … … 2088 2115 RT_NOREF(pDevIns, pThis, iReg); 2089 2116 pThis->EvtLogBaseAddr.u64 = u64Value & IOMMU_EVT_LOG_BAR_VALID_MASK; 2090 2091 #ifdef VBOX_STRICT 2092 uint32_t cEntries; 2093 uint8_t const uLen = pThis->EvtLogBaseAddr.n.u4EvtLen; 2094 iommuAmdDecodeBufferLength(uLen, &cEntries, NULL /* pcbBuffer */); 2095 if (!cEntries) 2096 Log((IOMMU_LOG_PFX ": iommuAmdEvtLogBar_w: Invalid length %#x\n", uLen)); 2097 #endif 2117 iommuAmdCheckBufferLength(pThis->EvtLogBaseAddr.n.u4EvtLen, __PRETTY_FUNCTION__); 2118 return VINF_SUCCESS; 2119 } 2120 2121 2122 /** 2123 * Writes to the Excluse Range Base Address Register. 2124 */ 2125 static VBOXSTRICTRC iommuAmdExclRangeBar_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t iReg, uint64_t u64Value) 2126 { 2127 RT_NOREF(pDevIns, pThis, iReg); 2128 pThis->ExclRangeBaseAddr.u64 = u64Value & IOMMU_EXCL_RANGE_BAR_VALID_MASK; 2129 return VINF_SUCCESS; 2130 } 2131 2132 2133 /** 2134 * Writes to the Excluse Range Limit Register. 2135 */ 2136 static VBOXSTRICTRC iommuAmdExclRangeLimit_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t iReg, uint64_t u64Value) 2137 { 2138 RT_NOREF(pDevIns, pThis, iReg); 2139 pThis->ExclRangeLimit.u64 = u64Value & IOMMU_EXCL_RANGE_LIMIT_VALID_MASK; 2140 return VINF_SUCCESS; 2141 } 2142 2143 2144 /** 2145 * Writes the PPR Log Base Address Register. 2146 */ 2147 static VBOXSTRICTRC iommuAmdPprLogBar_w(PPDMDEVINS pDevIns, PIOMMU pThis, uint32_t iReg, uint64_t u64Value) 2148 { 2149 RT_NOREF(pDevIns, pThis, iReg); 2150 pThis->PprLogBaseAddr.u64 = u64Value & IOMMU_PPR_LOG_BAR_VALID_MASK; 2151 iommuAmdCheckBufferLength(pThis->PprLogBaseAddr.n.u4PprLogLen, __PRETTY_FUNCTION__); 2098 2152 return VINF_SUCCESS; 2099 2153 } … … 2122 2176 * @returns Strict VBox status code. 2123 2177 * @param pDevIns The device instance. 2124 * @param off Offset in bytes.2178 * @param off MMIO byte offset to the register. 2125 2179 * @param cb The size of the write access. 2126 2180 * @param uValue The value being written. … … 2135 2189 Assert(pThis); 2136 2190 2137 VBOXSTRICTRC rcStrict;2138 2191 switch (off) 2139 2192 { 2140 2193 case IOMMU_MMIO_OFF_DEV_TAB_BAR: return iommuAmdDevTabBar_w(pDevIns, pThis, off, uValue); 2141 2194 case IOMMU_MMIO_OFF_CMD_BUF_BAR: return iommuAmdCmdBufBar_w(pDevIns, pThis, off, uValue); 2142 case IOMMU_MMIO_OFF_EVT_LOG_BAR: return iommuAmdEvtLogBar_w(pDevIns, pThis, off, 2195 case IOMMU_MMIO_OFF_EVT_LOG_BAR: return iommuAmdEvtLogBar_w(pDevIns, pThis, off, uValue); 2143 2196 case IOMMU_MMIO_OFF_CTRL: 2144 case IOMMU_MMIO_OFF_EXCL_BAR: 2145 case IOMMU_MMIO_OFF_EXCL_RANGE_LIMIT: 2146 case IOMMU_MMIO_OFF_EXT_FEAT: 2147 2148 case IOMMU_MMIO_OFF_PPR_LOG_BAR: 2149 case IOMMU_MMIO_OFF_HW_EVT_HI: 2150 case IOMMU_MMIO_OFF_HW_EVT_LO: 2197 case IOMMU_MMIO_OFF_EXCL_BAR: return iommuAmdExclRangeBar_w(pDevIns, pThis, off, uValue); 2198 case IOMMU_MMIO_OFF_EXCL_RANGE_LIMIT: return iommuAmdExclRangeLimit_w(pDevIns, pThis, off, uValue); 2199 case IOMMU_MMIO_OFF_EXT_FEAT: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2200 2201 case IOMMU_MMIO_OFF_PPR_LOG_BAR: return iommuAmdPprLogBar_w(pDevIns, pThis, off, uValue); 2202 case IOMMU_MMIO_OFF_HW_EVT_HI: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2203 case IOMMU_MMIO_OFF_HW_EVT_LO: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2151 2204 case IOMMU_MMIO_OFF_HW_EVT_STATUS: 2152 2205 2153 case IOMMU_MMIO_OFF_GALOG_BAR: 2154 case IOMMU_MMIO_OFF_GALOG_TAIL_ADDR: 2155 2156 case IOMMU_MMIO_OFF_PPR_LOG_B_BAR: 2157 case IOMMU_MMIO_OFF_PPR_EVT_B_BAR: 2206 case IOMMU_MMIO_OFF_GALOG_BAR: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2207 case IOMMU_MMIO_OFF_GALOG_TAIL_ADDR: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2208 2209 case IOMMU_MMIO_OFF_PPR_LOG_B_BAR: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2210 case IOMMU_MMIO_OFF_PPR_EVT_B_BAR: return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2158 2211 2159 2212 case IOMMU_MMIO_OFF_DEV_TAB_SEG_FIRST: … … 2162 2215 uint8_t const idxDevTabSeg = (off - IOMMU_MMIO_OFF_DEV_TAB_SEG_FIRST) >> 3; 2163 2216 Assert(idxDevTabSeg < RT_ELEMENTS(pThis->DevTabSeg)); 2164 break;2217 return iommuAmdIgnore_w(pDevIns, pThis, off, uValue); 2165 2218 } 2166 2219 … … 2227 2280 Log((IOMMU_LOG_PFX ": iommuAmdWriteRegister: Writing unsupported register: SMI filter %u -> Ignored\n", 2228 2281 (off - IOMMU_MMIO_OFF_SMI_FLT_FIRST) >> 3)); 2229 rcStrict = VINF_SUCCESS; 2230 break; 2282 return VINF_SUCCESS; 2231 2283 } 2232 2284 … … 2236 2288 Log((IOMMU_LOG_PFX ": iommuAmdWriteRegister: Trying to write unknown register at %u (%#x) with %#RX64\n", off, off, 2237 2289 uValue)); 2238 rcStrict = VINF_SUCCESS; 2239 break; 2290 return VINF_SUCCESS; 2240 2291 } 2241 2292 } 2242 2243 return rcStrict;2244 2293 } 2245 2294
Note:
See TracChangeset
for help on using the changeset viewer.