Skip to content

Commit

Permalink
hv:disable iommu snoop control to enable gvt-d by an option
Browse files Browse the repository at this point in the history
If one of the enabled VT-d DMAR units
doesn’t support snoop control,
then bit 11 of leaf PET of EPT is not set,
since the field is treated as reserved(0)
by VT-d hardware implementations
not supporting snoop control.

GUP IOMMU doesn’t support snoop control,
this patch add an option to disable
iommu snoop control for gvt-d.

v2 -> v3:
        * refine the MICRO name and description.

Tracked-On: #4405

Signed-off-by: Junming Liu <junming.liu@intel.com>
Reviewed-by: Wu Binbin <binbin.wu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
  • Loading branch information
Junming Liu authored and wenlingz committed Feb 24, 2020
1 parent 53de3a7 commit 1f1eb7f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions hypervisor/arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,10 @@ config MCE_ON_PSC_WORKAROUND_DISABLED
conditionally applied to the models that may be affected by the issue. However,
the software workaround has negative impact on performance. If all the guest OS
kernels are trusted, this option may be set for performance.

config IOMMU_ENFORCE_SNP
bool "IOMMU enforce snoop behavior of DMA operation"
default n
help
GPU IOMMU doesn't support snoop control capability,
To enable gvt-d,disable IOMMU snoop control by default.
10 changes: 10 additions & 0 deletions hypervisor/arch/x86/vtd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,17 @@ struct iommu_domain *create_iommu_domain(uint16_t vm_id, uint64_t translation_ta
domain->trans_table_ptr = translation_table;
domain->addr_width = addr_width;
domain->is_tt_ept = true;

#ifdef CONFIG_IOMMU_ENFORCE_SNP
domain->iommu_snoop = true;
#else
/* TODO: GPU IOMMU doesn't have snoop control capbility,
* so set domain->iommu_snoop false to enable gvt-d by default.
* If want to refine iommu snoop control policy,
* need to change domain->iommu_snoop dynamically.
*/
domain->iommu_snoop = false;
#endif

dev_dbg(DBG_LEVEL_IOMMU, "create domain [%d]: vm_id = %hu, ept@0x%x",
vmid_to_domainid(domain->vm_id), domain->vm_id, domain->trans_table_ptr);
Expand Down

0 comments on commit 1f1eb7f

Please sign in to comment.