.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Mediated device definition |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. |
---|
5 | 6 | * Author: Neo Jia <cjia@nvidia.com> |
---|
6 | 7 | * Kirti Wankhede <kwankhede@nvidia.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | 8 | */ |
---|
12 | 9 | |
---|
13 | 10 | #ifndef MDEV_H |
---|
14 | 11 | #define MDEV_H |
---|
15 | 12 | |
---|
16 | 13 | struct mdev_device; |
---|
| 14 | + |
---|
| 15 | +/* |
---|
| 16 | + * Called by the parent device driver to set the device which represents |
---|
| 17 | + * this mdev in iommu protection scope. By default, the iommu device is |
---|
| 18 | + * NULL, that indicates using vendor defined isolation. |
---|
| 19 | + * |
---|
| 20 | + * @dev: the mediated device that iommu will isolate. |
---|
| 21 | + * @iommu_device: a pci device which represents the iommu for @dev. |
---|
| 22 | + * |
---|
| 23 | + * Return 0 for success, otherwise negative error value. |
---|
| 24 | + */ |
---|
| 25 | +int mdev_set_iommu_device(struct device *dev, struct device *iommu_device); |
---|
| 26 | + |
---|
| 27 | +struct device *mdev_get_iommu_device(struct device *dev); |
---|
17 | 28 | |
---|
18 | 29 | /** |
---|
19 | 30 | * struct mdev_parent_ops - Structure to be registered for each parent device to |
---|
.. | .. |
---|
118 | 129 | |
---|
119 | 130 | #define to_mdev_driver(drv) container_of(drv, struct mdev_driver, driver) |
---|
120 | 131 | |
---|
121 | | -extern void *mdev_get_drvdata(struct mdev_device *mdev); |
---|
122 | | -extern void mdev_set_drvdata(struct mdev_device *mdev, void *data); |
---|
123 | | -extern uuid_le mdev_uuid(struct mdev_device *mdev); |
---|
| 132 | +void *mdev_get_drvdata(struct mdev_device *mdev); |
---|
| 133 | +void mdev_set_drvdata(struct mdev_device *mdev, void *data); |
---|
| 134 | +const guid_t *mdev_uuid(struct mdev_device *mdev); |
---|
124 | 135 | |
---|
125 | 136 | extern struct bus_type mdev_bus_type; |
---|
126 | 137 | |
---|
127 | | -extern int mdev_register_device(struct device *dev, |
---|
128 | | - const struct mdev_parent_ops *ops); |
---|
129 | | -extern void mdev_unregister_device(struct device *dev); |
---|
| 138 | +int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops); |
---|
| 139 | +void mdev_unregister_device(struct device *dev); |
---|
130 | 140 | |
---|
131 | | -extern int mdev_register_driver(struct mdev_driver *drv, struct module *owner); |
---|
132 | | -extern void mdev_unregister_driver(struct mdev_driver *drv); |
---|
| 141 | +int mdev_register_driver(struct mdev_driver *drv, struct module *owner); |
---|
| 142 | +void mdev_unregister_driver(struct mdev_driver *drv); |
---|
133 | 143 | |
---|
134 | | -extern struct device *mdev_parent_dev(struct mdev_device *mdev); |
---|
135 | | -extern struct device *mdev_dev(struct mdev_device *mdev); |
---|
136 | | -extern struct mdev_device *mdev_from_dev(struct device *dev); |
---|
| 144 | +struct device *mdev_parent_dev(struct mdev_device *mdev); |
---|
| 145 | +struct device *mdev_dev(struct mdev_device *mdev); |
---|
| 146 | +struct mdev_device *mdev_from_dev(struct device *dev); |
---|
137 | 147 | |
---|
138 | 148 | #endif /* MDEV_H */ |
---|