Re: [PATCH v6 4/5] iommu/vt-d: Add iommu_ops support for subdevice bus

From: Alex Williamson
Date: Fri Oct 30 2020 - 16:57:06 EST


On Fri, 30 Oct 2020 12:58:08 +0800
Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx> wrote:

> +static const struct iommu_ops siov_iommu_ops = {
> + .capable = intel_iommu_capable,
> + .domain_alloc = siov_iommu_domain_alloc,
> + .domain_free = intel_iommu_domain_free,
> + .attach_dev = siov_iommu_attach_device,
> + .detach_dev = siov_iommu_detach_device,
> + .map = intel_iommu_map,
> + .unmap = intel_iommu_unmap,
> + .iova_to_phys = intel_iommu_iova_to_phys,
> + .probe_device = siov_iommu_probe_device,
> + .release_device = siov_iommu_release_device,
> + .get_resv_regions = siov_iommu_get_resv_regions,
> + .put_resv_regions = generic_iommu_put_resv_regions,
> + .device_group = generic_device_group,
> + .pgsize_bitmap = (~0xFFFUL),
> +};
> +
> +void intel_siov_init(void)
> +{
> + if (!scalable_mode_support() || !iommu_pasid_support())
> + return;
> +
> + bus_set_iommu(&mdev_bus_type, &siov_iommu_ops);
> + pr_info("Intel(R) Scalable I/O Virtualization supported\n");
> +}

How can you presume to take over iommu_ops for an entire virtual bus?
This also forces mdev and all the dependencies of mdev to be built into
the kernel. I don't find that acceptable. Thanks,

Alex