~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mdev.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/mdev.h (Version linux-6.12-rc7) and /include/linux/mdev.h (Version linux-5.11.22)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*                                                  2 /*
  3  * Mediated device definition                       3  * Mediated device definition
  4  *                                                  4  *
  5  * Copyright (c) 2016, NVIDIA CORPORATION. All      5  * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
  6  *     Author: Neo Jia <cjia@nvidia.com>            6  *     Author: Neo Jia <cjia@nvidia.com>
  7  *             Kirti Wankhede <kwankhede@nvidi      7  *             Kirti Wankhede <kwankhede@nvidia.com>
  8  */                                                 8  */
  9                                                     9 
 10 #ifndef MDEV_H                                     10 #ifndef MDEV_H
 11 #define MDEV_H                                     11 #define MDEV_H
 12                                                    12 
 13 #include <linux/device.h>                      !!  13 struct mdev_device;
 14 #include <linux/uuid.h>                        << 
 15                                                    14 
 16 struct mdev_type;                              !!  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);
 17                                                    26 
 18 struct mdev_device {                           !!  27 struct device *mdev_get_iommu_device(struct device *dev);
 19         struct device dev;                     << 
 20         guid_t uuid;                           << 
 21         struct list_head next;                 << 
 22         struct mdev_type *type;                << 
 23         bool active;                           << 
 24 };                                             << 
 25                                                    28 
 26 struct mdev_type {                             !!  29 /**
 27         /* set by the driver before calling md !!  30  * struct mdev_parent_ops - Structure to be registered for each parent device to
 28         const char *sysfs_name;                !!  31  * register the device to mdev module.
 29         const char *pretty_name;               !!  32  *
 30                                                !!  33  * @owner:              The module owner.
 31         /* set by the core, can be used driver !!  34  * @dev_attr_groups:    Attributes of the parent device.
 32         struct mdev_parent *parent;            !!  35  * @mdev_attr_groups:   Attributes of the mediated device.
 33                                                !!  36  * @supported_type_groups: Attributes to define supported types. It is mandatory
 34         /* internal only */                    !!  37  *                      to provide supported types.
 35         struct kobject kobj;                   !!  38  * @create:             Called to allocate basic resources in parent device's
 36         struct kobject *devices_kobj;          !!  39  *                      driver for a particular mediated device. It is
                                                   >>  40  *                      mandatory to provide create ops.
                                                   >>  41  *                      @kobj: kobject of type for which 'create' is called.
                                                   >>  42  *                      @mdev: mdev_device structure on of mediated device
                                                   >>  43  *                            that is being created
                                                   >>  44  *                      Returns integer: success (0) or error (< 0)
                                                   >>  45  * @remove:             Called to free resources in parent device's driver for a
                                                   >>  46  *                      a mediated device. It is mandatory to provide 'remove'
                                                   >>  47  *                      ops.
                                                   >>  48  *                      @mdev: mdev_device device structure which is being
                                                   >>  49  *                             destroyed
                                                   >>  50  *                      Returns integer: success (0) or error (< 0)
                                                   >>  51  * @open:               Open mediated device.
                                                   >>  52  *                      @mdev: mediated device.
                                                   >>  53  *                      Returns integer: success (0) or error (< 0)
                                                   >>  54  * @release:            release mediated device
                                                   >>  55  *                      @mdev: mediated device.
                                                   >>  56  * @read:               Read emulation callback
                                                   >>  57  *                      @mdev: mediated device structure
                                                   >>  58  *                      @buf: read buffer
                                                   >>  59  *                      @count: number of bytes to read
                                                   >>  60  *                      @ppos: address.
                                                   >>  61  *                      Retuns number on bytes read on success or error.
                                                   >>  62  * @write:              Write emulation callback
                                                   >>  63  *                      @mdev: mediated device structure
                                                   >>  64  *                      @buf: write buffer
                                                   >>  65  *                      @count: number of bytes to be written
                                                   >>  66  *                      @ppos: address.
                                                   >>  67  *                      Retuns number on bytes written on success or error.
                                                   >>  68  * @ioctl:              IOCTL callback
                                                   >>  69  *                      @mdev: mediated device structure
                                                   >>  70  *                      @cmd: ioctl command
                                                   >>  71  *                      @arg: arguments to ioctl
                                                   >>  72  * @mmap:               mmap callback
                                                   >>  73  *                      @mdev: mediated device structure
                                                   >>  74  *                      @vma: vma structure
                                                   >>  75  * @request:            request callback to release device
                                                   >>  76  *                      @mdev: mediated device structure
                                                   >>  77  *                      @count: request sequence number
                                                   >>  78  * Parent device that support mediated device should be registered with mdev
                                                   >>  79  * module with mdev_parent_ops structure.
                                                   >>  80  **/
                                                   >>  81 struct mdev_parent_ops {
                                                   >>  82         struct module   *owner;
                                                   >>  83         const struct attribute_group **dev_attr_groups;
                                                   >>  84         const struct attribute_group **mdev_attr_groups;
                                                   >>  85         struct attribute_group **supported_type_groups;
                                                   >>  86 
                                                   >>  87         int     (*create)(struct kobject *kobj, struct mdev_device *mdev);
                                                   >>  88         int     (*remove)(struct mdev_device *mdev);
                                                   >>  89         int     (*open)(struct mdev_device *mdev);
                                                   >>  90         void    (*release)(struct mdev_device *mdev);
                                                   >>  91         ssize_t (*read)(struct mdev_device *mdev, char __user *buf,
                                                   >>  92                         size_t count, loff_t *ppos);
                                                   >>  93         ssize_t (*write)(struct mdev_device *mdev, const char __user *buf,
                                                   >>  94                          size_t count, loff_t *ppos);
                                                   >>  95         long    (*ioctl)(struct mdev_device *mdev, unsigned int cmd,
                                                   >>  96                          unsigned long arg);
                                                   >>  97         int     (*mmap)(struct mdev_device *mdev, struct vm_area_struct *vma);
                                                   >>  98         void    (*request)(struct mdev_device *mdev, unsigned int count);
 37 };                                                 99 };
 38                                                   100 
 39 /* embedded into the struct device that the md !! 101 /* interface for exporting mdev supported type attributes */
 40 struct mdev_parent {                           !! 102 struct mdev_type_attribute {
 41         struct device *dev;                    !! 103         struct attribute attr;
 42         struct mdev_driver *mdev_driver;       !! 104         ssize_t (*show)(struct kobject *kobj, struct device *dev, char *buf);
 43         struct kset *mdev_types_kset;          !! 105         ssize_t (*store)(struct kobject *kobj, struct device *dev,
 44         /* Synchronize device creation/removal !! 106                          const char *buf, size_t count);
 45         struct rw_semaphore unreg_sem;         << 
 46         struct mdev_type **types;              << 
 47         unsigned int nr_types;                 << 
 48         atomic_t available_instances;          << 
 49 };                                                107 };
 50                                                   108 
 51 static inline struct mdev_device *to_mdev_devi !! 109 #define MDEV_TYPE_ATTR(_name, _mode, _show, _store)             \
 52 {                                              !! 110 struct mdev_type_attribute mdev_type_attr_##_name =             \
 53         return container_of(dev, struct mdev_d !! 111         __ATTR(_name, _mode, _show, _store)
 54 }                                              !! 112 #define MDEV_TYPE_ATTR_RW(_name) \
                                                   >> 113         struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_RW(_name)
                                                   >> 114 #define MDEV_TYPE_ATTR_RO(_name) \
                                                   >> 115         struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_RO(_name)
                                                   >> 116 #define MDEV_TYPE_ATTR_WO(_name) \
                                                   >> 117         struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_WO(_name)
 55                                                   118 
 56 /**                                               119 /**
 57  * struct mdev_driver - Mediated device driver    120  * struct mdev_driver - Mediated device driver
 58  * @device_api: string to return for the devic !! 121  * @name: driver name
 59  * @max_instances: maximum number of instances << 
 60  * @probe: called when new device created         122  * @probe: called when new device created
 61  * @remove: called when device removed            123  * @remove: called when device removed
 62  * @get_available: Return the max number of in << 
 63  * @show_description: Print a description of t << 
 64  * @driver: device driver structure               124  * @driver: device driver structure
                                                   >> 125  *
 65  **/                                              126  **/
 66 struct mdev_driver {                              127 struct mdev_driver {
 67         const char *device_api;                !! 128         const char *name;
 68         unsigned int max_instances;            !! 129         int  (*probe)(struct device *dev);
 69         int (*probe)(struct mdev_device *dev); !! 130         void (*remove)(struct device *dev);
 70         void (*remove)(struct mdev_device *dev << 
 71         unsigned int (*get_available)(struct m << 
 72         ssize_t (*show_description)(struct mde << 
 73         struct device_driver driver;              131         struct device_driver driver;
 74 };                                                132 };
 75                                                   133 
 76 int mdev_register_parent(struct mdev_parent *p !! 134 #define to_mdev_driver(drv)     container_of(drv, struct mdev_driver, driver)
 77                 struct mdev_driver *mdev_drive !! 135 
 78                 unsigned int nr_types);        !! 136 void *mdev_get_drvdata(struct mdev_device *mdev);
 79 void mdev_unregister_parent(struct mdev_parent !! 137 void mdev_set_drvdata(struct mdev_device *mdev, void *data);
                                                   >> 138 const guid_t *mdev_uuid(struct mdev_device *mdev);
                                                   >> 139 
                                                   >> 140 extern struct bus_type mdev_bus_type;
                                                   >> 141 
                                                   >> 142 int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops);
                                                   >> 143 void mdev_unregister_device(struct device *dev);
 80                                                   144 
 81 int mdev_register_driver(struct mdev_driver *d !! 145 int mdev_register_driver(struct mdev_driver *drv, struct module *owner);
 82 void mdev_unregister_driver(struct mdev_driver    146 void mdev_unregister_driver(struct mdev_driver *drv);
 83                                                   147 
 84 static inline struct device *mdev_dev(struct m !! 148 struct device *mdev_parent_dev(struct mdev_device *mdev);
 85 {                                              !! 149 struct device *mdev_dev(struct mdev_device *mdev);
 86         return &mdev->dev;                     !! 150 struct mdev_device *mdev_from_dev(struct device *dev);
 87 }                                              << 
 88                                                   151 
 89 #endif /* MDEV_H */                               152 #endif /* MDEV_H */
 90                                                   153 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php