diff mbox series

[V2,XRT,Alveo,6/6] fpga: xrt: Kconfig and Makefile updates for XRT drivers

Message ID 20201217075046.28553-7-sonals@xilinx.com (mailing list archive)
State Superseded, archived
Headers show
Series XRT Alveo driver overview | expand

Commit Message

Sonal Santan Dec. 17, 2020, 7:50 a.m. UTC
From: Sonal Santan <sonal.santan@xilinx.com>

Update fpga Kconfig/Makefile and add Kconfig/Makefile for
new drivers.

Signed-off-by: Sonal Santan <sonal.santan@xilinx.com>
---
 drivers/fpga/Kconfig           |  2 ++
 drivers/fpga/Makefile          |  4 ++++
 drivers/fpga/xrt/Kconfig       |  7 +++++++
 drivers/fpga/xrt/Makefile      | 21 +++++++++++++++++++++
 drivers/fpga/xrt/lib/Kconfig   | 11 +++++++++++
 drivers/fpga/xrt/lib/Makefile  | 30 ++++++++++++++++++++++++++++++
 drivers/fpga/xrt/mgmt/Kconfig  | 11 +++++++++++
 drivers/fpga/xrt/mgmt/Makefile | 27 +++++++++++++++++++++++++++
 8 files changed, 113 insertions(+)
 create mode 100644 drivers/fpga/xrt/Kconfig
 create mode 100644 drivers/fpga/xrt/Makefile
 create mode 100644 drivers/fpga/xrt/lib/Kconfig
 create mode 100644 drivers/fpga/xrt/lib/Makefile
 create mode 100644 drivers/fpga/xrt/mgmt/Kconfig
 create mode 100644 drivers/fpga/xrt/mgmt/Makefile

Comments

kernel test robot Dec. 17, 2020, 2:55 p.m. UTC | #1
Hi Sonal,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.10 next-20201217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576
config: i386-randconfig-r035-20201217 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/3096c9b7caac1243afabb56e8b6c6f752cd1a0de
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048
        git checkout 3096c9b7caac1243afabb56e8b6c6f752cd1a0de
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/fpga/xrt/lib/xrt-main.c: In function 'xrt_subdev_register_external_driver':
>> drivers/fpga/xrt/lib/xrt-main.c:158:6: warning: variable 'result' set but not used [-Wunused-but-set-variable]
     158 |  int result = 0;
         |      ^~~~~~
