Commit 71cfafd
vfio: Move the Intel no-snoop control off of IOMMU_CACHE
IOMMU_CACHE means "normal DMA to this iommu_domain's IOVA should be cache
coherent" and is used by the DMA API. The definition allows for special
non-coherent DMA to exist - ie processing of the no-snoop flag in PCIe
TLPs - so long as this behavior is opt-in by the device driver.
The flag is mainly used by the DMA API to synchronize the IOMMU setting
with the expected cache behavior of the DMA master. eg based on
dev_is_dma_coherent() in some case.
For Intel IOMMU IOMMU_CACHE was redefined to mean 'force all DMA to be
cache coherent' which has the practical effect of causing the IOMMU to
ignore the no-snoop bit in a PCIe TLP.
x86 platforms are always IOMMU_CACHE, so Intel should ignore this flag.
Instead use the new domain op enforce_cache_coherency() which causes every
IOPTE created in the domain to have the no-snoop blocking behavior.
Reconfigure VFIO to always use IOMMU_CACHE and call
enforce_cache_coherency() to operate the special Intel behavior.
Remove the IOMMU_CACHE test from Intel IOMMU.
Ultimately VFIO plumbs the result of enforce_cache_coherency() back into
the x86 platform code through kvm_arch_register_noncoherent_dma() which
controls if the WBINVD instruction is available in the guest. No other
archs implement kvm_arch_register_noncoherent_dma() nor are there any
other known consumers of VFIO_DMA_CC_IOMMU that might be affected by the
user visible result change on non-x86 archs.
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/2-v3-2cf356649677+a32-intel_no_snoop_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>1 parent 6043257 commit 71cfafd
3 files changed
Lines changed: 21 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
645 | 644 | | |
646 | 645 | | |
647 | 646 | | |
| |||
4283 | 4282 | | |
4284 | 4283 | | |
4285 | 4284 | | |
4286 | | - | |
4287 | 4285 | | |
4288 | 4286 | | |
4289 | 4287 | | |
| |||
4422 | 4420 | | |
4423 | 4421 | | |
4424 | 4422 | | |
4425 | | - | |
4426 | | - | |
| 4423 | + | |
4427 | 4424 | | |
4428 | 4425 | | |
4429 | 4426 | | |
| |||
4550 | 4547 | | |
4551 | 4548 | | |
4552 | 4549 | | |
4553 | | - | |
| 4550 | + | |
4554 | 4551 | | |
4555 | 4552 | | |
4556 | 4553 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
1461 | 1461 | | |
1462 | 1462 | | |
1463 | 1463 | | |
1464 | | - | |
| 1464 | + | |
1465 | 1465 | | |
1466 | 1466 | | |
1467 | 1467 | | |
| |||
1771 | 1771 | | |
1772 | 1772 | | |
1773 | 1773 | | |
1774 | | - | |
| 1774 | + | |
1775 | 1775 | | |
1776 | 1776 | | |
1777 | 1777 | | |
| |||
1859 | 1859 | | |
1860 | 1860 | | |
1861 | 1861 | | |
1862 | | - | |
| 1862 | + | |
1863 | 1863 | | |
1864 | 1864 | | |
1865 | 1865 | | |
| |||
2267 | 2267 | | |
2268 | 2268 | | |
2269 | 2269 | | |
2270 | | - | |
2271 | | - | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
2272 | 2279 | | |
2273 | 2280 | | |
2274 | 2281 | | |
| |||
2279 | 2286 | | |
2280 | 2287 | | |
2281 | 2288 | | |
2282 | | - | |
| 2289 | + | |
| 2290 | + | |
2283 | 2291 | | |
2284 | 2292 | | |
2285 | 2293 | | |
| |||
2611 | 2619 | | |
2612 | 2620 | | |
2613 | 2621 | | |
2614 | | - | |
| 2622 | + | |
2615 | 2623 | | |
2616 | 2624 | | |
2617 | 2625 | | |
2618 | 2626 | | |
2619 | 2627 | | |
2620 | 2628 | | |
2621 | | - | |
| 2629 | + | |
2622 | 2630 | | |
2623 | 2631 | | |
2624 | 2632 | | |
| |||
2641 | 2649 | | |
2642 | 2650 | | |
2643 | 2651 | | |
2644 | | - | |
| 2652 | + | |
2645 | 2653 | | |
2646 | 2654 | | |
2647 | 2655 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | | - | |
543 | 542 | | |
544 | 543 | | |
545 | 544 | | |
| |||
0 commit comments