Changeset 88638 in vbox
- Timestamp:
- Apr 22, 2021 5:40:05 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 143951
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/err.h
r88579 r88638 3053 3053 * @{ 3054 3054 */ 3055 /** Internal processing error \#1 in the IOMMU device code. */3056 #define VERR_IOMMU_IPE_1 (-7201)3057 /** Internal processing error \#2 in the IOMMU device code. */3058 #define VERR_IOMMU_IPE_2 (-7202)3059 /** Internal processing error \#3 in the IOMMU device code. */3060 #define VERR_IOMMU_IPE_3 (-7203)3061 /** Internal processing error \#4 in the IOMMU device code. */3062 #define VERR_IOMMU_IPE_4 (-7204)3063 /** Internal processing error \#5 in the IOMMU device code. */3064 #define VERR_IOMMU_IPE_5 (-7205)3065 3055 /** Failed to read the device table entry from guest memory. */ 3066 #define VERR_IOMMU_DTE_READ_FAILED (-720 6)3056 #define VERR_IOMMU_DTE_READ_FAILED (-7200) 3067 3057 /** Failed to read the device table entry due to an invalid offset. */ 3068 #define VERR_IOMMU_DTE_BAD_OFFSET (-720 7)3058 #define VERR_IOMMU_DTE_BAD_OFFSET (-7201) 3069 3059 /** Address translation failed. */ 3070 #define VERR_IOMMU_ADDR_TRANSLATION_FAILED (-7208) 3060 #define VERR_IOMMU_ADDR_TRANSLATION_FAILED (-7202) 3061 /** Access denied for the address. */ 3062 #define VERR_IOMMU_ADDR_ACCESS_DENIED (-7203) 3063 /** Remapping failed for the interrupt. */ 3064 #define VERR_IOMMU_INTR_REMAP_FAILED (-7204) 3065 /** Remapping denied for the interrupt (might have caused a PCI target abort). */ 3066 #define VERR_IOMMU_INTR_REMAP_DENIED (-7205) 3067 /** Command not supported. */ 3068 #define VERR_IOMMU_CMD_NOT_SUPPORTED (-7206) 3069 /** Command format (or reserved bits) invalid. */ 3070 #define VERR_IOMMU_CMD_INVALID_FORMAT (-7207) 3071 /** Command hardware failure. */ 3072 #define VERR_IOMMU_CMD_HW_ERROR (-7208) 3073 /** IOMMU device is not present. */ 3074 #define VERR_IOMMU_NOT_PRESENT (-7209) 3075 /** IOMMU instance cannot call itself (for remapping interrupts or translating 3076 * addresses). */ 3077 #define VERR_IOMMU_CANNOT_CALL_SELF (-7210) 3071 3078 /** Address translation disabled (but permission bits apply). */ 3072 #define VINF_IOMMU_ADDR_TRANSLATION_DISABLED 7209 3073 /** Access denied for the address. */ 3074 #define VERR_IOMMU_ADDR_ACCESS_DENIED (-7210) 3075 /** Remapping failed for the interrupt. */ 3076 #define VERR_IOMMU_INTR_REMAP_FAILED (-7211) 3077 /** Remapping denied for the interrupt (might have caused a PCI target abort). */ 3078 #define VERR_IOMMU_INTR_REMAP_DENIED (-7212) 3079 /** Command not supported. */ 3080 #define VERR_IOMMU_CMD_NOT_SUPPORTED (-7213) 3081 /** Command format (or reserved bits) invalid. */ 3082 #define VERR_IOMMU_CMD_INVALID_FORMAT (-7214) 3083 /** Command hardware failure. */ 3084 #define VERR_IOMMU_CMD_HW_ERROR (-7215) 3085 /** IOMMU device is not present. */ 3086 #define VERR_IOMMU_NOT_PRESENT (-7216) 3079 #define VINF_IOMMU_ADDR_TRANSLATION_DISABLED 7211 3080 3081 /** IOMMU Internal processing error \#0. */ 3082 #define VERR_IOMMU_IPE_0 (-7290) 3083 /** IOMMU Internal processing error \#1. */ 3084 #define VERR_IOMMU_IPE_1 (-7291) 3085 /** IOMMU Internal processing error \#2. */ 3086 #define VERR_IOMMU_IPE_2 (-7292) 3087 /** IOMMU Internal processing error \#3. */ 3088 #define VERR_IOMMU_IPE_3 (-7293) 3089 /** IOMMU Internal processing error \#4. */ 3090 #define VERR_IOMMU_IPE_4 (-7294) 3091 /** IOMMU Internal processing error \#5. */ 3092 #define VERR_IOMMU_IPE_5 (-7295) 3093 /** IOMMU Internal processing error \#6. */ 3094 #define VERR_IOMMU_IPE_6 (-7296) 3095 /** IOMMU Internal processing error \#7. */ 3096 #define VERR_IOMMU_IPE_7 (-7297) 3097 /** IOMMU Internal processing error \#8. */ 3098 #define VERR_IOMMU_IPE_8 (-7298) 3099 /** IOMMU Internal processing error \#9. */ 3100 #define VERR_IOMMU_IPE_9 (-7299) 3087 3101 /** @} */ 3088 3102 -
trunk/src/VBox/Devices/PC/DevIoApic.cpp
r88631 r88638 537 537 ioapicGetMsiFromApicIntr(&ApicIntr, &MsiIn); 538 538 int const rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, VBOX_PCI_BDF_SB_IOAPIC, &MsiIn, &MsiOut); 539 if (RT_SUCCESS(rcRemap)) 539 if ( rcRemap == VERR_IOMMU_NOT_PRESENT 540 || rcRemap == VERR_IOMMU_CANNOT_CALL_SELF) 541 MsiOut = MsiIn; 542 else if (RT_SUCCESS(rcRemap)) 540 543 STAM_COUNTER_INC(&pThis->StatIommuRemappedIntr); 541 else if (rcRemap == VERR_IOMMU_NOT_PRESENT)542 MsiOut = MsiIn;543 544 else 544 545 { … … 924 925 * 925 926 * If the Bus:Dev:Fn isn't valid, it is ASSUMED the device generating the 926 * MSI is the IOMMU itself and hence is not subject to remapping. 927 * MSI may be the IOMMU itself and hence is not subject to remapping. 928 * 929 * For AMD IOMMUs, since it's a full fledged PCI device, the BDF will be 930 * valid but will be handled by VERR_IOMMU_CANNOT_CALL_SELF case. 927 931 */ 928 932 if (PCIBDF_IS_VALID(uBusDevFn)) … … 931 935 RT_ZERO(MsiOut); 932 936 int const rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, uBusDevFn, pMsi, &MsiOut); 933 if (RT_SUCCESS(rcRemap)) 937 if ( rcRemap == VERR_IOMMU_NOT_PRESENT 938 || rcRemap == VERR_IOMMU_CANNOT_CALL_SELF) 939 MsiOut = *pMsi; 940 else if (RT_SUCCESS(rcRemap)) 934 941 STAM_COUNTER_INC(&pThis->StatIommuRemappedMsi); 935 else if (rcRemap == VERR_IOMMU_NOT_PRESENT)936 MsiOut = *pMsi;937 942 else 938 943 { -
trunk/src/VBox/VMM/VMMAll/PDMAllIommu.cpp
r88636 r88638 89 89 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 90 90 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 91 if ( pDevInsIommu 92 && pDevInsIommu != pDevIns) 93 { 94 int rc = pIommu->pfnMsiRemap(pDevInsIommu, idDevice, pMsiIn, pMsiOut); 95 if (RT_FAILURE(rc)) 96 { 97 LogFunc(("MSI remap failed. idDevice=%#x pMsiIn=(%#RX64, %#RU32) rc=%Rrc\n", idDevice, pMsiIn->Addr.u64, 98 pMsiIn->Data.u32, rc)); 99 } 100 return rc; 101 } 102 /** @todo Should we return an rc such that we can reschedule to R3 if R0 isn't 103 * enabled? Is that even viable with the state the I/O APIC would be in? */ 104 return VERR_IOMMU_NOT_PRESENT; 91 Assert(pDevInsIommu); 92 if (pDevInsIommu != pDevIns) 93 return pIommu->pfnMsiRemap(pDevInsIommu, idDevice, pMsiIn, pMsiOut); 94 return VERR_IOMMU_CANNOT_CALL_SELF; 105 95 } 106 96 … … 126 116 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 127 117 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 128 if ( pDevInsIommu 129 && pDevInsIommu != pDevIns) 130 { 118 if (pDevInsIommu) 119 { 120 if (pDevInsIommu != pDevIns) 121 { /* likely */ } 122 else 123 return VERR_IOMMU_CANNOT_CALL_SELF; 124 131 125 uint16_t const idDevice = pdmIommuGetPciDeviceId(pDevIns, pPciDev); 132 126 int rc = VINF_SUCCESS; … … 190 184 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 191 185 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 192 if ( pDevInsIommu 193 && pDevInsIommu != pDevIns) 194 { 186 if (pDevInsIommu) 187 { 188 if (pDevInsIommu != pDevIns) 189 { /* likely */ } 190 else 191 return VERR_IOMMU_CANNOT_CALL_SELF; 192 195 193 uint16_t const idDevice = pdmIommuGetPciDeviceId(pDevIns, pPciDev); 196 194 int rc = VINF_SUCCESS; … … 251 249 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 252 250 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 253 if ( pDevInsIommu 254 && pDevInsIommu != pDevIns) 255 { 251 if (pDevInsIommu) 252 { 253 if (pDevInsIommu != pDevIns) 254 { /* likely */ } 255 else 256 return VERR_IOMMU_CANNOT_CALL_SELF; 257 256 258 uint16_t const idDevice = pdmIommuGetPciDeviceId(pDevIns, pPciDev); 257 259 size_t cbContig = 0; … … 296 298 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 297 299 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 298 if ( pDevInsIommu 299 && pDevInsIommu != pDevIns) 300 { 300 if (pDevInsIommu) 301 { 302 if (pDevInsIommu != pDevIns) 303 { /* likely */ } 304 else 305 return VERR_IOMMU_CANNOT_CALL_SELF; 306 301 307 uint16_t const idDevice = pdmIommuGetPciDeviceId(pDevIns, pPciDev); 302 308 size_t cbContig = 0; … … 344 350 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 345 351 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 346 if ( pDevInsIommu 347 && pDevInsIommu != pDevIns) 348 { 352 if (pDevInsIommu) 353 { 354 if (pDevInsIommu != pDevIns) 355 { /* likely */ } 356 else 357 return VERR_IOMMU_CANNOT_CALL_SELF; 358 349 359 /* Allocate space for translated addresses. */ 350 360 size_t const cbIovas = cPages * sizeof(uint64_t); … … 407 417 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 408 418 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 409 if ( pDevInsIommu 410 && pDevInsIommu != pDevIns) 411 { 419 if (pDevInsIommu) 420 { 421 if (pDevInsIommu != pDevIns) 422 { /* likely */ } 423 else 424 return VERR_IOMMU_CANNOT_CALL_SELF; 425 412 426 /* Allocate space for translated addresses. */ 413 427 size_t const cbIovas = cPages * sizeof(uint64_t); -
trunk/src/VBox/VMM/VMMR0/PDMR0DevHlp.cpp
r88631 r88638 153 153 #ifdef VBOX_WITH_IOMMU_AMD 154 154 int rc = pdmIommuMemAccessRead(pDevIns, pPciDev, GCPhys, pvBuf, cbRead, fFlags); 155 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 155 if ( rc == VERR_IOMMU_NOT_PRESENT 156 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 157 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 158 else 156 159 return rc; 157 160 #endif … … 187 190 #ifdef VBOX_WITH_IOMMU_AMD 188 191 int rc = pdmIommuMemAccessWrite(pDevIns, pPciDev, GCPhys, pvBuf, cbWrite, fFlags); 189 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 192 if ( rc == VERR_IOMMU_NOT_PRESENT 193 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 194 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 195 else 190 196 return rc; 191 197 #endif … … 1532 1538 #ifdef VBOX_WITH_IOMMU_AMD 1533 1539 if (pdmIommuIsPresent(pDevIns)) 1534 return pdmIommuMsiRemap(pDevIns, idDevice, pMsiIn, pMsiOut); 1540 { 1541 PGVM pGVM = pDevIns->Internal.s.pGVM; 1542 PPDMIOMMUR0 pIommu = &pGVM->pdmr0.s.aIommus[0]; 1543 if (pIommu->pDevInsR0) 1544 return pdmIommuMsiRemap(pDevIns, idDevice, pMsiIn, pMsiOut); 1545 AssertMsgFailedReturn(("Implement queueing PDM task for remapping MSI via IOMMU in ring-3"), VERR_IOMMU_IPE_0); 1546 } 1535 1547 #else 1536 1548 RT_NOREF(pDevIns, idDevice); -
trunk/src/VBox/VMM/VMMR0/PDMR0DevHlpTracing.cpp
r87477 r88638 314 314 #ifdef VBOX_WITH_IOMMU_AMD 315 315 int rc = pdmIommuMemAccessRead(pDevIns, pPciDev, GCPhys, pvBuf, cbRead, fFlags); 316 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 316 if ( rc == VERR_IOMMU_NOT_PRESENT 317 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 318 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 319 else 317 320 return rc; 318 321 #endif … … 348 351 #ifdef VBOX_WITH_IOMMU_AMD 349 352 int rc = pdmIommuMemAccessWrite(pDevIns, pPciDev, GCPhys, pvBuf, cbWrite, fFlags); 350 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 353 if ( rc == VERR_IOMMU_NOT_PRESENT 354 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 355 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 356 else 351 357 return rc; 352 358 #endif -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r88565 r88638 1870 1870 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 1871 1871 int rc = pdmIommuMemAccessRead(pDevIns, pPciDev, GCPhys, pvBuf, cbRead, fFlags); 1872 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 1872 if ( rc == VERR_IOMMU_NOT_PRESENT 1873 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 1874 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 1875 else 1873 1876 return rc; 1874 1877 #endif … … 1904 1907 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 1905 1908 int rc = pdmIommuMemAccessWrite(pDevIns, pPciDev, GCPhys, pvBuf, cbWrite, fFlags); 1906 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 1909 if ( rc == VERR_IOMMU_NOT_PRESENT 1910 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 1911 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 1912 else 1907 1913 return rc; 1908 1914 #endif … … 1935 1941 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 1936 1942 int rc = pdmR3IommuMemAccessWriteCCPtr(pDevIns, pPciDev, GCPhys, fFlags, ppv, pLock); 1937 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 1943 if ( rc == VERR_IOMMU_NOT_PRESENT 1944 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 1945 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 1946 else 1938 1947 return rc; 1939 1948 #endif … … 1966 1975 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 1967 1976 int rc = pdmR3IommuMemAccessReadCCPtr(pDevIns, pPciDev, GCPhys, fFlags, ppv, pLock); 1968 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 1977 if ( rc == VERR_IOMMU_NOT_PRESENT 1978 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 1979 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 1980 else 1969 1981 return rc; 1970 1982 #endif … … 1998 2010 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 1999 2011 int rc = pdmR3IommuMemAccessBulkWriteCCPtr(pDevIns, pPciDev, cPages, paGCPhysPages, fFlags, papvPages, paLocks); 2000 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 2012 if ( rc == VERR_IOMMU_NOT_PRESENT 2013 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 2014 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 2015 else 2001 2016 return rc; 2002 2017 #endif … … 2030 2045 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 2031 2046 int rc = pdmR3IommuMemAccessBulkReadCCPtr(pDevIns, pPciDev, cPages, paGCPhysPages, fFlags, papvPages, paLocks); 2032 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 2047 if ( rc == VERR_IOMMU_NOT_PRESENT 2048 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 2049 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 2050 else 2033 2051 return rc; 2034 2052 #endif -
trunk/src/VBox/VMM/VMMR3/PDMDevHlpTracing.cpp
r87477 r88638 420 420 #ifdef VBOX_WITH_IOMMU_AMD 421 421 int rc = pdmIommuMemAccessRead(pDevIns, pPciDev, GCPhys, pvBuf, cbRead, fFlags); 422 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 422 if ( rc == VERR_IOMMU_NOT_PRESENT 423 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 424 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 425 else 423 426 return rc; 424 427 #endif … … 454 457 #ifdef VBOX_WITH_IOMMU_AMD 455 458 int rc = pdmIommuMemAccessWrite(pDevIns, pPciDev, GCPhys, pvBuf, cbWrite, fFlags); 456 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 459 if ( rc == VERR_IOMMU_NOT_PRESENT 460 || rc == VERR_IOMMU_CANNOT_CALL_SELF) 461 { /* likely - ASSUMING most VMs won't be configured with an IOMMU. */ } 462 else 457 463 return rc; 458 464 #endif
Note:
See TracChangeset
for help on using the changeset viewer.