Thread (67 messages) 67 messages, 2 authors, 2023-08-16

Re: [PATCH v6 15/25] iommufd/selftest: Make the mock iommu driver into a real driver

From: Baolu Lu <baolu.lu@linux.intel.com>
Date: 2023-08-12 05:01:41
Also in: linux-arm-kernel, linux-arm-msm, linux-iommu, linux-mediatek, linux-rockchip, linux-s390, linux-samsung-soc, linux-sunxi, linux-tegra

On 2023/8/3 8:08, Jason Gunthorpe wrote:
+/*
+ * Register an iommu driver against a single bus. This is only used by iommufd
+ * selftest to create a mock iommu driver. The caller must provide
+ * some memory to hold a notifier_block.
+ */
+int iommu_device_register_bus(struct iommu_device *iommu,
+			      const struct iommu_ops *ops, struct bus_type *bus,
+			      struct notifier_block *nb)
+{
+	int err;
+
+	iommu->ops = ops;
+	nb->notifier_call = iommu_bus_notifier;
+	err = bus_register_notifier(bus, nb);
+	if (err)
+		return err;
+
+	spin_lock(&iommu_device_lock);
+	list_add_tail(&iommu->list, &iommu_device_list);
+	spin_unlock(&iommu_device_lock);
+
+	bus->iommu_ops = ops;
+	err = bus_iommu_probe(bus);
By the way, bus_iommu_probe() has been changed in iommu-next, so it
needs to be rebased here.

Best regards,
baolu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help