No need to emulate WBINVD when VT-d force snooping feature available
PATCH 1/1 No need to emulate WBINVD when VT-d force snooping feature available
There is no cache coherency issue if VT-d engine's force snooping feature available.
xen/arch/x86/hvm/vmx/vmcs.c +3 -1
@@ -1064,8 +1064,10 @@* 1: flushing cache (wbinvd) when the guest is scheduled out if * there is no wbinvd exit, or * 2: execute wbinvd on all dirty pCPUs when guest wbinvd exits. +* If VT-d engine can force snooping, we don't need to do these. */ -if (has_arch_pdevs (v->domain) && !cpu_has_wbinvd_exiting ) +if (has_arch_pdevs (v->domain) && !iommu_snoop + && !cpu_has_wbinvd_exiting ) {int cpu = v->arch.hvm_vmx.active_cpu;if ( cpu !=-1 )
xen/arch/x86/hvm/vmx/vmx.c +3 -0
@@ -2089,6 +2089,9 @@if ( !has_arch_mmios (current->domain) )return ; +if ( iommu_snoop ) +return ; +if ( cpu_has_wbinvd_exiting )on_each_cpu (wbinvd_ipi,NULL ,1 );else
xen/arch/x86/hvm/vmx/vmcs.c +3 -1
@@ -1064,8 +1064,10 @@* 1: flushing cache (wbinvd) when the guest is scheduled out if * there is no wbinvd exit, or * 2: execute wbinvd on all dirty pCPUs when guest wbinvd exits. +* If VT-d engine can force snooping, we don't need to do these. */ -if (has_arch_pdevs (v->domain) && !cpu_has_wbinvd_exiting ) +if (has_arch_pdevs (v->domain) && !iommu_snoop + && !cpu_has_wbinvd_exiting ) {int cpu = v->arch.hvm_vmx.active_cpu;if ( cpu !=-1 )
xen/arch/x86/hvm/vmx/vmx.c +3 -0
@@ -2089,6 +2089,9 @@if ( !has_arch_mmios (current->domain) )return ; +if ( iommu_snoop ) +return ; +if ( cpu_has_wbinvd_exiting )on_each_cpu (wbinvd_ipi,NULL ,1 );else
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 2 lines
There is no cache coherency issue if VT-d engine's force snooping feature available.
Isn't it also necessary to explicitly set the SNP bit in each VTd PTE to force snooping? I don't believe we do this today, but since we ignore guest PAT settings on RAM we should do so.
Thanks,
Ian
Quoted 30 lines
Signed-off-by Sheng Yang <[email protected]>xen/arch/x86/hvm/vmx/vmcs.c +3
-1@@ -1064,8 +1064,10 @@* 1: flushing cache (wbinvd) when the guest is scheduled out if * there is no wbinvd exit, or * 2: execute wbinvd on all dirty pCPUs when guest wbinvd exits. +* If VT-d engine can force snooping, we don't need to do these. */ -if (has_arch_pdevs (v->domain) && !cpu_has_wbinvd_exiting ) +if (has_arch_pdevs (v->domain) && !iommu_snoop + && !cpu_has_wbinvd_exiting ) {int cpu = v->arch.hvm_vmx.active_cpu;if ( cpu !=-1 )xen/arch/x86/hvm/vmx/vmx.c +3
-0@@ -2089,6 +2089,9 @@if ( !has_arch_mmios (current->domain) )return ; +if ( iommu_snoop ) +return ; +if ( cpu_has_wbinvd_exiting )on_each_cpu (wbinvd_ipi,NULL ,1 );else
Quoted 6 lines · Ian Pratt
Quoted 2 lines
There is no cache coherency issue if VT-d engine's force snooping feature available.
Isn't it also necessary to explicitly set the SNP bit in each VTd PTE to force snooping? I don't believe we do this today, but since we ignore guest PAT settings on RAM we should do so.
In drivers/passthrough/vtd/iommu.c:intel_iommu_map_page() ---
/* Set the SNP on leaf page table if Snoop Control available */
if ( iommu_snoop )
dma_set_pte_snp(*pte);
-- Keir
Quoted 34 lines
Thanks,
IanQuoted 30 lines
Signed-off-by Sheng Yang <[email protected]>xen/arch/x86/hvm/vmx/vmcs.c +3
-1@@ -1064,8 +1064,10 @@* 1: flushing cache (wbinvd) when the guest is scheduled out if * there is no wbinvd exit, or * 2: execute wbinvd on all dirty pCPUs when guest wbinvd exits. +* If VT-d engine can force snooping, we don't need to do these. */ -if (has_arch_pdevs (v->domain) && !cpu_has_wbinvd_exiting ) +if (has_arch_pdevs (v->domain) && !iommu_snoop + && !cpu_has_wbinvd_exiting ) {int cpu = v->arch.hvm_vmx.active_cpu;if ( cpu !=-1 )xen/arch/x86/hvm/vmx/vmx.c +3
-0@@ -2089,6 +2089,9 @@if ( !has_arch_mmios (current->domain) )return ; +if ( iommu_snoop ) +return ; +if ( cpu_has_wbinvd_exiting )on_each_cpu (wbinvd_ipi,NULL ,1 );else