Changeset 88631 in vbox
- Timestamp:
- Apr 21, 2021 11:54:19 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 143934
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmdev.h
r88580 r88631 1941 1941 * @param idDevice The device identifier (bus, device, function). 1942 1942 * @param pMsiIn The source MSI. 1943 * @param pMsiOut Where to store the remapped MSI. 1943 * @param pMsiOut Where to store the remapped MSI (only updated when 1944 * VINF_SUCCESS is returned). 1944 1945 */ 1945 1946 DECLCALLBACKMEMBER(int, pfnIommuMsiRemap,(PPDMDEVINS pDevIns, uint16_t idDevice, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)); -
trunk/src/VBox/Devices/PC/DevIoApic.cpp
r88612 r88631 536 536 RT_ZERO(MsiIn); 537 537 ioapicGetMsiFromApicIntr(&ApicIntr, &MsiIn); 538 int rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, VBOX_PCI_BDF_SB_IOAPIC, &MsiIn, &MsiOut); 538 int const rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, VBOX_PCI_BDF_SB_IOAPIC, &MsiIn, &MsiOut); 539 if (RT_SUCCESS(rcRemap)) 540 STAM_COUNTER_INC(&pThis->StatIommuRemappedIntr); 541 else if (rcRemap == VERR_IOMMU_NOT_PRESENT) 542 MsiOut = MsiIn; 543 else 544 { 545 STAM_COUNTER_INC(&pThis->StatIommuDiscardedIntr); 546 return; 547 } 548 549 ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr); 550 551 # ifdef RT_STRICT 539 552 if (RT_SUCCESS(rcRemap)) 540 553 { 541 STAM_COUNTER_INC(&pThis->StatIommuRemappedIntr);542 LogFlow(("IOAPIC: IOMMU remapped interrupt %#x to %#x\n", MsiIn.Data.n.u8Vector, MsiOut.Data.n.u8Vector));543 ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr);544 554 Assert(ApicIntr.u8Polarity == IOAPIC_RTE_GET_POLARITY(u64Rte)); /* Ensure polarity hasn't changed. */ 545 555 Assert(ApicIntr.u8TriggerMode == u8TriggerMode); /* Ensure trigger mode hasn't changed. */ 546 556 } 547 else 548 { 549 STAM_COUNTER_INC(&pThis->StatIommuDiscardedIntr); 550 Log(("IOAPIC: IOMMU discarded interrupt %#x. rc=%Rrc\n", ApicIntr.u8Vector, rcRemap)); 551 return; 552 } 557 # endif 553 558 #endif 554 559 … … 925 930 MSIMSG MsiOut; 926 931 RT_ZERO(MsiOut); 927 int rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, uBusDevFn, pMsi, &MsiOut);932 int const rcRemap = pThisCC->pIoApicHlp->pfnIommuMsiRemap(pDevIns, uBusDevFn, pMsi, &MsiOut); 928 933 if (RT_SUCCESS(rcRemap)) 929 {930 934 STAM_COUNTER_INC(&pThis->StatIommuRemappedMsi); 931 ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr);932 }935 else if (rcRemap == VERR_IOMMU_NOT_PRESENT) 936 MsiOut = *pMsi; 933 937 else 934 938 { 935 939 STAM_COUNTER_INC(&pThis->StatIommuDiscardedMsi); 936 Log(("IOAPIC: MSI (Addr=%#RX64 Data=%#RX32) remapping failed. rc=%Rrc", pMsi->Addr.u64, pMsi->Data.u32, rcRemap));937 940 return; 938 941 } 942 ioapicGetApicIntrFromMsi(&MsiOut, &ApicIntr); 939 943 } 940 944 else -
trunk/src/VBox/VMM/VMMAll/PDMAllIommu.cpp
r88078 r88631 64 64 #endif 65 65 return PCIBDF_MAKE(pBus->iBus, pPciDev->uDevFn); 66 } 67 68 69 /** 70 * Returns whether an IOMMU instance is present. 71 * 72 * @returns @c true if an IOMMU is present, @c false otherwise. 73 * @param pDevIns The device instance. 74 */ 75 bool pdmIommuIsPresent(PPDMDEVINS pDevIns) 76 { 77 PPDMIOMMU pIommu = PDMDEVINS_TO_IOMMU(pDevIns); 78 return pIommu != 0; 66 79 } 67 80 -
trunk/src/VBox/VMM/VMMR0/PDMR0DevHlp.cpp
r88593 r88631 1531 1531 1532 1532 #ifdef VBOX_WITH_IOMMU_AMD 1533 int rc = pdmIommuMsiRemap(pDevIns, idDevice, pMsiIn, pMsiOut); 1534 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 1535 return rc; 1533 if (pdmIommuIsPresent(pDevIns)) 1534 return pdmIommuMsiRemap(pDevIns, idDevice, pMsiIn, pMsiOut); 1536 1535 #else 1537 1536 RT_NOREF(pDevIns, idDevice); 1538 1537 #endif 1539 1540 *pMsiOut = *pMsiIn; 1541 return VINF_SUCCESS; 1538 return VERR_IOMMU_NOT_PRESENT; 1542 1539 } 1543 1540 -
trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp
r88580 r88631 149 149 150 150 #ifdef VBOX_WITH_IOMMU_AMD 151 int rc = pdmIommuMsiRemap(pDevIns, idDevice, pMsiIn, pMsiOut); 152 if (RT_SUCCESS(rc) || rc != VERR_IOMMU_NOT_PRESENT) 153 return rc; 151 if (pdmIommuIsPresent(pDevIns)) 152 return pdmIommuMsiRemap(pDevIns, idDevice, pMsiIn, pMsiOut); 154 153 #else 155 154 RT_NOREF(pDevIns, idDevice); 156 155 #endif 157 158 *pMsiOut = *pMsiIn; 159 return VINF_SUCCESS; 156 return VERR_IOMMU_NOT_PRESENT; 160 157 } 161 158 -
trunk/src/VBox/VMM/include/PDMInternal.h
r88582 r88631 1673 1673 1674 1674 #if defined(VBOX_WITH_IOMMU_AMD) || defined(VBOX_WITH_IOMMU_INTEL) 1675 bool pdmIommuIsPresent(PPDMDEVINS pDevIns); 1675 1676 int pdmIommuMsiRemap(PPDMDEVINS pDevIns, uint16_t idDevice, PCMSIMSG pMsiIn, PMSIMSG pMsiOut); 1676 1677 int pdmIommuMemAccessRead(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, RTGCPHYS GCPhys, void *pvBuf, size_t cbRead, uint32_t fFlags);
Note:
See TracChangeset
for help on using the changeset viewer.