[djwong-xfs:repair-symlink-swapext 325/325] fs/xfs/libxfs/xfs_symlink_remote.c:387:1: warning: no previous prototype for 'xfs_symlink_remote_truncate'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-symlink-swapext
head: 851df07d9599471df909c4ff0e3cf33f4b9619f0
commit: 851df07d9599471df909c4ff0e3cf33f4b9619f0 [325/325] xfs: convert symlink repair to use swapext
config: m68k-randconfig-r006-20211214 (https://download.01.org/0day-ci/archive/20211216/202112162251.CsRh5Tbt-lk...)
compiler: m68k-linux-gcc (GCC) 11.2.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
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/comm...
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs repair-symlink-swapext
git checkout 851df07d9599471df909c4ff0e3cf33f4b9619f0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash fs/xfs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
fs/xfs/libxfs/xfs_symlink_remote.c:28:1: warning: no previous prototype for 'xfs_symlink_blocks' [-Wmissing-prototypes]
28 | xfs_symlink_blocks(
| ^~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_symlink_remote.c:38:1: warning: no previous prototype for 'xfs_symlink_hdr_set' [-Wmissing-prototypes]
38 | xfs_symlink_hdr_set(
| ^~~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_symlink_remote.c:68:1: warning: no previous prototype for 'xfs_symlink_hdr_ok' [-Wmissing-prototypes]
68 | xfs_symlink_hdr_ok(
| ^~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_symlink_remote.c:167:1: warning: no previous prototype for 'xfs_symlink_local_to_remote' [-Wmissing-prototypes]
167 | xfs_symlink_local_to_remote(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_symlink_remote.c:206:1: warning: no previous prototype for 'xfs_symlink_shortform_verify' [-Wmissing-prototypes]
206 | xfs_symlink_shortform_verify(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_symlink_remote.c:239:1: warning: no previous prototype for 'xfs_symlink_remote_read' [-Wmissing-prototypes]
239 | xfs_symlink_remote_read(
| ^~~~~~~~~~~~~~~~~~~~~~~
fs/xfs/libxfs/xfs_symlink_remote.c:311:1: warning: no previous prototype for 'xfs_symlink_write_target' [-Wmissing-prototypes]
311 | xfs_symlink_write_target(
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> fs/xfs/libxfs/xfs_symlink_remote.c:387:1: warning: no previous prototype for 'xfs_symlink_remote_truncate' [-Wmissing-prototypes]
387 | xfs_symlink_remote_truncate(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/xfs_symlink_remote_truncate +387 fs/xfs/libxfs/xfs_symlink_remote.c
384
385 /* Remove all the blocks from a symlink and invalidate buffers. */
386 int
> 387 xfs_symlink_remote_truncate(
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[intel-tdx:kvm-upstream 79/152] arch/x86/kvm/vmx/tdx_stubs.c:11:5: error: no previous prototype for 'tdx_vm_ioctl'
by kernel test robot
tree: https://github.com/intel/tdx.git kvm-upstream
head: bdfe06c17daab60c196ff80c1d98467a1d3734fa
commit: aa43996cce77132edb090ca84f3f6a72e359b55c [79/152] KVM: TDX: initialize VM with TDX specific parameters
config: i386-randconfig-m021-20211216 (https://download.01.org/0day-ci/archive/20211216/202112162217.0r56Rm99-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/intel/tdx/commit/aa43996cce77132edb090ca84f3f6a72e359b55c
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm-upstream
git checkout aa43996cce77132edb090ca84f3f6a72e359b55c
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
arch/x86/kvm/vmx/tdx_stubs.c:4:13: error: no previous prototype for 'tdx_pre_kvm_init' [-Werror=missing-prototypes]
4 | void __init tdx_pre_kvm_init(unsigned int *vcpu_size,
| ^~~~~~~~~~~~~~~~
arch/x86/kvm/vmx/tdx_stubs.c:6:12: error: no previous prototype for 'tdx_hardware_setup' [-Werror=missing-prototypes]
6 | int __init tdx_hardware_setup(struct kvm_x86_ops *x86_ops) { return -EOPNOTSUPP; }
| ^~~~~~~~~~~~~~~~~~
arch/x86/kvm/vmx/tdx_stubs.c:7:6: error: no previous prototype for 'tdx_hardware_enable' [-Werror=missing-prototypes]
7 | void tdx_hardware_enable(void) {}
| ^~~~~~~~~~~~~~~~~~~
arch/x86/kvm/vmx/tdx_stubs.c:8:6: error: no previous prototype for 'tdx_hardware_disable' [-Werror=missing-prototypes]
8 | void tdx_hardware_disable(void) {}
| ^~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/vmx/tdx_stubs.c:10:5: error: no previous prototype for 'tdx_dev_ioctl' [-Werror=missing-prototypes]
10 | int tdx_dev_ioctl(void __user *argp) { return -EOPNOTSUPP; }
| ^~~~~~~~~~~~~
>> arch/x86/kvm/vmx/tdx_stubs.c:11:5: error: no previous prototype for 'tdx_vm_ioctl' [-Werror=missing-prototypes]
11 | int tdx_vm_ioctl(struct kvm *kvm, void __user *argp) { return -EOPNOTSUPP; }
| ^~~~~~~~~~~~
cc1: all warnings being treated as errors
vim +/tdx_vm_ioctl +11 arch/x86/kvm/vmx/tdx_stubs.c
3
4 void __init tdx_pre_kvm_init(unsigned int *vcpu_size,
5 unsigned int *vcpu_align, unsigned int *vm_size) {}
6 int __init tdx_hardware_setup(struct kvm_x86_ops *x86_ops) { return -EOPNOTSUPP; }
> 7 void tdx_hardware_enable(void) {}
8 void tdx_hardware_disable(void) {}
9
10 int tdx_dev_ioctl(void __user *argp) { return -EOPNOTSUPP; }
> 11 int tdx_vm_ioctl(struct kvm *kvm, void __user *argp) { return -EOPNOTSUPP; }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
arch/mips/lib/uncached.c:50 run_uncached() warn: always true condition '(sp >= (9223372036854775808 | ((0) << 59) | (0))) => (s64min-s64max >= s64min)'
by kernel test robot
Hi Lauri,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2b14864acbaaf03d9c01982e243a84632524c3ac
commit: baec970aa5ba11099ad7a91773350c91fb2113f0 mips: Add N64 machine type
date: 11 months ago
config: mips-randconfig-m031-20211216 (https://download.01.org/0day-ci/archive/20211216/202112162231.WVjq5Lh3-lk...)
compiler: mips64-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
New smatch warnings:
arch/mips/lib/uncached.c:50 run_uncached() warn: always true condition '(sp >= (9223372036854775808 | ((0) << 59) | (0))) => (s64min-s64max >= s64min)'
arch/mips/lib/uncached.c:62 run_uncached() warn: always true condition '(lfunc >= (9223372036854775808 | ((0) << 59) | (0))) => (s64min-s64max >= s64min)'
arch/mips/kernel/unaligned.c:347 emulate_load_store_insn() warn: ignoring unreachable code.
arch/mips/kernel/unaligned.c:1136 emulate_load_store_microMIPS() warn: ignoring unreachable code.
arch/mips/kernel/unaligned.c:1402 emulate_load_store_MIPS16e() warn: ignoring unreachable code.
arch/mips/math-emu/dsemul.c:264 mips_dsemul() warn: 'break_math' 33685517 can't fit into 65535 '*(_badinst.halfword[1])'
kernel/bpf/ringbuf.c:334 __bpf_ringbuf_reserve() error: uninitialized symbol 'flags'.
Old smatch warnings:
arch/mips/kernel/unaligned.c:370 emulate_load_store_insn() warn: ignoring unreachable code.
arch/mips/kernel/unaligned.c:433 emulate_load_store_insn() warn: ignoring unreachable code.
arch/mips/kernel/unaligned.c:1158 emulate_load_store_microMIPS() warn: ignoring unreachable code.
arch/mips/kernel/unaligned.c:1200 emulate_load_store_microMIPS() warn: ignoring unreachable code.
arch/mips/kernel/unaligned.c:1426 emulate_load_store_MIPS16e() warn: ignoring unreachable code.
arch/mips/kernel/unaligned.c:1474 emulate_load_store_MIPS16e() warn: ignoring unreachable code.
vim +50 arch/mips/lib/uncached.c
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 22
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 23 /*
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 24 * FUNC is executed in one of the uncached segments, depending on its
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 25 * original address as follows:
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 26 *
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 27 * 1. If the original address is in CKSEG0 or CKSEG1, then the uncached
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 28 * segment used is CKSEG1.
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 29 * 2. If the original address is in XKPHYS, then the uncached segment
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 30 * used is XKPHYS(2).
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 31 * 3. Otherwise it's a bug.
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 32 *
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 33 * The same remapping is done with the stack pointer. Stack handling
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 34 * works because we don't handle stack arguments or more complex return
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 35 * values, so we can avoid sharing the same stack area between a cached
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 36 * and the uncached mode.
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 37 */
078a55fc824c16 Paul Gortmaker 2013-06-18 38 unsigned long run_uncached(void *func)
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 39 {
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 40 register long ret __asm__("$2");
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 41 long lfunc = (long)func, ufunc;
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 42 long usp;
5b058973d32055 Anders Roxell 2020-12-11 43 long sp;
5b058973d32055 Anders Roxell 2020-12-11 44
5b058973d32055 Anders Roxell 2020-12-11 45 __asm__("move %0, $sp" : "=r" (sp));
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 46
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 47 if (sp >= (long)CKSEG0 && sp < (long)CKSEG2)
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 48 usp = CKSEG1ADDR(sp);
c55197eb549dc0 Yoichi Yuasa 2007-02-06 49 #ifdef CONFIG_64BIT
48ef2626aeecac Andrew Sharp 2007-10-31 @50 else if ((long long)sp >= (long long)PHYS_TO_XKPHYS(0, 0) &&
48ef2626aeecac Andrew Sharp 2007-10-31 51 (long long)sp < (long long)PHYS_TO_XKPHYS(8, 0))
48ef2626aeecac Andrew Sharp 2007-10-31 52 usp = PHYS_TO_XKPHYS(K_CALG_UNCACHED,
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 53 XKPHYS_TO_PHYS((long long)sp));
c55197eb549dc0 Yoichi Yuasa 2007-02-06 54 #endif
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 55 else {
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 56 BUG();
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 57 usp = sp;
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 58 }
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 59 if (lfunc >= (long)CKSEG0 && lfunc < (long)CKSEG2)
ba5187dbb4b2ea Thiemo Seufer 2005-04-25 60 ufunc = CKSEG1ADDR(lfunc);
c55197eb549dc0 Yoichi Yuasa 2007-02-06 61 #ifdef CONFIG_64BIT
48ef2626aeecac Andrew Sharp 2007-10-31 @62 else if ((long long)lfunc >= (long long)PHYS_TO_XKPHYS(0, 0) &&
:::::: The code at line 50 was first introduced by commit
:::::: 48ef2626aeecac3b160d1aee38ac46d6c3540122 [MIPS] Put cast inside macro instead of all the callers
:::::: TO: Andrew Sharp <andy.sharp(a)onstor.com>
:::::: CC: Ralf Baechle <ralf(a)linux-mips.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[djwong-xfs:repair-symlink-swapext 325/325] fs/xfs/libxfs/xfs_symlink_remote.c:387:1: warning: no previous prototype for function 'xfs_symlink_remote_truncate'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-symlink-swapext
head: 851df07d9599471df909c4ff0e3cf33f4b9619f0
commit: 851df07d9599471df909c4ff0e3cf33f4b9619f0 [325/325] xfs: convert symlink repair to use swapext
config: riscv-randconfig-r042-20211216 (https://download.01.org/0day-ci/archive/20211216/202112162223.7F9L1svL-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/comm...
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs repair-symlink-swapext
git checkout 851df07d9599471df909c4ff0e3cf33f4b9619f0
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash fs/xfs/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
fs/xfs/libxfs/xfs_symlink_remote.c:28:1: warning: no previous prototype for function 'xfs_symlink_blocks' [-Wmissing-prototypes]
xfs_symlink_blocks(
^
fs/xfs/libxfs/xfs_symlink_remote.c:27:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int
^
static
fs/xfs/libxfs/xfs_symlink_remote.c:38:1: warning: no previous prototype for function 'xfs_symlink_hdr_set' [-Wmissing-prototypes]
xfs_symlink_hdr_set(
^
fs/xfs/libxfs/xfs_symlink_remote.c:37:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int
^
static
fs/xfs/libxfs/xfs_symlink_remote.c:68:1: warning: no previous prototype for function 'xfs_symlink_hdr_ok' [-Wmissing-prototypes]
xfs_symlink_hdr_ok(
^
fs/xfs/libxfs/xfs_symlink_remote.c:67:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
bool
^
static
fs/xfs/libxfs/xfs_symlink_remote.c:167:1: warning: no previous prototype for function 'xfs_symlink_local_to_remote' [-Wmissing-prototypes]
xfs_symlink_local_to_remote(
^
fs/xfs/libxfs/xfs_symlink_remote.c:166:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void
^
static
fs/xfs/libxfs/xfs_symlink_remote.c:206:1: warning: no previous prototype for function 'xfs_symlink_shortform_verify' [-Wmissing-prototypes]
xfs_symlink_shortform_verify(
^
fs/xfs/libxfs/xfs_symlink_remote.c:205:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
xfs_failaddr_t
^
static
fs/xfs/libxfs/xfs_symlink_remote.c:239:1: warning: no previous prototype for function 'xfs_symlink_remote_read' [-Wmissing-prototypes]
xfs_symlink_remote_read(
^
fs/xfs/libxfs/xfs_symlink_remote.c:238:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int
^
static
fs/xfs/libxfs/xfs_symlink_remote.c:311:1: warning: no previous prototype for function 'xfs_symlink_write_target' [-Wmissing-prototypes]
xfs_symlink_write_target(
^
fs/xfs/libxfs/xfs_symlink_remote.c:310:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int
^
static
>> fs/xfs/libxfs/xfs_symlink_remote.c:387:1: warning: no previous prototype for function 'xfs_symlink_remote_truncate' [-Wmissing-prototypes]
xfs_symlink_remote_truncate(
^
fs/xfs/libxfs/xfs_symlink_remote.c:386:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int
^
static
8 warnings generated.
vim +/xfs_symlink_remote_truncate +387 fs/xfs/libxfs/xfs_symlink_remote.c
308
309 /* Write the symlink target into the inode. */
310 int
> 311 xfs_symlink_write_target(
312 struct xfs_trans *tp,
313 struct xfs_inode *ip,
314 const char *target_path,
315 int pathlen,
316 xfs_fsblock_t fs_blocks,
317 uint resblks)
318 {
319 struct xfs_bmbt_irec mval[XFS_SYMLINK_MAPS];
320 struct xfs_mount *mp = tp->t_mountp;
321 const char *cur_chunk;
322 struct xfs_buf *bp;
323 xfs_daddr_t d;
324 int byte_cnt;
325 int nmaps;
326 int offset = 0;
327 int n;
328 int error;
329
330 /*
331 * If the symlink will fit into the inode, write it inline.
332 */
333 if (pathlen <= XFS_IFORK_DSIZE(ip)) {
334 xfs_init_local_fork(ip, XFS_DATA_FORK, target_path, pathlen);
335
336 ip->i_disk_size = pathlen;
337 ip->i_df.if_format = XFS_DINODE_FMT_LOCAL;
338 xfs_trans_log_inode(tp, ip, XFS_ILOG_DDATA | XFS_ILOG_CORE);
339 return 0;
340 }
341
342 nmaps = XFS_SYMLINK_MAPS;
343 error = xfs_bmapi_write(tp, ip, 0, fs_blocks, XFS_BMAPI_METADATA,
344 resblks, mval, &nmaps);
345 if (error)
346 return error;
347
348 ip->i_disk_size = pathlen;
349 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
350
351 cur_chunk = target_path;
352 offset = 0;
353 for (n = 0; n < nmaps; n++) {
354 char *buf;
355
356 d = XFS_FSB_TO_DADDR(mp, mval[n].br_startblock);
357 byte_cnt = XFS_FSB_TO_B(mp, mval[n].br_blockcount);
358 error = xfs_trans_get_buf(tp, mp->m_ddev_targp, d,
359 BTOBB(byte_cnt), 0, &bp);
360 if (error)
361 return error;
362 bp->b_ops = &xfs_symlink_buf_ops;
363
364 byte_cnt = XFS_SYMLINK_BUF_SPACE(mp, byte_cnt);
365 byte_cnt = min(byte_cnt, pathlen);
366
367 buf = bp->b_addr;
368 buf += xfs_symlink_hdr_set(mp, ip->i_ino, offset, byte_cnt,
369 bp);
370
371 memcpy(buf, cur_chunk, byte_cnt);
372
373 cur_chunk += byte_cnt;
374 pathlen -= byte_cnt;
375 offset += byte_cnt;
376
377 xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
378 xfs_trans_log_buf(tp, bp, 0, (buf + byte_cnt - 1) -
379 (char *)bp->b_addr);
380 }
381 ASSERT(pathlen == 0);
382 return 0;
383 }
384
385 /* Remove all the blocks from a symlink and invalidate buffers. */
386 int
> 387 xfs_symlink_remote_truncate(
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[frank-w-bpi-r2-4.14:5.16-r2pro 7/46] drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1985:11: error: variable 'u4Wait' set but not used
by kernel test robot
tree: https://github.com/frank-w/BPI-R2-4.14 5.16-r2pro
head: 128a9afefdc678ae6492ee2067b1e33e14b6c28f
commit: 4511c37ac89f210b67a8654f0d15f44fffff165c [7/46] mt6625l: disable {get,set}_fs as these are dropped in 5.15 source
config: arm-randconfig-r003-20211216 (https://download.01.org/0day-ci/archive/20211216/202112162153.t0HEOjZI-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/frank-w/BPI-R2-4.14/commit/4511c37ac89f210b67a8654f0d1...
git remote add frank-w-bpi-r2-4.14 https://github.com/frank-w/BPI-R2-4.14
git fetch --no-tags frank-w-bpi-r2-4.14 5.16-r2pro
git checkout 4511c37ac89f210b67a8654f0d15f44fffff165c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/ drivers/power/supply/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1291:31: error: unused variable 'wmt_dbg_fops' [-Werror,-Wunused-variable]
static const struct proc_ops wmt_dbg_fops = {
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1289:7: error: no previous prototype for function 'wmt_dev_dbg_setup' [-Werror,-Wmissing-prototypes]
INT32 wmt_dev_dbg_setup(VOID)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1289:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
INT32 wmt_dev_dbg_setup(VOID)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1303:7: error: no previous prototype for function 'wmt_dev_dbg_remove' [-Werror,-Wmissing-prototypes]
INT32 wmt_dev_dbg_remove(VOID)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1303:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
INT32 wmt_dev_dbg_remove(VOID)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1376:31: error: unused variable 'wmt_aee_fops' [-Werror,-Wunused-variable]
static const struct proc_ops wmt_aee_fops = {
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1374:7: error: no previous prototype for function 'wmt_dev_proc_for_aee_setup' [-Werror,-Wmissing-prototypes]
INT32 wmt_dev_proc_for_aee_setup(VOID)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1374:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
INT32 wmt_dev_proc_for_aee_setup(VOID)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1390:7: error: no previous prototype for function 'wmt_dev_proc_for_aee_remove' [-Werror,-Wmissing-prototypes]
INT32 wmt_dev_proc_for_aee_remove(VOID)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1390:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
INT32 wmt_dev_proc_for_aee_remove(VOID)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1435:7: error: no previous prototype for function 'wmt_dev_read_file' [-Werror,-Wmissing-prototypes]
INT32 wmt_dev_read_file(PUINT8 pName, const PPUINT8 ppBufPtr, INT32 offset, INT32 padSzBuf)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1435:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
INT32 wmt_dev_read_file(PUINT8 pName, const PPUINT8 ppBufPtr, INT32 offset, INT32 padSzBuf)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1597:14: error: no previous prototype for function 'wmt_dev_is_file_exist' [-Werror,-Wmissing-prototypes]
MTK_WCN_BOOL wmt_dev_is_file_exist(PUINT8 pFileName)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1597:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
MTK_WCN_BOOL wmt_dev_is_file_exist(PUINT8 pFileName)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1645:14: error: no previous prototype for function 'wmt_dev_tra_bitf_update' [-Werror,-Wmissing-prototypes]
extern INT32 wmt_dev_tra_bitf_update(void)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1645:8: note: declare 'static' if the function is not intended to be used outside of this translation unit
extern INT32 wmt_dev_tra_bitf_update(void)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1703:6: error: no previous prototype for function 'wmt_dev_tm_temp_query' [-Werror,-Wmissing-prototypes]
long wmt_dev_tm_temp_query(void)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1703:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
long wmt_dev_tm_temp_query(void)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1801:9: error: no previous prototype for function 'WMT_write' [-Werror,-Wmissing-prototypes]
ssize_t WMT_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1801:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
ssize_t WMT_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1834:9: error: no previous prototype for function 'WMT_read' [-Werror,-Wmissing-prototypes]
ssize_t WMT_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1834:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
ssize_t WMT_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
^
static
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1865:14: error: no previous prototype for function 'WMT_poll' [-Werror,-Wmissing-prototypes]
unsigned int WMT_poll(struct file *filp, poll_table *wait)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1865:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
unsigned int WMT_poll(struct file *filp, poll_table *wait)
^
static
>> drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1985:11: error: variable 'u4Wait' set but not used [-Werror,-Wunused-but-set-variable]
UINT32 u4Wait;
^
>> drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:2154:21: error: variable 'pTemp' set but not used [-Werror,-Wunused-but-set-variable]
P_WMT_PATCH_INFO pTemp = NULL;
^
>> drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1885:6: error: no previous prototype for function 'WMT_unlocked_ioctl' [-Werror,-Wmissing-prototypes]
long WMT_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:1885:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
long WMT_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
^
static
>> drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:2368:6: error: no previous prototype for function 'wmt_dev_bgw_desense_init' [-Werror,-Wmissing-prototypes]
void wmt_dev_bgw_desense_init(VOID)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:2368:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void wmt_dev_bgw_desense_init(VOID)
^
static
>> drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:2373:6: error: no previous prototype for function 'wmt_dev_bgw_desense_deinit' [-Werror,-Wmissing-prototypes]
void wmt_dev_bgw_desense_deinit(VOID)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:2373:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void wmt_dev_bgw_desense_deinit(VOID)
^
static
>> drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:2544:5: error: no previous prototype for function 'mtk_wcn_soc_common_drv_init' [-Werror,-Wmissing-prototypes]
int mtk_wcn_soc_common_drv_init(void)
^
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c:2544:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int mtk_wcn_soc_common_drv_init(void)
^
static
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
vim +/u4Wait +1985 drivers/misc/mediatek/connectivity/common/conn_soc/linux/pri/wmt_dev.c
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1883
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1884 /* INT32 WMT_ioctl(struct inode *inode, struct file *filp, UINT32 cmd, unsigned long arg) */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 @1885 long WMT_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1886 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1887
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1888 INT32 iRet = 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1889 UINT8 *pBuffer = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1890
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1891 WMT_DBG_FUNC("cmd (%u), arg (0x%lx)\n", cmd, arg);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1892 switch (cmd) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1893 case WMT_IOCTL_SET_PATCH_NAME: /* patch location */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1894 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1895
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1896 pBuffer = kmalloc(NAME_MAX + 1, GFP_KERNEL);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1897 if (!pBuffer) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1898 WMT_ERR_FUNC("pBuffer kmalloc memory fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1899 return 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1900 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1901 if (copy_from_user(pBuffer, (void *)arg, NAME_MAX)) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1902 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1903 kfree(pBuffer);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1904 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1905 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1906 pBuffer[NAME_MAX] = '\0';
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1907 wmt_lib_set_patch_name(pBuffer);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1908 kfree(pBuffer);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1909 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1910 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1911
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1912 case WMT_IOCTL_SET_STP_MODE: /* stp/hif/fm mode */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1913
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1914 /* set hif conf */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1915 do {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1916 P_OSAL_OP pOp;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1917 MTK_WCN_BOOL bRet;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1918 P_OSAL_SIGNAL pSignal = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1919 P_WMT_HIF_CONF pHif = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1920
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1921 iRet = wmt_lib_set_hif(arg);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1922 if (0 != iRet) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1923 WMT_INFO_FUNC("wmt_lib_set_hif fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1924 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1925 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1926
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1927 pOp = wmt_lib_get_free_op();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1928 if (!pOp) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1929 WMT_INFO_FUNC("get_free_lxop fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1930 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1931 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1932 pSignal = &pOp->signal;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1933 pOp->op.opId = WMT_OPID_HIF_CONF;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1934
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1935 pHif = wmt_lib_get_hif();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1936
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1937 osal_memcpy(&pOp->op.au4OpData[0], pHif, sizeof(WMT_HIF_CONF));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1938 pOp->op.u4InfoBit = WMT_OP_HIF_BIT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1939 pSignal->timeoutValue = 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1940
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1941 bRet = wmt_lib_put_act_op(pOp);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1942 WMT_DBG_FUNC("WMT_OPID_HIF_CONF result(%d)\n", bRet);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1943 iRet = (MTK_WCN_BOOL_FALSE == bRet) ? -EFAULT : 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1944 } while (0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1945
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1946 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1947
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1948 case WMT_IOCTL_FUNC_ONOFF_CTRL: /* test turn on/off func */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1949
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1950 do {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1951 MTK_WCN_BOOL bRet = MTK_WCN_BOOL_FALSE;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1952
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1953 if (arg & 0x80000000)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1954 bRet = mtk_wcn_wmt_func_on(arg & 0xF);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1955 else
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1956 bRet = mtk_wcn_wmt_func_off(arg & 0xF);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1957
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1958 iRet = (MTK_WCN_BOOL_FALSE == bRet) ? -EFAULT : 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1959 } while (0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1960
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1961 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1962
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1963 case WMT_IOCTL_LPBK_POWER_CTRL:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1964 /*switch Loopback function on/off
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1965 arg: bit0 = 1:turn loopback function on
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1966 bit0 = 0:turn loopback function off
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1967 */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1968 do {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1969 MTK_WCN_BOOL bRet = MTK_WCN_BOOL_FALSE;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1970
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1971 if (arg & 0x01)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1972 bRet = mtk_wcn_wmt_func_on(WMTDRV_TYPE_LPBK);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1973 else
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1974 bRet = mtk_wcn_wmt_func_off(WMTDRV_TYPE_LPBK);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1975
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1976 iRet = (MTK_WCN_BOOL_FALSE == bRet) ? -EFAULT : 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1977 } while (0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1978
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1979 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1980
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1981 case WMT_IOCTL_LPBK_TEST:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1982 do {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1983 P_OSAL_OP pOp;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1984 MTK_WCN_BOOL bRet;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 @1985 UINT32 u4Wait;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1986 /* UINT8 lpbk_buf[1024] = {0}; */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1987 UINT32 effectiveLen = 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1988 P_OSAL_SIGNAL pSignal = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1989
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1990 if (copy_from_user(&effectiveLen, (void *)arg, sizeof(effectiveLen))) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1991 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1992 WMT_ERR_FUNC("copy_from_user failed at %d\n", __LINE__);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1993 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1994 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1995 if (effectiveLen > sizeof(gLpbkBuf)) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1996 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1997 WMT_ERR_FUNC("length is too long\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1998 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 1999 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2000 WMT_DBG_FUNC("len = %d\n", effectiveLen);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2001
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2002 pOp = wmt_lib_get_free_op();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2003 if (!pOp) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2004 WMT_WARN_FUNC("get_free_lxop fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2005 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2006 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2007 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2008 u4Wait = 2000;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2009 if (copy_from_user(&gLpbkBuf[0], (void *)arg + sizeof(unsigned long), effectiveLen)) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2010 WMT_ERR_FUNC("copy_from_user failed at %d\n", __LINE__);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2011 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2012 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2013 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2014 pSignal = &pOp->signal;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2015 pOp->op.opId = WMT_OPID_LPBK;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2016 pOp->op.au4OpData[0] = effectiveLen; /* packet length */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2017 pOp->op.au4OpData[1] = (SIZE_T) &gLpbkBuf[0]; /* packet buffer pointer */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2018 memcpy(&gLpbkBufLog, &gLpbkBuf[((effectiveLen >= 4) ? effectiveLen - 4 : 0)], 4);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2019 pSignal->timeoutValue = MAX_EACH_WMT_CMD;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2020 WMT_INFO_FUNC("OPID(%d) type(%d) start\n", pOp->op.opId, pOp->op.au4OpData[0]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2021 if (DISABLE_PSM_MONITOR()) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2022 WMT_ERR_FUNC("wake up failed,OPID(%d) type(%d) abort\n",
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2023 pOp->op.opId, pOp->op.au4OpData[0]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2024 wmt_lib_put_op_to_free_queue(pOp);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2025 return -1;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2026 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2027
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2028 bRet = wmt_lib_put_act_op(pOp);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2029 ENABLE_PSM_MONITOR();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2030 if (MTK_WCN_BOOL_FALSE == bRet) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2031 WMT_WARN_FUNC("OPID(%d) type(%d) buf tail(0x%08x) fail\n",
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2032 pOp->op.opId, pOp->op.au4OpData[0], gLpbkBufLog);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2033 iRet = -1;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2034 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2035 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2036 WMT_INFO_FUNC("OPID(%d) length(%d) ok\n", pOp->op.opId, pOp->op.au4OpData[0]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2037 iRet = pOp->op.au4OpData[0];
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2038 if (copy_to_user((void *)arg + sizeof(SIZE_T) + sizeof(UINT8[2048]), gLpbkBuf, iRet)) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2039 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2040 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2041 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2042
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2043 } while (0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2044
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2045 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2046
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2047 case WMT_IOCTL_ADIE_LPBK_TEST:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2048 do {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2049 P_OSAL_OP pOp;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2050 MTK_WCN_BOOL bRet;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2051 P_OSAL_SIGNAL pSignal = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2052
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2053 pOp = wmt_lib_get_free_op();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2054 if (!pOp) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2055 WMT_WARN_FUNC("get_free_lxop fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2056 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2057 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2058 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2059
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2060 pSignal = &pOp->signal;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2061 pOp->op.opId = WMT_OPID_ADIE_LPBK_TEST;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2062 pOp->op.au4OpData[0] = 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2063 pOp->op.au4OpData[1] = (SIZE_T) &gLpbkBuf[0];
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2064 pSignal->timeoutValue = MAX_EACH_WMT_CMD;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2065 WMT_INFO_FUNC("OPID(%d) start\n", pOp->op.opId);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2066 if (DISABLE_PSM_MONITOR()) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2067 WMT_ERR_FUNC("wake up failed,OPID(%d)abort\n", pOp->op.opId);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2068 wmt_lib_put_op_to_free_queue(pOp);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2069 return -1;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2070 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2071
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2072 bRet = wmt_lib_put_act_op(pOp);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2073 ENABLE_PSM_MONITOR();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2074 if (MTK_WCN_BOOL_FALSE == bRet) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2075 WMT_WARN_FUNC("OPID(%d) fail\n", pOp->op.opId);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2076 iRet = -1;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2077 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2078 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2079 WMT_INFO_FUNC("OPID(%d) length(%d) ok\n", pOp->op.opId, pOp->op.au4OpData[0]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2080 iRet = pOp->op.au4OpData[0];
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2081 if (copy_to_user((void *)arg + sizeof(SIZE_T), gLpbkBuf, iRet)) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2082 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2083 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2084 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2085
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2086 } while (0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2087
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2088 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2089
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2090 case 10:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2091 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2092 pBuffer = kmalloc(NAME_MAX + 1, GFP_KERNEL);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2093 if (!pBuffer) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2094 WMT_ERR_FUNC("pBuffer kmalloc memory fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2095 return 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2096 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2097 wmt_lib_host_awake_get();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2098 mtk_wcn_stp_coredump_start_ctrl(1);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2099 osal_strcpy(pBuffer, "MT662x f/w coredump start-");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2100 if (copy_from_user
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2101 (pBuffer + osal_strlen(pBuffer), (void *)arg, NAME_MAX - osal_strlen(pBuffer))) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2102 /* osal_strcpy(pBuffer, "MT662x f/w assert core dump start"); */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2103 WMT_ERR_FUNC("copy assert string failed\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2104 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2105 pBuffer[NAME_MAX] = '\0';
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2106 osal_dbg_assert_aee(pBuffer, pBuffer);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2107 kfree(pBuffer);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2108 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2109 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2110 case 11:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2111 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2112 osal_dbg_assert_aee("MT662x f/w coredump end", "MT662x firmware coredump ends");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2113 wmt_lib_host_awake_put();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2114 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2115 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2116
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2117 case WMT_IOCTL_GET_CHIP_INFO:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2118 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2119 if (0 == arg)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2120 return wmt_lib_get_icinfo(WMTCHIN_CHIPID);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2121 else if (1 == arg)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2122 return wmt_lib_get_icinfo(WMTCHIN_HWVER);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2123 else if (2 == arg)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2124 return wmt_lib_get_icinfo(WMTCHIN_FWVER);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2125
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2126 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2127 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2128
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2129 case WMT_IOCTL_SET_LAUNCHER_KILL:{
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2130 if (1 == arg) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2131 WMT_INFO_FUNC("launcher may be killed,block abnormal stp tx.\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2132 wmt_lib_set_stp_wmt_last_close(1);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2133 } else {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2134 wmt_lib_set_stp_wmt_last_close(0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2135 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2136
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2137 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2138 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2139
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2140 case WMT_IOCTL_SET_PATCH_NUM:{
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2141 pAtchNum = arg;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2142 WMT_DBG_FUNC(" get patch num from launcher = %d\n", pAtchNum);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2143 wmt_lib_set_patch_num(pAtchNum);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2144 pPatchInfo = kcalloc(pAtchNum, sizeof(WMT_PATCH_INFO), GFP_ATOMIC);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2145 if (!pPatchInfo) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2146 WMT_ERR_FUNC("allocate memory fail!\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2147 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2148 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2149 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2150 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2151
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2152 case WMT_IOCTL_SET_PATCH_INFO:{
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2153 WMT_PATCH_INFO wMtPatchInfo;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 @2154 P_WMT_PATCH_INFO pTemp = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2155 UINT32 dWloadSeq;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2156 static UINT32 counter;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2157
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2158 if (!pPatchInfo) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2159 WMT_ERR_FUNC("NULL patch info pointer\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2160 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2161 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2162
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2163 if (copy_from_user(&wMtPatchInfo, (void *)arg, sizeof(WMT_PATCH_INFO))) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2164 WMT_ERR_FUNC("copy_from_user failed at %d\n", __LINE__);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2165 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2166 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2167 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2168
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2169 dWloadSeq = wMtPatchInfo.dowloadSeq;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2170 WMT_DBG_FUNC(
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2171 "patch dl seq %d,name %s,address info 0x%02x,0x%02x,0x%02x,0x%02x\n",
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2172 dWloadSeq, wMtPatchInfo.patchName,
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2173 wMtPatchInfo.addRess[0],
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2174 wMtPatchInfo.addRess[1],
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2175 wMtPatchInfo.addRess[2],
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2176 wMtPatchInfo.addRess[3]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2177 osal_memcpy(pPatchInfo + dWloadSeq - 1, &wMtPatchInfo, sizeof(WMT_PATCH_INFO));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2178 pTemp = pPatchInfo + dWloadSeq - 1;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2179 if (++counter == pAtchNum) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2180 wmt_lib_set_patch_info(pPatchInfo);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2181 counter = 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2182 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2183 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2184 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2185
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2186 case WMT_IOCTL_WMT_COREDUMP_CTRL:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2187 mtk_wcn_stp_coredump_flag_ctrl(arg);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2188 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2189 case WMT_IOCTL_WMT_QUERY_CHIPID:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2190 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2191 iRet = mtk_wcn_wmt_chipid_query();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2192 WMT_WARN_FUNC("chipid = 0x%x\n", iRet);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2193 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2194 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2195 case WMT_IOCTL_SEND_BGW_DS_CMD:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2196 do {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2197 P_OSAL_OP pOp;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2198 MTK_WCN_BOOL bRet;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2199 UINT8 desense_buf[14] = { 0 };
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2200 UINT32 effectiveLen = 14;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2201 P_OSAL_SIGNAL pSignal = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2202
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2203 pOp = wmt_lib_get_free_op();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2204 if (!pOp) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2205 WMT_WARN_FUNC("get_free_lxop fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2206 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2207 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2208 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2209 if (copy_from_user(&desense_buf[0], (void *)arg, effectiveLen)) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2210 WMT_ERR_FUNC("copy_from_user failed at %d\n", __LINE__);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2211 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2212 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2213 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2214 pSignal = &pOp->signal;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2215 pOp->op.opId = WMT_OPID_BGW_DS;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2216 pOp->op.au4OpData[0] = effectiveLen; /* packet length */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2217 pOp->op.au4OpData[1] = (SIZE_T) &desense_buf[0]; /* packet buffer pointer */
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2218 pSignal->timeoutValue = MAX_EACH_WMT_CMD;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2219 WMT_INFO_FUNC("OPID(%d) start\n", pOp->op.opId);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2220 if (DISABLE_PSM_MONITOR()) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2221 WMT_ERR_FUNC("wake up failed,opid(%d) abort\n", pOp->op.opId);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2222 wmt_lib_put_op_to_free_queue(pOp);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2223 return -1;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2224 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2225
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2226 bRet = wmt_lib_put_act_op(pOp);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2227 ENABLE_PSM_MONITOR();
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2228 if (MTK_WCN_BOOL_FALSE == bRet) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2229 WMT_WARN_FUNC("OPID(%d) fail\n", pOp->op.opId);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2230 iRet = -1;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2231 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2232 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2233 WMT_INFO_FUNC("OPID(%d) length(%d) ok\n", pOp->op.opId, pOp->op.au4OpData[0]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2234 iRet = pOp->op.au4OpData[0];
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2235
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2236 } while (0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2237
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2238 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2239 case WMT_IOCTL_FW_DBGLOG_CTRL:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2240 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2241 iRet = wmt_plat_set_dbg_mode(arg);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2242 if (iRet == 0)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2243 wmt_dbg_fwinfor_from_emi(0, 1, 0);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2244 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2245 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2246 case WMT_IOCTL_DYNAMIC_DUMP_CTRL:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2247 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2248 UINT32 i = 0, j = 0, k = 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2249 UINT8 *pBuf = NULL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2250 UINT32 int_buf[10];
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2251 char Buffer[10][11];
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2252
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2253 pBuf = kmalloc(DYNAMIC_DUMP_BUF + 1, GFP_KERNEL);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2254 if (!pBuf) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2255 WMT_ERR_FUNC("pBuf kmalloc memory fail\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2256 return 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2257 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2258 if (copy_from_user(pBuf, (void *)arg, DYNAMIC_DUMP_BUF)) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2259 iRet = -EFAULT;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2260 kfree(pBuf);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2261 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2262 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2263 pBuf[DYNAMIC_DUMP_BUF] = '\0';
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2264 WMT_INFO_FUNC("get dynamic dump data from property(%s)\n", pBuf);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2265 memset(Buffer, 0, 10*11);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2266 for (i = 0; i < DYNAMIC_DUMP_BUF; i++) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2267 if (pBuf[i] == '/') {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2268 k = 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2269 j++;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2270 } else {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2271 Buffer[j][k] = pBuf[i];
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2272 k++;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2273 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2274 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2275 for (j = 0; j < 10; j++) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2276 iRet = kstrtou32(Buffer[j], 0, &int_buf[j]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2277 if (iRet) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2278 WMT_ERR_FUNC("string convert fail(%d)\n", iRet);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2279 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2280 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2281 WMT_INFO_FUNC("dynamic dump data buf[%d]:(0x%x)\n", j, int_buf[j]);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2282 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2283 wmt_plat_set_dynamic_dumpmem(int_buf);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2284 kfree(pBuf);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2285 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2286 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2287 default:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2288 iRet = -EINVAL;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2289 WMT_WARN_FUNC("unknown cmd (%d)\n", cmd);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2290 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2291 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2292
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2293 return iRet;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2294 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2295 #ifdef CONFIG_COMPAT
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2296 long WMT_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2297 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2298 long ret;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2299 WMT_INFO_FUNC("cmd[0x%x]\n", cmd);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2300 switch (cmd) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2301 case COMPAT_WMT_IOCTL_SET_PATCH_NAME:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2302 ret = WMT_unlocked_ioctl(filp, WMT_IOCTL_SET_PATCH_NAME, (unsigned long)compat_ptr(arg));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2303 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2304 case COMPAT_WMT_IOCTL_LPBK_TEST:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2305 ret = WMT_unlocked_ioctl(filp, WMT_IOCTL_LPBK_TEST, (unsigned long)compat_ptr(arg));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2306 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2307 case COMPAT_WMT_IOCTL_SET_PATCH_INFO:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2308 ret = WMT_unlocked_ioctl(filp, WMT_IOCTL_SET_PATCH_INFO, (unsigned long)compat_ptr(arg));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2309 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2310 case COMPAT_WMT_IOCTL_PORT_NAME:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2311 ret = WMT_unlocked_ioctl(filp, WMT_IOCTL_PORT_NAME, (unsigned long)compat_ptr(arg));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2312 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2313 case COMPAT_WMT_IOCTL_WMT_CFG_NAME:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2314 ret = WMT_unlocked_ioctl(filp, WMT_IOCTL_WMT_CFG_NAME, (unsigned long)compat_ptr(arg));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2315 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2316 case COMPAT_WMT_IOCTL_SEND_BGW_DS_CMD:
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2317 ret = WMT_unlocked_ioctl(filp, WMT_IOCTL_SEND_BGW_DS_CMD, (unsigned long)compat_ptr(arg));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2318 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2319 default: {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2320 ret = WMT_unlocked_ioctl(filp, cmd, arg);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2321 break;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2322 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2323 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2324 return ret;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2325 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2326 #endif
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2327 static int WMT_open(struct inode *inode, struct file *file)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2328 {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2329 long ret;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2330
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2331 WMT_INFO_FUNC("major %d minor %d (pid %d)\n", imajor(inode), iminor(inode), current->pid);
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2332 ret = wait_event_timeout(gWmtInitWq, gWmtInitDone != 0, msecs_to_jiffies(WMT_DEV_INIT_TO_MS));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2333 if (!ret) {
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2334 WMT_WARN_FUNC("wait_event_timeout (%d)ms,(%d)jiffies,return -EIO\n",
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2335 WMT_DEV_INIT_TO_MS, msecs_to_jiffies(WMT_DEV_INIT_TO_MS));
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2336 return -EIO;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2337 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2338
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2339 if (atomic_inc_return(&gWmtRefCnt) == 1)
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2340 WMT_INFO_FUNC("1st call\n");
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2341
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2342 return 0;
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2343 }
d03a149ef0a8e6 Frank Wunderlich 2021-08-29 2344
:::::: The code at line 1985 was first introduced by commit
:::::: d03a149ef0a8e6180c7c086fc189dedb7ecb8af5 mt6625l: add driver folder from 5.14
:::::: TO: Frank Wunderlich <frank-w(a)public-files.de>
:::::: CC: Frank Wunderlich <frank-w(a)public-files.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
drivers/watchdog/mtx-1_wdt.c:184:27: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces))
by kernel test robot
Hi Randy,
First bad commit (maybe != root cause):
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2b14864acbaaf03d9c01982e243a84632524c3ac
commit: 76215889be9d2cd388207545424bbbe3bf80e1ea watchdog: mtx-1: drop au1000.h header file
date: 6 months ago
config: mips-randconfig-s032-20211216 (https://download.01.org/0day-ci/archive/20211216/202112162138.CtaUacXU-lk...)
compiler: mips64-linux-gcc (GCC) 11.2.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.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 76215889be9d2cd388207545424bbbe3bf80e1ea
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash drivers/watchdog/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
>> drivers/watchdog/mtx-1_wdt.c:184:27: sparse: sparse: incorrect type in initializer (incompatible argument 2 (different address spaces)) @@ expected long ( *write )( ... ) @@ got long ( * )( ... ) @@
drivers/watchdog/mtx-1_wdt.c:184:27: sparse: expected long ( *write )( ... )
drivers/watchdog/mtx-1_wdt.c:184:27: sparse: got long ( * )( ... )
vim +184 drivers/watchdog/mtx-1_wdt.c
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 177
b47a166ed0baaa drivers/watchdog/mtx-1_wdt.c Jan Engelhardt 2008-01-22 178 static const struct file_operations mtx1_wdt_fops = {
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 179 .owner = THIS_MODULE,
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 180 .llseek = no_llseek,
ed78c2da149247 drivers/watchdog/mtx-1_wdt.c Alan Cox 2008-05-19 181 .unlocked_ioctl = mtx1_wdt_ioctl,
b6dfb2477fb0bf drivers/watchdog/mtx-1_wdt.c Arnd Bergmann 2019-06-03 182 .compat_ioctl = compat_ptr_ioctl,
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 183 .open = mtx1_wdt_open,
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 @184 .write = mtx1_wdt_write,
7944d3a5a70ee5 drivers/watchdog/mtx-1_wdt.c Wim Van Sebroeck 2008-08-06 185 .release = mtx1_wdt_release,
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 186 };
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 187
04bf3b4f5fc033 drivers/char/watchdog/mtx-1_wdt.c Florian Fainelli 2007-05-06 188
:::::: The code at line 184 was first introduced by commit
:::::: 04bf3b4f5fc033adf921f2e57d034ddbebef5fe7 [WATCHDOG] MTX-1 Watchdog driver
:::::: TO: Florian Fainelli <florian.fainelli(a)int-evry.fr>
:::::: CC: Wim Van Sebroeck <wim(a)iguana.be>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week
[android-common:android13-5.10 2/2] mm/memory.c:4703:9: error: implicit declaration of function 'mmu_notifier_trylock'
by kernel test robot
tree: https://android.googlesource.com/kernel/common android13-5.10
head: 729a79f366e5e7376ee64b955958124c7dc28073
commit: 729a79f366e5e7376ee64b955958124c7dc28073 [2/2] ANDROID: fix mmu_notifier race caused by not taking mmap_lock during SPF
config: arm-randconfig-r002-20211216 (https://download.01.org/0day-ci/archive/20211216/202112162150.bjWRx19B-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dd245bab9fbb364faa1581e4f92ba3119a872fba)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android13-5.10
git checkout 729a79f366e5e7376ee64b955958124c7dc28073
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
>> mm/memory.c:4703:9: error: implicit declaration of function 'mmu_notifier_trylock' [-Werror,-Wimplicit-function-declaration]
if (!mmu_notifier_trylock(vmf->vma->vm_mm)) {
^
1 error generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for QCOM_SCM
Depends on (ARM || ARM64) && HAVE_ARM_SMCCC
Selected by
- ARM_QCOM_SPM_CPUIDLE && CPU_IDLE && (ARM || ARM64) && (ARCH_QCOM || COMPILE_TEST && !ARM64 && MMU
vim +/mmu_notifier_trylock +4703 mm/memory.c
4595
4596 /*
4597 * These routines also need to handle stuff like marking pages dirty
4598 * and/or accessed for architectures that don't do it in hardware (most
4599 * RISC architectures). The early dirtying is also good on the i386.
4600 *
4601 * There is also a hook called "update_mmu_cache()" that architectures
4602 * with external mmu caches can use to update those (ie the Sparc or
4603 * PowerPC hashed page tables that act as extended TLBs).
4604 *
4605 * We enter with non-exclusive mmap_lock (to exclude vma changes, but allow
4606 * concurrent faults).
4607 *
4608 * The mmap_lock may have been released depending on flags and our return value.
4609 * See filemap_fault() and __lock_page_or_retry().
4610 */
4611 static vm_fault_t handle_pte_fault(struct vm_fault *vmf)
4612 {
4613 pte_t entry;
4614 vm_fault_t ret = 0;
4615
4616 if (unlikely(pmd_none(*vmf->pmd))) {
4617 /*
4618 * In the case of the speculative page fault handler we abort
4619 * the speculative path immediately as the pmd is probably
4620 * in the way to be converted in a huge one. We will try
4621 * again holding the mmap_sem (which implies that the collapse
4622 * operation is done).
4623 */
4624 if (vmf->flags & FAULT_FLAG_SPECULATIVE)
4625 return VM_FAULT_RETRY;
4626 /*
4627 * Leave __pte_alloc() until later: because vm_ops->fault may
4628 * want to allocate huge page, and if we expose page table
4629 * for an instant, it will be difficult to retract from
4630 * concurrent faults and from rmap lookups.
4631 */
4632 vmf->pte = NULL;
4633 } else if (!(vmf->flags & FAULT_FLAG_SPECULATIVE)) {
4634 /*
4635 * If a huge pmd materialized under us just retry later. Use
4636 * pmd_trans_unstable() via pmd_devmap_trans_unstable() instead
4637 * of pmd_trans_huge() to ensure the pmd didn't become
4638 * pmd_trans_huge under us and then back to pmd_none, as a
4639 * result of MADV_DONTNEED running immediately after a huge pmd
4640 * fault in a different thread of this mm, in turn leading to a
4641 * misleading pmd_trans_huge() retval. All we have to ensure is
4642 * that it is a regular pmd that we can walk with
4643 * pte_offset_map() and we can do that through an atomic read
4644 * in C, which is what pmd_trans_unstable() provides.
4645 */
4646 if (pmd_devmap_trans_unstable(vmf->pmd))
4647 return 0;
4648 /*
4649 * A regular pmd is established and it can't morph into a huge
4650 * pmd from under us anymore at this point because we hold the
4651 * mmap_lock read mode and khugepaged takes it in write mode.
4652 * So now it's safe to run pte_offset_map().
4653 * This is not applicable to the speculative page fault handler
4654 * but in that case, the pte is fetched earlier in
4655 * handle_speculative_fault().
4656 */
4657 vmf->pte = pte_offset_map(vmf->pmd, vmf->address);
4658 vmf->orig_pte = *vmf->pte;
4659
4660 /*
4661 * some architectures can have larger ptes than wordsize,
4662 * e.g.ppc44x-defconfig has CONFIG_PTE_64BIT=y and
4663 * CONFIG_32BIT=y, so READ_ONCE cannot guarantee atomic
4664 * accesses. The code below just needs a consistent view
4665 * for the ifs and we later double check anyway with the
4666 * ptl lock held. So here a barrier will do.
4667 */
4668 barrier();
4669 if (pte_none(vmf->orig_pte)) {
4670 pte_unmap(vmf->pte);
4671 vmf->pte = NULL;
4672 }
4673 }
4674
4675 if (!vmf->pte) {
4676 if (vma_is_anonymous(vmf->vma))
4677 return do_anonymous_page(vmf);
4678 else if ((vmf->flags & FAULT_FLAG_SPECULATIVE) &&
4679 !vmf_allows_speculation(vmf))
4680 return VM_FAULT_RETRY;
4681 else
4682 return do_fault(vmf);
4683 }
4684
4685 if (!pte_present(vmf->orig_pte))
4686 return do_swap_page(vmf);
4687
4688 if (pte_protnone(vmf->orig_pte) && vma_is_accessible(vmf->vma))
4689 return do_numa_page(vmf);
4690
4691 if (!pte_spinlock(vmf))
4692 return VM_FAULT_RETRY;
4693 entry = vmf->orig_pte;
4694 if (unlikely(!pte_same(*vmf->pte, entry))) {
4695 update_mmu_tlb(vmf->vma, vmf->address, vmf->pte);
4696 goto unlock;
4697 }
4698 if (vmf->flags & FAULT_FLAG_WRITE) {
4699 if (!pte_write(entry)) {
4700 if (!(vmf->flags & FAULT_FLAG_SPECULATIVE))
4701 return do_wp_page(vmf);
4702
> 4703 if (!mmu_notifier_trylock(vmf->vma->vm_mm)) {
4704 ret = VM_FAULT_RETRY;
4705 goto unlock;
4706 }
4707
4708 ret = do_wp_page(vmf);
4709 mmu_notifier_unlock(vmf->vma->vm_mm);
4710 return ret;
4711 }
4712 entry = pte_mkdirty(entry);
4713 }
4714 entry = pte_mkyoung(entry);
4715 if (ptep_set_access_flags(vmf->vma, vmf->address, vmf->pte, entry,
4716 vmf->flags & FAULT_FLAG_WRITE)) {
4717 update_mmu_cache(vmf->vma, vmf->address, vmf->pte);
4718 } else {
4719 /* Skip spurious TLB flush for retried page fault */
4720 if (vmf->flags & FAULT_FLAG_TRIED)
4721 goto unlock;
4722 if (vmf->flags & FAULT_FLAG_SPECULATIVE)
4723 ret = VM_FAULT_RETRY;
4724 /*
4725 * This is needed only for protection faults but the arch code
4726 * is not yet telling us if this is a protection fault or not.
4727 * This still avoids useless tlb flushes for .text page faults
4728 * with threads.
4729 */
4730 if (vmf->flags & FAULT_FLAG_WRITE)
4731 flush_tlb_fix_spurious_fault(vmf->vma, vmf->address);
4732 }
4733 unlock:
4734 pte_unmap_unlock(vmf->pte, vmf->ptl);
4735 return ret;
4736 }
4737
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
9 months, 1 week