[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 05 of 16] amd iommu: Enable guest level translation
# HG changeset patch # User Wei Wang <wei.wang2@xxxxxxx> # Date 1323875770 -3600 # Node ID be3f15ae6a4153504bbb3376291a2383684afee5 # Parent d3aa7f936872abacb7e059393fa8963db35c4045 amd iommu: Enable guest level translation. Similar to nested paging for SVM, IOMMUv2 supports two level translations for DMA. This patch enables this feature. Signed-off-by: Wei Wang <wei.wang2@xxxxxxx> diff -r d3aa7f936872 -r be3f15ae6a41 xen/drivers/passthrough/amd/iommu_init.c --- a/xen/drivers/passthrough/amd/iommu_init.c Wed Dec 14 16:08:39 2011 +0100 +++ b/xen/drivers/passthrough/amd/iommu_init.c Wed Dec 14 16:16:10 2011 +0100 @@ -220,6 +220,23 @@ static void set_iommu_translation_contro writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET); } +static void set_iommu_guest_translation_control(struct amd_iommu *iommu, + int enable) +{ + u32 entry; + + entry = readl(iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET); + + enable ? + iommu_set_bit(&entry, IOMMU_CONTROL_GT_ENABLE_SHIFT): + iommu_clear_bit(&entry, IOMMU_CONTROL_GT_ENABLE_SHIFT); + + writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET); + + if ( enable ) + AMD_IOMMU_DEBUG("Guest Translation Enabled.\n"); +} + static void set_iommu_command_buffer_control(struct amd_iommu *iommu, int enable) { @@ -655,6 +672,9 @@ static void enable_iommu(struct amd_iomm if ( iommu_has_feature(iommu, IOMMU_EXT_FEATURE_PPRSUP_SHIFT) ) set_iommu_ppr_log_control(iommu, IOMMU_CONTROL_ENABLED); + if ( iommu_has_feature(iommu, IOMMU_EXT_FEATURE_GTSUP_SHIFT) ) + set_iommu_guest_translation_control(iommu, IOMMU_CONTROL_ENABLED); + set_iommu_translation_control(iommu, IOMMU_CONTROL_ENABLED); if ( iommu_has_feature(iommu, IOMMU_EXT_FEATURE_IASUP_SHIFT) ) @@ -996,6 +1016,9 @@ static void disable_iommu(struct amd_iom if ( iommu_has_feature(iommu, IOMMU_EXT_FEATURE_PPRSUP_SHIFT) ) set_iommu_ppr_log_control(iommu, IOMMU_CONTROL_DISABLED); + if ( iommu_has_feature(iommu, IOMMU_EXT_FEATURE_GTSUP_SHIFT) ) + set_iommu_guest_translation_control(iommu, IOMMU_CONTROL_DISABLED); + set_iommu_translation_control(iommu, IOMMU_CONTROL_DISABLED); iommu->enabled = 0; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |