Changeset 83941 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 23, 2020 10:22:56 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137493
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r83851 r83941 407 407 /** 408 408 * The Device ID. 409 * In accordance with the AMD spec.410 */ 411 typedef union 412 { 413 struct 414 { 415 uint16_t u Function : 3; /**< Bits 2:0- Function. */416 uint16_t u Device : 5; /**< Bits 7:3 - Device. */417 uint16_t u Bus : 8; /**< Bits 15:8- Bus. */409 * In accordance with VirtualBox's PCI configuration. 410 */ 411 typedef union 412 { 413 struct 414 { 415 uint16_t u3Function : 3; /**< Bits 2:0 - Function. */ 416 uint16_t u9Device : 9; /**< Bits 11:3 - Device. */ 417 uint16_t u4Bus : 4; /**< Bits 15:12 - Bus. */ 418 418 } n; 419 419 /** The unsigned integer view. */ … … 975 975 AssertCompileSize(EVT_EVENT_COUNTER_ZERO, 16); 976 976 977 /* Not needed as we can initialize from bitfields and set/get using PCI config PDM helpers. */978 #if 0979 977 /** 980 978 * IOMMU Capability Header (PCI). … … 994 992 uint32_t u1EfrSup : 1; /**< Bit 27 - EFRSup: Extended Feature Register Support. */ 995 993 uint32_t u1CapExt : 1; /**< Bit 28 - CapExt: Misc. Information Register 1 Support. */ 996 uint32_t u 4Rsvd0 : 4; /**< Bits 31:29 - Reserved. */994 uint32_t u3Rsvd0 : 3; /**< Bits 31:29 - Reserved. */ 997 995 } n; 998 996 /** The 32-bit unsigned integer view. */ … … 1000 998 } IOMMU_CAP_HDR_T; 1001 999 AssertCompileSize(IOMMU_CAP_HDR_T, 4); 1002 #endif1003 1000 1004 1001 /** … … 1887 1884 typedef struct IOMMU 1888 1885 { 1889 /** IOMMU device index . */1886 /** IOMMU device index (0 is at the top of the PCI tree hierarchy). */ 1890 1887 uint32_t idxIommu; 1891 1888 /** Alignment padding. */ … … 1895 1892 /** The MMIO handle. */ 1896 1893 IOMMMIOHANDLE hMmio; 1897 /** Whether this IOMMU is at the top of the PCI tree hierarchy or not. */1898 bool fRootComplex;1899 /** Alignment padding. */1900 bool afPadding[7];1901 1894 1902 1895 /** @name PCI: Base capability block registers. 1903 1896 * @{ */ 1904 IOMMU_BAR_T IommuBar; 1897 IOMMU_BAR_T IommuBar; /**< IOMMU base address register. */ 1905 1898 /** @} */ 1906 1899 … … 1962 1955 /** @name MMIO: x2APIC Control registers. 1963 1956 * @{ */ 1964 IOMMU_XT_GEN_INTR_CTRL_T XtGenIntrCtrl; /**< IOMMU X2APIC General interrupt control register. */1965 IOMMU_XT_PPR_INTR_CTRL_T XtPprIntrCtrl; /**< IOMMU X2APIC PPR interrupt control register. */1966 IOMMU_XT_GALOG_INTR_CTRL_T XtGALogIntrCtrl; /**< IOMMU X2APIC Guest Log interrupt control register. */1957 IOMMU_XT_GEN_INTR_CTRL_T XtGenIntrCtrl; /**< IOMMU X2APIC General interrupt control register. */ 1958 IOMMU_XT_PPR_INTR_CTRL_T XtPprIntrCtrl; /**< IOMMU X2APIC PPR interrupt control register. */ 1959 IOMMU_XT_GALOG_INTR_CTRL_T XtGALogIntrCtrl; /**< IOMMU X2APIC Guest Log interrupt control register. */ 1967 1960 /** @} */ 1968 1961 1969 1962 /** @name MMIO: MARC registers. 1970 1963 * @{ */ 1971 MARC_APER_T aMarcApers[4]; /**< MARC Aperture Registers. */1964 MARC_APER_T aMarcApers[4]; /**< MARC Aperture Registers. */ 1972 1965 /** @} */ 1973 1966 1974 1967 /** @name MMIO: Reserved register. 1975 1968 * @{ */ 1976 IOMMU_RSVD_REG_T RsvdReg; /**< IOMMU Reserved Register. */1969 IOMMU_RSVD_REG_T RsvdReg; /**< IOMMU Reserved Register. */ 1977 1970 /** @} */ 1978 1971 … … 2029 2022 /** Pointer to the const IOMMU device state. */ 2030 2023 typedef const struct IOMMU *PCIOMMU; 2024 AssertCompileMemberAlignment(IOMMU, hEvtCmdThread, 8); 2025 AssertCompileMemberAlignment(IOMMU, hMmio, 8); 2026 AssertCompileMemberAlignment(IOMMU, IommuBar, 8); 2027 2031 2028 2032 2029 /** … … 2450 2447 * 2451 2448 * @returns VBox status code. 2452 * @param pDevIns The device instance.2449 * @param pDevIns The IOMMU device instance. 2453 2450 * @param pThread The command thread. 2454 2451 */ … … 2463 2460 * 2464 2461 * @returns VBox status code. 2465 * @param pDevIns The device instance.2462 * @param pDevIns The IOMMU device instance. 2466 2463 * @param pThread The command thread. 2467 2464 */ … … 2495 2492 * 2496 2493 * @returns Strict VBox status code. 2497 * @param pDevIns The device instance.2494 * @param pDevIns The IOMMU device instance. 2498 2495 * @param off MMIO byte offset to the register. 2499 2496 * @param cb The size of the write access. … … 2639 2636 * 2640 2637 * @returns Strict VBox status code. 2641 * @param pDevIns The device instance.2638 * @param pDevIns The IOMMU device instance. 2642 2639 * @param off Offset in bytes. 2643 2640 * @param puResult Where to store the value being read. … … 2793 2790 return VINF_SUCCESS; 2794 2791 } 2792 2793 2794 /** 2795 * Memory read transaction from a downstream device. 2796 * 2797 * @returns VBox status code. 2798 * @param pDevIns The IOMMU device instance. 2799 * @param uDeviceId The device identifier (bus, device, function). 2800 * @param uDva The device virtual address being read. 2801 * @param cbRead The number of bytes being read. 2802 * @param GCPhysOut Where to store the translated physical address. 2803 * 2804 * @thread Any. 2805 */ 2806 static int iommuAmdDeviceMemRead(PPDMDEVINS pDevIns, uint16_t uDeviceId, uint64_t uDva, size_t cbRead, PRTGCPHYS pGCPhysOut) 2807 { 2808 RT_NOREF(pDevIns, uDeviceId, uDva, cbRead, pGCPhysOut); 2809 return VERR_NOT_IMPLEMENTED; 2810 } 2811 2812 2813 /** 2814 * Memory write transaction from a downstream device. 2815 * 2816 * @returns VBox status code. 2817 * @param pDevIns The IOMMU device instance. 2818 * @param uDeviceId The device identifier (bus, device, function). 2819 * @param uDva The device virtual address being written. 2820 * @param cbRead The number of bytes being written. 2821 * @param GCPhysOut Where to store the translated physical address. 2822 * 2823 * @thread Any. 2824 */ 2825 static int iommuAmdDeviceMemWrite(PPDMDEVINS pDevIns, uint16_t uDeviceId, uint64_t uDva, size_t cbWrite, PRTGCPHYS pGCPhysOut) 2826 { 2827 RT_NOREF(pDevIns, uDeviceId, uDva, cbWrite, pGCPhysOut); 2828 return VERR_NOT_IMPLEMENTED; 2829 } 2830 2795 2831 2796 2832 /** … … 3661 3697 * Register the IOMMU with PDM. 3662 3698 */ 3663 PDMIOMMUREG CCIommuReg;3699 PDMIOMMUREGR3 IommuReg; 3664 3700 RT_ZERO(IommuReg); 3665 IommuReg.u32Version = PDM_IOMMUREGCC_VERSION; 3666 IommuReg.u32TheEnd = PDM_IOMMUREGCC_VERSION; 3701 IommuReg.u32Version = PDM_IOMMUREGCC_VERSION; 3702 IommuReg.pfnMemRead = iommuAmdDeviceMemRead; 3703 IommuReg.pfnMemWrite = iommuAmdDeviceMemWrite; 3704 IommuReg.u32TheEnd = PDM_IOMMUREGCC_VERSION; 3667 3705 rc = PDMDevHlpIommuRegister(pDevIns, &IommuReg, &pThisCC->CTX_SUFF(pIommuHlp), &pThis->idxIommu); 3668 3706 if (RT_FAILURE(rc)) … … 3833 3871 PDMIOMMUREGCC IommuReg; 3834 3872 RT_ZERO(IommuReg); 3835 IommuReg.u32Version = PDM_IOMMUREGCC_VERSION; 3836 IommuReg.idxIommu = pThis->idxIommu; 3837 IommuReg.u32TheEnd = PDM_IOMMUREGCC_VERSION; 3873 IommuReg.u32Version = PDM_IOMMUREGCC_VERSION; 3874 IommuReg.idxIommu = pThis->idxIommu; 3875 IommuReg.pfnMemRead = iommuAmdDeviceMemRead; 3876 IommuReg.pfnMemWrite = iommuAmdDeviceMemWrite; 3877 IommuReg.u32TheEnd = PDM_IOMMUREGCC_VERSION; 3838 3878 rc = PDMDevHlpIommuSetUpContext(pDevIns, &IommuReg, &pThisCC->CTX_SUFF(pIommuHlp)); 3839 3879 AssertRCReturn(rc, rc); -
trunk/src/VBox/Devices/Makefile.kmk
r83816 r83941 137 137 VBOX_WITH_DMI_CHASSIS \ 138 138 VBOX_WITH_DMI_OEMSTRINGS \ 139 $(if $(VBOX_WITH_NEW_LPC_DEVICE),VBOX_WITH_NEW_LPC_DEVICE,) 139 $(if $(VBOX_WITH_NEW_LPC_DEVICE),VBOX_WITH_NEW_LPC_DEVICE,) \ 140 $(if $(VBOX_WITH_IOMMU_AMD),VBOX_WITH_IOMMU_AMD,) 140 141 VBoxDD_DEFS.win = _WIN32_WINNT=0x0510 141 142 ifeq ($(KBUILD_TARGET_ARCH),x86) … … 918 919 VBoxDDRC_DEFS.darwin = VBOX_WITH_2X_4GB_ADDR_SPACE 919 920 endif 920 VBoxDDRC_DEFS = $(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) 921 VBoxDDRC_DEFS = $(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) $(if $(VBOX_WITH_IOMMU_AMD),VBOX_WITH_IOMMU_AMD,) 921 922 VBoxDDRC_INCS = build $(VBOX_GRAPHICS_INCS) 922 923 VBoxDDRC_SOURCES = \ … … 1100 1101 # 1101 1102 VBoxDDR0_TEMPLATE = VBoxR0 1102 VBoxDDR0_DEFS = IN_RT_R0 $(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) # - WTF is IN_RT_R0 doing here? 1103 VBoxDDR0_DEFS = \ 1104 $(if $(VBOX_WITH_HGCM),VBOX_WITH_HGCM,) \ 1105 $(if $(VBOX_WITH_IOMMU_AMD),VBOX_WITH_IOMMU_AMD,) \ 1106 IN_RT_R0 # - WTF is IN_RT_R0 doing here? 1103 1107 VBoxDDR0_DEFS.win += VBOX_WITH_WIN_PARPORT_SUP 1104 1108 VBoxDDR0_INCS = build $(VBOX_GRAPHICS_INCS)
Note:
See TracChangeset
for help on using the changeset viewer.