arch/powerpc/kvm/book3s_xive.c:51:15: sparse: sparse: cast to restricted __be16

From: kernel test robot
Date: Tue Jun 14 2022 - 11:59:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b13baccc3850ca8b8cccbf8ed9912dbaa0fdf7f3
commit: b22af9041927075b82bcaf4b6c7a354688198d47 KVM: PPC: Book3s: Remove real mode interrupt controller hcalls handlers
date: 4 weeks ago
config: powerpc64-randconfig-s032-20220613 (https://download.01.org/0day-ci/archive/20220614/202206142322.McgZGdEj-lkp@xxxxxxxxx/config)
compiler: powerpc64le-linux-gcc (GCC) 11.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.4-30-g92122700-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b22af9041927075b82bcaf4b6c7a354688198d47
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout b22af9041927075b82bcaf4b6c7a354688198d47
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/kvm/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> arch/powerpc/kvm/book3s_xive.c:51:15: sparse: sparse: cast to restricted __be16
>> arch/powerpc/kvm/book3s_xive.c:357:41: sparse: sparse: incorrect type in initializer (different base types) @@ expected restricted __be64 [usertype] qw1 @@ got unsigned long @@
arch/powerpc/kvm/book3s_xive.c:357:41: sparse: expected restricted __be64 [usertype] qw1
arch/powerpc/kvm/book3s_xive.c:357:41: sparse: got unsigned long
arch/powerpc/kvm/book3s_xive.c:701:57: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long v @@ got restricted __be64 [usertype] w01 @@
arch/powerpc/kvm/book3s_xive.c:701:57: sparse: expected unsigned long v
arch/powerpc/kvm/book3s_xive.c:701:57: sparse: got restricted __be64 [usertype] w01
arch/powerpc/kvm/book3s_xive.c:702:32: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int v @@ got restricted __be32 [usertype] xive_cam_word @@
arch/powerpc/kvm/book3s_xive.c:702:32: sparse: expected unsigned int v
arch/powerpc/kvm/book3s_xive.c:702:32: sparse: got restricted __be32 [usertype] xive_cam_word
arch/powerpc/kvm/book3s_xive.c:774:49: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be64 [usertype] w01 @@ got unsigned long @@
arch/powerpc/kvm/book3s_xive.c:774:49: sparse: expected restricted __be64 [usertype] w01
arch/powerpc/kvm/book3s_xive.c:774:49: sparse: got unsigned long

vim +51 arch/powerpc/kvm/book3s_xive.c

38
39 static void xive_vm_ack_pending(struct kvmppc_xive_vcpu *xc)
40 {
41 u8 cppr;
42 u16 ack;
43
44 /*
45 * Ensure any previous store to CPPR is ordered vs.
46 * the subsequent loads from PIPR or ACK.
47 */
48 eieio();
49
50 /* Perform the acknowledge OS to register cycle. */
> 51 ack = be16_to_cpu(__raw_readw(xive_tima + TM_SPC_ACK_OS_REG));
52
53 /* Synchronize subsequent queue accesses */
54 mb();
55
56 /* XXX Check grouping level */
57
58 /* Anything ? */
59 if (!((ack >> 8) & TM_QW1_NSR_EO))
60 return;
61
62 /* Grab CPPR of the most favored pending interrupt */
63 cppr = ack & 0xff;
64 if (cppr < 8)
65 xc->pending |= 1 << cppr;
66
67 /* Check consistency */
68 if (cppr >= xc->hw_cppr)
69 pr_warn("KVM-XIVE: CPU %d odd ack CPPR, got %d at %d\n",
70 smp_processor_id(), cppr, xc->hw_cppr);
71
72 /*
73 * Update our image of the HW CPPR. We don't yet modify
74 * xc->cppr, this will be done as we scan for interrupts
75 * in the queues.
76 */
77 xc->hw_cppr = cppr;
78 }
79

--
0-DAY CI Kernel Test Service
https://01.org/lkp