Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8488df2f authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Patrick Daly
Browse files

iommu: Add iommu_trigger_fault



It can be useful to trigger an IOMMU fault during development and
debugging.  Add support to the IOMMU framework to do so.

Change-Id: I908c9f5b52c6abe937f031de546d290027ba64b5
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent cc8d12f4
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1554,6 +1554,21 @@ int iommu_domain_set_attr(struct iommu_domain *domain,
}
EXPORT_SYMBOL_GPL(iommu_domain_set_attr);

/**
 * iommu_trigger_fault() - trigger an IOMMU fault
 * @domain: iommu domain
 *
 * Triggers a fault on the device to which this domain is attached.
 *
 * This function should only be used for debugging purposes, for obvious
 * reasons.
 */
void iommu_trigger_fault(struct iommu_domain *domain, unsigned long flags)
{
	if (domain->ops->trigger_fault)
		domain->ops->trigger_fault(domain, flags);
}

void iommu_get_dm_regions(struct device *dev, struct list_head *list)
{
	const struct iommu_ops *ops = dev->bus->iommu_ops;
+10 −0
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@ struct iommu_dm_region {
 * @domain_get_windows: Return the number of windows for a domain
 * @of_xlate: add OF master IDs to iommu grouping
 * @pgsize_bitmap: bitmap of all possible supported page sizes
 * @trigger_fault: trigger a fault on the device attached to an iommu domain
 */
struct iommu_ops {
	bool (*capable)(enum iommu_cap);
@@ -212,6 +213,7 @@ struct iommu_ops {
	int (*domain_set_windows)(struct iommu_domain *domain, u32 w_count);
	/* Get the number of windows per domain */
	u32 (*domain_get_windows)(struct iommu_domain *domain);
	void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags);

	int (*of_xlate)(struct device *dev, struct of_phandle_args *args);

@@ -347,6 +349,9 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain,
	return domain->ops->map_sg(domain, iova, sg, nents, prot);
}

extern void iommu_trigger_fault(struct iommu_domain *domain,
				unsigned long flags);

/* PCI device grouping function */
extern struct iommu_group *pci_device_group(struct device *dev);
/* Generic device grouping function */
@@ -568,6 +573,11 @@ static inline void iommu_device_unlink(struct device *dev, struct device *link)
{
}

static inline void iommu_trigger_fault(struct iommu_domain *domain,
				       unsigned long flags)
{
}

#endif /* CONFIG_IOMMU_API */

#endif /* __LINUX_IOMMU_H */