Changeset 84183 in vbox
- Timestamp:
- May 7, 2020 11:23:48 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137790
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevIommuAmd.cpp
r84181 r84183 481 481 /** Maximum number of host address translation levels supported. */ 482 482 #define IOMMU_MAX_HOST_PT_LEVEL 6 483 /** The IOTLB entry magic. */ 484 #define IOMMU_IOTLBE_MAGIC 0x10acce55 483 485 /** @} */ 484 486 … … 2213 2215 typedef struct 2214 2216 { 2217 /** Magic (IOMMU_IOTLBE_MAGIC). */ 2218 uint32_t uMagic; 2219 /** Reserved for future (eviction hints?). */ 2220 uint16_t uRsvd0; 2215 2221 /** The I/O access permissions (IOMMU_IO_PERM_XXX). */ 2216 2222 uint8_t fIoPerm; 2217 2223 /** The number of offset bits in the system physical address. */ 2218 2224 uint8_t cShift; 2219 /** Reserved for future (eviction hints?). */2220 uint16_t uRsvd0;2221 /** Alignment padding. */2222 uint32_t uRsvd1;2223 2225 /** The translated system physical address of the page. */ 2224 2226 RTGCPHYS GCPhysSpa; … … 3780 3782 static void iommuAmdInitIotlbe(RTGCPHYS GCPhysSpa, uint8_t cShift, uint8_t fIoPerm, PIOTLBE_T pIotlbe) 3781 3783 { 3784 pIotlbe->uMagic = IOMMU_IOTLBE_MAGIC; 3785 pIotlbe->uRsvd0 = 0; 3782 3786 pIotlbe->fIoPerm = fIoPerm; 3783 pIotlbe->uRsvd0 = 0; 3784 pIotlbe->uRsvd1 = 0; 3787 pIotlbe->cShift = cShift; 3788 pIotlbe->GCPhysSpa = GCPhysSpa; 3789 } 3790 3791 /** 3792 * Updates an IOTLB entry. 3793 * 3794 * @param GCPhysSpa The translated system physical address. 3795 * @param cShift The number of offset bits in the system physical address. 3796 * @param fIoPerm The I/O access permissions (IOMMU_IO_PERM_XXX). 3797 * @param pIotlbe The IOTLB entry to update. 3798 */ 3799 static void iommuAmdUpdateIotlbe(RTGCPHYS GCPhysSpa, uint8_t cShift, uint8_t fIoPerm, PIOTLBE_T pIotlbe) 3800 { 3801 Assert(pIotlbe->uMagic == IOMMU_IOTLBE_MAGIC); 3802 pIotlbe->fIoPerm = fIoPerm; 3785 3803 pIotlbe->cShift = cShift; 3786 3804 pIotlbe->GCPhysSpa = GCPhysSpa; … … 3886 3904 iommuAmdRaiseIoPageFaultEvent(pDevIns, uDevId, pDte->n.u16DomainId, uIova, true /* fPresentOrValid */, 3887 3905 enmOp, kIoPageFaultType_DteTranslationDisabled); 3888 iommuAmd InitIotlbe(NIL_RTGCPHYS, 0 /* cShift */, IOMMU_IO_PERM_NONE, pIotlbe);3906 iommuAmdUpdateIotlbe(NIL_RTGCPHYS, 0 /* cShift */, IOMMU_IO_PERM_NONE, pIotlbe); 3889 3907 return VERR_IOMMU_ADDR_TRANSLATION_FAILED; 3890 3908 } … … 3899 3917 return VERR_IOMMU_ADDR_ACCESS_DENIED; 3900 3918 } 3901 iommuAmd InitIotlbe(uIova, 0 /* cShift */, fDtePerm, pIotlbe);3919 iommuAmdUpdateIotlbe(uIova, 0 /* cShift */, fDtePerm, pIotlbe); 3902 3920 return VINF_SUCCESS; 3903 3921 } … … 3910 3928 * I'm just going with this one... */ 3911 3929 /** @todo IOMMU: raise I/O page fault. */ 3912 iommuAmd InitIotlbe(NIL_RTGCPHYS, 0 /* cShift */, IOMMU_IO_PERM_NONE, pIotlbe);3930 iommuAmdUpdateIotlbe(NIL_RTGCPHYS, 0 /* cShift */, IOMMU_IO_PERM_NONE, pIotlbe); 3913 3931 return VERR_IOMMU_ADDR_TRANSLATION_FAILED; 3914 3932 } … … 3937 3955 PIOTLBE_T pIotlbe) 3938 3956 { 3957 Assert(pIotlbe->uMagic == IOMMU_IOTLBE_MAGIC); 3939 3958 PIOMMU pThis = PDMDEVINS_2_DATA(pDevIns, PIOMMU); 3940 3959 … … 3949 3968 else 3950 3969 { 3951 iommuAmd InitIotlbe(uIova, 0 /* cShift */, IOMMU_IO_PERM_READ_WRITE, pIotlbe);3970 iommuAmdUpdateIotlbe(uIova, 0 /* cShift */, IOMMU_IO_PERM_READ_WRITE, pIotlbe); 3952 3971 return VINF_SUCCESS; 3953 3972 } … … 3973 3992 else 3974 3993 { 3975 iommuAmd InitIotlbe(uIova, 0 /* cShift */, IOMMU_IO_PERM_READ_WRITE, pIotlbe);3994 iommuAmdUpdateIotlbe(uIova, 0 /* cShift */, IOMMU_IO_PERM_READ_WRITE, pIotlbe); 3976 3995 return VINF_SUCCESS; 3977 3996 }
Note:
See TracChangeset
for help on using the changeset viewer.