- Timestamp:
- Apr 7, 2021 4:35:52 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuIntel.cpp
r88370 r88404 54 54 || (a_off) - DMAR_MMIO_GROUP_1_OFF_FIRST < DMAR_MMIO_GROUP_1_SIZE) 55 55 56 /** @name DMAR implementation specifics. 57 * @{ */ 56 58 /** The number of fault recording registers our implementation supports. 57 59 * Normal guest operation shouldn't trigger faults anyway, so we only support the … … 85 87 #define DMAR_MMIO_GROUP_1_SIZE (DMAR_MMIO_GROUP_1_OFF_END - DMAR_MMIO_GROUP_1_OFF_FIRST) 86 88 89 /** DMAR implementation's minor version number (exposed to software). */ 90 #define DMAR_VER_MINOR 0 91 /** DMAR implementation's major version number (exposed to software). */ 92 #define DMAR_VER_MAJOR 1 93 /** Number of domains supported (0=16, 1=64, 2=256, 3=1024, 4=4K, 5=16K, 6=64K, 94 * 7=(Reserved). */ 95 #define DMAR_CAP_ND 2 96 /** Large page support level (0=2M, 1=1GB pages). */ 97 #define DMAR_CAP_LARGE_PAGE_LVL 0 98 /** Maximum address mask value. */ 99 #define DMAR_CAP_MAMV 9 100 101 /** @} */ 102 87 103 /** Release log prefix string. */ 88 104 #define DMAR_LOG_PFX "Intel-IOMMU" 89 90 105 /** The current saved state version. */ 91 106 #define DMAR_SAVED_STATE_VERSION 1 … … 673 688 static DECLCALLBACK(int) iommuIntelMsiRemap(PPDMDEVINS pDevIns, uint16_t idDevice, PCMSIMSG pMsiIn, PMSIMSG pMsiOut) 674 689 { 675 RT_NOREF4(pDevIns, idDevice, pMsiIn, pMsiOut); 690 RT_NOREF3(idDevice, pMsiIn, pMsiOut); 691 PDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PDMAR); 692 STAM_COUNTER_INC(&pThis->CTX_SUFF_Z(StatMsiRemap)); NOREF(pThis); 693 676 694 return VERR_NOT_IMPLEMENTED; 677 695 } … … 742 760 743 761 #ifdef IN_RING3 762 /** 763 * Initializes read-only (constant) registers in the DMAR unit. 764 * 765 * @param pDevIns The IOMMU device instance. 766 */ 767 static void dmarR3RegInitReadOnly(PPDMDEVINS pDevIns) 768 { 769 PDMAR pThis = PDMDEVINS_2_DATA(pDevIns, PDMAR); 770 /* VER_REG */ 771 { 772 uint8_t const uVer = RT_BF_MAKE(VTD_BF_VER_REG_MIN, DMAR_VER_MINOR) 773 | RT_BF_MAKE(VTD_BF_VER_REG_MAX, DMAR_VER_MAJOR); 774 dmarRegWriteRaw64(pThis, VTD_MMIO_OFF_VER_REG, uVer); 775 } 776 /* CAP_REG */ 777 { 778 uint8_t cGstPhysAddrBits; 779 uint8_t cGstLinearAddrBits; 780 PDMDevHlpCpuGetGuestAddrWidths(pDevIns, &cGstPhysAddrBits, &cGstLinearAddrBits); 781 uint64_t const uCap = RT_BF_MAKE(VTD_BF_CAP_REG_ND, DMAR_CAP_ND) 782 | RT_BF_MAKE(VTD_BF_CAP_REG_AFL, 0) /* AFL: not supported. */ 783 | RT_BF_MAKE(VTD_BF_CAP_REG_RWBF, 0) /* Software need not flush write-buffers. */ 784 | RT_BF_MAKE(VTD_BF_CAP_REG_PLMR, 0) /* PLMR: not supported. */ 785 | RT_BF_MAKE(VTD_BF_CAP_REG_PHMR, 0) /* PHMR: not supported. */ 786 | RT_BF_MAKE(VTD_BF_CAP_REG_CM, 1) /** @todo Figure out if required when we impl. caching. */ 787 | RT_BF_MAKE(VTD_BF_CAP_REG_SAGAW, 0) /* SLS: not supported. */ 788 | RT_BF_MAKE(VTD_BF_CAP_REG_MGAW, cGstPhysAddrBits) 789 | RT_BF_MAKE(VTD_BF_CAP_REG_ZLR, 1) /** @todo Zero-length read? */ 790 | RT_BF_MAKE(VTD_BF_CAP_REG_FRO, DMAR_MMIO_OFF_FRCD_LO_REG >> 4) 791 | RT_BF_MAKE(VTD_BF_CAP_REG_SLLPS, DMAR_CAP_LARGE_PAGE_LVL) 792 | RT_BF_MAKE(VTD_BF_CAP_REG_PSI, 1) 793 | RT_BF_MAKE(VTD_BF_CAP_REG_NFR, DMAR_FRCD_REG_COUNT - 1) 794 | RT_BF_MAKE(VTD_BF_CAP_REG_MAMV, DMAR_CAP_MAMV) 795 | RT_BF_MAKE(VTD_BF_CAP_REG_DWD, 1) 796 | RT_BF_MAKE(VTD_BF_CAP_REG_FL1GP, 0) /* FLTS: not supported. */ 797 | RT_BF_MAKE(VTD_BF_CAP_REG_PI, 0) /* PI: not supported. */ 798 | RT_BF_MAKE(VTD_BF_CAP_REG_FL5LP, 0); /* FLTS: not supported. */ 799 dmarRegWriteRaw64(pThis, VTD_MMIO_OFF_CAP_REG, uCap); 800 } 801 /** @todo Rest of read-only registers. */ 802 } 803 804 744 805 /** 745 806 * @interface_method_impl{PDMDEVREG,pfnReset} … … 814 875 PDMPciDevSetDeviceId(pPciDev, DMAR_PCI_DEVICE_ID); /* VirtualBox DMAR device */ 815 876 PDMPciDevSetRevisionId(pPciDev, DMAR_PCI_REVISION_ID); /* VirtualBox specific device implementation revision */ 816 PDMPciDevSetClassBase(pPciDev, VBOX_PCI_CLASS_SYSTEM); /* System Base Peripheral */817 PDMPciDevSetClassSub(pPciDev, VBOX_PCI_SUB_SYSTEM_OTHER); /* Other */818 PDMPciDevSetHeaderType(pPciDev, 0 x0);/* Single function, type 0 */819 PDMPciDevSetSubSystemId(pPciDev, DMAR_PCI_DEVICE_ID); /* VirtualBox DMAR device */820 PDMPciDevSetSubSystemVendorId(pPciDev, DMAR_PCI_VENDOR_ID); /* Intel */877 PDMPciDevSetClassBase(pPciDev, VBOX_PCI_CLASS_SYSTEM); /* System Base Peripheral */ 878 PDMPciDevSetClassSub(pPciDev, VBOX_PCI_SUB_SYSTEM_OTHER); /* Other */ 879 PDMPciDevSetHeaderType(pPciDev, 0); /* Single function, type 0 */ 880 PDMPciDevSetSubSystemId(pPciDev, DMAR_PCI_DEVICE_ID); /* VirtualBox DMAR device */ 881 PDMPciDevSetSubSystemVendorId(pPciDev, DMAR_PCI_VENDOR_ID); /* Intel */ 821 882 822 883 /** @todo VTD: Chipset spec says PCI Express Capability Id. Relevant for us? */ … … 838 899 * This must be done -after- registering it as a PCI device! 839 900 */ 840 #endif841 842 /** @todo VTD: Intercept PCI config space accesses for debugging. */843 #if 0844 /*845 * Intercept PCI config. space accesses.846 */847 rc = PDMDevHlpPCIInterceptConfigAccesses(pDevIns, pPciDev, ..);848 AssertLogRelRCReturn(rc, rc);849 901 #endif 850 902 … … 883 935 PDMDevHlpSTAMRegister(pDevIns, &pThis->StatMemBulkWriteRZ, STAMTYPE_COUNTER, "RZ/MemBulkWrite", STAMUNIT_OCCURENCES, "Number of memory bulk write translation requests in RZ."); 884 936 # endif 937 938 /* 939 * Initialize read-only registers. 940 */ 941 dmarR3RegInitReadOnly(pDevIns); 885 942 886 943 LogRel(("%s: Capabilities=%#RX64 Extended-Capabilities=%#RX64\n", DMAR_LOG_PFX, dmarRegRead64(pThis, VTD_MMIO_OFF_CAP_REG),
Note:
See TracChangeset
for help on using the changeset viewer.