2023-07-17 11:12:09 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2023-08-02 17:08:02 -07:00
|
|
|
/* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.
|
|
|
|
*/
|
2023-07-17 11:12:09 -07:00
|
|
|
#ifndef __LINUX_IOMMU_PRIV_H
|
|
|
|
#define __LINUX_IOMMU_PRIV_H
|
|
|
|
|
|
|
|
#include <linux/iommu.h>
|
|
|
|
|
2023-08-18 03:10:29 -07:00
|
|
|
static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Assume that valid ops must be installed if iommu_probe_device()
|
|
|
|
* has succeeded. The device ops are essentially for internal use
|
|
|
|
* within the IOMMU subsystem itself, so we should be able to trust
|
|
|
|
* ourselves not to misuse the helper.
|
|
|
|
*/
|
|
|
|
return dev->iommu->iommu_dev->ops;
|
|
|
|
}
|
|
|
|
|
2024-07-02 04:40:48 -07:00
|
|
|
const struct iommu_ops *iommu_ops_from_fwnode(const struct fwnode_handle *fwnode);
|
|
|
|
|
2024-07-02 04:40:51 -07:00
|
|
|
static inline const struct iommu_ops *iommu_fwspec_ops(struct iommu_fwspec *fwspec)
|
|
|
|
{
|
|
|
|
return iommu_ops_from_fwnode(fwspec ? fwspec->iommu_fwnode : NULL);
|
|
|
|
}
|
|
|
|
|
2023-07-17 11:12:09 -07:00
|
|
|
int iommu_group_replace_domain(struct iommu_group *group,
|
|
|
|
struct iommu_domain *new_domain);
|
|
|
|
|
2023-08-02 17:08:02 -07:00
|
|
|
int iommu_device_register_bus(struct iommu_device *iommu,
|
2024-02-16 07:40:24 -07:00
|
|
|
const struct iommu_ops *ops,
|
|
|
|
const struct bus_type *bus,
|
2023-08-02 17:08:02 -07:00
|
|
|
struct notifier_block *nb);
|
|
|
|
void iommu_device_unregister_bus(struct iommu_device *iommu,
|
2024-02-16 07:40:24 -07:00
|
|
|
const struct bus_type *bus,
|
2023-08-02 17:08:02 -07:00
|
|
|
struct notifier_block *nb);
|
|
|
|
|
2024-07-01 23:34:36 -07:00
|
|
|
struct iommu_attach_handle *iommu_attach_handle_get(struct iommu_group *group,
|
|
|
|
ioasid_t pasid,
|
|
|
|
unsigned int type);
|
2024-07-01 23:34:38 -07:00
|
|
|
int iommu_attach_group_handle(struct iommu_domain *domain,
|
|
|
|
struct iommu_group *group,
|
|
|
|
struct iommu_attach_handle *handle);
|
|
|
|
void iommu_detach_group_handle(struct iommu_domain *domain,
|
|
|
|
struct iommu_group *group);
|
|
|
|
int iommu_replace_group_handle(struct iommu_group *group,
|
|
|
|
struct iommu_domain *new_domain,
|
|
|
|
struct iommu_attach_handle *handle);
|
2023-07-17 11:12:09 -07:00
|
|
|
#endif /* __LINUX_IOMMU_PRIV_H */
|