hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/vfio/mdev/mdev_private.h
....@@ -1,13 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Mediated device interal definitions
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_PRIVATE_H
....@@ -23,20 +20,25 @@
2320 struct list_head next;
2421 struct kset *mdev_types_kset;
2522 struct list_head type_list;
23
+ /* Synchronize device creation/removal with parent unregistration */
24
+ struct rw_semaphore unreg_sem;
2625 };
2726
2827 struct mdev_device {
2928 struct device dev;
3029 struct mdev_parent *parent;
31
- uuid_le uuid;
30
+ guid_t uuid;
3231 void *driver_data;
33
- struct kref ref;
3432 struct list_head next;
3533 struct kobject *type_kobj;
34
+ struct device *iommu_device;
3635 bool active;
3736 };
3837
39
-#define to_mdev_device(dev) container_of(dev, struct mdev_device, dev)
38
+static inline struct mdev_device *to_mdev_device(struct device *dev)
39
+{
40
+ return container_of(dev, struct mdev_device, dev);
41
+}
4042 #define dev_is_mdev(d) ((d)->bus == &mdev_bus_type)
4143
4244 struct mdev_type {
....@@ -58,7 +60,8 @@
5860 int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type);
5961 void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type);
6062
61
-int mdev_device_create(struct kobject *kobj, struct device *dev, uuid_le uuid);
62
-int mdev_device_remove(struct device *dev, bool force_remove);
63
+int mdev_device_create(struct kobject *kobj,
64
+ struct device *dev, const guid_t *uuid);
65
+int mdev_device_remove(struct device *dev);
6366
6467 #endif /* MDEV_PRIVATE_H */