vfio/spapr: Always clear TCEs before unsetting the window
authorShivaprasad G Bhat <sbhat@linux.ibm.com>
Mon, 24 Jun 2024 12:38:58 +0000 (12:38 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 28 Jun 2024 07:03:39 +0000 (17:03 +1000)
commit4ba2fdff2eb174114786784926d0efb6903c88a6
tree0881e5881d6ab2201aa5d9cb65fc17499e22f469
parentaed6e4946ed9654fc965482b045b84f9b9572bb8
vfio/spapr: Always clear TCEs before unsetting the window

The PAPR expects the TCE table to have no entries at the time of
unset window(i.e. remove-pe). The TCE clear right now is done
before freeing the iommu table. On pSeries, the unset window
makes those entries inaccessible to the OS and the H_PUT/GET calls
fail on them with H_CONSTRAINED.

On PowerNV, this has no side effect as the TCE clear can be done
before the DMA window removal as well.

Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/171923273535.1397.1236742071894414895.stgit@linux.ibm.com
drivers/vfio/vfio_iommu_spapr_tce.c