mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 05:13:18 +00:00
iommu: Add IOMMU_DOMAIN_PLATFORM for S390
The PLATFORM domain will be set as the default domain and attached as normal during probe. The driver will ignore the initial attach from a NULL domain to the PLATFORM domain. After this, the PLATFORM domain's attach_dev will be called whenever we detach from an UNMANAGED domain (eg for VFIO). This is the same time the original design would have called op->detach_dev(). This is temporary until the S390 dma-iommu.c conversion is merged. Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/4-v8-81230027b2fa+9d-iommu_all_defdom_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
2ad56efa80
commit
e04c7487a6
@ -142,14 +142,31 @@ static int s390_iommu_attach_device(struct iommu_domain *domain,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void s390_iommu_set_platform_dma(struct device *dev)
|
||||
/*
|
||||
* Switch control over the IOMMU to S390's internal dma_api ops
|
||||
*/
|
||||
static int s390_iommu_platform_attach(struct iommu_domain *platform_domain,
|
||||
struct device *dev)
|
||||
{
|
||||
struct zpci_dev *zdev = to_zpci_dev(dev);
|
||||
|
||||
if (!zdev->s390_domain)
|
||||
return 0;
|
||||
|
||||
__s390_iommu_detach_device(zdev);
|
||||
zpci_dma_init_device(zdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct iommu_domain_ops s390_iommu_platform_ops = {
|
||||
.attach_dev = s390_iommu_platform_attach,
|
||||
};
|
||||
|
||||
static struct iommu_domain s390_iommu_platform_domain = {
|
||||
.type = IOMMU_DOMAIN_PLATFORM,
|
||||
.ops = &s390_iommu_platform_ops,
|
||||
};
|
||||
|
||||
static void s390_iommu_get_resv_regions(struct device *dev,
|
||||
struct list_head *list)
|
||||
{
|
||||
@ -428,12 +445,12 @@ void zpci_destroy_iommu(struct zpci_dev *zdev)
|
||||
}
|
||||
|
||||
static const struct iommu_ops s390_iommu_ops = {
|
||||
.default_domain = &s390_iommu_platform_domain,
|
||||
.capable = s390_iommu_capable,
|
||||
.domain_alloc = s390_domain_alloc,
|
||||
.probe_device = s390_iommu_probe_device,
|
||||
.release_device = s390_iommu_release_device,
|
||||
.device_group = generic_device_group,
|
||||
.set_platform_dma_ops = s390_iommu_set_platform_dma,
|
||||
.pgsize_bitmap = SZ_4K,
|
||||
.get_resv_regions = s390_iommu_get_resv_regions,
|
||||
.default_domain_ops = &(const struct iommu_domain_ops) {
|
||||
|
Loading…
Reference in New Issue
Block a user