powerpc: iommu: Bring back table group release_ownership() call
authorShivaprasad G Bhat <sbhat@linux.ibm.com>
Fri, 26 Jan 2024 15:09:18 +0000 (09:09 -0600)
committerJoerg Roedel <jroedel@suse.de>
Fri, 2 Feb 2024 08:26:20 +0000 (09:26 +0100)
commitd2d00e15808c37ec476a5c040ee2cdd23854ef18
tree8b906d851d6a4d6ce9685d80ad1af221d5562fef
parentfae6e669cdc52fdbb843e7fb1b8419642b6b8cba
powerpc: iommu: Bring back table group release_ownership() call

The commit 2ad56efa80db ("powerpc/iommu: Setup a default domain and
remove set_platform_dma_ops") refactored the code removing the
set_platform_dma_ops(). It missed out the table group
release_ownership() call which would have got called otherwise
during the guest shutdown via vfio_group_detach_container(). On
PPC64, this particular call actually sets up the 32-bit TCE table,
and enables the 64-bit DMA bypass etc. Now after guest shutdown,
the subsequent host driver (e.g megaraid-sas) probe post unbind
from vfio-pci fails like,

megaraid_sas 0031:01:00.0: Warning: IOMMU dma not supported: mask 0x7fffffffffffffff, table unavailable
megaraid_sas 0031:01:00.0: Warning: IOMMU dma not supported: mask 0xffffffff, table unavailable
megaraid_sas 0031:01:00.0: Failed to set DMA mask
megaraid_sas 0031:01:00.0: Failed from megasas_init_fw 6539

The patch brings back the call to table_group release_ownership()
call when switching back to PLATFORM domain from BLOCKED, while
also separates the domain_ops for both.

Fixes: 2ad56efa80db ("powerpc/iommu: Setup a default domain and remove set_platform_dma_ops")
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/170628173462.3742.18330000394415935845.stgit@ltcd48-lp2.aus.stglab.ibm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
arch/powerpc/kernel/iommu.c