drivers/iommu/s390-iommu.c

Source file repositories/reference/linux-study-clean/drivers/iommu/s390-iommu.c

File Facts

System
Linux kernel
Corpus path
drivers/iommu/s390-iommu.c
Extension
.c
Size
28889 bytes
Lines
1198
Domain
Driver Families
Bucket
drivers/iommu
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

subsys_initcall(s390_iommu_init);

static int s390_attach_dev_identity(struct iommu_domain *domain,
				    struct device *dev,
				    struct iommu_domain *old)
{
	struct zpci_dev *zdev = to_zpci_dev(dev);
	u8 status;
	int cc;

	blocking_domain_attach_device(&blocking_domain, dev, old);

	/* If we fail now DMA remains blocked via blocking domain */
	cc = s390_iommu_domain_reg_ioat(zdev, domain, &status);
	if (reg_ioat_propagate_error(cc, status))
		return -EIO;

	zdev_s390_domain_update(zdev, domain);

	return 0;
}

static const struct iommu_domain_ops s390_identity_ops = {
	.attach_dev = s390_attach_dev_identity,
};

static struct iommu_domain s390_identity_domain = {
	.type = IOMMU_DOMAIN_IDENTITY,
	.ops = &s390_identity_ops,
};

static struct iommu_domain blocking_domain = {
	.type = IOMMU_DOMAIN_BLOCKED,
	.ops = &(const struct iommu_domain_ops) {
		.attach_dev	= blocking_domain_attach_device,
	}
};

#define S390_IOMMU_COMMON_OPS() \
	.blocked_domain		= &blocking_domain, \
	.release_domain		= &blocking_domain, \
	.capable = s390_iommu_capable, \
	.domain_alloc_paging = s390_domain_alloc_paging, \
	.probe_device = s390_iommu_probe_device, \
	.device_group = generic_device_group, \
	.get_resv_regions = s390_iommu_get_resv_regions, \
	.default_domain_ops = &(const struct iommu_domain_ops) { \
		.attach_dev	= s390_iommu_attach_device, \
		.map_pages	= s390_iommu_map_pages, \
		.unmap_pages	= s390_iommu_unmap_pages, \
		.flush_iotlb_all = s390_iommu_flush_iotlb_all, \
		.iotlb_sync      = s390_iommu_iotlb_sync, \
		.iotlb_sync_map  = s390_iommu_iotlb_sync_map, \
		.iova_to_phys	= s390_iommu_iova_to_phys, \
		.free		= s390_domain_free, \
	}

static const struct iommu_ops s390_iommu_ops = {
	S390_IOMMU_COMMON_OPS()
};

static const struct iommu_ops s390_iommu_rtr_ops = {
	.identity_domain	= &s390_identity_domain,
	S390_IOMMU_COMMON_OPS()
};

Annotation

Implementation Notes