Loading drivers/iommu/iommu.c +24 −0 Original line number Original line Diff line number Diff line Loading @@ -933,6 +933,30 @@ void iommu_trigger_fault(struct iommu_domain *domain, unsigned long flags) domain->ops->trigger_fault(domain, flags); domain->ops->trigger_fault(domain, flags); } } /** * iommu_reg_read() - read an IOMMU register * * Reads the IOMMU register at the given offset. */ unsigned long iommu_reg_read(struct iommu_domain *domain, unsigned long offset) { if (domain->ops->reg_read) return domain->ops->reg_read(domain, offset); return 0; } /** * iommu_reg_write() - write an IOMMU register * * Writes the given value to the IOMMU register at the given offset. */ void iommu_reg_write(struct iommu_domain *domain, unsigned long offset, unsigned long val) { if (domain->ops->reg_write) domain->ops->reg_write(domain, offset, val); } struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) { { struct iommu_domain *domain; struct iommu_domain *domain; Loading include/linux/iommu.h +21 −0 Original line number Original line Diff line number Diff line Loading @@ -124,6 +124,8 @@ extern struct dentry *iommu_debugfs_top; * @domain_set_attr: Change domain attributes * @domain_set_attr: Change domain attributes * @pgsize_bitmap: bitmap of supported page sizes * @pgsize_bitmap: bitmap of supported page sizes * @trigger_fault: trigger a fault on the device attached to an iommu domain * @trigger_fault: trigger a fault on the device attached to an iommu domain * @reg_read: read an IOMMU register * @reg_write: write an IOMMU register */ */ struct iommu_ops { struct iommu_ops { bool (*capable)(enum iommu_cap); bool (*capable)(enum iommu_cap); Loading Loading @@ -164,6 +166,10 @@ struct iommu_ops { int (*dma_supported)(struct iommu_domain *domain, struct device *dev, int (*dma_supported)(struct iommu_domain *domain, struct device *dev, u64 mask); u64 mask); void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags); void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags); unsigned long (*reg_read)(struct iommu_domain *domain, unsigned long offset); void (*reg_write)(struct iommu_domain *domain, unsigned long val, unsigned long offset); unsigned long pgsize_bitmap; unsigned long pgsize_bitmap; }; }; Loading Loading @@ -205,6 +211,10 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain, iommu_fault_handler_t handler, void *token); iommu_fault_handler_t handler, void *token); extern void iommu_trigger_fault(struct iommu_domain *domain, extern void iommu_trigger_fault(struct iommu_domain *domain, unsigned long flags); unsigned long flags); extern unsigned long iommu_reg_read(struct iommu_domain *domain, unsigned long offset); extern void iommu_reg_write(struct iommu_domain *domain, unsigned long offset, unsigned long val); extern int iommu_attach_group(struct iommu_domain *domain, extern int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group); struct iommu_group *group); Loading Loading @@ -413,6 +423,17 @@ static inline void iommu_trigger_fault(struct iommu_domain *domain, { { } } static inline unsigned long iommu_reg_read(struct iommu_domain *domain, unsigned long offset) { return 0; } static inline void iommu_reg_write(struct iommu_domain *domain, unsigned long val, unsigned long offset) { } static inline int iommu_attach_group(struct iommu_domain *domain, static inline int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group) struct iommu_group *group) { { Loading Loading
drivers/iommu/iommu.c +24 −0 Original line number Original line Diff line number Diff line Loading @@ -933,6 +933,30 @@ void iommu_trigger_fault(struct iommu_domain *domain, unsigned long flags) domain->ops->trigger_fault(domain, flags); domain->ops->trigger_fault(domain, flags); } } /** * iommu_reg_read() - read an IOMMU register * * Reads the IOMMU register at the given offset. */ unsigned long iommu_reg_read(struct iommu_domain *domain, unsigned long offset) { if (domain->ops->reg_read) return domain->ops->reg_read(domain, offset); return 0; } /** * iommu_reg_write() - write an IOMMU register * * Writes the given value to the IOMMU register at the given offset. */ void iommu_reg_write(struct iommu_domain *domain, unsigned long offset, unsigned long val) { if (domain->ops->reg_write) domain->ops->reg_write(domain, offset, val); } struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) { { struct iommu_domain *domain; struct iommu_domain *domain; Loading
include/linux/iommu.h +21 −0 Original line number Original line Diff line number Diff line Loading @@ -124,6 +124,8 @@ extern struct dentry *iommu_debugfs_top; * @domain_set_attr: Change domain attributes * @domain_set_attr: Change domain attributes * @pgsize_bitmap: bitmap of supported page sizes * @pgsize_bitmap: bitmap of supported page sizes * @trigger_fault: trigger a fault on the device attached to an iommu domain * @trigger_fault: trigger a fault on the device attached to an iommu domain * @reg_read: read an IOMMU register * @reg_write: write an IOMMU register */ */ struct iommu_ops { struct iommu_ops { bool (*capable)(enum iommu_cap); bool (*capable)(enum iommu_cap); Loading Loading @@ -164,6 +166,10 @@ struct iommu_ops { int (*dma_supported)(struct iommu_domain *domain, struct device *dev, int (*dma_supported)(struct iommu_domain *domain, struct device *dev, u64 mask); u64 mask); void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags); void (*trigger_fault)(struct iommu_domain *domain, unsigned long flags); unsigned long (*reg_read)(struct iommu_domain *domain, unsigned long offset); void (*reg_write)(struct iommu_domain *domain, unsigned long val, unsigned long offset); unsigned long pgsize_bitmap; unsigned long pgsize_bitmap; }; }; Loading Loading @@ -205,6 +211,10 @@ extern void iommu_set_fault_handler(struct iommu_domain *domain, iommu_fault_handler_t handler, void *token); iommu_fault_handler_t handler, void *token); extern void iommu_trigger_fault(struct iommu_domain *domain, extern void iommu_trigger_fault(struct iommu_domain *domain, unsigned long flags); unsigned long flags); extern unsigned long iommu_reg_read(struct iommu_domain *domain, unsigned long offset); extern void iommu_reg_write(struct iommu_domain *domain, unsigned long offset, unsigned long val); extern int iommu_attach_group(struct iommu_domain *domain, extern int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group); struct iommu_group *group); Loading Loading @@ -413,6 +423,17 @@ static inline void iommu_trigger_fault(struct iommu_domain *domain, { { } } static inline unsigned long iommu_reg_read(struct iommu_domain *domain, unsigned long offset) { return 0; } static inline void iommu_reg_write(struct iommu_domain *domain, unsigned long val, unsigned long offset) { } static inline int iommu_attach_group(struct iommu_domain *domain, static inline int iommu_attach_group(struct iommu_domain *domain, struct iommu_group *group) struct iommu_group *group) { { Loading