blob: 5f731d994803c6bb644ad8b078da026be1c51f28 [file] [log] [blame]
Nicolin Chenaddb6652023-07-17 15:12:09 -03001/* SPDX-License-Identifier: GPL-2.0-only */
Jason Gunthorpe23a1b462023-08-02 21:08:02 -03002/* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.
3 */
Nicolin Chenaddb6652023-07-17 15:12:09 -03004#ifndef __LINUX_IOMMU_PRIV_H
5#define __LINUX_IOMMU_PRIV_H
6
7#include <linux/iommu.h>
8
Yi Liu92766e12023-08-18 03:10:29 -07009static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)
10{
11 /*
12 * Assume that valid ops must be installed if iommu_probe_device()
13 * has succeeded. The device ops are essentially for internal use
14 * within the IOMMU subsystem itself, so we should be able to trust
15 * ourselves not to misuse the helper.
16 */
17 return dev->iommu->iommu_dev->ops;
18}
19
Nicolin Chenaddb6652023-07-17 15:12:09 -030020int iommu_group_replace_domain(struct iommu_group *group,
21 struct iommu_domain *new_domain);
22
Jason Gunthorpe23a1b462023-08-02 21:08:02 -030023int iommu_device_register_bus(struct iommu_device *iommu,
Krzysztof Kozlowskie70e9ec2024-02-16 15:40:24 +010024 const struct iommu_ops *ops,
25 const struct bus_type *bus,
Jason Gunthorpe23a1b462023-08-02 21:08:02 -030026 struct notifier_block *nb);
27void iommu_device_unregister_bus(struct iommu_device *iommu,
Krzysztof Kozlowskie70e9ec2024-02-16 15:40:24 +010028 const struct bus_type *bus,
Jason Gunthorpe23a1b462023-08-02 21:08:02 -030029 struct notifier_block *nb);
30
Nicolin Chenaddb6652023-07-17 15:12:09 -030031#endif /* __LINUX_IOMMU_PRIV_H */