- Timestamp:
- Sep 2, 2020 7:12:44 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r85971 r85988 507 507 508 508 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 509 if ( !ASMAtomicXchgBool(&pThis->fCmdThreadSignaled, true)510 && ASMAtomicReadBool(&pThis->fCmdThreadSleeping))509 IOMMU_STATUS_T const Status = iommuAmdGetStatus(pThis); 510 if (Status.n.u1CmdBufRunning) 511 511 { 512 512 LogFlowFunc(("Signaling command thread\n")); … … 647 647 ASMAtomicWriteU64(&pThis->Ctrl.u64, NewCtrl.u64); 648 648 649 bool const fNewIommuEn = NewCtrl.n.u1IommuEn; 650 bool const fOldIommuEn = OldCtrl.n.u1IommuEn; 651 649 652 /* Enable or disable event logging when the bit transitions. */ 650 bool const fNewIommuEn = NewCtrl.n.u1IommuEn;651 653 bool const fOldEvtLogEn = OldCtrl.n.u1EvtLogEn; 652 654 bool const fNewEvtLogEn = NewCtrl.n.u1EvtLogEn; 653 if (fOldEvtLogEn != fNewEvtLogEn) 655 if ( fOldEvtLogEn != fNewEvtLogEn 656 || fOldIommuEn != fNewIommuEn) 654 657 { 655 658 if ( fNewIommuEn … … 666 669 bool const fOldCmdBufEn = OldCtrl.n.u1CmdBufEn; 667 670 bool const fNewCmdBufEn = NewCtrl.n.u1CmdBufEn; 668 if (fOldCmdBufEn != fNewCmdBufEn) 669 { 670 if ( fNewIommuEn 671 && fNewCmdBufEn) 671 if ( fOldCmdBufEn != fNewCmdBufEn 672 || fOldIommuEn != fNewIommuEn) 673 { 674 if ( fNewCmdBufEn 675 && fNewIommuEn) 676 { 672 677 ASMAtomicOrU64(&pThis->Status.u64, IOMMU_STATUS_CMD_BUF_RUNNING); 678 LogFunc(("Command buffer enabled\n")); 679 680 /* Wake up the command thread to start processing commands. */ 681 iommuAmdCmdThreadWakeUpIfNeeded(pDevIns); 682 } 673 683 else 684 { 674 685 ASMAtomicAndU64(&pThis->Status.u64, ~IOMMU_STATUS_CMD_BUF_RUNNING); 675 676 /* Wake up the command thread to start or stop processing commands. */ 677 iommuAmdCmdThreadWakeUpIfNeeded(pDevIns); 686 LogFunc(("Command buffer disabled\n")); 687 } 678 688 } 679 689 … … 1475 1485 pThis->HwEvtHi.u64 = RT_MAKE_U64(pEvent->au32[0], pEvent->au32[1]); 1476 1486 pThis->HwEvtLo = RT_MAKE_U64(pEvent->au32[2], pEvent->au32[3]); 1477 Assert(pThis->HwEvtHi.n.u4EvtCode == IOMMU_EVT_DEV_TAB_HW_ERROR); 1487 Assert( pThis->HwEvtHi.n.u4EvtCode == IOMMU_EVT_DEV_TAB_HW_ERROR 1488 || pThis->HwEvtHi.n.u4EvtCode == IOMMU_EVT_PAGE_TAB_HW_ERROR 1489 || pThis->HwEvtHi.n.u4EvtCode == IOMMU_EVT_COMMAND_HW_ERROR); 1478 1490 } 1479 1491 } … … 2771 2783 IOMMU_ASSERT_NOT_LOCKED(pDevIns); 2772 2784 2785 LogFlowFunc(("\n")); 2786 2773 2787 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 2774 2788 uint8_t const bCmd = pCmd->n.u4Opcode; … … 2936 2950 if (Status.n.u1CmdBufRunning) 2937 2951 { 2952 LogFlowFunc(("Command buffer running\n")); 2953 2938 2954 /* Get the offset we need to read the command from memory (circular buffer offset). */ 2939 2955 uint32_t const cbCmdBuf = iommuAmdGetTotalBufLength(pThis->CmdBufBaseAddr.n.u4Len); … … 3844 3860 PDMPciDevSetVendorId(pPciDev, IOMMU_PCI_VENDOR_ID); /* AMD */ 3845 3861 PDMPciDevSetDeviceId(pPciDev, IOMMU_PCI_DEVICE_ID); /* VirtualBox IOMMU device */ 3846 PDMPciDevSetCommand(pPciDev, 0); /* Command*/3862 PDMPciDevSetCommand(pPciDev, VBOX_PCI_COMMAND_MASTER); /* Enable bus master (as we write to main memory). */ 3847 3863 PDMPciDevSetStatus(pPciDev, VBOX_PCI_STATUS_CAP_LIST); /* Status - CapList supported */ 3848 3864 PDMPciDevSetRevisionId(pPciDev, IOMMU_PCI_REVISION_ID); /* VirtualBox specific device implementation revision */
Note:
See TracChangeset
for help on using the changeset viewer.