[Intel-gfx] [PATCH 2/6] mdev: introduce device specific ops

kbuild test robot lkp at intel.com
Mon Sep 23 15:20:12 UTC 2019


Hi Jason,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190920]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Jason-Wang/mdev-based-hardware-virtio-offloading-support/20190923-210738
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp at intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/vfio_mdev.h:10:0,
                    from <command-line>:0:
>> include/linux/mdev.h:25:34: warning: 'struct device' declared inside parameter list will not be visible outside of this definition or declaration
    int mdev_set_iommu_device(struct device *dev, struct device *iommu_device);
                                     ^~~~~~
>> include/linux/mdev.h:62:27: warning: 'struct kobject' declared inside parameter list will not be visible outside of this definition or declaration
     int     (*create)(struct kobject *kobj, struct mdev_device *mdev);
                              ^~~~~~~
>> include/linux/mdev.h:69:19: error: field 'attr' has incomplete type
     struct attribute attr;
                      ^~~~
   include/linux/mdev.h:70:25: warning: 'struct kobject' declared inside parameter list will not be visible outside of this definition or declaration
     ssize_t (*show)(struct kobject *kobj, struct device *dev, char *buf);
                            ^~~~~~~
   include/linux/mdev.h:71:26: warning: 'struct kobject' declared inside parameter list will not be visible outside of this definition or declaration
     ssize_t (*store)(struct kobject *kobj, struct device *dev,
                             ^~~~~~~
>> include/linux/mdev.h:98:23: error: field 'driver' has incomplete type
     struct device_driver driver;
                          ^~~~~~
>> include/linux/mdev.h:106:7: error: unknown type name 'guid_t'
    const guid_t *mdev_uuid(struct mdev_device *mdev);
          ^~~~~~
   In file included from <command-line>:0:0:
>> include/linux/vfio_mdev.h:50:47: warning: 'struct vm_area_struct' declared inside parameter list will not be visible outside of this definition or declaration
     int (*mmap)(struct mdev_device *mdev, struct vm_area_struct *vma);
                                                  ^~~~~~~~~~~~~~

vim +/attr +69 include/linux/mdev.h

7b96953bc640b6 Kirti Wankhede  2016-11-17   14  
8ac13175cbe985 Lu Baolu        2019-04-12   15  /*
8ac13175cbe985 Lu Baolu        2019-04-12   16   * Called by the parent device driver to set the device which represents
8ac13175cbe985 Lu Baolu        2019-04-12   17   * this mdev in iommu protection scope. By default, the iommu device is
8ac13175cbe985 Lu Baolu        2019-04-12   18   * NULL, that indicates using vendor defined isolation.
8ac13175cbe985 Lu Baolu        2019-04-12   19   *
8ac13175cbe985 Lu Baolu        2019-04-12   20   * @dev: the mediated device that iommu will isolate.
8ac13175cbe985 Lu Baolu        2019-04-12   21   * @iommu_device: a pci device which represents the iommu for @dev.
8ac13175cbe985 Lu Baolu        2019-04-12   22   *
8ac13175cbe985 Lu Baolu        2019-04-12   23   * Return 0 for success, otherwise negative error value.
8ac13175cbe985 Lu Baolu        2019-04-12   24   */
8ac13175cbe985 Lu Baolu        2019-04-12  @25  int mdev_set_iommu_device(struct device *dev, struct device *iommu_device);
8ac13175cbe985 Lu Baolu        2019-04-12   26  
8ac13175cbe985 Lu Baolu        2019-04-12   27  struct device *mdev_get_iommu_device(struct device *dev);
8ac13175cbe985 Lu Baolu        2019-04-12   28  
7b96953bc640b6 Kirti Wankhede  2016-11-17   29  /**
42930553a7c11f Alex Williamson 2016-12-30   30   * struct mdev_parent_ops - Structure to be registered for each parent device to
7b96953bc640b6 Kirti Wankhede  2016-11-17   31   * register the device to mdev module.
7b96953bc640b6 Kirti Wankhede  2016-11-17   32   *
7b96953bc640b6 Kirti Wankhede  2016-11-17   33   * @owner:		The module owner.
7b96953bc640b6 Kirti Wankhede  2016-11-17   34   * @dev_attr_groups:	Attributes of the parent device.
7b96953bc640b6 Kirti Wankhede  2016-11-17   35   * @mdev_attr_groups:	Attributes of the mediated device.
7b96953bc640b6 Kirti Wankhede  2016-11-17   36   * @supported_type_groups: Attributes to define supported types. It is mandatory
7b96953bc640b6 Kirti Wankhede  2016-11-17   37   *			to provide supported types.
7b96953bc640b6 Kirti Wankhede  2016-11-17   38   * @create:		Called to allocate basic resources in parent device's
7b96953bc640b6 Kirti Wankhede  2016-11-17   39   *			driver for a particular mediated device. It is
7b96953bc640b6 Kirti Wankhede  2016-11-17   40   *			mandatory to provide create ops.
7b96953bc640b6 Kirti Wankhede  2016-11-17   41   *			@kobj: kobject of type for which 'create' is called.
7b96953bc640b6 Kirti Wankhede  2016-11-17   42   *			@mdev: mdev_device structure on of mediated device
7b96953bc640b6 Kirti Wankhede  2016-11-17   43   *			      that is being created
7b96953bc640b6 Kirti Wankhede  2016-11-17   44   *			Returns integer: success (0) or error (< 0)
7b96953bc640b6 Kirti Wankhede  2016-11-17   45   * @remove:		Called to free resources in parent device's driver for a
7b96953bc640b6 Kirti Wankhede  2016-11-17   46   *			a mediated device. It is mandatory to provide 'remove'
7b96953bc640b6 Kirti Wankhede  2016-11-17   47   *			ops.
7b96953bc640b6 Kirti Wankhede  2016-11-17   48   *			@mdev: mdev_device device structure which is being
7b96953bc640b6 Kirti Wankhede  2016-11-17   49   *			       destroyed
7b96953bc640b6 Kirti Wankhede  2016-11-17   50   *			Returns integer: success (0) or error (< 0)
0baad8a6f6fefa Jason Wang      2019-09-23   51   * @device_ops:         Device specific emulation callback.
0baad8a6f6fefa Jason Wang      2019-09-23   52   *
7b96953bc640b6 Kirti Wankhede  2016-11-17   53   * Parent device that support mediated device should be registered with mdev
42930553a7c11f Alex Williamson 2016-12-30   54   * module with mdev_parent_ops structure.
7b96953bc640b6 Kirti Wankhede  2016-11-17   55   **/
42930553a7c11f Alex Williamson 2016-12-30   56  struct mdev_parent_ops {
7b96953bc640b6 Kirti Wankhede  2016-11-17   57  	struct module   *owner;
7b96953bc640b6 Kirti Wankhede  2016-11-17   58  	const struct attribute_group **dev_attr_groups;
7b96953bc640b6 Kirti Wankhede  2016-11-17   59  	const struct attribute_group **mdev_attr_groups;
7b96953bc640b6 Kirti Wankhede  2016-11-17   60  	struct attribute_group **supported_type_groups;
7b96953bc640b6 Kirti Wankhede  2016-11-17   61  
7b96953bc640b6 Kirti Wankhede  2016-11-17  @62  	int     (*create)(struct kobject *kobj, struct mdev_device *mdev);
7b96953bc640b6 Kirti Wankhede  2016-11-17   63  	int     (*remove)(struct mdev_device *mdev);
0baad8a6f6fefa Jason Wang      2019-09-23   64  	const void *device_ops;
7b96953bc640b6 Kirti Wankhede  2016-11-17   65  };
7b96953bc640b6 Kirti Wankhede  2016-11-17   66  
7b96953bc640b6 Kirti Wankhede  2016-11-17   67  /* interface for exporting mdev supported type attributes */
7b96953bc640b6 Kirti Wankhede  2016-11-17   68  struct mdev_type_attribute {
7b96953bc640b6 Kirti Wankhede  2016-11-17  @69  	struct attribute attr;
7b96953bc640b6 Kirti Wankhede  2016-11-17  @70  	ssize_t (*show)(struct kobject *kobj, struct device *dev, char *buf);
7b96953bc640b6 Kirti Wankhede  2016-11-17   71  	ssize_t (*store)(struct kobject *kobj, struct device *dev,
7b96953bc640b6 Kirti Wankhede  2016-11-17   72  			 const char *buf, size_t count);
7b96953bc640b6 Kirti Wankhede  2016-11-17   73  };
7b96953bc640b6 Kirti Wankhede  2016-11-17   74  
7b96953bc640b6 Kirti Wankhede  2016-11-17   75  #define MDEV_TYPE_ATTR(_name, _mode, _show, _store)		\
7b96953bc640b6 Kirti Wankhede  2016-11-17   76  struct mdev_type_attribute mdev_type_attr_##_name =		\
7b96953bc640b6 Kirti Wankhede  2016-11-17   77  	__ATTR(_name, _mode, _show, _store)
7b96953bc640b6 Kirti Wankhede  2016-11-17   78  #define MDEV_TYPE_ATTR_RW(_name) \
7b96953bc640b6 Kirti Wankhede  2016-11-17   79  	struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_RW(_name)
7b96953bc640b6 Kirti Wankhede  2016-11-17   80  #define MDEV_TYPE_ATTR_RO(_name) \
7b96953bc640b6 Kirti Wankhede  2016-11-17   81  	struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_RO(_name)
7b96953bc640b6 Kirti Wankhede  2016-11-17   82  #define MDEV_TYPE_ATTR_WO(_name) \
7b96953bc640b6 Kirti Wankhede  2016-11-17   83  	struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_WO(_name)
7b96953bc640b6 Kirti Wankhede  2016-11-17   84  
7b96953bc640b6 Kirti Wankhede  2016-11-17   85  /**
7b96953bc640b6 Kirti Wankhede  2016-11-17   86   * struct mdev_driver - Mediated device driver
7b96953bc640b6 Kirti Wankhede  2016-11-17   87   * @name: driver name
7b96953bc640b6 Kirti Wankhede  2016-11-17   88   * @probe: called when new device created
7b96953bc640b6 Kirti Wankhede  2016-11-17   89   * @remove: called when device removed
7b96953bc640b6 Kirti Wankhede  2016-11-17   90   * @driver: device driver structure
6294ee8e0b5153 Jason Wang      2019-09-23   91   * @id_table: the ids serviced by this driver.
7b96953bc640b6 Kirti Wankhede  2016-11-17   92   *
7b96953bc640b6 Kirti Wankhede  2016-11-17   93   **/
7b96953bc640b6 Kirti Wankhede  2016-11-17   94  struct mdev_driver {
7b96953bc640b6 Kirti Wankhede  2016-11-17   95  	const char *name;
7b96953bc640b6 Kirti Wankhede  2016-11-17   96  	int  (*probe)(struct device *dev);
7b96953bc640b6 Kirti Wankhede  2016-11-17   97  	void (*remove)(struct device *dev);
7b96953bc640b6 Kirti Wankhede  2016-11-17  @98  	struct device_driver driver;
6294ee8e0b5153 Jason Wang      2019-09-23   99  	const struct mdev_class_id *id_table;
7b96953bc640b6 Kirti Wankhede  2016-11-17  100  };
7b96953bc640b6 Kirti Wankhede  2016-11-17  101  
7b96953bc640b6 Kirti Wankhede  2016-11-17  102  #define to_mdev_driver(drv)	container_of(drv, struct mdev_driver, driver)
7b96953bc640b6 Kirti Wankhede  2016-11-17  103  
50732af3b65691 Parav Pandit    2019-04-30  104  void *mdev_get_drvdata(struct mdev_device *mdev);
50732af3b65691 Parav Pandit    2019-04-30  105  void mdev_set_drvdata(struct mdev_device *mdev, void *data);
50732af3b65691 Parav Pandit    2019-04-30 @106  const guid_t *mdev_uuid(struct mdev_device *mdev);
7b96953bc640b6 Kirti Wankhede  2016-11-17  107  

:::::: The code at line 69 was first introduced by commit
:::::: 7b96953bc640b6b25665fe17ffca4b668b371f14 vfio: Mediated device Core driver

:::::: TO: Kirti Wankhede <kwankhede at nvidia.com>
:::::: CC: Alex Williamson <alex.williamson at redhat.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 54846 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20190923/b5126bb0/attachment-0001.gz>


More information about the Intel-gfx mailing list