Changeset 83237 in vbox
- Timestamp:
- Mar 10, 2020 9:28:52 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r83185 r83237 129 129 /** UnitID: HyperTransport Unit ID. */ 130 130 #define IOMMU_BF_RANGE_UNIT_ID_SHIFT 0 131 #define IOMMU_BF_RANGE_UNIT_ID_MASK UINT32_C(0x000000 0f)131 #define IOMMU_BF_RANGE_UNIT_ID_MASK UINT32_C(0x0000001f) 132 132 /** Bits 6:5 reserved. */ 133 #define IOMMU_BF_RANGE_RSVD_ 6_5_SHIFT 5134 #define IOMMU_BF_RANGE_RSVD_ 6_5_MASK UINT32_C(0x00000060)133 #define IOMMU_BF_RANGE_RSVD_5_6_SHIFT 5 134 #define IOMMU_BF_RANGE_RSVD_5_6_MASK UINT32_C(0x00000060) 135 135 /** RngValid: Range valid. */ 136 136 #define IOMMU_BF_RANGE_VALID_SHIFT 7 … … 146 146 #define IOMMU_BF_RANGE_LAST_DEVICE_MASK UINT32_C(0xff000000) 147 147 RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_RANGE_, UINT32_C(0), UINT32_MAX, 148 (UNIT_ID, RSVD_ 6_15, VALID, BUS_NUMBER, FIRST_DEVICE, LAST_DEVICE));148 (UNIT_ID, RSVD_5_6, VALID, BUS_NUMBER, FIRST_DEVICE, LAST_DEVICE)); 149 149 /** @} */ 150 150 … … 156 156 /** MsiNum: MSI message number. */ 157 157 #define IOMMU_BF_MISCINFO_0_MSI_NUM_SHIFT 0 158 #define IOMMU_BF_MISCINFO_0_MSI_NUM_MASK UINT32_C(0x000000 0f)158 #define IOMMU_BF_MISCINFO_0_MSI_NUM_MASK UINT32_C(0x0000001f) 159 159 /** GvaSize: Guest Virtual Address Size. */ 160 160 #define IOMMU_BF_MISCINFO_0_GVA_SIZE_SHIFT 5 … … 176 176 #define IOMMU_BF_MISCINFO_0_MSI_NUM_PPR_MASK UINT32_C(0xf8000000) 177 177 RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MISCINFO_0_, UINT32_C(0), UINT32_MAX, 178 (MSI_NUM, GVA_SIZE, PA_SIZE, VA_SIZE, HT S_ATS_RESV, RSVD_23_26, MSI_NUM_PPR));178 (MSI_NUM, GVA_SIZE, PA_SIZE, VA_SIZE, HT_ATS_RESV, RSVD_23_26, MSI_NUM_PPR)); 179 179 /** @} */ 180 180 … … 186 186 /** MsiNumGA: MSI message number for guest vAPIC. */ 187 187 #define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_SHIFT 0 188 #define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_MASK UINT32_C(0x000000 0f)188 #define IOMMU_BF_MISCINFO_1_MSI_NUM_GA_MASK UINT32_C(0x0000001f) 189 189 /** Bits 31:5 reserved. */ 190 190 #define IOMMU_BF_MISCINFO_1_RSVD_5_31_SHIFT 5 191 191 #define IOMMU_BF_MISCINFO_1_RSVD_5_31_MASK UINT32_C(0xffffffe0) 192 192 RT_BF_ASSERT_COMPILE_CHECKS(IOMMU_BF_MISCINFO_1_, UINT32_C(0), UINT32_MAX, 193 ( NUM_GA, RSVD_5_31));193 (MSI_NUM_GA, RSVD_5_31)); 194 194 /** @} */ 195 195 … … 229 229 uint32_t u3Mode : 3; /**< Bits 11:9 - Mode: Paging mode. */ 230 230 uint32_t u20PageTableRootPtrLo : 20; /**< Bits 31:12 - Page Table Root Pointer (Lo). */ 231 uint32_t u 40PageTableRootPtrHi : 40; /**< Bits 51:32 - Page Table Root Pointer (Hi). */231 uint32_t u20PageTableRootPtrHi : 20; /**< Bits 51:32 - Page Table Root Pointer (Hi). */ 232 232 uint32_t u1Ppr : 1; /**< Bit 52 - PPR: Peripheral Page Request. */ 233 233 uint32_t u1Grpr : 1; /**< Bit 53 - GRPR: Guest PPR Response with PASID. */ … … 375 375 struct 376 376 { 377 RT_GCC_EXTENSION uint64_t u1Store; /**< Bit 0 - S: Completion Store. */ 378 RT_GCC_EXTENSION uint64_t u1Interrupt; /**< Bit 1 - I: Completion Interrupt. */ 379 RT_GCC_EXTENSION uint64_t u1Flush; /**< Bit 2 - F: Flush Queue. */ 380 RT_GCC_EXTENSION uint64_t u48StoreAddr : 48; /**< Bits 51:3 - Store Address. */ 381 RT_GCC_EXTENSION uint64_t u8Rsvd0 : 8; /**< Bits 59:52 - Reserved. */ 382 RT_GCC_EXTENSION uint64_t u4OpCode : 4; /**< Bits 63:60 - OpCode (Command). */ 383 uint64_t u64StoreData; /**< Bits 127:64 - Store Data. */ 377 uint32_t u1Store : 1; /**< Bit 0 - S: Completion Store. */ 378 uint32_t u1Interrupt : 1; /**< Bit 1 - I: Completion Interrupt. */ 379 uint32_t u1Flush : 1; /**< Bit 2 - F: Flush Queue. */ 380 uint32_t u29StoreAddrLo : 29; /**< Bits 31:3 - Store Address (Lo). */ 381 uint32_t u20StoreAddrHi : 20; /**< Bits 51:32 - Store Address (Hi). */ 382 uint32_t u8Rsvd0 : 8; /**< Bits 59:52 - Reserved. */ 383 uint32_t u4OpCode : 4; /**< Bits 63:60 - OpCode (Command). */ 384 uint64_t u64StoreData; /**< Bits 127:64 - Store Data. */ 384 385 } n; 385 386 /** The 64-bit unsigned integer view. */ 386 uint 64_t au64[2];387 uint32_t au64[2]; 387 388 } CMD_COMPLETION_WAIT_T; 388 389 AssertCompileSize(CMD_COMPLETION_WAIT_T, 16); … … 489 490 uint16_t u16DeviceId; /**< Bits 15:0 - Device ID. */ 490 491 uint16_t u16Rsvd0; /**< Bits 31:16 - Reserved. */ 491 uint32_t u20Pasid ;/**< Bits 51:32 - PASID: Process Address-Space ID. */492 uint32_t u8Rsvd0 ;/**< Bits 59:52 - Reserved. */493 uint32_t u4OpCode ;/**< Bits 63:60 - Op Code (Command). */492 uint32_t u20Pasid : 20; /**< Bits 51:32 - PASID: Process Address-Space ID. */ 493 uint32_t u8Rsvd0 : 8; /**< Bits 59:52 - Reserved. */ 494 uint32_t u4OpCode : 4; /**< Bits 63:60 - Op Code (Command). */ 494 495 uint32_t u2Rsvd0 : 2; /**< Bits 65:64 - Reserved. */ 495 496 uint32_t u1GuestOrNested : 1; /**< Bit 66 - GN: Guest (GPA) or Nested (GVA). */ 496 497 uint32_t u29Rsvd0 : 29; /**< Bits 95:67 - Reserved. */ 497 uint 16_t u16CompletionTag;/**< Bits 111:96 - Completion Tag. */498 uint 16_t u16Rsvd0;/**< Bits 127:112 - Reserved. */498 uint32_t u16CompletionTag : 16; /**< Bits 111:96 - Completion Tag. */ 499 uint32_t u16Rsvd1 : 16; /**< Bits 127:112 - Reserved. */ 499 500 } n; 500 501 /** The 64-bit unsigned integer view. */ … … 557 558 uint16_t u1Rsvd0 : 1; /**< Bit 52 - Reserved. */ 558 559 uint16_t u1ReadWrite : 1; /**< Bit 53 - RW: Read/Write. */ 559 uint16_t u1Rsvd 0: 1; /**< Bit 54 - Reserved. */560 uint16_t u1Rsvd1 : 1; /**< Bit 54 - Reserved. */ 560 561 uint16_t u1RsvdZero : 1; /**< Bit 55 - RZ: Reserved bit not Zero or invalid level encoding. */ 561 562 uint16_t u1Translation : 1; /**< Bit 56 - TN: Translation. */ … … 768 769 769 770 771 /** 772 * The IOMMU device state. 773 */ 774 typedef struct IOMMU 775 { 776 777 } IOMMU; 778 /** Pointer to the IOMMU device state. */ 779 typedef struct IOMMU *PIOMMU; 780 781 /** 782 * The ring-3 IOMMU device state. 783 */ 784 typedef struct IOMMUR3 785 { 786 } IOMMUR3; 787 /** Pointer to the ring-3 IOMMU device state. */ 788 typedef IOMMUR3 *PIOMMUR3; 789 790 /** 791 * The ring-0 IOMMU device state. 792 */ 793 typedef struct IOMMUR0 794 { 795 uint64_t uUnused; 796 } IOMMUR0; 797 /** Pointer to the ring-0 IOMMU device state. */ 798 typedef IOMMUR0 *PIOMMUR0; 799 800 /** 801 * The raw-mode IOMMU device state. 802 */ 803 typedef struct IOMMURC 804 { 805 uint64_t uUnused; 806 } IOMMURC; 807 /** Pointer to the raw-mode IOMMU device state. */ 808 typedef IOMMURC *PIOMMURC; 809 810 /** The IOMMU device state for the current context. */ 811 typedef CTX_SUFF(IOMMU) IOMMUCC; 812 /** Pointer to the IOMMU device state for the current context. */ 813 typedef CTX_SUFF(PIOMMU) PIOMMUCC; 814 815 770 816 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 817 818 # ifdef IN_RING3 819 /** 820 * @interface_method_impl{PDMDEVREG,pfnDestruct} 821 */ 822 static DECLCALLBACK(int) iommuR3Destruct(PPDMDEVINS pDevIns) 823 { 824 return VINF_SUCCESS; 825 } 826 827 828 /** 829 * @interface_method_impl{PDMDEVREG,pfnConstruct} 830 */ 831 static DECLCALLBACK(int) iommuR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 832 { 833 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 834 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 835 PIOMMUCC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PIOMMUCC); 836 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 837 int rc; 838 LogFlowFunc(("\n")); 839 840 /* 841 * Validate and read the configuration. 842 */ 843 //PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "", ""); 844 return VINF_SUCCESS; 845 } 846 847 # else /* !IN_RING3 */ 848 849 /** 850 * @callback_method_impl{PDMDEVREGR0,pfnConstruct} 851 */ 852 static DECLCALLBACK(int) iommuRZConstruct(PPDMDEVINS pDevIns) 853 { 854 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 855 return VINF_SUCCESS; 856 } 857 858 # endif /* !IN_RING3 */ 859 771 860 /** 772 861 * The device registration structure. … … 777 866 /* .uReserved0 = */ 0, 778 867 /* .szName = */ "iommu", 779 /* .fFlags = */ /** @todo IOMMU: figure out flags. */,780 /* .fClass = */ PDM_DEVREG_CLASS_ ARCH,/** @todo IOMMU: We want to be instantiated781 before PDM_DEVREG_CLASS_BUS_PCI? Maybe doesn't matter? */868 /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE, 869 /* .fClass = */ PDM_DEVREG_CLASS_BUS_PCI, /** @todo IOMMU: We want to be instantiated 870 before PDM_DEVREG_CLASS_BUS_PCI? Maybe doesn't matter? */ 782 871 /* .cMaxInstances = */ ~0U, 783 872 /* .uSharedVersion = */ 42, 784 /* .cbInstanceShared = */ sizeof( ), /** @todo IOMMU: compute. */785 /* .cbInstanceCC = */ sizeof( ), /** @todo IOMMU: compute. */786 /* .cbInstanceRC = */ sizeof( ), /** @todo IOMMU: compute. */873 /* .cbInstanceShared = */ sizeof(IOMMU), 874 /* .cbInstanceCC = */ sizeof(IOMMUCC), 875 /* .cbInstanceRC = */ sizeof(IOMMURC), 787 876 /* .cMaxPciDevices = */ 1, 788 877 /* .cMaxMsixVectors = */ 0, … … 844 933 845 934 #endif /* !VBOX_DEVICE_STRUCT_TESTCASE */ 935
Note:
See TracChangeset
for help on using the changeset viewer.

