.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Mediated device interal definitions |
---|
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_PRIVATE_H |
---|
.. | .. |
---|
23 | 20 | struct list_head next; |
---|
24 | 21 | struct kset *mdev_types_kset; |
---|
25 | 22 | struct list_head type_list; |
---|
| 23 | + /* Synchronize device creation/removal with parent unregistration */ |
---|
| 24 | + struct rw_semaphore unreg_sem; |
---|
26 | 25 | }; |
---|
27 | 26 | |
---|
28 | 27 | struct mdev_device { |
---|
29 | 28 | struct device dev; |
---|
30 | 29 | struct mdev_parent *parent; |
---|
31 | | - uuid_le uuid; |
---|
| 30 | + guid_t uuid; |
---|
32 | 31 | void *driver_data; |
---|
33 | | - struct kref ref; |
---|
34 | 32 | struct list_head next; |
---|
35 | 33 | struct kobject *type_kobj; |
---|
| 34 | + struct device *iommu_device; |
---|
36 | 35 | bool active; |
---|
37 | 36 | }; |
---|
38 | 37 | |
---|
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 | +} |
---|
40 | 42 | #define dev_is_mdev(d) ((d)->bus == &mdev_bus_type) |
---|
41 | 43 | |
---|
42 | 44 | struct mdev_type { |
---|
.. | .. |
---|
58 | 60 | int mdev_create_sysfs_files(struct device *dev, struct mdev_type *type); |
---|
59 | 61 | void mdev_remove_sysfs_files(struct device *dev, struct mdev_type *type); |
---|
60 | 62 | |
---|
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); |
---|
63 | 66 | |
---|
64 | 67 | #endif /* MDEV_PRIVATE_H */ |
---|