Alexey Kardashevskiy f87a88642e vfio: powerpc/spapr/iommu/powernv/ioda2: Rework IOMMU ownership control
This adds tce_iommu_take_ownership() and tce_iommu_release_ownership
which call in a loop iommu_take_ownership()/iommu_release_ownership()
for every table on the group. As there is just one now, no change in
behaviour is expected.

At the moment the iommu_table struct has a set_bypass() which enables/
disables DMA bypass on IODA2 PHB. This is exposed to POWERPC IOMMU code
which calls this callback when external IOMMU users such as VFIO are
about to get over a PHB.

The set_bypass() callback is not really an iommu_table function but
IOMMU/PE function. This introduces a iommu_table_group_ops struct and
adds take_ownership()/release_ownership() callbacks to it which are
called when an external user takes/releases control over the IOMMU.

This replaces set_bypass() with ownership callbacks as it is not
necessarily just bypass enabling, it can be something else/more
so let's give it more generic name.

The callbacks is implemented for IODA2 only. Other platforms (P5IOC2,
IODA1) will use the old iommu_take_ownership/iommu_release_ownership API.
The following patches will replace iommu_take_ownership/
iommu_release_ownership calls in IODA2 with full IOMMU table release/
create.

As we here and touching bypass control, this removes
pnv_pci_ioda2_setup_bypass_pe() as it does not do much
more compared to pnv_pci_ioda2_set_bypass. This moves tce_bypass_base
initialization to pnv_pci_ioda2_setup_dma_pe.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
[aw: for the vfio related changes]
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2015-06-11 15:16:47 +10:00
..
2014-08-14 12:48:11 +02:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2013-04-18 13:03:53 +10:00
2014-04-09 12:53:28 +10:00
2012-03-28 18:30:02 +01:00
2015-04-07 17:15:13 +10:00
2014-01-23 16:36:54 -08:00
2011-11-08 14:51:46 +11:00
2014-06-25 18:49:40 -05:00
2015-01-12 05:04:13 -08:00
2015-02-03 18:47:18 +01:00
2014-11-03 12:12:32 +11:00
2012-03-20 21:48:30 +08:00
2014-12-11 17:48:14 -08:00
2015-02-23 14:52:04 +11:00
2015-04-26 13:23:15 -07:00
2011-07-26 16:49:47 -07:00
2013-12-09 11:40:25 +11:00
2014-07-28 14:10:23 +10:00
2014-11-07 18:10:42 -06:00
2014-07-28 14:10:23 +10:00
2015-06-05 08:32:21 +10:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2013-11-06 14:13:49 +11:00
2015-03-06 23:21:07 +01:00
2012-09-17 16:31:51 +10:00
2011-03-31 11:26:23 -03:00
2015-05-20 10:42:05 +10:00
2011-03-31 11:26:23 -03:00
2014-02-17 11:19:37 +11:00
2013-10-30 16:02:28 +11:00