FILE
iommu-priv.h
File preview with syntax highlighting.
linux-6.19.14/drivers/iommu/iommu-priv.h
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. 3 */ 4#ifndef __LINUX_IOMMU_PRIV_H 5#define __LINUX_IOMMU_PRIV_H 6 7#include <linux/iommu.h> 8#include <linux/msi.h> 9 10static inline const struct iommu_ops *dev_iommu_ops(struct device *dev) 11{ 12 /* 13 * Assume that valid ops must be installed if iommu_probe_device() 14 * has succeeded. The device ops are essentially for internal use 15 * within the IOMMU subsystem itself, so we should be able to trust 16 * ourselves not to misuse the helper. 17 */ 18 return dev->iommu->iommu_dev->ops; 19} 20 21void dev_iommu_free(struct device *dev); 22 23const struct iommu_ops *iommu_ops_from_fwnode(const struct fwnode_handle *fwnode); 24 25static inline const struct iommu_ops *iommu_fwspec_ops(struct iommu_fwspec *fwspec) 26{ 27 return iommu_ops_from_fwnode(fwspec ? fwspec->iommu_fwnode : NULL); 28} 29 30void iommu_fwspec_free(struct device *dev); 31 32int iommu_device_register_bus(struct iommu_device *iommu, 33 const struct iommu_ops *ops, 34 const struct bus_type *bus, 35 struct notifier_block *nb); 36void iommu_device_unregister_bus(struct iommu_device *iommu, 37 const struct bus_type *bus, 38 struct notifier_block *nb); 39 40int iommu_mock_device_add(struct device *dev, struct iommu_device *iommu); 41 42struct iommu_attach_handle *iommu_attach_handle_get(struct iommu_group *group, 43 ioasid_t pasid, 44 unsigned int type); 45int iommu_attach_group_handle(struct iommu_domain *domain, 46 struct iommu_group *group, 47 struct iommu_attach_handle *handle); 48void iommu_detach_group_handle(struct iommu_domain *domain, 49 struct iommu_group *group); 50int iommu_replace_group_handle(struct iommu_group *group, 51 struct iommu_domain *new_domain, 52 struct iommu_attach_handle *handle); 53 54#if IS_ENABLED(CONFIG_IOMMUFD_DRIVER_CORE) && IS_ENABLED(CONFIG_IRQ_MSI_IOMMU) 55int iommufd_sw_msi(struct iommu_domain *domain, struct msi_desc *desc, 56 phys_addr_t msi_addr); 57#else /* !CONFIG_IOMMUFD_DRIVER_CORE || !CONFIG_IRQ_MSI_IOMMU */ 58static inline int iommufd_sw_msi(struct iommu_domain *domain, 59 struct msi_desc *desc, phys_addr_t msi_addr) 60{ 61 return -EOPNOTSUPP; 62} 63#endif /* CONFIG_IOMMUFD_DRIVER_CORE && CONFIG_IRQ_MSI_IOMMU */ 64 65int iommu_replace_device_pasid(struct iommu_domain *domain, 66 struct device *dev, ioasid_t pasid, 67 struct iommu_attach_handle *handle); 68#endif /* __LINUX_IOMMU_PRIV_H */
~/
Read-only file preview.