--
>> drivers/fpga/xrt/lib/../common/xrt-metadata.c:76:5: warning: no previous prototype for 'xrt_md_add_node' [-Wmissing-prototypes]
      76 | int xrt_md_add_node(struct device *dev, char *blob, int parent_offset,
         |     ^~~~~~~~~~~~~~~
--
   drivers/fpga/xrt/lib/subdevs/xrt-icap.c: In function 'icap_probe_chip':
>> drivers/fpga/xrt/lib/subdevs/xrt-icap.c:181:6: warning: variable 'w' set but not used [-Wunused-but-set-variable]
     181 |  u32 w;
         |      ^
--
>> drivers/fpga/xrt/lib/subdevs/xrt-clock.c:55:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
      55 | const static struct xmgmt_ocl_clockwiz {
         | ^~~~~
--
   drivers/fpga/xrt/lib/subdevs/xrt-ucs.c: In function 'xrt_ucs_event_cb':
>> drivers/fpga/xrt/lib/subdevs/xrt-ucs.c:77:19: warning: variable 'ucs' set but not used [-Wunused-but-set-variable]
      77 |  struct xrt_ucs  *ucs;
         |                   ^~~
--
>> drivers/fpga/xrt/lib/subdevs/xrt-calib.c:125:5: warning: no previous prototype for 'xrt_calib_remove' [-Wmissing-prototypes]
     125 | int xrt_calib_remove(struct platform_device *pdev)
         |     ^~~~~~~~~~~~~~~~
>> drivers/fpga/xrt/lib/subdevs/xrt-calib.c:141:5: warning: no previous prototype for 'xrt_calib_probe' [-Wmissing-prototypes]
     141 | int xrt_calib_probe(struct platform_device *pdev)
         |     ^~~~~~~~~~~~~~~
--
   In file included from include/linux/device.h:15,
                    from drivers/fpga/xrt/mgmt/../common/xrt-xclbin.h:14,
                    from drivers/fpga/xrt/mgmt/xmgmt-main.c:13:
   drivers/fpga/xrt/mgmt/xmgmt-main.c: In function 'ulp_image_write':
>> drivers/fpga/xrt/mgmt/../include/subdev.h:187:20: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     187 |  prt_fn(DEV(pdev), "%s %s: "fmt,   \
         |                    ^~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/fpga/xrt/mgmt/../include/subdev.h:187:2: note: in expansion of macro 'dev_err'
     187 |  prt_fn(DEV(pdev), "%s %s: "fmt,   \
         |  ^~~~~~
   drivers/fpga/xrt/mgmt/../include/subdev.h:189:37: note: in expansion of macro 'FMT_PRT'
     189 | #define xrt_err(pdev, fmt, args...) FMT_PRT(dev_err, pdev, fmt, ##args)
         |                                     ^~~~~~~
   drivers/fpga/xrt/mgmt/xmgmt-main.c:216:4: note: in expansion of macro 'xrt_err'
     216 |    xrt_err(xmm->pdev, "count is too small %ld", count);
         |    ^~~~~~~
   drivers/fpga/xrt/mgmt/xmgmt-main.c:216:45: note: format string is defined here
     216 |    xrt_err(xmm->pdev, "count is too small %ld", count);
         |                                           ~~^
         |                                             |
         |                                             long int
         |                                           %d
   In file included from include/linux/device.h:15,
                    from drivers/fpga/xrt/mgmt/../common/xrt-xclbin.h:14,
                    from drivers/fpga/xrt/mgmt/xmgmt-main.c:13:
   drivers/fpga/xrt/mgmt/xmgmt-main.c: In function 'is_valid_firmware':
>> drivers/fpga/xrt/mgmt/../include/subdev.h:187:20: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     187 |  prt_fn(DEV(pdev), "%s %s: "fmt,   \
         |                    ^~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/fpga/xrt/mgmt/../include/subdev.h:187:2: note: in expansion of macro 'dev_err'
     187 |  prt_fn(DEV(pdev), "%s %s: "fmt,   \
         |  ^~~~~~
   drivers/fpga/xrt/mgmt/../include/subdev.h:189:37: note: in expansion of macro 'FMT_PRT'
     189 | #define xrt_err(pdev, fmt, args...) FMT_PRT(dev_err, pdev, fmt, ##args)
         |                                     ^~~~~~~
   drivers/fpga/xrt/mgmt/xmgmt-main.c:370:3: note: in expansion of macro 'xrt_err'
     370 |   xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
         |   ^~~~~~~
   drivers/fpga/xrt/mgmt/xmgmt-main.c:370:42: note: format string is defined here
     370 |   xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
         |                                        ~~^
         |                                          |
         |                                          long int
         |                                        %d
   In file included from include/linux/device.h:15,
                    from drivers/fpga/xrt/mgmt/../common/xrt-xclbin.h:14,
                    from drivers/fpga/xrt/mgmt/xmgmt-main.c:13:
   drivers/fpga/xrt/mgmt/../include/subdev.h:187:20: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     187 |  prt_fn(DEV(pdev), "%s %s: "fmt,   \
         |                    ^~~~~~~~~
   include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
      19 | #define dev_fmt(fmt) fmt
         |                      ^~~
   drivers/fpga/xrt/mgmt/../include/subdev.h:187:2: note: in expansion of macro 'dev_err'
     187 |  prt_fn(DEV(pdev), "%s %s: "fmt,   \
         |  ^~~~~~
   drivers/fpga/xrt/mgmt/../include/subdev.h:189:37: note: in expansion of macro 'FMT_PRT'
     189 | #define xrt_err(pdev, fmt, args...) FMT_PRT(dev_err, pdev, fmt, ##args)
         |                                     ^~~~~~~
   drivers/fpga/xrt/mgmt/xmgmt-main.c:370:3: note: in expansion of macro 'xrt_err'
     370 |   xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
         |   ^~~~~~~
   drivers/fpga/xrt/mgmt/xmgmt-main.c:370:55: note: format string is defined here
     370 |   xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
         |                                                     ~~^
         |                                                       |
         |                                                       long int
         |                                                     %d
   In file included from drivers/fpga/xrt/mgmt/xmgmt-main.c:21:
   At top level:
   drivers/fpga/xrt/mgmt/../include/subdev/axigate.h:25:27: warning: 'xrt_axigate_epnames' defined but not used [-Wunused-const-variable=]
      25 | static const char * const xrt_axigate_epnames[] = {
         |                           ^~~~~~~~~~~~~~~~~~~
--
>> drivers/fpga/xrt/mgmt/../common/xrt-metadata.c:76:5: warning: no previous prototype for 'xrt_md_add_node' [-Wmissing-prototypes]
      76 | int xrt_md_add_node(struct device *dev, char *blob, int parent_offset,
         |     ^~~~~~~~~~~~~~~


vim +/result +158 drivers/fpga/xrt/lib/xrt-main.c

2039758de374ce7 Sonal Santan 2020-12-16  153  
2039758de374ce7 Sonal Santan 2020-12-16  154  int xrt_subdev_register_external_driver(enum xrt_subdev_id id,
2039758de374ce7 Sonal Santan 2020-12-16  155  	struct platform_driver *drv, struct xrt_subdev_endpoints *eps)
2039758de374ce7 Sonal Santan 2020-12-16  156  {
2039758de374ce7 Sonal Santan 2020-12-16  157  	int i;
2039758de374ce7 Sonal Santan 2020-12-16 @158  	int result = 0;
2039758de374ce7 Sonal Santan 2020-12-16  159  
2039758de374ce7 Sonal Santan 2020-12-16  160  	mutex_lock(&xrt_class_lock);
2039758de374ce7 Sonal Santan 2020-12-16  161  	for (i = 0; i < ARRAY_SIZE(xrt_drv_maps); i++) {
2039758de374ce7 Sonal Santan 2020-12-16  162  		struct xrt_drv_map *map = &xrt_drv_maps[i];
2039758de374ce7 Sonal Santan 2020-12-16  163  
2039758de374ce7 Sonal Santan 2020-12-16  164  		if (map->id != id)
2039758de374ce7 Sonal Santan 2020-12-16  165  			continue;
2039758de374ce7 Sonal Santan 2020-12-16  166  		if (map->drv) {
2039758de374ce7 Sonal Santan 2020-12-16  167  			result = -EEXIST;
2039758de374ce7 Sonal Santan 2020-12-16  168  			pr_err("Id %d already has a registered driver, 0x%p\n",
2039758de374ce7 Sonal Santan 2020-12-16  169  				id, map->drv);
2039758de374ce7 Sonal Santan 2020-12-16  170  			break;
2039758de374ce7 Sonal Santan 2020-12-16  171  		}
2039758de374ce7 Sonal Santan 2020-12-16  172  		map->drv = drv;
2039758de374ce7 Sonal Santan 2020-12-16  173  		BUG_ON(map->eps);
2039758de374ce7 Sonal Santan 2020-12-16  174  		map->eps = eps;
2039758de374ce7 Sonal Santan 2020-12-16  175  		xrt_drv_register_driver(id);
2039758de374ce7 Sonal Santan 2020-12-16  176  	}
2039758de374ce7 Sonal Santan 2020-12-16  177  	mutex_unlock(&xrt_class_lock);
2039758de374ce7 Sonal Santan 2020-12-16  178  	return 0;
2039758de374ce7 Sonal Santan 2020-12-16  179  }
2039758de374ce7 Sonal Santan 2020-12-16  180  EXPORT_SYMBOL_GPL(xrt_subdev_register_external_driver);
2039758de374ce7 Sonal Santan 2020-12-16  181  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 7cd5a29fc437..73e4deb20986 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -215,4 +215,6 @@  config FPGA_MGR_ZYNQMP_FPGA
 	  to configure the programmable logic(PL) through PS
 	  on ZynqMP SoC.
 
+source "drivers/fpga/xrt/Kconfig"
+
 endif # FPGA
diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
index d8e21dfc6778..2b4453ff7c52 100644
--- a/drivers/fpga/Makefile
+++ b/drivers/fpga/Makefile
@@ -46,3 +46,7 @@  dfl-afu-objs += dfl-afu-error.o
 
 # Drivers for FPGAs which implement DFL
 obj-$(CONFIG_FPGA_DFL_PCI)		+= dfl-pci.o
+
+# XRT drivers for Alveo
+obj-$(CONFIG_FPGA_XRT_LIB)		+= xrt/lib/
+obj-$(CONFIG_FPGA_XRT_XMGMT)		+= xrt/mgmt/
diff --git a/drivers/fpga/xrt/Kconfig b/drivers/fpga/xrt/Kconfig
new file mode 100644
index 000000000000..50422f77c6df
--- /dev/null
+++ b/drivers/fpga/xrt/Kconfig
@@ -0,0 +1,7 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Xilinx Alveo FPGA device configuration
+#
+
+source "drivers/fpga/xrt/lib/Kconfig"
+source "drivers/fpga/xrt/mgmt/Kconfig"
diff --git a/drivers/fpga/xrt/Makefile b/drivers/fpga/xrt/Makefile
new file mode 100644
index 000000000000..19e828cc7af9
--- /dev/null
+++ b/drivers/fpga/xrt/Makefile
@@ -0,0 +1,21 @@ 
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2020 Xilinx, Inc. All rights reserved.
+#
+# Authors: Sonal.Santan@xilinx.com
+#
+
+all:
+	$(MAKE) -C lib all
+	$(MAKE) -C mgmt all
+	$(MAKE) lint
+
+tags:
+	../../../../scripts/tags.sh
+
+clean:
+	$(MAKE) -C lib clean
+	$(MAKE) -C mgmt clean
+
+lint:
+	../../../../scripts/lint.sh
diff --git a/drivers/fpga/xrt/lib/Kconfig b/drivers/fpga/xrt/lib/Kconfig
new file mode 100644
index 000000000000..541af91008ee
--- /dev/null
+++ b/drivers/fpga/xrt/lib/Kconfig
@@ -0,0 +1,11 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# XRT Alveo FPGA device configuration
+#
+
+config FPGA_XRT_LIB
+	tristate "XRT Alveo Driver Library"
+	depends on HWMON && PCI
+	select LIBFDT
+	help
+	  XRT Alveo FPGA PCIe device driver common library.
diff --git a/drivers/fpga/xrt/lib/Makefile b/drivers/fpga/xrt/lib/Makefile
new file mode 100644
index 000000000000..176e2134171c
--- /dev/null
+++ b/drivers/fpga/xrt/lib/Makefile
@@ -0,0 +1,30 @@ 
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2020 Xilinx, Inc. All rights reserved.
+#
+# Authors: Sonal.Santan@xilinx.com
+#
+
+FULL_XRT_PATH=$(srctree)/$(src)/..
+FULL_DTC_PATH=$(srctree)/scripts/dtc/libfdt
+
+obj-$(CONFIG_FPGA_XRT_LIB) := xrt-lib.o
+
+xrt-lib-objs := 			\
+	xrt-main.o			\
+	xrt-subdev.o			\
+	xrt-cdev.o			\
+	../common/xrt-metadata.o	\
+	subdevs/xrt-partition.o		\
+	subdevs/xrt-vsec.o		\
+	subdevs/xrt-axigate.o		\
+	subdevs/xrt-gpio.o		\
+	subdevs/xrt-icap.o		\
+	subdevs/xrt-clock.o		\
+	subdevs/xrt-clkfreq.o		\
+	subdevs/xrt-ucs.o		\
+	subdevs/xrt-calib.o
+
+ccflags-y := -I$(FULL_XRT_PATH)/include \
+	-I$(FULL_XRT_PATH)/common \
+	-I$(FULL_DTC_PATH)
diff --git a/drivers/fpga/xrt/mgmt/Kconfig b/drivers/fpga/xrt/mgmt/Kconfig
new file mode 100644
index 000000000000..a2fe7ab21941
--- /dev/null
+++ b/drivers/fpga/xrt/mgmt/Kconfig
@@ -0,0 +1,11 @@ 
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Xilinx XRT FPGA device configuration
+#
+
+config FPGA_XRT_XMGMT
+	tristate "Xilinx Alveo Management Driver"
+	depends on HWMON && PCI && FPGA_XRT_LIB
+	select LIBFDT
+	help
+	  XRT Alveo FPGA PCIe device driver for Management Physical Function.
diff --git a/drivers/fpga/xrt/mgmt/Makefile b/drivers/fpga/xrt/mgmt/Makefile
new file mode 100644
index 000000000000..d32698b8bf58
--- /dev/null
+++ b/drivers/fpga/xrt/mgmt/Makefile
@@ -0,0 +1,27 @@ 
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2019-2020 Xilinx, Inc. All rights reserved.
+#
+# Authors: Sonal.Santan@xilinx.com
+#
+
+FULL_XRT_PATH=$(srctree)/$(src)/..
+FULL_DTC_PATH=$(srctree)/scripts/dtc/libfdt
+
+obj-$(CONFIG_FPGA_XRT_XMGMT)	+= xmgmt.o
+
+commondir := ../common
+
+xmgmt-objs := xmgmt-root.o			\
+	   xmgmt-main.o				\
+	   xmgmt-fmgr-drv.o      		\
+	   xmgmt-main-region.o			\
+	   $(commondir)/xrt-root.o		\
+	   $(commondir)/xrt-metadata.o		\
+	   $(commondir)/xrt-xclbin.o
+
+
+
+ccflags-y := -I$(FULL_XRT_PATH)/include \
+	-I$(FULL_XRT_PATH)/common \
+	-I$(FULL_DTC_PATH)