From: Tom Rix <[email protected]>
To use a dfl pci device, several dfl configs need to be selected.
This is tedious and error prone.
So automagically select the needed configs when FPGA_DFL_PCI
is selected.
Signed-off-by: Tom Rix <[email protected]>
---
drivers/fpga/Kconfig | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 7cd5a29fc437..4b9e05af5426 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -138,6 +138,27 @@ config OF_FPGA_REGION
Support for loading FPGA images by applying a Device Tree
overlay.
+config FPGA_DFL_PCI
+ tristate "FPGA DFL PCIe Device Driver"
+ depends on PCI
+ select FPGA_DFL
+ select FPGA_DFL_FME
+ select FPGA_DFL_FME_MGR
+ select FPGA_DFL_FME_BRIDGE
+ select FPGA_DFL_FME_REGION
+ select FPGA_DFL_AFU
+ help
+ Select this option to enable PCIe driver for PCIe-based
+ Field-Programmable Gate Array (FPGA) solutions which implement
+ the Device Feature List (DFL). This driver provides interfaces
+ for userspace applications to configure, enumerate, open and access
+ FPGA accelerators on the FPGA DFL devices, enables system level
+ management functions such as FPGA partial reconfiguration, power
+ management and virtualization with DFL framework and DFL feature
+ device drivers.
+
+ To compile this as a module, choose M here.
+
config FPGA_DFL
tristate "FPGA Device Feature List (DFL) support"
select FPGA_BRIDGE
@@ -191,21 +212,6 @@ config FPGA_DFL_AFU
to the FPGA infrastructure via a Port. There may be more than one
Port/AFU per DFL based FPGA device.
-config FPGA_DFL_PCI
- tristate "FPGA DFL PCIe Device Driver"
- depends on PCI && FPGA_DFL
- help
- Select this option to enable PCIe driver for PCIe-based
- Field-Programmable Gate Array (FPGA) solutions which implement
- the Device Feature List (DFL). This driver provides interfaces
- for userspace applications to configure, enumerate, open and access
- FPGA accelerators on the FPGA DFL devices, enables system level
- management functions such as FPGA partial reconfiguration, power
- management and virtualization with DFL framework and DFL feature
- device drivers.
-
- To compile this as a module, choose M here.
-
config FPGA_MGR_ZYNQMP_FPGA
tristate "Xilinx ZynqMP FPGA"
depends on ZYNQMP_FIRMWARE || (!ZYNQMP_FIRMWARE && COMPILE_TEST)
--
2.18.1
I think maybe we don't have to select them all. It is now possible for
FPGA DFL boards to work without FME or AFU, providing limited
functionality. It is possible designers trim the bitstream for their
purpose, and also need a smaller driver set.
I think we may add "default FPGA_DFL" for FPGA_DFL_FME,
FPGA_DFL_FME_MGR and others to make life easier.
How do you think?
On Sun, Jun 28, 2020 at 08:18:13AM -0700, [email protected] wrote:
> From: Tom Rix <[email protected]>
>
> To use a dfl pci device, several dfl configs need to be selected.
> This is tedious and error prone.
>
> So automagically select the needed configs when FPGA_DFL_PCI
> is selected.
>
> Signed-off-by: Tom Rix <[email protected]>
> ---
> drivers/fpga/Kconfig | 36 +++++++++++++++++++++---------------
> 1 file changed, 21 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> index 7cd5a29fc437..4b9e05af5426 100644
> --- a/drivers/fpga/Kconfig
> +++ b/drivers/fpga/Kconfig
> @@ -138,6 +138,27 @@ config OF_FPGA_REGION
> Support for loading FPGA images by applying a Device Tree
> overlay.
>
> +config FPGA_DFL_PCI
> + tristate "FPGA DFL PCIe Device Driver"
> + depends on PCI
> + select FPGA_DFL
> + select FPGA_DFL_FME
> + select FPGA_DFL_FME_MGR
> + select FPGA_DFL_FME_BRIDGE
> + select FPGA_DFL_FME_REGION
> + select FPGA_DFL_AFU
> + help
> + Select this option to enable PCIe driver for PCIe-based
> + Field-Programmable Gate Array (FPGA) solutions which implement
> + the Device Feature List (DFL). This driver provides interfaces
> + for userspace applications to configure, enumerate, open and access
> + FPGA accelerators on the FPGA DFL devices, enables system level
> + management functions such as FPGA partial reconfiguration, power
> + management and virtualization with DFL framework and DFL feature
> + device drivers.
> +
> + To compile this as a module, choose M here.
> +
> config FPGA_DFL
> tristate "FPGA Device Feature List (DFL) support"
> select FPGA_BRIDGE
> @@ -191,21 +212,6 @@ config FPGA_DFL_AFU
> to the FPGA infrastructure via a Port. There may be more than one
> Port/AFU per DFL based FPGA device.
>
> -config FPGA_DFL_PCI
> - tristate "FPGA DFL PCIe Device Driver"
> - depends on PCI && FPGA_DFL
> - help
> - Select this option to enable PCIe driver for PCIe-based
> - Field-Programmable Gate Array (FPGA) solutions which implement
> - the Device Feature List (DFL). This driver provides interfaces
> - for userspace applications to configure, enumerate, open and access
> - FPGA accelerators on the FPGA DFL devices, enables system level
> - management functions such as FPGA partial reconfiguration, power
> - management and virtualization with DFL framework and DFL feature
> - device drivers.
> -
> - To compile this as a module, choose M here.
> -
> config FPGA_MGR_ZYNQMP_FPGA
> tristate "Xilinx ZynqMP FPGA"
> depends on ZYNQMP_FIRMWARE || (!ZYNQMP_FIRMWARE && COMPILE_TEST)
> --
> 2.18.1
> -----Original Message-----
> From: [email protected] <[email protected]>
> On Behalf Of Xu Yilun
> Sent: Monday, June 29, 2020 10:19 AM
> To: [email protected]
> Cc: [email protected]; [email protected]; linux-
> [email protected]; Wu, Hao <[email protected]>;
> [email protected]
> Subject: Re: [PATCH] fpga: dfl: improve configuration of dfl pci devices
>
> I think maybe we don't have to select them all. It is now possible for
> FPGA DFL boards to work without FME or AFU, providing limited
> functionality. It is possible designers trim the bitstream for their
> purpose, and also need a smaller driver set.
>
Yes, we hope that this dfl-pci could be a common module shared by
different cards. Some device doesn't have FME, e.g. some VF device
with AFU only, some device has FME, but no PR support, and in the
future, it's possible to add new modules, or something replacing AFU
or FME, so we don't have to select all here.
> I think we may add "default FPGA_DFL" for FPGA_DFL_FME,
> FPGA_DFL_FME_MGR and others to make life easier.
It's hard to say it's easier for everybody, e.g. I am a user of N3000, but
I have to unselect the PR modules, as they are default Yes as proposed?
Maybe it's better to let user select what they want, unless we find
something really common needed under DFL framework.
Hao
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.8-rc3 next-20200629]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/trix-redhat-com/fpga-dfl-improve-configuration-of-dfl-pci-devices/20200628-231854
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 719fdd32921fb7e3208db8832d32ae1c2d68900f
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
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
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All error/warnings (new ones prefixed by >>):
drivers/fpga/dfl-fme-perf.c: In function 'fme_perf_event_destroy':
>> drivers/fpga/dfl-fme-perf.c:788:54: error: 'struct perf_event' has no member named 'hw'
788 | struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
| ^~
In file included from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ptrace.h:6,
from include/uapi/asm-generic/bpf_perf_event.h:4,
from ./arch/ia64/include/generated/uapi/asm/bpf_perf_event.h:1,
from include/uapi/linux/bpf_perf_event.h:11,
from include/linux/perf_event.h:18,
from drivers/fpga/dfl-fme-perf.c:19:
>> drivers/fpga/dfl-fme-perf.c:789:53: error: 'struct perf_event' has no member named 'pmu'
789 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/kernel.h:1002:26: note: in definition of macro 'container_of'
1002 | void *__mptr = (void *)(ptr); \
| ^~~
>> drivers/fpga/dfl-fme-perf.c:789:31: note: in expansion of macro 'to_fme_perf_priv'
789 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~~~~~~~~~~~~~~~
In file included from include/uapi/linux/swab.h:6,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/ia64/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from drivers/fpga/dfl-fme-perf.c:19:
>> drivers/fpga/dfl-fme-perf.c:789:53: error: 'struct perf_event' has no member named 'pmu'
789 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
1003 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~~~~~~
include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
1003 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:176:32: note: in expansion of macro 'container_of'
176 | #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
| ^~~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:789:31: note: in expansion of macro 'to_fme_perf_priv'
789 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~~~~~~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:789:53: error: 'struct perf_event' has no member named 'pmu'
789 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
1003 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~~~~~~
include/linux/kernel.h:1004:6: note: in expansion of macro '__same_type'
1004 | !__same_type(*(ptr), void), \
| ^~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:176:32: note: in expansion of macro 'container_of'
176 | #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
| ^~~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:789:31: note: in expansion of macro 'to_fme_perf_priv'
789 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~~~~~~~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:792:33: error: 'struct perf_event' has no member named 'hw'
792 | ops->event_destroy(priv, event->hw.idx, event->hw.config_base);
| ^~
drivers/fpga/dfl-fme-perf.c:792:48: error: 'struct perf_event' has no member named 'hw'
792 | ops->event_destroy(priv, event->hw.idx, event->hw.config_base);
| ^~
In file included from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ptrace.h:6,
from include/uapi/asm-generic/bpf_perf_event.h:4,
from ./arch/ia64/include/generated/uapi/asm/bpf_perf_event.h:1,
from include/uapi/linux/bpf_perf_event.h:11,
from include/linux/perf_event.h:18,
from drivers/fpga/dfl-fme-perf.c:19:
drivers/fpga/dfl-fme-perf.c: In function 'fme_perf_event_init':
drivers/fpga/dfl-fme-perf.c:797:53: error: 'struct perf_event' has no member named 'pmu'
797 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/kernel.h:1002:26: note: in definition of macro 'container_of'
1002 | void *__mptr = (void *)(ptr); \
| ^~~
drivers/fpga/dfl-fme-perf.c:797:31: note: in expansion of macro 'to_fme_perf_priv'
797 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~~~~~~~~~~~~~~~
In file included from include/uapi/linux/swab.h:6,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/ia64/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from drivers/fpga/dfl-fme-perf.c:19:
drivers/fpga/dfl-fme-perf.c:797:53: error: 'struct perf_event' has no member named 'pmu'
797 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
1003 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~~~~~~
include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
1003 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:176:32: note: in expansion of macro 'container_of'
176 | #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
| ^~~~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:797:31: note: in expansion of macro 'to_fme_perf_priv'
797 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~~~~~~~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:797:53: error: 'struct perf_event' has no member named 'pmu'
797 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
1003 | BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
| ^~~~~~~~~~~~~~~~
include/linux/kernel.h:1004:6: note: in expansion of macro '__same_type'
1004 | !__same_type(*(ptr), void), \
| ^~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:176:32: note: in expansion of macro 'container_of'
176 | #define to_fme_perf_priv(_pmu) container_of(_pmu, struct fme_perf_priv, pmu)
| ^~~~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:797:31: note: in expansion of macro 'to_fme_perf_priv'
797 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~~~~~~~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:798:36: error: 'struct perf_event' has no member named 'hw'
798 | struct hw_perf_event *hwc = &event->hw;
| ^~
>> drivers/fpga/dfl-fme-perf.c:803:11: error: 'struct perf_event' has no member named 'attr'
803 | if (event->attr.type != event->pmu->type)
| ^~
drivers/fpga/dfl-fme-perf.c:803:31: error: 'struct perf_event' has no member named 'pmu'
803 | if (event->attr.type != event->pmu->type)
| ^~
>> drivers/fpga/dfl-fme-perf.c:811:6: error: implicit declaration of function 'is_sampling_event' [-Werror=implicit-function-declaration]
811 | if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
| ^~~~~~~~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:811:39: error: 'struct perf_event' has no member named 'attach_state'
811 | if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
| ^~
>> drivers/fpga/dfl-fme-perf.c:814:11: error: 'struct perf_event' has no member named 'cpu'
814 | if (event->cpu < 0)
| ^~
drivers/fpga/dfl-fme-perf.c:817:11: error: 'struct perf_event' has no member named 'cpu'
817 | if (event->cpu != priv->cpu)
| ^~
In file included from include/uapi/linux/swab.h:6,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/ia64/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from drivers/fpga/dfl-fme-perf.c:19:
drivers/fpga/dfl-fme-perf.c:820:27: error: 'struct perf_event' has no member named 'attr'
820 | eventid = get_event(event->attr.config);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:52:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
52 | BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:108:3: note: in expansion of macro '__BF_FIELD_CHECK'
108 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:213:28: note: in expansion of macro 'FIELD_GET'
213 | #define get_event(_config) FIELD_GET(FME_EVENT_MASK, _config)
| ^~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:820:12: note: in expansion of macro 'get_event'
820 | eventid = get_event(event->attr.config);
| ^~~~~~~~~
In file included from drivers/fpga/dfl.h:17,
from drivers/fpga/dfl-fme-perf.c:20:
drivers/fpga/dfl-fme-perf.c:820:27: error: 'struct perf_event' has no member named 'attr'
820 | eventid = get_event(event->attr.config);
| ^~
include/linux/bitfield.h:109:21: note: in definition of macro 'FIELD_GET'
109 | (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
| ^~~~
>> drivers/fpga/dfl-fme-perf.c:820:12: note: in expansion of macro 'get_event'
820 | eventid = get_event(event->attr.config);
| ^~~~~~~~~
In file included from include/uapi/linux/swab.h:6,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/ia64/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from drivers/fpga/dfl-fme-perf.c:19:
drivers/fpga/dfl-fme-perf.c:821:27: error: 'struct perf_event' has no member named 'attr'
821 | portid = get_portid(event->attr.config);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:52:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
52 | BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:108:3: note: in expansion of macro '__BF_FIELD_CHECK'
108 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:215:29: note: in expansion of macro 'FIELD_GET'
215 | #define get_portid(_config) FIELD_GET(FME_PORTID_MASK, _config)
| ^~~~~~~~~
>> drivers/fpga/dfl-fme-perf.c:821:11: note: in expansion of macro 'get_portid'
821 | portid = get_portid(event->attr.config);
| ^~~~~~~~~~
In file included from drivers/fpga/dfl.h:17,
from drivers/fpga/dfl-fme-perf.c:20:
drivers/fpga/dfl-fme-perf.c:821:27: error: 'struct perf_event' has no member named 'attr'
821 | portid = get_portid(event->attr.config);
| ^~
include/linux/bitfield.h:109:21: note: in definition of macro 'FIELD_GET'
109 | (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
| ^~~~
>> drivers/fpga/dfl-fme-perf.c:821:11: note: in expansion of macro 'get_portid'
821 | portid = get_portid(event->attr.config);
| ^~~~~~~~~~
In file included from include/uapi/linux/swab.h:6,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/ia64/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from drivers/fpga/dfl-fme-perf.c:19:
drivers/fpga/dfl-fme-perf.c:822:27: error: 'struct perf_event' has no member named 'attr'
822 | evtype = get_evtype(event->attr.config);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:52:3: note: in expansion of macro 'BUILD_BUG_ON_MSG'
52 | BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:108:3: note: in expansion of macro '__BF_FIELD_CHECK'
108 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:214:29: note: in expansion of macro 'FIELD_GET'
214 | #define get_evtype(_config) FIELD_GET(FME_EVTYPE_MASK, _config)
| ^~~~~~~~~
drivers/fpga/dfl-fme-perf.c:822:11: note: in expansion of macro 'get_evtype'
822 | evtype = get_evtype(event->attr.config);
| ^~~~~~~~~~
In file included from drivers/fpga/dfl.h:17,
from drivers/fpga/dfl-fme-perf.c:20:
drivers/fpga/dfl-fme-perf.c:822:27: error: 'struct perf_event' has no member named 'attr'
822 | evtype = get_evtype(event->attr.config);
| ^~
include/linux/bitfield.h:109:21: note: in definition of macro 'FIELD_GET'
109 | (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
| ^~~~
drivers/fpga/dfl-fme-perf.c:822:11: note: in expansion of macro 'get_evtype'
822 | evtype = get_evtype(event->attr.config);
| ^~~~~~~~~~
drivers/fpga/dfl-fme-perf.c:826:5: error: 'struct hw_perf_event' has no member named 'event_base'
826 | hwc->event_base = evtype;
| ^~
drivers/fpga/dfl-fme-perf.c:827:5: error: 'struct hw_perf_event' has no member named 'idx'
827 | hwc->idx = (int)eventid;
| ^~
drivers/fpga/dfl-fme-perf.c:828:5: error: 'struct hw_perf_event' has no member named 'config_base'
828 | hwc->config_base = portid;
| ^~
drivers/fpga/dfl-fme-perf.c:830:7: error: 'struct perf_event' has no member named 'destroy'
830 | event->destroy = fme_perf_event_destroy;
| ^~
drivers/fpga/dfl-fme-perf.c: In function 'fme_perf_event_update':
drivers/fpga/dfl-fme-perf.c:844:54: error: 'struct perf_event' has no member named 'hw'
844 | struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
| ^~
In file included from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/pid.h:5,
from include/linux/sched.h:14,
from include/linux/ptrace.h:6,
from include/uapi/asm-generic/bpf_perf_event.h:4,
from ./arch/ia64/include/generated/uapi/asm/bpf_perf_event.h:1,
from include/uapi/linux/bpf_perf_event.h:11,
from include/linux/perf_event.h:18,
from drivers/fpga/dfl-fme-perf.c:19:
drivers/fpga/dfl-fme-perf.c:845:53: error: 'struct perf_event' has no member named 'pmu'
845 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/kernel.h:1002:26: note: in definition of macro 'container_of'
1002 | void *__mptr = (void *)(ptr); \
| ^~~
drivers/fpga/dfl-fme-perf.c:845:31: note: in expansion of macro 'to_fme_perf_priv'
845 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~~~~~~~~~~~~~~~
In file included from include/uapi/linux/swab.h:6,
from include/linux/swab.h:5,
from include/uapi/linux/byteorder/little_endian.h:13,
from include/linux/byteorder/little_endian.h:5,
from arch/ia64/include/uapi/asm/byteorder.h:5,
from include/uapi/linux/perf_event.h:20,
from include/linux/perf_event.h:17,
from drivers/fpga/dfl-fme-perf.c:19:
drivers/fpga/dfl-fme-perf.c:845:53: error: 'struct perf_event' has no member named 'pmu'
845 | struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
| ^~
include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
372 | if (!(condition)) \
| ^~~~~~~~~
include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
392 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
vim +788 drivers/fpga/dfl-fme-perf.c
724142f8c42a7b Wu Hao 2020-04-27 785
724142f8c42a7b Wu Hao 2020-04-27 786 static void fme_perf_event_destroy(struct perf_event *event)
724142f8c42a7b Wu Hao 2020-04-27 787 {
724142f8c42a7b Wu Hao 2020-04-27 @788 struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
724142f8c42a7b Wu Hao 2020-04-27 @789 struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
724142f8c42a7b Wu Hao 2020-04-27 790
724142f8c42a7b Wu Hao 2020-04-27 791 if (ops->event_destroy)
724142f8c42a7b Wu Hao 2020-04-27 792 ops->event_destroy(priv, event->hw.idx, event->hw.config_base);
724142f8c42a7b Wu Hao 2020-04-27 793 }
724142f8c42a7b Wu Hao 2020-04-27 794
724142f8c42a7b Wu Hao 2020-04-27 795 static int fme_perf_event_init(struct perf_event *event)
724142f8c42a7b Wu Hao 2020-04-27 796 {
724142f8c42a7b Wu Hao 2020-04-27 797 struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
724142f8c42a7b Wu Hao 2020-04-27 @798 struct hw_perf_event *hwc = &event->hw;
724142f8c42a7b Wu Hao 2020-04-27 799 struct fme_perf_event_ops *ops;
724142f8c42a7b Wu Hao 2020-04-27 800 u32 eventid, evtype, portid;
724142f8c42a7b Wu Hao 2020-04-27 801
724142f8c42a7b Wu Hao 2020-04-27 802 /* test the event attr type check for PMU enumeration */
724142f8c42a7b Wu Hao 2020-04-27 @803 if (event->attr.type != event->pmu->type)
724142f8c42a7b Wu Hao 2020-04-27 804 return -ENOENT;
724142f8c42a7b Wu Hao 2020-04-27 805
724142f8c42a7b Wu Hao 2020-04-27 806 /*
724142f8c42a7b Wu Hao 2020-04-27 807 * fme counters are shared across all cores.
724142f8c42a7b Wu Hao 2020-04-27 808 * Therefore, it does not support per-process mode.
724142f8c42a7b Wu Hao 2020-04-27 809 * Also, it does not support event sampling mode.
724142f8c42a7b Wu Hao 2020-04-27 810 */
724142f8c42a7b Wu Hao 2020-04-27 @811 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
724142f8c42a7b Wu Hao 2020-04-27 812 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 813
724142f8c42a7b Wu Hao 2020-04-27 @814 if (event->cpu < 0)
724142f8c42a7b Wu Hao 2020-04-27 815 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 816
724142f8c42a7b Wu Hao 2020-04-27 817 if (event->cpu != priv->cpu)
724142f8c42a7b Wu Hao 2020-04-27 818 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 819
724142f8c42a7b Wu Hao 2020-04-27 @820 eventid = get_event(event->attr.config);
724142f8c42a7b Wu Hao 2020-04-27 @821 portid = get_portid(event->attr.config);
724142f8c42a7b Wu Hao 2020-04-27 @822 evtype = get_evtype(event->attr.config);
724142f8c42a7b Wu Hao 2020-04-27 823 if (evtype > FME_EVTYPE_MAX)
724142f8c42a7b Wu Hao 2020-04-27 824 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 825
724142f8c42a7b Wu Hao 2020-04-27 @826 hwc->event_base = evtype;
724142f8c42a7b Wu Hao 2020-04-27 @827 hwc->idx = (int)eventid;
724142f8c42a7b Wu Hao 2020-04-27 @828 hwc->config_base = portid;
724142f8c42a7b Wu Hao 2020-04-27 829
724142f8c42a7b Wu Hao 2020-04-27 @830 event->destroy = fme_perf_event_destroy;
724142f8c42a7b Wu Hao 2020-04-27 831
724142f8c42a7b Wu Hao 2020-04-27 832 dev_dbg(priv->dev, "%s event=0x%x, evtype=0x%x, portid=0x%x,\n",
724142f8c42a7b Wu Hao 2020-04-27 833 __func__, eventid, evtype, portid);
724142f8c42a7b Wu Hao 2020-04-27 834
724142f8c42a7b Wu Hao 2020-04-27 835 ops = get_event_ops(evtype);
724142f8c42a7b Wu Hao 2020-04-27 836 if (ops->event_init)
724142f8c42a7b Wu Hao 2020-04-27 837 return ops->event_init(priv, eventid, portid);
724142f8c42a7b Wu Hao 2020-04-27 838
724142f8c42a7b Wu Hao 2020-04-27 839 return 0;
724142f8c42a7b Wu Hao 2020-04-27 840 }
724142f8c42a7b Wu Hao 2020-04-27 841
724142f8c42a7b Wu Hao 2020-04-27 842 static void fme_perf_event_update(struct perf_event *event)
724142f8c42a7b Wu Hao 2020-04-27 843 {
724142f8c42a7b Wu Hao 2020-04-27 844 struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
724142f8c42a7b Wu Hao 2020-04-27 845 struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
724142f8c42a7b Wu Hao 2020-04-27 846 struct hw_perf_event *hwc = &event->hw;
724142f8c42a7b Wu Hao 2020-04-27 847 u64 now, prev, delta;
724142f8c42a7b Wu Hao 2020-04-27 848
724142f8c42a7b Wu Hao 2020-04-27 849 now = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
724142f8c42a7b Wu Hao 2020-04-27 @850 prev = local64_read(&hwc->prev_count);
724142f8c42a7b Wu Hao 2020-04-27 851 delta = now - prev;
724142f8c42a7b Wu Hao 2020-04-27 852
724142f8c42a7b Wu Hao 2020-04-27 @853 local64_add(delta, &event->count);
724142f8c42a7b Wu Hao 2020-04-27 854 }
724142f8c42a7b Wu Hao 2020-04-27 855
724142f8c42a7b Wu Hao 2020-04-27 856 static void fme_perf_event_start(struct perf_event *event, int flags)
724142f8c42a7b Wu Hao 2020-04-27 857 {
724142f8c42a7b Wu Hao 2020-04-27 858 struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
724142f8c42a7b Wu Hao 2020-04-27 859 struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
724142f8c42a7b Wu Hao 2020-04-27 860 struct hw_perf_event *hwc = &event->hw;
724142f8c42a7b Wu Hao 2020-04-27 861 u64 count;
724142f8c42a7b Wu Hao 2020-04-27 862
724142f8c42a7b Wu Hao 2020-04-27 863 count = ops->read_counter(priv, (u32)hwc->idx, hwc->config_base);
724142f8c42a7b Wu Hao 2020-04-27 @864 local64_set(&hwc->prev_count, count);
724142f8c42a7b Wu Hao 2020-04-27 865 }
724142f8c42a7b Wu Hao 2020-04-27 866
724142f8c42a7b Wu Hao 2020-04-27 867 static void fme_perf_event_stop(struct perf_event *event, int flags)
724142f8c42a7b Wu Hao 2020-04-27 868 {
724142f8c42a7b Wu Hao 2020-04-27 869 fme_perf_event_update(event);
724142f8c42a7b Wu Hao 2020-04-27 870 }
724142f8c42a7b Wu Hao 2020-04-27 871
724142f8c42a7b Wu Hao 2020-04-27 872 static int fme_perf_event_add(struct perf_event *event, int flags)
724142f8c42a7b Wu Hao 2020-04-27 873 {
724142f8c42a7b Wu Hao 2020-04-27 874 if (flags & PERF_EF_START)
724142f8c42a7b Wu Hao 2020-04-27 875 fme_perf_event_start(event, flags);
724142f8c42a7b Wu Hao 2020-04-27 876
724142f8c42a7b Wu Hao 2020-04-27 877 return 0;
724142f8c42a7b Wu Hao 2020-04-27 878 }
724142f8c42a7b Wu Hao 2020-04-27 879
724142f8c42a7b Wu Hao 2020-04-27 880 static void fme_perf_event_del(struct perf_event *event, int flags)
724142f8c42a7b Wu Hao 2020-04-27 881 {
724142f8c42a7b Wu Hao 2020-04-27 882 fme_perf_event_stop(event, PERF_EF_UPDATE);
724142f8c42a7b Wu Hao 2020-04-27 883 }
724142f8c42a7b Wu Hao 2020-04-27 884
724142f8c42a7b Wu Hao 2020-04-27 885 static void fme_perf_event_read(struct perf_event *event)
724142f8c42a7b Wu Hao 2020-04-27 886 {
724142f8c42a7b Wu Hao 2020-04-27 887 fme_perf_event_update(event);
724142f8c42a7b Wu Hao 2020-04-27 888 }
724142f8c42a7b Wu Hao 2020-04-27 889
724142f8c42a7b Wu Hao 2020-04-27 890 static void fme_perf_setup_hardware(struct fme_perf_priv *priv)
724142f8c42a7b Wu Hao 2020-04-27 891 {
724142f8c42a7b Wu Hao 2020-04-27 892 void __iomem *base = priv->ioaddr;
724142f8c42a7b Wu Hao 2020-04-27 893 u64 v;
724142f8c42a7b Wu Hao 2020-04-27 894
724142f8c42a7b Wu Hao 2020-04-27 895 /* read and save current working mode for fabric counters */
724142f8c42a7b Wu Hao 2020-04-27 896 v = readq(base + FAB_CTRL);
724142f8c42a7b Wu Hao 2020-04-27 897
724142f8c42a7b Wu Hao 2020-04-27 898 if (FIELD_GET(FAB_PORT_FILTER, v) == FAB_PORT_FILTER_DISABLE)
724142f8c42a7b Wu Hao 2020-04-27 899 priv->fab_port_id = FME_PORTID_ROOT;
724142f8c42a7b Wu Hao 2020-04-27 900 else
724142f8c42a7b Wu Hao 2020-04-27 901 priv->fab_port_id = FIELD_GET(FAB_PORT_ID, v);
724142f8c42a7b Wu Hao 2020-04-27 902 }
724142f8c42a7b Wu Hao 2020-04-27 903
724142f8c42a7b Wu Hao 2020-04-27 904 static int fme_perf_pmu_register(struct platform_device *pdev,
724142f8c42a7b Wu Hao 2020-04-27 905 struct fme_perf_priv *priv)
724142f8c42a7b Wu Hao 2020-04-27 906 {
724142f8c42a7b Wu Hao 2020-04-27 907 struct pmu *pmu = &priv->pmu;
724142f8c42a7b Wu Hao 2020-04-27 908 char *name;
724142f8c42a7b Wu Hao 2020-04-27 909 int ret;
724142f8c42a7b Wu Hao 2020-04-27 910
724142f8c42a7b Wu Hao 2020-04-27 911 spin_lock_init(&priv->fab_lock);
724142f8c42a7b Wu Hao 2020-04-27 912
724142f8c42a7b Wu Hao 2020-04-27 913 fme_perf_setup_hardware(priv);
724142f8c42a7b Wu Hao 2020-04-27 914
724142f8c42a7b Wu Hao 2020-04-27 915 pmu->task_ctx_nr = perf_invalid_context;
724142f8c42a7b Wu Hao 2020-04-27 916 pmu->attr_groups = fme_perf_groups;
724142f8c42a7b Wu Hao 2020-04-27 917 pmu->attr_update = fme_perf_events_groups;
724142f8c42a7b Wu Hao 2020-04-27 918 pmu->event_init = fme_perf_event_init;
724142f8c42a7b Wu Hao 2020-04-27 919 pmu->add = fme_perf_event_add;
724142f8c42a7b Wu Hao 2020-04-27 920 pmu->del = fme_perf_event_del;
724142f8c42a7b Wu Hao 2020-04-27 921 pmu->start = fme_perf_event_start;
724142f8c42a7b Wu Hao 2020-04-27 922 pmu->stop = fme_perf_event_stop;
724142f8c42a7b Wu Hao 2020-04-27 923 pmu->read = fme_perf_event_read;
724142f8c42a7b Wu Hao 2020-04-27 924 pmu->capabilities = PERF_PMU_CAP_NO_INTERRUPT |
724142f8c42a7b Wu Hao 2020-04-27 925 PERF_PMU_CAP_NO_EXCLUDE;
724142f8c42a7b Wu Hao 2020-04-27 926
724142f8c42a7b Wu Hao 2020-04-27 927 name = devm_kasprintf(priv->dev, GFP_KERNEL, "dfl_fme%d", pdev->id);
724142f8c42a7b Wu Hao 2020-04-27 928
724142f8c42a7b Wu Hao 2020-04-27 @929 ret = perf_pmu_register(pmu, name, -1);
724142f8c42a7b Wu Hao 2020-04-27 930 if (ret)
724142f8c42a7b Wu Hao 2020-04-27 931 return ret;
724142f8c42a7b Wu Hao 2020-04-27 932
724142f8c42a7b Wu Hao 2020-04-27 933 return 0;
724142f8c42a7b Wu Hao 2020-04-27 934 }
724142f8c42a7b Wu Hao 2020-04-27 935
724142f8c42a7b Wu Hao 2020-04-27 936 static void fme_perf_pmu_unregister(struct fme_perf_priv *priv)
724142f8c42a7b Wu Hao 2020-04-27 937 {
724142f8c42a7b Wu Hao 2020-04-27 @938 perf_pmu_unregister(&priv->pmu);
724142f8c42a7b Wu Hao 2020-04-27 939 }
724142f8c42a7b Wu Hao 2020-04-27 940
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
On 6/28/20 8:12 PM, Wu, Hao wrote:
>> -----Original Message-----
>> From: [email protected] <[email protected]>
>> On Behalf Of Xu Yilun
>> Sent: Monday, June 29, 2020 10:19 AM
>> To: [email protected]
>> Cc: [email protected]; [email protected]; linux-
>> [email protected]; Wu, Hao <[email protected]>;
>> [email protected]
>> Subject: Re: [PATCH] fpga: dfl: improve configuration of dfl pci devices
>>
>> I think maybe we don't have to select them all. It is now possible for
>> FPGA DFL boards to work without FME or AFU, providing limited
>> functionality. It is possible designers trim the bitstream for their
>> purpose, and also need a smaller driver set.
>>
> Yes, we hope that this dfl-pci could be a common module shared by
> different cards. Some device doesn't have FME, e.g. some VF device
> with AFU only, some device has FME, but no PR support, and in the
> future, it's possible to add new modules, or something replacing AFU
> or FME, so we don't have to select all here.
>
>> I think we may add "default FPGA_DFL" for FPGA_DFL_FME,
>> FPGA_DFL_FME_MGR and others to make life easier.
> It's hard to say it's easier for everybody, e.g. I am a user of N3000, but
> I have to unselect the PR modules, as they are default Yes as proposed?
> Maybe it's better to let user select what they want, unless we find
> something really common needed under DFL framework.
I get your point about n3000, but that card is not currently supported in the public. Currently there is really only pac10, the 0x9c4 device. Once n3000 (and d5005) is out, it will have several sub devices that will also so need to be manually configured. While a developer of the n3000 will know which subdevices are needed, someone just building the kernel will not. So would expect there to be something like
CONFIG_FPGA_DFL_N3000
select CONFIG_DFL_PCI
select CONFIG_DFL_SUBDEV_1
..
On PF vs FP, yes only afu parts are needed. But i doubt anyone builds a VF specific kernel. And if folks wanted to not use the fme parts they would not have to load it's module at run time.
I would like a top level config what auto selects all of the submodules needed based on the card. I think maybe that is CONFIG_FPGA_DFL_PAC10. so we will be ready for CONFIG_FPGA_DFL_N3000 and CONFIG_FPGA_DFL_D5005 and what ever comes later.
Tom
> Hao
>
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.8-rc3 next-20200629]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/trix-redhat-com/fpga-dfl-improve-configuration-of-dfl-pci-devices/20200628-231854
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 719fdd32921fb7e3208db8832d32ae1c2d68900f
config: s390-randconfig-s031-20200629 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-3-gfa153962-dirty
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C= CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
sparse warnings: (new ones prefixed by >>)
drivers/fpga/dfl-fme-perf.c:788:61: sparse: sparse: using member 'hw' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:789:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
>> drivers/fpga/dfl-fme-perf.c:789:38: sparse: sparse: cast from unknown type
drivers/fpga/dfl-fme-perf.c:789:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:789:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:792:47: sparse: sparse: using member 'hw' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:797:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:797:38: sparse: sparse: cast from unknown type
drivers/fpga/dfl-fme-perf.c:797:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:797:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:798:43: sparse: sparse: using member 'hw' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:803:18: sparse: sparse: using member 'attr' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:803:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:811:13: sparse: sparse: undefined identifier 'is_sampling_event'
drivers/fpga/dfl-fme-perf.c:814:18: sparse: sparse: using member 'cpu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:817:18: sparse: sparse: using member 'cpu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:820:19: sparse: sparse: using member 'attr' in incomplete struct perf_event
>> drivers/fpga/dfl-fme-perf.c:820:19: sparse: sparse: incompatible types for operation (>):
>> drivers/fpga/dfl-fme-perf.c:820:19: sparse: unsigned long long
>> drivers/fpga/dfl-fme-perf.c:820:19: sparse: bad type
drivers/fpga/dfl-fme-perf.c:820:19: sparse: sparse: using member 'attr' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:820:19: sparse: sparse: cast from unknown type
drivers/fpga/dfl-fme-perf.c:821:18: sparse: sparse: using member 'attr' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:821:18: sparse: sparse: incompatible types for operation (>):
drivers/fpga/dfl-fme-perf.c:821:18: sparse: unsigned long long
drivers/fpga/dfl-fme-perf.c:821:18: sparse: bad type
drivers/fpga/dfl-fme-perf.c:821:18: sparse: sparse: using member 'attr' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:821:18: sparse: sparse: cast from unknown type
drivers/fpga/dfl-fme-perf.c:822:18: sparse: sparse: using member 'attr' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:822:18: sparse: sparse: incompatible types for operation (>):
drivers/fpga/dfl-fme-perf.c:822:18: sparse: unsigned long long
drivers/fpga/dfl-fme-perf.c:822:18: sparse: bad type
drivers/fpga/dfl-fme-perf.c:822:18: sparse: sparse: using member 'attr' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:822:18: sparse: sparse: cast from unknown type
drivers/fpga/dfl-fme-perf.c:826:12: sparse: sparse: using member 'event_base' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:827:12: sparse: sparse: using member 'idx' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:828:12: sparse: sparse: using member 'config_base' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:830:14: sparse: sparse: using member 'destroy' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:844:61: sparse: sparse: using member 'hw' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:845:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:845:38: sparse: sparse: cast from unknown type
drivers/fpga/dfl-fme-perf.c:845:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:845:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:846:43: sparse: sparse: using member 'hw' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:849:47: sparse: sparse: using member 'idx' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:849:57: sparse: sparse: using member 'config_base' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:850:16: sparse: sparse: using member 'prev_count' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:853:9: sparse: sparse: using member 'count' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:858:61: sparse: sparse: using member 'hw' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:859:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:859:38: sparse: sparse: cast from unknown type
drivers/fpga/dfl-fme-perf.c:859:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:859:38: sparse: sparse: using member 'pmu' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:860:43: sparse: sparse: using member 'hw' in incomplete struct perf_event
drivers/fpga/dfl-fme-perf.c:863:49: sparse: sparse: using member 'idx' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:863:59: sparse: sparse: using member 'config_base' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:864:9: sparse: sparse: using member 'prev_count' in incomplete struct hw_perf_event
drivers/fpga/dfl-fme-perf.c:929:15: sparse: sparse: undefined identifier 'perf_pmu_register'
drivers/fpga/dfl-fme-perf.c:938:9: sparse: sparse: undefined identifier 'perf_pmu_unregister'
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:236:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long long [usertype] val @@ got restricted __le64 [usertype] @@
include/asm-generic/io.h:236:22: sparse: expected unsigned long long [usertype] val
include/asm-generic/io.h:236:22: sparse: got restricted __le64 [usertype]
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:193:15: sparse: sparse: cast to restricted __le64
include/asm-generic/io.h:236:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long long [usertype] val @@ got restricted __le64 [usertype] @@
include/asm-generic/io.h:236:22: sparse: expected unsigned long long [usertype] val
vim +789 drivers/fpga/dfl-fme-perf.c
724142f8c42a7b Wu Hao 2020-04-27 785
724142f8c42a7b Wu Hao 2020-04-27 786 static void fme_perf_event_destroy(struct perf_event *event)
724142f8c42a7b Wu Hao 2020-04-27 787 {
724142f8c42a7b Wu Hao 2020-04-27 788 struct fme_perf_event_ops *ops = get_event_ops(event->hw.event_base);
724142f8c42a7b Wu Hao 2020-04-27 @789 struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
724142f8c42a7b Wu Hao 2020-04-27 790
724142f8c42a7b Wu Hao 2020-04-27 791 if (ops->event_destroy)
724142f8c42a7b Wu Hao 2020-04-27 792 ops->event_destroy(priv, event->hw.idx, event->hw.config_base);
724142f8c42a7b Wu Hao 2020-04-27 793 }
724142f8c42a7b Wu Hao 2020-04-27 794
724142f8c42a7b Wu Hao 2020-04-27 795 static int fme_perf_event_init(struct perf_event *event)
724142f8c42a7b Wu Hao 2020-04-27 796 {
724142f8c42a7b Wu Hao 2020-04-27 797 struct fme_perf_priv *priv = to_fme_perf_priv(event->pmu);
724142f8c42a7b Wu Hao 2020-04-27 798 struct hw_perf_event *hwc = &event->hw;
724142f8c42a7b Wu Hao 2020-04-27 799 struct fme_perf_event_ops *ops;
724142f8c42a7b Wu Hao 2020-04-27 800 u32 eventid, evtype, portid;
724142f8c42a7b Wu Hao 2020-04-27 801
724142f8c42a7b Wu Hao 2020-04-27 802 /* test the event attr type check for PMU enumeration */
724142f8c42a7b Wu Hao 2020-04-27 803 if (event->attr.type != event->pmu->type)
724142f8c42a7b Wu Hao 2020-04-27 804 return -ENOENT;
724142f8c42a7b Wu Hao 2020-04-27 805
724142f8c42a7b Wu Hao 2020-04-27 806 /*
724142f8c42a7b Wu Hao 2020-04-27 807 * fme counters are shared across all cores.
724142f8c42a7b Wu Hao 2020-04-27 808 * Therefore, it does not support per-process mode.
724142f8c42a7b Wu Hao 2020-04-27 809 * Also, it does not support event sampling mode.
724142f8c42a7b Wu Hao 2020-04-27 810 */
724142f8c42a7b Wu Hao 2020-04-27 811 if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK)
724142f8c42a7b Wu Hao 2020-04-27 812 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 813
724142f8c42a7b Wu Hao 2020-04-27 814 if (event->cpu < 0)
724142f8c42a7b Wu Hao 2020-04-27 815 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 816
724142f8c42a7b Wu Hao 2020-04-27 817 if (event->cpu != priv->cpu)
724142f8c42a7b Wu Hao 2020-04-27 818 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 819
724142f8c42a7b Wu Hao 2020-04-27 @820 eventid = get_event(event->attr.config);
724142f8c42a7b Wu Hao 2020-04-27 821 portid = get_portid(event->attr.config);
724142f8c42a7b Wu Hao 2020-04-27 822 evtype = get_evtype(event->attr.config);
724142f8c42a7b Wu Hao 2020-04-27 823 if (evtype > FME_EVTYPE_MAX)
724142f8c42a7b Wu Hao 2020-04-27 824 return -EINVAL;
724142f8c42a7b Wu Hao 2020-04-27 825
724142f8c42a7b Wu Hao 2020-04-27 826 hwc->event_base = evtype;
724142f8c42a7b Wu Hao 2020-04-27 827 hwc->idx = (int)eventid;
724142f8c42a7b Wu Hao 2020-04-27 828 hwc->config_base = portid;
724142f8c42a7b Wu Hao 2020-04-27 829
724142f8c42a7b Wu Hao 2020-04-27 830 event->destroy = fme_perf_event_destroy;
724142f8c42a7b Wu Hao 2020-04-27 831
724142f8c42a7b Wu Hao 2020-04-27 832 dev_dbg(priv->dev, "%s event=0x%x, evtype=0x%x, portid=0x%x,\n",
724142f8c42a7b Wu Hao 2020-04-27 833 __func__, eventid, evtype, portid);
724142f8c42a7b Wu Hao 2020-04-27 834
724142f8c42a7b Wu Hao 2020-04-27 835 ops = get_event_ops(evtype);
724142f8c42a7b Wu Hao 2020-04-27 836 if (ops->event_init)
724142f8c42a7b Wu Hao 2020-04-27 837 return ops->event_init(priv, eventid, portid);
724142f8c42a7b Wu Hao 2020-04-27 838
724142f8c42a7b Wu Hao 2020-04-27 839 return 0;
724142f8c42a7b Wu Hao 2020-04-27 840 }
724142f8c42a7b Wu Hao 2020-04-27 841
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
> On 6/28/20 8:12 PM, Wu, Hao wrote:
> >> -----Original Message-----
> >> From: [email protected] <linux-fpga-
> [email protected]>
> >> On Behalf Of Xu Yilun
> >> Sent: Monday, June 29, 2020 10:19 AM
> >> To: [email protected]
> >> Cc: [email protected]; [email protected]; linux-
> >> [email protected]; Wu, Hao <[email protected]>;
> >> [email protected]
> >> Subject: Re: [PATCH] fpga: dfl: improve configuration of dfl pci devices
> >>
> >> I think maybe we don't have to select them all. It is now possible for
> >> FPGA DFL boards to work without FME or AFU, providing limited
> >> functionality. It is possible designers trim the bitstream for their
> >> purpose, and also need a smaller driver set.
> >>
> > Yes, we hope that this dfl-pci could be a common module shared by
> > different cards. Some device doesn't have FME, e.g. some VF device
> > with AFU only, some device has FME, but no PR support, and in the
> > future, it's possible to add new modules, or something replacing AFU
> > or FME, so we don't have to select all here.
> >
> >> I think we may add "default FPGA_DFL" for FPGA_DFL_FME,
> >> FPGA_DFL_FME_MGR and others to make life easier.
> > It's hard to say it's easier for everybody, e.g. I am a user of N3000, but
> > I have to unselect the PR modules, as they are default Yes as proposed?
> > Maybe it's better to let user select what they want, unless we find
> > something really common needed under DFL framework.
>
> I get your point about n3000, but that card is not currently supported in the
> public. Currently there is really only pac10, the 0x9c4 device. Once n3000
> (and d5005) is out, it will have several sub devices that will also so need to be
> manually configured. While a developer of the n3000 will know which
> subdevices are needed, someone just building the kernel will not. So would
> expect there to be something like
>
> CONFIG_FPGA_DFL_N3000
>
> select CONFIG_DFL_PCI
>
> select CONFIG_DFL_SUBDEV_1
>
> ..
How about non DFL sub modules? Do you mean it's going to select everything
this card needs, including spi, ethernet, bmc and other components used on
this card, as FPGA (e.g. N3000) is the only communication channel to them?
>
> On PF vs FP, yes only afu parts are needed. But i doubt anyone builds a VF
> specific kernel. And if folks wanted to not use the fme parts they would not
> have to load it's module at run time.
It's possible to build a smaller image for virtual machine usage.
>
> I would like a top level config what auto selects all of the submodules needed
> based on the card. I think maybe that is CONFIG_FPGA_DFL_PAC10. so we
> will be ready for CONFIG_FPGA_DFL_N3000 and CONFIG_FPGA_DFL_D5005
> and what ever comes later.
How about a reference kernel config listed somewhere (e.g. in kernel doc or
some other public place) for them?
Hao
>
> Tom
>
> > Hao
> >