hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/mdev.h
....@@ -1,19 +1,30 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Mediated device definition
34 *
45 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
56 * Author: Neo Jia <cjia@nvidia.com>
67 * 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.
118 */
129
1310 #ifndef MDEV_H
1411 #define MDEV_H
1512
1613 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);
1728
1829 /**
1930 * struct mdev_parent_ops - Structure to be registered for each parent device to
....@@ -118,21 +129,20 @@
118129
119130 #define to_mdev_driver(drv) container_of(drv, struct mdev_driver, driver)
120131
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);
124135
125136 extern struct bus_type mdev_bus_type;
126137
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);
130140
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);
133143
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);
137147
138148 #endif /* MDEV_H */