hv:disable iommu snoop control to enable gvt-d by an option

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>
This commit is contained in:
Junming Liu 2020-02-20 10:03:40 +00:00 committed by wenlingz
parent 53de3a727c
commit 1f1eb7fdba
2 changed files with 17 additions and 0 deletions

View File

@ -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.

View File

@ -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);