Changeset 84677 in vbox
- Timestamp:
- Jun 4, 2020 1:12:06 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
include/VBox/msi.h (modified) (1 diff)
-
include/VBox/vmm/pdmdev.h (modified) (6 diffs)
-
src/VBox/Devices/Bus/DevIommuAmd.cpp (modified) (15 diffs)
-
src/VBox/Devices/PC/DevIoApic.cpp (modified) (3 diffs)
-
src/VBox/VMM/VMMR0/PDMR0DevHlp.cpp (modified) (2 diffs)
-
src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp (modified) (3 diffs)
-
src/VBox/VMM/include/PDMInternal.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/msi.h
r84662 r84677 213 213 { 214 214 /** The MSI Address Register. */ 215 MSIADDR MsiAddr;215 MSIADDR Addr; 216 216 /** The MSI Data Register. */ 217 MSIDATA MsiData;217 MSIDATA Data; 218 218 } MSIMSG; 219 219 /** Pointer to an MSI message struct. */ -
trunk/include/VBox/vmm/pdmdev.h
r84459 r84677 48 48 #include <VBox/vmm/pgm.h> /* PGMR3HandlerPhysicalTypeRegister() argument types. */ 49 49 #include <VBox/err.h> /* VINF_EM_DBG_STOP, also 120+ source files expecting this. */ 50 #include <VBox/msi.h> 50 51 #include <iprt/stdarg.h> 51 52 #include <iprt/list.h> … … 1291 1292 * @param pDevIns The IOMMU device instance. 1292 1293 * @param uDevId The device identifier (bus, device, function). 1293 * @param GCPhysIn The source MSI address. 1294 * @param uDataIn The source MSI data. 1295 * @param pGCPhysOut Where to store the remapped MSI address. 1296 * @param puDataOut Where to store the remapped MSI data. 1294 * @param pMsiIn The source MSI. 1295 * @param pMsiOut Where to store the remapped MSI. 1297 1296 * 1298 1297 * @thread Any. 1299 1298 */ 1300 DECLR0CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn, 1301 PRTGCPHYS pGCPhysOut, uint32_t *puDataOut)); 1299 DECLR0CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)); 1302 1300 1303 1301 /** Just a safety precaution. */ … … 1358 1356 * @param pDevIns The IOMMU device instance. 1359 1357 * @param uDevId The device identifier (bus, device, function). 1360 * @param GCPhysIn The source MSI address. 1361 * @param uDataIn The source MSI data. 1362 * @param pGCPhysOut Where to store the remapped MSI address. 1363 * @param puDataOut Where to store the remapped MSI data. 1358 * @param pMsiIn The source MSI. 1359 * @param pMsiOut Where to store the remapped MSI. 1364 1360 * 1365 1361 * @thread Any. 1366 1362 */ 1367 DECLRCCALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn, 1368 PRTGCPHYS pGCPhysOut, uint32_t *puDataOut)); 1363 DECLRCCALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)); 1369 1364 1370 1365 /** Just a safety precaution. */ … … 1425 1420 * @param pDevIns The IOMMU device instance. 1426 1421 * @param uDevId The device identifier (bus, device, function). 1427 * @param GCPhysIn The source MSI address. 1428 * @param uDataIn The source MSI data. 1429 * @param pGCPhysOut Where to store the remapped MSI address. 1430 * @param puDataOut Where to store the remapped MSI data. 1422 * @param pMsiIn The source MSI. 1423 * @param pMsiOut Where to store the remapped MSI. 1431 1424 * 1432 1425 * @thread Any. 1433 1426 */ 1434 DECLR3CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn, 1435 PRTGCPHYS pGCPhysOut, uint32_t *puDataOut)); 1427 DECLR3CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)); 1436 1428 1437 1429 /** Just a safety precaution. */ … … 1793 1785 DECLCALLBACKMEMBER(void, pfnUnlock)(PPDMDEVINS pDevIns); 1794 1786 1787 /** 1788 * Private interface between the IOAPIC and IOMMU. 1789 * 1790 * @returns status code. 1791 * @param pDevIns Device instance of the IOAPIC. 1792 * @param uDevId The device ID (bus, device, function) for the source MSI. 1793 * @param pMsiIn The source MSI. 1794 * @param pMsiOut Where to store the remapped MSI. 1795 * 1796 * @sa iommuAmdDeviceMsiRemap(). 1797 */ 1798 DECLCALLBACKMEMBER(int, pfnIommuMsiRemap)(PPDMDEVINS pDevIns, uint16_t uDevIt, PCMSIMSG pMsiIn, PMSIMSG pMsiOut); 1799 1795 1800 /** Just a safety precaution. */ 1796 1801 uint32_t u32TheEnd; … … 1802 1807 1803 1808 /** Current PDMIOAPICHLP version number. */ 1804 #define PDM_IOAPICHLP_VERSION PDM_VERSION_MAKE(0xfff0, 2, 0)1809 #define PDM_IOAPICHLP_VERSION PDM_VERSION_MAKE(0xfff0, 2, 1) 1805 1810 1806 1811 -
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r84651 r84677 4548 4548 * @param uDevId The device ID. 4549 4549 * @param pDte The device table entry. 4550 * @param GCPhysIn The source MSI address.4551 * @param uDataIn The source MSI data.4552 4550 * @param enmOp The IOMMU operation being performed. 4553 * @param p GCPhysOut Where to store the remapped MSI address.4554 * @param p uDataOut Where to store the remapped MSI data.4551 * @param pMsiIn The source MSI. 4552 * @param pMsiOut Where to store the remapped MSI. 4555 4553 * 4556 4554 * @thread Any. 4557 4555 */ 4558 static int iommuAmdRemapIntr(PPDMDEVINS pDevIns, uint16_t uDevId, PCDTE_T pDte, RTGCPHYS GCPhysIn, uint32_t uDataIn, 4559 IOMMUOP enmOp, PRTGCPHYS pGCPhysOut, uint32_t *puDataOut) 4560 { 4561 /** @todo Replace GCPhys[Out|In], uData[Out|In] with MSIMSG. */ 4556 static int iommuAmdRemapIntr(PPDMDEVINS pDevIns, uint16_t uDevId, PCDTE_T pDte, IOMMUOP enmOp, PCMSIMSG pMsiIn, 4557 PMSIMSG pMsiOut) 4558 { 4562 4559 Assert(pDte->n.u2IntrCtrl == IOMMU_INTR_CTRL_REMAP); 4563 4560 4564 4561 IRTE_T Irte; 4565 int rc = iommuAmdReadIrte(pDevIns, uDevId, pDte, GCPhysIn, uDataIn, enmOp, &Irte);4562 int rc = iommuAmdReadIrte(pDevIns, uDevId, pDte, pMsiIn->Addr.u64, pMsiIn->Data.u32, enmOp, &Irte); 4566 4563 if (RT_SUCCESS(rc)) 4567 4564 { … … 4572 4569 if (Irte.n.u3IntrType < VBOX_MSI_DELIVERY_MODE_LOWEST_PRIO) 4573 4570 { 4574 MSIADDR MsiAddrIn;4575 MsiAddrIn.u64 = GCPhysIn;4576 4577 MSIDATA MsiDataIn;4578 MsiDataIn.u32 = uDataIn;4579 4580 PMSIADDR pMsiAddrOut = (PMSIADDR)pGCPhysOut;4581 PMSIDATA pMsiDataOut = (PMSIDATA)puDataOut;4582 4583 4571 /* Preserve all bits from the source MSI address that don't map 1:1 from the IRTE. */ 4584 pMsi AddrOut->u64 = GCPhysIn;4585 pMsi AddrOut->n.u1DestMode = Irte.n.u1DestMode;4586 pMsi AddrOut->n.u8DestId = Irte.n.u8Dest;4572 pMsiOut->Addr.u64 = pMsiIn->Addr.u64; 4573 pMsiOut->Addr.n.u1DestMode = Irte.n.u1DestMode; 4574 pMsiOut->Addr.n.u8DestId = Irte.n.u8Dest; 4587 4575 4588 4576 /* Preserve all bits from the source MSI data that don't map 1:1 from the IRTE. */ 4589 pMsi DataOut->u32 = uDataIn;4590 pMsi DataOut->n.u8Vector = Irte.n.u8Vector;4591 pMsi DataOut->n.u3DeliveryMode = Irte.n.u3IntrType;4577 pMsiOut->Data.u32 = pMsiIn->Data.u32; 4578 pMsiOut->Data.n.u8Vector = Irte.n.u8Vector; 4579 pMsiOut->Data.n.u3DeliveryMode = Irte.n.u3IntrType; 4592 4580 4593 4581 return VINF_SUCCESS; … … 4596 4584 Log((IOMMU_LOG_PFX ": Interrupt type (%#x) invalid -> IOPF", Irte.n.u3IntrType)); 4597 4585 EVT_IO_PAGE_FAULT_T EvtIoPageFault; 4598 iommuAmdInitIoPageFaultEvent(uDevId, pDte->n.u16DomainId, GCPhysIn, Irte.n.u1RemapEnable, true /* fRsvdNotZero */,4599 false /* fPermDenied */, enmOp, &EvtIoPageFault);4586 iommuAmdInitIoPageFaultEvent(uDevId, pDte->n.u16DomainId, pMsiIn->Addr.u64, Irte.n.u1RemapEnable, 4587 true /* fRsvdNotZero */, false /* fPermDenied */, enmOp, &EvtIoPageFault); 4600 4588 iommuAmdRaiseIoPageFaultEvent(pDevIns, pDte, &Irte, enmOp, &EvtIoPageFault, kIoPageFaultType_IrteRsvdIntType); 4601 4589 return VERR_IOMMU_ADDR_TRANSLATION_FAILED; … … 4604 4592 Log((IOMMU_LOG_PFX ": Guest mode not supported -> IOPF")); 4605 4593 EVT_IO_PAGE_FAULT_T EvtIoPageFault; 4606 iommuAmdInitIoPageFaultEvent(uDevId, pDte->n.u16DomainId, GCPhysIn, Irte.n.u1RemapEnable, true /* fRsvdNotZero */,4607 false /* fPermDenied */, enmOp, &EvtIoPageFault);4594 iommuAmdInitIoPageFaultEvent(uDevId, pDte->n.u16DomainId, pMsiIn->Addr.u64, Irte.n.u1RemapEnable, 4595 true /* fRsvdNotZero */, false /* fPermDenied */, enmOp, &EvtIoPageFault); 4608 4596 iommuAmdRaiseIoPageFaultEvent(pDevIns, pDte, &Irte, enmOp, &EvtIoPageFault, kIoPageFaultType_IrteRsvdNotZero); 4609 4597 return VERR_IOMMU_ADDR_TRANSLATION_FAILED; … … 4612 4600 Log((IOMMU_LOG_PFX ": Remapping disabled -> IOPF")); 4613 4601 EVT_IO_PAGE_FAULT_T EvtIoPageFault; 4614 iommuAmdInitIoPageFaultEvent(uDevId, pDte->n.u16DomainId, GCPhysIn, Irte.n.u1RemapEnable, false /* fRsvdNotZero */,4615 false /* f PermDenied */, enmOp, &EvtIoPageFault);4602 iommuAmdInitIoPageFaultEvent(uDevId, pDte->n.u16DomainId, pMsiIn->Addr.u64, Irte.n.u1RemapEnable, 4603 false /* fRsvdNotZero */, false /* fPermDenied */, enmOp, &EvtIoPageFault); 4616 4604 iommuAmdRaiseIoPageFaultEvent(pDevIns, pDte, &Irte, enmOp, &EvtIoPageFault, kIoPageFaultType_IrteRemapEn); 4617 4605 return VERR_IOMMU_ADDR_TRANSLATION_FAILED; … … 4628 4616 * @param pDevIns The IOMMU instance data. 4629 4617 * @param uDevId The device ID. 4630 * @param GCPhysIn The source MSI address.4631 * @param uDataIn The source MSI data.4632 4618 * @param enmOp The IOMMU operation being performed. 4633 * @param p GCPhysOut Where to store the remapped MSI address.4634 * @param p uDataOut Where to store the remapped MSI data.4619 * @param pMsiIn The source MSI. 4620 * @param pMsiOut Where to store the remapped MSI. 4635 4621 * 4636 4622 * @thread Any. 4637 4623 */ 4638 static int iommuAmdLookupIntrTable(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn, IOMMUOP enmOp, 4639 PRTGCPHYS pGCPhysOut, uint32_t *puDataOut) 4624 static int iommuAmdLookupIntrTable(PPDMDEVINS pDevIns, uint16_t uDevId, IOMMUOP enmOp, PCMSIMSG pMsiIn, PMSIMSG pMsiOut) 4640 4625 { 4641 4626 /* Read the device table entry from memory. */ … … 4658 4643 fRsvd1)); 4659 4644 EVT_ILLEGAL_DTE_T Event; 4660 iommuAmdInitIllegalDteEvent(uDevId, GCPhysIn, true /* fRsvdNotZero */, enmOp, &Event);4645 iommuAmdInitIllegalDteEvent(uDevId, pMsiIn->Addr.u64, true /* fRsvdNotZero */, enmOp, &Event); 4661 4646 iommuAmdRaiseIllegalDteEvent(pDevIns, enmOp, &Event, kIllegalDteType_RsvdNotZero); 4662 4647 return VERR_IOMMU_INTR_REMAP_FAILED; … … 4680 4665 * See Intel spec. 10.11.1 "Message Address Register Format". 4681 4666 */ 4682 MSIADDR MsiAddrIn; 4683 MsiAddrIn.u64 = GCPhysIn; 4684 if ((MsiAddrIn.u64 & VBOX_MSI_ADDR_ADDR_MASK) == VBOX_MSI_ADDR_BASE) 4667 if ((pMsiIn->Addr.u64 & VBOX_MSI_ADDR_ADDR_MASK) == VBOX_MSI_ADDR_BASE) 4685 4668 { 4686 MSIDATA MsiDataIn;4687 MsiDataIn.u32 = uDataIn;4688 4689 4669 /* 4690 4670 * The IOMMU remaps fixed and arbitrated interrupts using the IRTE. 4691 4671 * See AMD IOMMU spec. "2.2.5.1 Interrupt Remapping Tables, Guest Virtual APIC Not Enabled". 4692 4672 */ 4693 uint8_t const u8DeliveryMode = MsiDataIn.n.u3DeliveryMode;4673 uint8_t const u8DeliveryMode = pMsiIn->Data.n.u3DeliveryMode; 4694 4674 bool fPassThru = false; 4695 4675 switch (u8DeliveryMode) … … 4729 4709 NOREF(pThis); 4730 4710 4731 return iommuAmdRemapIntr(pDevIns, uDevId, &Dte, GCPhysIn, uDataIn, enmOp, pGCPhysOut, puDataOut);4711 return iommuAmdRemapIntr(pDevIns, uDevId, &Dte, enmOp, pMsiIn, pMsiOut); 4732 4712 } 4733 4713 4734 4714 Log((IOMMU_LOG_PFX ": Invalid interrupt table length %#x -> Illegal DTE\n", uIntTabLen)); 4735 4715 EVT_ILLEGAL_DTE_T Event; 4736 iommuAmdInitIllegalDteEvent(uDevId, GCPhysIn, false /* fRsvdNotZero */, enmOp, &Event);4716 iommuAmdInitIllegalDteEvent(uDevId, pMsiIn->Addr.u64, false /* fRsvdNotZero */, enmOp, &Event); 4737 4717 iommuAmdRaiseIllegalDteEvent(pDevIns, enmOp, &Event, kIllegalDteType_RsvdIntTabLen); 4738 4718 return VERR_IOMMU_INTR_REMAP_FAILED; … … 4744 4724 Log((IOMMU_LOG_PFX ":IntCtl mode invalid %#x -> Illegal DTE", uIntrCtrl)); 4745 4725 EVT_ILLEGAL_DTE_T Event; 4746 iommuAmdInitIllegalDteEvent(uDevId, GCPhysIn, true /* fRsvdNotZero */, enmOp, &Event);4726 iommuAmdInitIllegalDteEvent(uDevId, pMsiIn->Addr.u64, true /* fRsvdNotZero */, enmOp, &Event); 4747 4727 iommuAmdRaiseIllegalDteEvent(pDevIns, enmOp, &Event, kIllegalDteType_RsvdIntCtl); 4748 4728 return VERR_IOMMU_INTR_REMAP_FAILED; … … 4764 4744 if (fPassThru) 4765 4745 { 4766 *pGCPhysOut = GCPhysIn; 4767 *puDataOut = uDataIn; 4746 *pMsiOut = *pMsiIn; 4768 4747 return VINF_SUCCESS; 4769 4748 } … … 4774 4753 else 4775 4754 { 4776 Log((IOMMU_LOG_PFX ":MSI address region invalid %#RX64.", MsiAddrIn.u64));4755 Log((IOMMU_LOG_PFX ":MSI address region invalid %#RX64.", pMsiIn->Addr.u64)); 4777 4756 return VERR_IOMMU_INTR_REMAP_FAILED; 4778 4757 } … … 4781 4760 { 4782 4761 /** @todo IOMMU: Add to interrupt remapping cache. */ 4783 *pGCPhysOut = GCPhysIn; 4784 *puDataOut = uDataIn; 4762 *pMsiOut = *pMsiIn; 4785 4763 return VINF_SUCCESS; 4786 4764 } … … 4798 4776 * @param pDevIns The IOMMU device instance. 4799 4777 * @param uDevId The device ID (bus, device, function). 4800 * @param GCPhysIn The source MSI address. 4801 * @param uDataIn The source MSI data. 4802 * @param pGCPhysOut Where to store the remapped MSI address. 4803 * @param puDataOut Where to store the remapped MSI data. 4804 */ 4805 static int iommuAmdDeviceMsiRemap(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn, 4806 PRTGCPHYS pGCPhysOut, uint32_t *puDataOut) 4778 * @param pMsiIn The source MSI. 4779 * @param pMsiOut Where to store the remapped MSI. 4780 */ 4781 static int iommuAmdDeviceMsiRemap(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut) 4807 4782 { 4808 4783 /* Validate. */ 4809 4784 Assert(pDevIns); 4810 Assert(pGCPhysOut); 4811 Assert(puDataOut); 4812 4813 /* Remove later. */ 4814 RT_NOREF(uDevId, GCPhysIn, uDataIn, pGCPhysOut, puDataOut); 4785 Assert(pMsiIn); 4786 Assert(pMsiOut); 4815 4787 4816 4788 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); … … 4822 4794 /** @todo Cache? */ 4823 4795 4824 return iommuAmdLookupIntrTable(pDevIns, uDevId, GCPhysIn, uDataIn, IOMMUOP_INTR_REQ, pGCPhysOut, puDataOut); 4825 } 4826 4827 *pGCPhysOut = GCPhysIn; 4828 *puDataOut = uDataIn; 4796 return iommuAmdLookupIntrTable(pDevIns, uDevId, IOMMUOP_INTR_REQ, pMsiIn, pMsiOut); 4797 } 4798 4799 *pMsiOut = *pMsiIn; 4829 4800 return VINF_SUCCESS; 4830 4801 } -
trunk/src/VBox/Devices/PC/DevIoApic.cpp
r84666 r84677 432 432 * See Intel spec. 10.11.2 "Message Data Register Format". 433 433 */ 434 pIntr->u8Dest = pMsi-> MsiAddr.n.u8DestId;435 pIntr->u8DestMode = pMsi-> MsiAddr.n.u1DestMode;436 pIntr->u8RedirHint = pMsi-> MsiAddr.n.u1RedirHint;437 438 pIntr->u8Vector = pMsi-> MsiData.n.u8Vector;439 pIntr->u8TriggerMode = pMsi-> MsiData.n.u1TriggerMode;440 pIntr->u8DeliveryMode = pMsi-> MsiData.n.u3DeliveryMode;434 pIntr->u8Dest = pMsi->Addr.n.u8DestId; 435 pIntr->u8DestMode = pMsi->Addr.n.u1DestMode; 436 pIntr->u8RedirHint = pMsi->Addr.n.u1RedirHint; 437 438 pIntr->u8Vector = pMsi->Data.n.u8Vector; 439 pIntr->u8TriggerMode = pMsi->Data.n.u1TriggerMode; 440 pIntr->u8DeliveryMode = pMsi->Data.n.u3DeliveryMode; 441 441 } 442 442 … … 450 450 DECLINLINE(void) ioapicGetMsiFromApicIntr(PCXAPICINTR pIntr, PMSIMSG pMsi) 451 451 { 452 pMsi-> MsiAddr.n.u12Addr = VBOX_MSI_ADDR_BASE >> VBOX_MSI_ADDR_SHIFT;453 pMsi-> MsiAddr.n.u8DestId = pIntr->u8Dest;454 pMsi-> MsiAddr.n.u1RedirHint = pIntr->u8RedirHint;455 pMsi-> MsiAddr.n.u1DestMode = pIntr->u8DestMode;456 457 pMsi-> MsiData.n.u8Vector = pIntr->u8Vector;458 pMsi-> MsiData.n.u3DeliveryMode = pIntr->u8DeliveryMode;459 pMsi-> MsiData.n.u1TriggerMode = pIntr->u8TriggerMode;460 461 /* pMsi-> MsiData.n.u1Level = ??? */452 pMsi->Addr.n.u12Addr = VBOX_MSI_ADDR_BASE >> VBOX_MSI_ADDR_SHIFT; 453 pMsi->Addr.n.u8DestId = pIntr->u8Dest; 454 pMsi->Addr.n.u1RedirHint = pIntr->u8RedirHint; 455 pMsi->Addr.n.u1DestMode = pIntr->u8DestMode; 456 457 pMsi->Data.n.u8Vector = pIntr->u8Vector; 458 pMsi->Data.n.u3DeliveryMode = pIntr->u8DeliveryMode; 459 pMsi->Data.n.u1TriggerMode = pIntr->u8TriggerMode; 460 461 /* pMsi->Data.n.u1Level = ??? */ 462 462 /** @todo r=ramshankar: Level triggered MSIs don't make much sense though 463 463 * possible in theory? Maybe document this more explicitly... */ … … 855 855 LogFlow(("IOAPIC: ioapicSendMsi: GCPhys=%#RGp uValue=%#RX32\n", GCPhys, uValue)); 856 856 857 MSIMSG Msi Msg;858 Msi Msg.MsiAddr.u64 = GCPhys;859 Msi Msg.MsiData.u32 = uValue;857 MSIMSG Msi; 858 Msi.Addr.u64 = GCPhys; 859 Msi.Data.u32 = uValue; 860 860 861 861 XAPICINTR ApicIntr; 862 862 RT_ZERO(ApicIntr); 863 ioapicGetApicIntrFromMsi(&Msi Msg, &ApicIntr);863 ioapicGetApicIntrFromMsi(&Msi, &ApicIntr); 864 864 865 865 /* -
trunk/src/VBox/VMM/VMMR0/PDMR0DevHlp.cpp
r84459 r84677 1558 1558 1559 1559 1560 /** @interface_method_impl{PDMIOAPICHLP,pfnIommuMsiRemap} */ 1561 static DECLCALLBACK(int) pdmR0IoApicHlp_IommuMsiRemap(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut) 1562 { 1563 PDMDEV_ASSERT_DEVINS(pDevIns); 1564 LogFlow(("pdmR0IoApicHlp_IommuMsiRemap: caller='%s'/%d: pMsiIn=(%#RX64, %#RU32)\n", pDevIns->pReg->szName, 1565 pDevIns->iInstance, pMsiIn->Addr.u64, pMsiIn->Data.u32)); 1566 1567 #ifdef VBOX_WITH_IOMMU_AMD 1568 /** @todo IOMMU: Optimize/re-organize things here later. */ 1569 PGVM pGVM = pDevIns->Internal.s.pGVM; 1570 PPDMIOMMUR0 pIommu = &pGVM->pdmr0.s.aIommus[0]; 1571 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 1572 if ( pDevInsIommu 1573 && pDevInsIommu != pDevIns) 1574 { 1575 int rc = pIommu->pfnMsiRemap(pDevInsIommu, uDevId, pMsiIn, pMsiOut); 1576 if (RT_FAILURE(rc)) 1577 { 1578 Log(("pdmR0IoApicHlp_IommuMsiRemap: IOMMU MSI remap failed. uDevId=%#x pMsiIn=(%#RX64, %#RU32) rc=%Rrc\n", 1579 uDevId, pMsiIn->Addr.u64, pMsiIn->Data.u32, rc)); 1580 return rc; 1581 } 1582 } 1583 #else 1584 *pMsiOut = *pMsiIn; 1585 #endif 1586 return VINF_SUCCESS; 1587 } 1588 1589 1560 1590 /** 1561 1591 * The Ring-0 I/O APIC Helper Callbacks. … … 1567 1597 pdmR0IoApicHlp_Lock, 1568 1598 pdmR0IoApicHlp_Unlock, 1599 pdmR0IoApicHlp_IommuMsiRemap, 1569 1600 PDM_IOAPICHLP_VERSION 1570 1601 }; -
trunk/src/VBox/VMM/VMMR3/PDMDevMiscHlp.cpp
r83263 r84677 31 31 #include <VBox/log.h> 32 32 #include <VBox/err.h> 33 #include <VBox/msi.h> 33 34 #include <iprt/asm.h> 34 35 #include <iprt/assert.h> … … 140 141 141 142 143 /** @interface_method_impl{PDMIOAPICHLP,pfnIommuMsiRemap} */ 144 static DECLCALLBACK(int) pdmR3IoApicHlp_IommuMsiRemap(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut) 145 { 146 PDMDEV_ASSERT_DEVINS(pDevIns); 147 LogFlow(("pdmR3IoApicHlp_IommuRemapMsi: caller='%s'/%d: pMsiIn=(%#RX64, %#RU32)\n", pDevIns->pReg->szName, 148 pDevIns->iInstance, pMsiIn->Addr.u64, pMsiIn->Data.u32)); 149 150 #ifdef VBOX_WITH_IOMMU_AMD 151 /** @todo IOMMU: Optimize/re-organize things here later. */ 152 PVM pVM = pDevIns->Internal.s.pVMR3; 153 PPDMIOMMU pIommu = &pVM->pdm.s.aIommus[0]; 154 PPDMDEVINS pDevInsIommu = pIommu->CTX_SUFF(pDevIns); 155 if ( pDevInsIommu 156 && pDevInsIommu != pDevIns) 157 { 158 int rc = pIommu->pfnMsiRemap(pDevInsIommu, uDevId, pMsiIn, pMsiOut); 159 if (RT_FAILURE(rc)) 160 { 161 Log(("pdmR3IoApicHlp_IommuRemapMsi: IOMMU MSI remap failed. uDevId=%#x pMsiIn=(%#RX64, %#RU32) rc=%Rrc\n", 162 uDevId, pMsiIn->Addr.u64, pMsiIn->Data.u32, rc)); 163 return rc; 164 } 165 } 166 #else 167 *pMsiOut = *pMsiIn; 168 #endif 169 return VINF_SUCCESS; 170 } 171 172 142 173 /** 143 174 * I/O APIC Device Helpers. … … 149 180 pdmR3IoApicHlp_Lock, 150 181 pdmR3IoApicHlp_Unlock, 182 pdmR3IoApicHlp_IommuMsiRemap, 151 183 PDM_IOAPICHLP_VERSION /* the end */ 152 184 }; -
trunk/src/VBox/VMM/include/PDMInternal.h
r84459 r84677 39 39 #include <VBox/vmm/pdmtask.h> 40 40 #include <VBox/sup.h> 41 #include <VBox/msi.h> 41 42 #include <iprt/assert.h> 42 43 #include <iprt/critsect.h> … … 704 705 PRTGCPHYS pGCPhysSpa)); 705 706 /** @copydoc PDMIOMMUREGR3::pfnMsiRemap */ 706 DECLR3CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn, 707 PRTGCPHYS pGCPhysOut, uint32_t *puDataOut)); 707 DECLR3CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)); 708 708 } PDMIOMMU; 709 709 … … 727 727 PRTGCPHYS pGCPhysSpa)); 728 728 /** @copydoc PDMIOMMUREGR3::pfnMsiRemap */ 729 DECLR0CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, RTGCPHYS GCPhysIn, uint32_t uDataIn, 730 PRTGCPHYS pGCPhysOut, uint32_t *puDataOut)); 729 DECLR0CALLBACKMEMBER(int, pfnMsiRemap,(PPDMDEVINS pDevIns, uint16_t uDevId, PCMSIMSG pMsiIn, PMSIMSG pMsiOut)); 731 730 } PDMIOMMUR0; 732 731 /** Pointer to a ring-0 IOMMU data. */
Note:
See TracChangeset
for help on using the changeset viewer.

