From b4f1e5aa85de24762f9d5d93788b415e2c45b7e3 Mon Sep 17 00:00:00 2001 From: Xiaoguang Wu Date: Thu, 26 Mar 2020 15:17:18 +0800 Subject: [PATCH] hv: iommu: disable snoop bit in EPT-PTE/SL-PTE Due to the fact that i915 iommu doesn't support snoop, hence it can't access memory when the SNOOP bit of Secondary Level page PTE (SL-PTE) is set, this will cause many undefined issues such as invisible cursor in WaaG etc. Current hv design uses EPT as Scondary Leval Page for iommu, and this patch removes the codes of setting SNOOP bit in both EPT-PTE and SL-PTE to avoid errors. And according to SDM 28.2.2, the SNOOP bit (11th bit) will be ignored by EPT, so it will not affect the CPU address translation. Tracked-On: #4509 Signed-off-by: Xiaoguang Wu Reviewed-by: Binbin Wu Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/ept.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hypervisor/arch/x86/guest/ept.c b/hypervisor/arch/x86/guest/ept.c index 023d5b108..8b83b36ba 100644 --- a/hypervisor/arch/x86/guest/ept.c +++ b/hypervisor/arch/x86/guest/ept.c @@ -116,14 +116,6 @@ void ept_add_mr(struct acrn_vm *vm, uint64_t *pml4_page, dev_dbg(DBG_LEVEL_EPT, "%s, vm[%d] hpa: 0x%016lx gpa: 0x%016lx size: 0x%016lx prot: 0x%016x\n", __func__, vm->vm_id, hpa, gpa, size, prot); - /* EPT & VT-d share the same page tables, set SNP bit - * to force snooping of PCIe devices if the page - * is cachable - */ - if (((prot & EPT_MT_MASK) != EPT_UNCACHED) && iommu_snoop_supported(vm->iommu)) { - prot |= EPT_SNOOP_CTRL; - } - spinlock_obtain(&vm->ept_lock); mmu_add(pml4_page, hpa, gpa, size, prot, &vm->arch_vm.ept_mem_ops); @@ -145,10 +137,6 @@ void ept_modify_mr(struct acrn_vm *vm, uint64_t *pml4_page, dev_dbg(DBG_LEVEL_EPT, "%s,vm[%d] gpa 0x%lx size 0x%lx\n", __func__, vm->vm_id, gpa, size); - if (((local_prot & EPT_MT_MASK) != EPT_UNCACHED) && iommu_snoop_supported(vm->iommu)) { - local_prot |= EPT_SNOOP_CTRL; - } - spinlock_obtain(&vm->ept_lock); mmu_modify_or_del(pml4_page, gpa, size, local_prot, prot_clr, &(vm->arch_vm.ept_mem_ops), MR_MODIFY);