drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Sat Mar 04 2023 - 20:22:47 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b01fe98d34f3bed944a93bd8119fed80c856fad8
commit: 93a4fa622eb061f75f87f0cf9609ab4e69c67d01 LoongArch: Add STACKTRACE support
date: 7 months ago
config: loongarch-randconfig-s053-20230305 (https://download.01.org/0day-ci/archive/20230305/202303050909.k3a83A1q-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=93a4fa622eb061f75f87f0cf9609ab4e69c67d01
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 93a4fa622eb061f75f87f0cf9609ab4e69c67d01
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202303050909.k3a83A1q-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got unsigned int [noderef] __percpu *
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got int [noderef] __percpu *
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got int [noderef] __percpu *
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got int [noderef] __percpu *
>> drivers/soc/qcom/rpmh.c:441:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
drivers/soc/qcom/rpmh.c:441:9: sparse: expected void *ptr
drivers/soc/qcom/rpmh.c:441:9: sparse: got int [noderef] __percpu *
--
mm/slub.c:2598:19: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2598:19: sparse: expected void *ptr
mm/slub.c:2598:19: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2598:19: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2598:19: sparse: expected void *ptr
mm/slub.c:2598:19: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2598:19: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2598:19: sparse: expected void *ptr
mm/slub.c:2598:19: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2598:19: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2598:19: sparse: expected void *ptr
mm/slub.c:2598:19: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2619:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2619:9: sparse: expected void *ptr
mm/slub.c:2619:9: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2619:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2619:9: sparse: expected void *ptr
mm/slub.c:2619:9: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2619:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2619:9: sparse: expected void *ptr
mm/slub.c:2619:9: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2619:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2619:9: sparse: expected void *ptr
mm/slub.c:2619:9: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2562:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2562:24: sparse: expected void *ptr
mm/slub.c:2562:24: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2562:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2562:24: sparse: expected void *ptr
mm/slub.c:2562:24: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2562:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2562:24: sparse: expected void *ptr
mm/slub.c:2562:24: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2562:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2562:24: sparse: expected void *ptr
mm/slub.c:2562:24: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2563:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2563:9: sparse: expected void *ptr
mm/slub.c:2563:9: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2563:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2563:9: sparse: expected void *ptr
mm/slub.c:2563:9: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2563:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2563:9: sparse: expected void *ptr
mm/slub.c:2563:9: sparse: got struct slab *[noderef] __percpu *
mm/slub.c:2563:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got struct slab *[noderef] __percpu * @@
mm/slub.c:2563:9: sparse: expected void *ptr
mm/slub.c:2563:9: sparse: got struct slab *[noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
mm/slub.c:2475:9: sparse: sparse: context imbalance in 'deactivate_slab' - different lock contexts for basic block
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
mm/slub.c:2509:55: sparse: sparse: context imbalance in '__unfreeze_partials' - unexpected unlock
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got unsigned int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
>> mm/slub.c:486:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
mm/slub.c:486:17: sparse: expected void *ptr
mm/slub.c:486:17: sparse: got int [noderef] __percpu *
mm/slub.c:3350:47: sparse: sparse: context imbalance in '__slab_free' - unexpected unlock
--
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got unsigned int [noderef] __percpu *
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got unsigned int [noderef] __percpu *
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got unsigned int [noderef] __percpu *
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got unsigned int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got unsigned int [noderef] __percpu *
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got int [noderef] __percpu *
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got int [noderef] __percpu *
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got int [noderef] __percpu *
>> kernel/time/posix-cpu-timers.c:1380:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *ptr @@ got int [noderef] __percpu * @@
kernel/time/posix-cpu-timers.c:1380:9: sparse: expected void *ptr
kernel/time/posix-cpu-timers.c:1380:9: sparse: got int [noderef] __percpu *
kernel/time/posix-cpu-timers.c: note: in included file:
include/linux/sched/signal.h:752:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:752:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:752:37: sparse: got struct spinlock [noderef] __rcu *
kernel/time/posix-cpu-timers.c:42:5: sparse: sparse: context imbalance in 'update_rlimit_cpu' - different lock contexts for basic block
include/linux/sched/signal.h:752:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:752:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:752:37: sparse: got struct spinlock [noderef] __rcu *
include/linux/sched/signal.h:752:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:752:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:752:37: sparse: got struct spinlock [noderef] __rcu *
include/linux/sched/signal.h:752:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:752:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:752:37: sparse: got struct spinlock [noderef] __rcu *
include/linux/sched/signal.h:752:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:752:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:752:37: sparse: got struct spinlock [noderef] __rcu *
include/linux/sched/signal.h:752:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:752:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:752:37: sparse: got struct spinlock [noderef] __rcu *
include/linux/sched/signal.h:752:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
include/linux/sched/signal.h:752:37: sparse: expected struct spinlock [usertype] *lock
include/linux/sched/signal.h:752:37: sparse: got struct spinlock [noderef] __rcu *

vim +441 drivers/soc/qcom/rpmh.c

600513dfeef33c Lina Iyer 2018-06-20 426
600513dfeef33c Lina Iyer 2018-06-20 427 /**
985427f997b6a3 Maulik Shah 2020-04-12 428 * rpmh_flush() - Flushes the buffered sleep and wake sets to TCSes
600513dfeef33c Lina Iyer 2018-06-20 429 *
985427f997b6a3 Maulik Shah 2020-04-12 430 * @ctrlr: Controller making request to flush cached data
600513dfeef33c Lina Iyer 2018-06-20 431 *
985427f997b6a3 Maulik Shah 2020-04-12 432 * Return:
985427f997b6a3 Maulik Shah 2020-04-12 433 * * 0 - Success
985427f997b6a3 Maulik Shah 2020-04-12 434 * * Error code - Otherwise
600513dfeef33c Lina Iyer 2018-06-20 435 */
d5e205079c34aa Maulik Shah 2020-02-03 436 int rpmh_flush(struct rpmh_ctrlr *ctrlr)
600513dfeef33c Lina Iyer 2018-06-20 437 {
600513dfeef33c Lina Iyer 2018-06-20 438 struct cache_req *p;
d2a8cfc6f32026 Douglas Anderson 2020-05-04 439 int ret = 0;
600513dfeef33c Lina Iyer 2018-06-20 440
985427f997b6a3 Maulik Shah 2020-04-12 @441 lockdep_assert_irqs_disabled();
985427f997b6a3 Maulik Shah 2020-04-12 442
d2a8cfc6f32026 Douglas Anderson 2020-05-04 443 /*
d2a8cfc6f32026 Douglas Anderson 2020-05-04 444 * Currently rpmh_flush() is only called when we think we're running
d2a8cfc6f32026 Douglas Anderson 2020-05-04 445 * on the last processor. If the lock is busy it means another
d2a8cfc6f32026 Douglas Anderson 2020-05-04 446 * processor is up and it's better to abort than spin.
d2a8cfc6f32026 Douglas Anderson 2020-05-04 447 */
d2a8cfc6f32026 Douglas Anderson 2020-05-04 448 if (!spin_trylock(&ctrlr->cache_lock))
d2a8cfc6f32026 Douglas Anderson 2020-05-04 449 return -EBUSY;
d2a8cfc6f32026 Douglas Anderson 2020-05-04 450
600513dfeef33c Lina Iyer 2018-06-20 451 if (!ctrlr->dirty) {
600513dfeef33c Lina Iyer 2018-06-20 452 pr_debug("Skipping flush, TCS has latest data.\n");
d2a8cfc6f32026 Douglas Anderson 2020-05-04 453 goto exit;
600513dfeef33c Lina Iyer 2018-06-20 454 }
600513dfeef33c Lina Iyer 2018-06-20 455
f5ac95f9ca2f43 Maulik Shah 2020-04-12 456 /* Invalidate the TCSes first to avoid stale data */
881808d0bbf336 Douglas Anderson 2020-04-13 457 rpmh_rsc_invalidate(ctrlr_to_drv(ctrlr));
f5ac95f9ca2f43 Maulik Shah 2020-04-12 458
c8790cb6da58d3 Lina Iyer 2018-06-20 459 /* First flush the cached batch requests */
c8790cb6da58d3 Lina Iyer 2018-06-20 460 ret = flush_batch(ctrlr);
c8790cb6da58d3 Lina Iyer 2018-06-20 461 if (ret)
d2a8cfc6f32026 Douglas Anderson 2020-05-04 462 goto exit;
c8790cb6da58d3 Lina Iyer 2018-06-20 463
600513dfeef33c Lina Iyer 2018-06-20 464 list_for_each_entry(p, &ctrlr->cache, list) {
600513dfeef33c Lina Iyer 2018-06-20 465 if (!is_req_valid(p)) {
600513dfeef33c Lina Iyer 2018-06-20 466 pr_debug("%s: skipping RPMH req: a:%#x s:%#x w:%#x",
600513dfeef33c Lina Iyer 2018-06-20 467 __func__, p->addr, p->sleep_val, p->wake_val);
600513dfeef33c Lina Iyer 2018-06-20 468 continue;
600513dfeef33c Lina Iyer 2018-06-20 469 }
d5e205079c34aa Maulik Shah 2020-02-03 470 ret = send_single(ctrlr, RPMH_SLEEP_STATE, p->addr,
d5e205079c34aa Maulik Shah 2020-02-03 471 p->sleep_val);
600513dfeef33c Lina Iyer 2018-06-20 472 if (ret)
d2a8cfc6f32026 Douglas Anderson 2020-05-04 473 goto exit;
d5e205079c34aa Maulik Shah 2020-02-03 474 ret = send_single(ctrlr, RPMH_WAKE_ONLY_STATE, p->addr,
d5e205079c34aa Maulik Shah 2020-02-03 475 p->wake_val);
600513dfeef33c Lina Iyer 2018-06-20 476 if (ret)
d2a8cfc6f32026 Douglas Anderson 2020-05-04 477 goto exit;
600513dfeef33c Lina Iyer 2018-06-20 478 }
600513dfeef33c Lina Iyer 2018-06-20 479
600513dfeef33c Lina Iyer 2018-06-20 480 ctrlr->dirty = false;
600513dfeef33c Lina Iyer 2018-06-20 481
d2a8cfc6f32026 Douglas Anderson 2020-05-04 482 exit:
d2a8cfc6f32026 Douglas Anderson 2020-05-04 483 spin_unlock(&ctrlr->cache_lock);
d2a8cfc6f32026 Douglas Anderson 2020-05-04 484 return ret;
600513dfeef33c Lina Iyer 2018-06-20 485 }
600513dfeef33c Lina Iyer 2018-06-20 486

:::::: The code at line 441 was first introduced by commit
:::::: 985427f997b6a31155cce841eb395d43c64771c5 soc: qcom: rpmh: Invoke rpmh_flush() for dirty caches

:::::: TO: Maulik Shah <mkshah@xxxxxxxxxxxxxx>
:::::: CC: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests