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 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/kbuild-all@lists.01.org