[dm:for-next 5/8] drivers/md/persistent-data/dm-btree.c:702:5: warning: no previous prototype for 'shadow_child'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head: 68040817337fda98196974401391f2d1b9f87e49
commit: d69e2e7e28bd1d13ad2ac1f2e9ea6184567d1587 [5/8] dm btree: improve btree residency
config: um-allmodconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.gi...
git remote add dm https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
git fetch --no-tags dm for-next
git checkout d69e2e7e28bd1d13ad2ac1f2e9ea6184567d1587
# save the attached .config to linux build tree
make W=1 ARCH=um
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 >>):
>> drivers/md/persistent-data/dm-btree.c:702:5: warning: no previous prototype for 'shadow_child' [-Wmissing-prototypes]
702 | int shadow_child(struct dm_btree_info *info, struct dm_btree_value_type *vt,
| ^~~~~~~~~~~~
vim +/shadow_child +702 drivers/md/persistent-data/dm-btree.c
696
697 /*
698 * We often need to modify a sibling node. This function shadows a particular
699 * child of the given parent node. Making sure to update the parent to point
700 * to the new shadow.
701 */
> 702 int shadow_child(struct dm_btree_info *info, struct dm_btree_value_type *vt,
703 struct btree_node *parent, unsigned index, struct dm_block **result)
704 {
705 int r, inc;
706 dm_block_t root;
707 struct btree_node *node;
708
709 root = value64(parent, index);
710
711 r = dm_tm_shadow_block(info->tm, root, &btree_node_validator,
712 result, &inc);
713 if (r)
714 return r;
715
716 node = dm_block_data(*result);
717
718 if (inc)
719 inc_children(info->tm, node, vt);
720
721 *((__le64 *) value_ptr(parent, index)) =
722 cpu_to_le64(dm_block_location(*result));
723
724 return 0;
725 }
726
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[dm:for-next 7/8] include/uapi/linux/byteorder/big_endian.h:32:50: warning: cast from pointer to integer of different size
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git for-next
head: 68040817337fda98196974401391f2d1b9f87e49
commit: def6a7a9a7f0e7e3886fb77cf45c4a48e7e71c36 [7/8] dm space maps: improve performance with inc/dec on ranges of blocks
config: mips-allyesconfig (attached as .config)
compiler: mips-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
# https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.gi...
git remote add dm https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
git fetch --no-tags dm for-next
git checkout def6a7a9a7f0e7e3886fb77cf45c4a48e7e71c36
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips
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 >>):
In file included from include/linux/swab.h:5,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/mips/include/uapi/asm/byteorder.h:13,
from arch/mips/include/asm/bitops.h:20,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/asm-generic/bug.h:20,
from arch/mips/include/asm/bug.h:42,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/current.h:5,
from ./arch/mips/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/blkdev.h:5,
from drivers/md/persistent-data/dm-block-manager.h:11,
from drivers/md/persistent-data/dm-btree.h:9,
from drivers/md/persistent-data/dm-array.h:9,
from drivers/md/persistent-data/dm-array.c:7:
drivers/md/persistent-data/dm-array.c: In function 'block_inc':
>> include/uapi/linux/byteorder/big_endian.h:32:50: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
32 | #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
| ^
include/uapi/linux/swab.h:128:54: note: in definition of macro '__swab64'
128 | #define __swab64(x) (__u64)__builtin_bswap64((__u64)(x))
| ^
include/linux/byteorder/generic.h:87:21: note: in expansion of macro '__le64_to_cpu'
87 | #define le64_to_cpu __le64_to_cpu
| ^~~~~~~~~~~~~
drivers/md/persistent-data/dm-array.c:578:34: note: in expansion of macro 'le64_to_cpu'
578 | dm_tm_inc(info->btree_info.tm, le64_to_cpu(block_le));
| ^~~~~~~~~~~
vim +32 include/uapi/linux/byteorder/big_endian.h
5921e6f8809b161 David Howells 2012-10-13 14
5921e6f8809b161 David Howells 2012-10-13 15 #define __constant_htonl(x) ((__force __be32)(__u32)(x))
5921e6f8809b161 David Howells 2012-10-13 16 #define __constant_ntohl(x) ((__force __u32)(__be32)(x))
5921e6f8809b161 David Howells 2012-10-13 17 #define __constant_htons(x) ((__force __be16)(__u16)(x))
5921e6f8809b161 David Howells 2012-10-13 18 #define __constant_ntohs(x) ((__force __u16)(__be16)(x))
5921e6f8809b161 David Howells 2012-10-13 19 #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
5921e6f8809b161 David Howells 2012-10-13 20 #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
5921e6f8809b161 David Howells 2012-10-13 21 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
5921e6f8809b161 David Howells 2012-10-13 22 #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
5921e6f8809b161 David Howells 2012-10-13 23 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
5921e6f8809b161 David Howells 2012-10-13 24 #define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
5921e6f8809b161 David Howells 2012-10-13 25 #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8809b161 David Howells 2012-10-13 26 #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8809b161 David Howells 2012-10-13 27 #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8809b161 David Howells 2012-10-13 28 #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8809b161 David Howells 2012-10-13 29 #define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8809b161 David Howells 2012-10-13 30 #define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8809b161 David Howells 2012-10-13 31 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
5921e6f8809b161 David Howells 2012-10-13 @32 #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
5921e6f8809b161 David Howells 2012-10-13 33 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
5921e6f8809b161 David Howells 2012-10-13 34 #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
5921e6f8809b161 David Howells 2012-10-13 35 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
5921e6f8809b161 David Howells 2012-10-13 36 #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
5921e6f8809b161 David Howells 2012-10-13 37 #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
5921e6f8809b161 David Howells 2012-10-13 38 #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
5921e6f8809b161 David Howells 2012-10-13 39 #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
5921e6f8809b161 David Howells 2012-10-13 40 #define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
5921e6f8809b161 David Howells 2012-10-13 41 #define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
5921e6f8809b161 David Howells 2012-10-13 42 #define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
5921e6f8809b161 David Howells 2012-10-13 43
:::::: The code at line 32 was first introduced by commit
:::::: 5921e6f8809b1616932ca4afd40fe449faa8fd88 UAPI: (Scripted) Disintegrate include/linux/byteorder
:::::: TO: David Howells <dhowells(a)redhat.com>
:::::: CC: David Howells <dhowells(a)redhat.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
{standard input}:3140: Error: operands mismatch -- statement `andl %a1,%d1' ignored
by kernel test robot
Hi Brendan,
FYI, the error/warning still remains.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c3d0e3fd41b7f0f5d5d5b6022ab7e813f04ea727
commit: 981f94c3e92146705baf97fb417a5ed1ab1a79a5 bpf: Add bitwise atomic instructions
date: 4 months ago
config: m68k-randconfig-r002-20210520 (attached as .config)
compiler: m68k-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
# 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 981f94c3e92146705baf97fb417a5ed1ab1a79a5
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
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 >>):
In file included from include/linux/kernel.h:10,
from include/linux/list.h:9,
from include/linux/preempt.h:11,
from arch/m68k/include/asm/irqflags.h:6,
from include/linux/irqflags.h:16,
from arch/m68k/include/asm/atomic.h:6,
from include/linux/atomic.h:7,
from include/linux/filter.h:10,
from kernel/bpf/core.c:21:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:174:49: warning: ordered comparison of pointer with null pointer [-Wextra]
174 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
78 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
include/linux/scatterlist.h:137:2: note: in expansion of macro 'BUG_ON'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~
include/linux/scatterlist.h:137:10: note: in expansion of macro 'virt_addr_valid'
137 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
kernel/bpf/core.c: At top level:
kernel/bpf/core.c:1350:12: warning: no previous prototype for 'bpf_probe_read_kernel' [-Wmissing-prototypes]
1350 | u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr)
| ^~~~~~~~~~~~~~~~~~~~~
{standard input}: Assembler messages:
{standard input}:3094: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d0,%d1,(%a6)' ignored
>> {standard input}:3140: Error: operands mismatch -- statement `andl %a1,%d1' ignored
{standard input}:3140: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d0,%d1,(%a6)' ignored
>> {standard input}:3193: Error: operands mismatch -- statement `orl %a1,%d1' ignored
{standard input}:3193: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d0,%d1,(%a6)' ignored
>> {standard input}:3239: Error: operands mismatch -- statement `eorl %a1,%d1' ignored
{standard input}:3239: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d0,%d1,(%a6)' ignored
{standard input}:3262: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d0,%d5,(%a0)' ignored
{standard input}:3299: Error: invalid instruction for this architecture; needs 68020 or higher (68020 [68k, 68ec020], 68030 [68ec030], 68040 [68ec040], 68060 [68ec060]) -- statement `casl %d0,%d5,(%a6)' ignored
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[drm-drm-misc:drm-misc-next 8/16] drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:332:1: warning: unused label 'exit'
by kernel test robot
tree: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head: 07775fc13878cbc2e9cda5ffac7c7289adee91cb
commit: f89f8c6bafd0692d3afd21488d012ceb1baf6df6 [8/16] drm/amdgpu: Guard against write accesses after device removal
config: powerpc64-randconfig-r026-20210520 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bf9ef3efaa99c02e7bfc4c57207301b8de39a278)
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 powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
git remote add drm-drm-misc git://anongit.freedesktop.org/drm/drm-misc
git fetch --no-tags drm-drm-misc drm-misc-next
git checkout f89f8c6bafd0692d3afd21488d012ceb1baf6df6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64
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 >>):
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:332:1: warning: unused label 'exit' [-Wunused-label]
exit:
^~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1140:18: warning: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
res->start > 0x100000000ull)
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4662:6: warning: no previous prototype for function 'amdgpu_device_recheck_guilty_jobs' [-Wmissing-prototypes]
void amdgpu_device_recheck_guilty_jobs(
^
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:4662:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void amdgpu_device_recheck_guilty_jobs(
^
static
3 warnings generated.
vim +/exit +332 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
315
316 spin_lock_irqsave(&adev->mmio_idx_lock, flags);
317 for (last = pos + size; pos < last; pos += 4) {
318 uint32_t tmp = pos >> 31;
319
320 WREG32_NO_KIQ(mmMM_INDEX, ((uint32_t)pos) | 0x80000000);
321 if (tmp != hi) {
322 WREG32_NO_KIQ(mmMM_INDEX_HI, tmp);
323 hi = tmp;
324 }
325 if (write)
326 WREG32_NO_KIQ(mmMM_DATA, *buf++);
327 else
328 *buf++ = RREG32_NO_KIQ(mmMM_DATA);
329 }
330 spin_unlock_irqrestore(&adev->mmio_idx_lock, flags);
331
> 332 exit:
333 drm_dev_exit(idx);
334 }
335
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
arch/sh/boards/mach-rsk/devices-rsk7203.c:131:9: sparse: sparse: incorrect type in argument 1 (different base types)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c3d0e3fd41b7f0f5d5d5b6022ab7e813f04ea727
commit: e5fc436f06eef54ef512ea55a9db8eb9f2e76959 sparse: use static inline for __chk_{user,io}_ptr()
date: 9 months ago
config: sh-randconfig-s032-20210520 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-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 e5fc436f06eef54ef512ea55a9db8eb9f2e76959
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=sh
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 >>)
>> arch/sh/boards/mach-rsk/devices-rsk7203.c:131:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected void const volatile [noderef] __iomem *ptr @@ got unsigned int @@
arch/sh/boards/mach-rsk/devices-rsk7203.c:131:9: sparse: expected void const volatile [noderef] __iomem *ptr
arch/sh/boards/mach-rsk/devices-rsk7203.c:131:9: sparse: got unsigned int
vim +131 arch/sh/boards/mach-rsk/devices-rsk7203.c
3787aa112c653b arch/sh/boards/renesas/rsk7203/setup.c Paul Mundt 2008-05-19 123
3787aa112c653b arch/sh/boards/renesas/rsk7203/setup.c Paul Mundt 2008-05-19 124 static int __init rsk7203_devices_setup(void)
3787aa112c653b arch/sh/boards/renesas/rsk7203/setup.c Paul Mundt 2008-05-19 125 {
7a5c679b52d064 arch/sh/boards/board-rsk7203.c Magnus Damm 2008-10-08 126 /* Select pins for SCIF0 */
7a5c679b52d064 arch/sh/boards/board-rsk7203.c Magnus Damm 2008-10-08 127 gpio_request(GPIO_FN_TXD0, NULL);
7a5c679b52d064 arch/sh/boards/board-rsk7203.c Magnus Damm 2008-10-08 128 gpio_request(GPIO_FN_RXD0, NULL);
7a5c679b52d064 arch/sh/boards/board-rsk7203.c Magnus Damm 2008-10-08 129
724cfb944007b7 arch/sh/boards/mach-rsk/devices-rsk7203.c Magnus Damm 2009-04-28 130 /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */
9d56dd3b083a3b arch/sh/boards/mach-rsk/devices-rsk7203.c Paul Mundt 2010-01-26 @131 __raw_writel(0x36db0400, 0xfffc0008); /* CS1BCR */
:::::: The code at line 131 was first introduced by commit
:::::: 9d56dd3b083a3bec56e9da35ce07baca81030b03 sh: Mass ctrl_in/outX to __raw_read/writeX conversion.
:::::: TO: Paul Mundt <lethal(a)linux-sh.org>
:::::: CC: Paul Mundt <lethal(a)linux-sh.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[zx2c4-wireguard-linux:stable 7/7] drivers/net/wireguard/main.c:57:1: warning: unused label 'err_selftests'
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/wireguard-linux.git stable
head: da063960365c1da4ff0375fdf51a3d5d3346d9a7
commit: da063960365c1da4ff0375fdf51a3d5d3346d9a7 [7/7] wireguard: allowedips: allocate nodes in kmem_cache
config: x86_64-randconfig-a016-20210520 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bf9ef3efaa99c02e7bfc4c57207301b8de39a278)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/wireguard-linux.git...
git remote add zx2c4-wireguard-linux https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/wireguard-linux.git
git fetch --no-tags zx2c4-wireguard-linux stable
git checkout da063960365c1da4ff0375fdf51a3d5d3346d9a7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
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 >>):
>> drivers/net/wireguard/main.c:57:1: warning: unused label 'err_selftests' [-Wunused-label]
err_selftests:
^~~~~~~~~~~~~~
1 warning generated.
vim +/err_selftests +57 drivers/net/wireguard/main.c
19
20 static int __init mod_init(void)
21 {
22 int ret;
23
24 ret = wg_allowedips_slab_init();
25 if (ret < 0)
26 goto err_allowedips;
27
28 #ifdef DEBUG
29 ret = -ENOTRECOVERABLE;
30 if (!wg_allowedips_selftest() || !wg_packet_counter_selftest() ||
31 !wg_ratelimiter_selftest())
32 goto err_selftests;
33 #endif
34 wg_noise_init();
35
36 ret = wg_peer_init();
37 if (ret < 0)
38 goto err_peer;
39
40 ret = wg_device_init();
41 if (ret < 0)
42 goto err_device;
43
44 ret = wg_genetlink_init();
45 if (ret < 0)
46 goto err_netlink;
47
48 pr_info("WireGuard " WIREGUARD_VERSION " loaded. See www.wireguard.com for information.\n");
49 pr_info("Copyright (C) 2015-2019 Jason A. Donenfeld <Jason(a)zx2c4.com>. All Rights Reserved.\n");
50
51 return 0;
52
53 err_netlink:
54 wg_device_uninit();
55 err_device:
56 wg_peer_uninit();
> 57 err_selftests:
58 err_peer:
59 wg_allowedips_slab_uninit();
60 err_allowedips:
61 return ret;
62 }
63
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[hch-block:bvec-phys 23/31] drivers/vhost/vringh.c:1185:2: error: 'kaddr' undeclared
by kernel test robot
tree: git://git.infradead.org/users/hch/block.git bvec-phys
head: 282ec99e1ddbbefe986790bef36bf50573d15cf2
commit: 89142b678be44d8b11844add9d2b511dcb66edd9 [23/31] vhost: use bvec_kmap_local in {get,put}u16_iotlb
config: mips-randconfig-r011-20210520 (attached as .config)
compiler: mips64el-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
git remote add hch-block git://git.infradead.org/users/hch/block.git
git fetch --no-tags hch-block bvec-phys
git checkout 89142b678be44d8b11844add9d2b511dcb66edd9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips
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/vhost/vringh.c: In function 'getu16_iotlb':
>> drivers/vhost/vringh.c:1185:2: error: 'kaddr' undeclared (first use in this function)
1185 | kaddr = bvec_kmap_local(&iov);
| ^~~~~
drivers/vhost/vringh.c:1185:2: note: each undeclared identifier is reported only once for each function it appears in
drivers/vhost/vringh.c:1176:8: warning: unused variable 'from' [-Wunused-variable]
1176 | void *from;
| ^~~~
drivers/vhost/vringh.c: In function 'putu16_iotlb':
>> drivers/vhost/vringh.c:1207:2: error: implicit declaration of function 'kunmap_loal'; did you mean 'kunmap_local'? [-Werror=implicit-function-declaration]
1207 | kunmap_loal(kaddr);
| ^~~~~~~~~~~
| kunmap_local
cc1: some warnings being treated as errors
vim +/kaddr +1185 drivers/vhost/vringh.c
1171
1172 static inline int getu16_iotlb(const struct vringh *vrh,
1173 u16 *val, const __virtio16 *p)
1174 {
1175 struct bio_vec iov;
1176 void *from;
1177 int ret;
1178
1179 /* Atomic read is needed for getu16 */
1180 ret = iotlb_translate(vrh, (u64)(uintptr_t)p, sizeof(*p),
1181 &iov, 1, VHOST_MAP_RO);
1182 if (ret < 0)
1183 return ret;
1184
> 1185 kaddr = bvec_kmap_local(&iov);
1186 *val = vringh16_to_cpu(vrh, READ_ONCE(*(__virtio16 *)kaddr));
1187 kunmap_local(kaddr);
1188
1189 return 0;
1190 }
1191
1192 static inline int putu16_iotlb(const struct vringh *vrh,
1193 __virtio16 *p, u16 val)
1194 {
1195 struct bio_vec iov;
1196 void *kaddr;
1197 int ret;
1198
1199 /* Atomic write is needed for putu16 */
1200 ret = iotlb_translate(vrh, (u64)(uintptr_t)p, sizeof(*p),
1201 &iov, 1, VHOST_MAP_WO);
1202 if (ret < 0)
1203 return ret;
1204
1205 kaddr = bvec_kmap_local(&iov);
1206 WRITE_ONCE(*(__virtio16 *)kaddr, cpu_to_vringh16(vrh, val));
> 1207 kunmap_loal(kaddr);
1208
1209 return 0;
1210 }
1211
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[frank-w-bpi-r2-4.14:5.10-main 6/34] drivers/pci/probe.c:929:39: error: 'struct device' has no member named 'msi_domain'; did you mean 'pm_domain'?
by kernel test robot
tree: https://github.com/frank-w/BPI-R2-4.14 5.10-main
head: e2d611389c10351ed2caab346dca9f8f2cb9af60
commit: aae45a226341c84a12b431abb7904bb39cac53c2 [6/34] pci: fix MSI issue part 2
config: x86_64-randconfig-c022-20210519 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/frank-w/BPI-R2-4.14/commit/aae45a226341c84a12b431abb79...
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.10-main
git checkout aae45a226341c84a12b431abb7904bb39cac53c2
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
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/pci/probe.c: In function 'pci_register_host_bridge':
>> drivers/pci/probe.c:929:39: error: 'struct device' has no member named 'msi_domain'; did you mean 'pm_domain'?
929 | (bridge->msi_domain && !bus->dev.msi_domain))
| ^~~~~~~~~~
| pm_domain
vim +929 drivers/pci/probe.c
903
904 b = pci_find_bus(pci_domain_nr(bus), bridge->busnr);
905 if (b) {
906 /* Ignore it if we already got here via a different bridge */
907 dev_dbg(&b->dev, "bus already known\n");
908 err = -EEXIST;
909 goto free;
910 }
911
912 dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(bus),
913 bridge->busnr);
914
915 err = pcibios_root_bridge_prepare(bridge);
916 if (err)
917 goto free;
918
919 err = device_add(&bridge->dev);
920 if (err) {
921 put_device(&bridge->dev);
922 goto free;
923 }
924 bus->bridge = get_device(&bridge->dev);
925 device_enable_async_suspend(bus->bridge);
926 pci_set_bus_of_node(bus);
927 pci_set_bus_msi_domain(bus);
928 if (bridge->no_msi ||
> 929 (bridge->msi_domain && !bus->dev.msi_domain))
930 bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
931
932 if (!parent)
933 set_dev_node(bus->bridge, pcibus_to_node(bus));
934
935 bus->dev.class = &pcibus_class;
936 bus->dev.parent = bus->bridge;
937
938 dev_set_name(&bus->dev, "%04x:%02x", pci_domain_nr(bus), bus->number);
939 name = dev_name(&bus->dev);
940
941 err = device_register(&bus->dev);
942 if (err)
943 goto unregister;
944
945 pcibios_add_bus(bus);
946
947 if (bus->ops->add_bus) {
948 err = bus->ops->add_bus(bus);
949 if (WARN_ON(err < 0))
950 dev_err(&bus->dev, "failed to add bus: %d\n", err);
951 }
952
953 /* Create legacy_io and legacy_mem files for this bus */
954 pci_create_legacy_files(bus);
955
956 if (parent)
957 dev_info(parent, "PCI host bridge to bus %s\n", name);
958 else
959 pr_info("PCI host bridge to bus %s\n", name);
960
961 if (nr_node_ids > 1 && pcibus_to_node(bus) == NUMA_NO_NODE)
962 dev_warn(&bus->dev, "Unknown NUMA node; performance will be reduced\n");
963
964 /* Add initial resources to the bus */
965 resource_list_for_each_entry_safe(window, n, &resources) {
966 list_move_tail(&window->node, &bridge->windows);
967 offset = window->offset;
968 res = window->res;
969
970 if (res->flags & IORESOURCE_BUS)
971 pci_bus_insert_busn_res(bus, bus->number, res->end);
972 else
973 pci_bus_add_resource(bus, res, 0);
974
975 if (offset) {
976 if (resource_type(res) == IORESOURCE_IO)
977 fmt = " (bus address [%#06llx-%#06llx])";
978 else
979 fmt = " (bus address [%#010llx-%#010llx])";
980
981 snprintf(addr, sizeof(addr), fmt,
982 (unsigned long long)(res->start - offset),
983 (unsigned long long)(res->end - offset));
984 } else
985 addr[0] = '\0';
986
987 dev_info(&bus->dev, "root bus resource %pR%s\n", res, addr);
988 }
989
990 down_write(&pci_bus_sem);
991 list_add_tail(&bus->node, &pci_root_buses);
992 up_write(&pci_bus_sem);
993
994 return 0;
995
996 unregister:
997 put_device(&bridge->dev);
998 device_del(&bridge->dev);
999
1000 free:
1001 kfree(bus);
1002 return err;
1003 }
1004
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[linux-next:master 196/4016] arch/sh/kernel/crash_dump.c:37:61: sparse: sparse: incorrect type in argument 2 (different address spaces)
by kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 7a42b92b6d30c3f09629c7d5ada9e3de2aba01af
commit: 258cf5f8aef48f76e1933fc9524a476d21e21e68 [196/4016] sh: kdump: add some attribute to function
config: sh-allyesconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commi...
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout 258cf5f8aef48f76e1933fc9524a476d21e21e68
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=sh
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 >>)
>> arch/sh/kernel/crash_dump.c:37:61: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got void [noderef] __iomem * @@
arch/sh/kernel/crash_dump.c:37:61: sparse: expected void const *from
arch/sh/kernel/crash_dump.c:37:61: sparse: got void [noderef] __iomem *
>> arch/sh/kernel/crash_dump.c:42:28: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *__from @@ got void [noderef] __iomem * @@
arch/sh/kernel/crash_dump.c:42:28: sparse: expected void const *__from
arch/sh/kernel/crash_dump.c:42:28: sparse: got void [noderef] __iomem *
vim +37 arch/sh/kernel/crash_dump.c
12
13 /**
14 * copy_oldmem_page - copy one page from "oldmem"
15 * @pfn: page frame number to be copied
16 * @buf: target memory address for the copy; this can be in kernel address
17 * space or user address space (see @userbuf)
18 * @csize: number of bytes to copy
19 * @offset: offset in bytes into the page (based on pfn) to begin the copy
20 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
21 * otherwise @buf is in kernel address space, use memcpy().
22 *
23 * Copy a page from "oldmem". For this page, there is no pte mapped
24 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
25 */
26 ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
27 size_t csize, unsigned long offset, int userbuf)
28 {
29 void __iomem *vaddr;
30
31 if (!csize)
32 return 0;
33
34 vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
35
36 if (userbuf) {
> 37 if (copy_to_user((void __user *)buf, (vaddr + offset), csize)) {
38 iounmap(vaddr);
39 return -EFAULT;
40 }
41 } else
> 42 memcpy(buf, (vaddr + offset), csize);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months
[freescale-fslc:pr/344 9435/18956] drivers/virtio/virtio_ivshmem.c:119:55: sparse: sparse: restricted __le32 degrades to integer
by kernel test robot
tree: https://github.com/Freescale/linux-fslc pr/344
head: 2cbb55e591febb414b623269d61d4444113c285f
commit: 3ea2de8648ea6ecd86e527bdd5993740e8bc7cef [9435/18956] virtio: Add virtio-over-ivshmem transport driver
config: ia64-randconfig-s032-20210520 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/Freescale/linux-fslc/commit/3ea2de8648ea6ecd86e527bdd5...
git remote add freescale-fslc https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc pr/344
git checkout 3ea2de8648ea6ecd86e527bdd5993740e8bc7cef
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=ia64
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 >>)
>> drivers/virtio/virtio_ivshmem.c:119:55: sparse: sparse: restricted __le32 degrades to integer
>> drivers/virtio/virtio_ivshmem.c:140:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] @@ got restricted __le16 [usertype] @@
drivers/virtio/virtio_ivshmem.c:140:42: sparse: expected unsigned short [usertype]
drivers/virtio/virtio_ivshmem.c:140:42: sparse: got restricted __le16 [usertype]
>> drivers/virtio/virtio_ivshmem.c:142:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __le32 [usertype] @@
drivers/virtio/virtio_ivshmem.c:142:42: sparse: expected unsigned int [usertype]
drivers/virtio/virtio_ivshmem.c:142:42: sparse: got restricted __le32 [usertype]
>> drivers/virtio/virtio_ivshmem.c:144:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] @@ got restricted __le64 [usertype] @@
drivers/virtio/virtio_ivshmem.c:144:42: sparse: expected unsigned long long [usertype]
drivers/virtio/virtio_ivshmem.c:144:42: sparse: got restricted __le64 [usertype]
>> drivers/virtio/virtio_ivshmem.c:188:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] w @@ got unsigned short [usertype] @@
drivers/virtio/virtio_ivshmem.c:188:19: sparse: expected restricted __le16 [usertype] w
drivers/virtio/virtio_ivshmem.c:188:19: sparse: got unsigned short [usertype]
>> drivers/virtio/virtio_ivshmem.c:192:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] l @@ got unsigned int [usertype] @@
drivers/virtio/virtio_ivshmem.c:192:19: sparse: expected restricted __le32 [usertype] l
drivers/virtio/virtio_ivshmem.c:192:19: sparse: got unsigned int [usertype]
>> drivers/virtio/virtio_ivshmem.c:196:19: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le64 [usertype] q @@ got unsigned long long [usertype] @@
drivers/virtio/virtio_ivshmem.c:196:19: sparse: expected restricted __le64 [usertype] q
drivers/virtio/virtio_ivshmem.c:196:19: sparse: got unsigned long long [usertype]
>> drivers/virtio/virtio_ivshmem.c:233:20: sparse: sparse: incorrect type in initializer (different base types) @@ expected unsigned int [usertype] gen @@ got restricted __le32 [addressable] __val @@
drivers/virtio/virtio_ivshmem.c:233:20: sparse: expected unsigned int [usertype] gen
drivers/virtio/virtio_ivshmem.c:233:20: sparse: got restricted __le32 [addressable] __val
drivers/virtio/virtio_ivshmem.c:236:55: sparse: sparse: restricted __le32 degrades to integer
>> drivers/virtio/virtio_ivshmem.c:243:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] gen @@ got restricted __le32 [addressable] __val @@
drivers/virtio/virtio_ivshmem.c:243:21: sparse: expected unsigned int [usertype] gen
drivers/virtio/virtio_ivshmem.c:243:21: sparse: got restricted __le32 [addressable] __val
drivers/virtio/virtio_ivshmem.c:336:13: sparse: sparse: restricted __le32 degrades to integer
>> drivers/virtio/virtio_ivshmem.c:405:14: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int size @@ got restricted __le16 [usertype] queue_size @@
drivers/virtio/virtio_ivshmem.c:405:14: sparse: expected unsigned int size
drivers/virtio/virtio_ivshmem.c:405:14: sparse: got restricted __le16 [usertype] queue_size
>> drivers/virtio/virtio_ivshmem.c:411:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int device_vector @@ got restricted __le16 [usertype] queue_device_vector @@
drivers/virtio/virtio_ivshmem.c:411:29: sparse: expected unsigned int device_vector
drivers/virtio/virtio_ivshmem.c:411:29: sparse: got restricted __le16 [usertype] queue_device_vector
drivers/virtio/virtio_ivshmem.c:865:34: sparse: sparse: restricted __le32 degrades to integer
>> drivers/virtio/virtio_ivshmem.c:889:63: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long size @@ got restricted __le32 [usertype] size @@
drivers/virtio/virtio_ivshmem.c:889:63: sparse: expected unsigned long size
drivers/virtio/virtio_ivshmem.c:889:63: sparse: got restricted __le32 [usertype] size
drivers/virtio/virtio_ivshmem.c:900:36: sparse: sparse: restricted __le32 degrades to integer
>> drivers/virtio/virtio_ivshmem.c:908:16: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
drivers/virtio/virtio_ivshmem.c:908:16: sparse: expected unsigned int [usertype] value
drivers/virtio/virtio_ivshmem.c:908:16: sparse: got restricted __le32 [usertype]
drivers/virtio/virtio_ivshmem.c: note: in included file (through arch/ia64/include/asm/io.h, arch/ia64/include/asm/smp.h, include/linux/smp.h, ...):
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:179:15: sparse: sparse: cast to restricted __le32
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
include/asm-generic/io.h:225:22: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
include/asm-generic/io.h:225:22: sparse: expected unsigned int [usertype] value
include/asm-generic/io.h:225:22: sparse: got restricted __le32 [usertype]
vim +119 drivers/virtio/virtio_ivshmem.c
115
116 static bool vi_synchronize_reg_write(struct virtio_ivshmem_device *vi_dev)
117 {
118 while (READ_ONCE(vi_dev->virtio_header->write_transaction)) {
> 119 if (READ_ONCE(*vi_dev->peer_state) != VIRTIO_STATE_READY) {
120 dev_err_ratelimited(&vi_dev->pci_dev->dev,
121 "backend failed!");
122 return false;
123 }
124 cpu_relax();
125 }
126 return true;
127 }
128
129 static bool vi_reg_write(struct virtio_ivshmem_device *vi_dev, unsigned int reg,
130 u64 value, unsigned int size)
131 {
132 u8 *reg_area = (u8 *)vi_dev->virtio_header;
133
134 if (!vi_synchronize_reg_write(vi_dev))
135 return false;
136
137 if (size == 1)
138 *(u8 *)(reg_area + reg) = (u8)value;
139 else if (size == 2)
> 140 *(u16 *)(reg_area + reg) = cpu_to_le16((u16)value);
141 else if (size == 4)
> 142 *(u32 *)(reg_area + reg) = cpu_to_le32((u32)value);
143 else if (size == 8)
> 144 *(u64 *)(reg_area + reg) = cpu_to_le64(value);
145 else
146 BUG();
147 virt_wmb();
148
149 vi_dev->virtio_header->write_transaction = cpu_to_le32(reg);
150 virt_wmb();
151
152 writel((vi_dev->peer_id << 16), &vi_dev->ivshm_regs->doorbell);
153
154 return true;
155 }
156
157 static bool vi_reg_write16(struct virtio_ivshmem_device *vi_dev,
158 unsigned int reg, u32 value)
159 {
160 return vi_reg_write(vi_dev, reg, value, 2);
161 }
162
163 static bool vi_reg_write32(struct virtio_ivshmem_device *vi_dev,
164 unsigned int reg, u32 value)
165 {
166 return vi_reg_write(vi_dev, reg, value, 4);
167 }
168
169 static bool vi_reg_write64(struct virtio_ivshmem_device *vi_dev,
170 unsigned int reg, u64 value)
171 {
172 return vi_reg_write(vi_dev, reg, value, 8);
173 }
174
175 static void vi_get(struct virtio_device *vdev, unsigned offset,
176 void *buf, unsigned len)
177 {
178 struct virtio_ivshmem_device *vi_dev = to_virtio_ivshmem_device(vdev);
179 __le16 w;
180 __le32 l;
181 __le64 q;
182
183 switch (len) {
184 case 1:
185 *(u8 *)buf = *(u8 *)(vi_dev->virtio_header->config + offset);
186 break;
187 case 2:
> 188 w = *(u16 *)(vi_dev->virtio_header->config + offset);
189 *(u16 *)buf = le16_to_cpu(w);
190 break;
191 case 4:
> 192 l = *(u32 *)(vi_dev->virtio_header->config + offset);
193 *(u32 *)buf = le32_to_cpu(l);
194 break;
195 case 8:
> 196 q = *(u64 *)(vi_dev->virtio_header->config + offset);
197 *(u64 *)buf = le64_to_cpu(q);
198 break;
199 default:
200 BUG();
201 }
202 }
203
204 static void vi_set(struct virtio_device *vdev, unsigned offset,
205 const void *buf, unsigned len)
206 {
207 u64 value;
208
209 switch (len) {
210 case 1:
211 value = *(u8 *)buf;
212 break;
213 case 2:
214 value = *(u16 *)buf;
215 break;
216 case 4:
217 value = *(u32 *)buf;
218 break;
219 case 8:
220 value = *(u64 *)buf;
221 break;
222 default:
223 BUG();
224 }
225 vi_reg_write(to_virtio_ivshmem_device(vdev),
226 offsetof(struct virtio_ivshmem_header, config) + offset,
227 value, len);
228 }
229
230 static u32 vi_generation(struct virtio_device *vdev)
231 {
232 struct virtio_ivshmem_device *vi_dev = to_virtio_ivshmem_device(vdev);
> 233 u32 gen = READ_ONCE(vi_dev->virtio_header->config_generation);
234
235 while (gen & 1) {
236 if (READ_ONCE(*vi_dev->peer_state) != VIRTIO_STATE_READY) {
237 dev_err_ratelimited(&vi_dev->pci_dev->dev,
238 "backend failed!");
239 return 0;
240 }
241 cpu_relax();
242
> 243 gen = READ_ONCE(vi_dev->virtio_header->config_generation);
244 }
245 return gen;
246 }
247
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
1 year, 4 months