aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-03-30 09:49:36 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-03-30 09:49:36 -0700
commit17860ccabff533748c85ea32904abd6bae990099 (patch)
treea693893cebd263144b6a35ebfd9c09dfbf152822
parente720e7d0e983bf05de80b231bccc39f1487f0f16 (diff)
parente0146a108ce4d2c22b9510fd12268e3ee72a0161 (diff)
downloadkernfs-17860ccabff533748c85ea32904abd6bae990099.tar.gz
Merge tag 'vfio-v5.12-rc6' of git://github.com/awilliam/linux-vfio
Pull VFIO fixes from Alex Williamson: - Fix pfnmap batch carryover (Daniel Jordan) - Fix nvlink Kconfig dependency (Jason Gunthorpe) * tag 'vfio-v5.12-rc6' of git://github.com/awilliam/linux-vfio: vfio/nvlink: Add missing SPAPR_TCE_IOMMU depends vfio/type1: Empty batch for pfnmap pages
-rw-r--r--drivers/vfio/pci/Kconfig2
-rw-r--r--drivers/vfio/vfio_iommu_type1.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig
index ac3c1dd3edeff1..4abddbebd4b236 100644
--- a/drivers/vfio/pci/Kconfig
+++ b/drivers/vfio/pci/Kconfig
@@ -42,6 +42,6 @@ config VFIO_PCI_IGD
config VFIO_PCI_NVLINK2
def_bool y
- depends on VFIO_PCI && PPC_POWERNV
+ depends on VFIO_PCI && PPC_POWERNV && SPAPR_TCE_IOMMU
help
VFIO PCI support for P9 Witherspoon machine with NVIDIA V100 GPUs
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index be444407664af7..45cbfd4879a553 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -739,6 +739,12 @@ out:
ret = vfio_lock_acct(dma, lock_acct, false);
unpin_out:
+ if (batch->size == 1 && !batch->offset) {
+ /* May be a VM_PFNMAP pfn, which the batch can't remember. */
+ put_pfn(pfn, dma->prot);
+ batch->size = 0;
+ }
+
if (ret < 0) {
if (pinned && !rsvd) {
for (pfn = *pfn_base ; pinned ; pfn++, pinned--)