From: kernel test robot <lkp@intel.com>
To: Jeffrey Hugo <jhugo@codeaurora.org>,
manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, Jeffrey Hugo <jhugo@codeaurora.org>
Subject: Re: [PATCH] mhi_bus: core: Wait for ready state after reset
Date: Wed, 17 Feb 2021 08:36:40 +0800 [thread overview]
Message-ID: <202102170848.iuwGefKm-lkp@intel.com> (raw)
In-Reply-To: <1613508745-32324-1-git-send-email-jhugo@codeaurora.org>
[-- Attachment #1: Type: text/plain, Size: 7125 bytes --]
Hi Jeffrey,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.11 next-20210216]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jeffrey-Hugo/mhi_bus-core-Wait-for-ready-state-after-reset/20210217-045558
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f40ddce88593482919761f74910f42f4b84c004b
config: x86_64-randconfig-a013-20210216 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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://github.com/0day-ci/linux/commit/a9148d0d4715fb099ae777ecd89a1d3fab7eb7aa
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jeffrey-Hugo/mhi_bus-core-Wait-for-ready-state-after-reset/20210217-045558
git checkout a9148d0d4715fb099ae777ecd89a1d3fab7eb7aa
# 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@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/bus/mhi/core/pm.c:501:8: warning: variable 'cur_state' is uninitialized when used here [-Wuninitialized]
cur_state == MHI_PM_SYS_ERR_PROCESS) {
^~~~~~~~~
drivers/bus/mhi/core/pm.c:451:2: note: variable 'cur_state' is declared here
enum mhi_pm_state cur_state;
^
1 warning generated.
vim +/cur_state +501 drivers/bus/mhi/core/pm.c
447
448 /* Handle shutdown transitions */
449 static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
450 {
451 enum mhi_pm_state cur_state;
452 struct mhi_event *mhi_event;
453 struct mhi_cmd_ctxt *cmd_ctxt;
454 struct mhi_cmd *mhi_cmd;
455 struct mhi_event_ctxt *er_ctxt;
456 struct device *dev = &mhi_cntrl->mhi_dev->dev;
457 int ret, i;
458
459 dev_dbg(dev, "Processing disable transition with PM state: %s\n",
460 to_mhi_pm_state_str(mhi_cntrl->pm_state));
461
462 mutex_lock(&mhi_cntrl->pm_mutex);
463
464 /* Trigger MHI RESET so that the device will not access host memory */
465 if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
466 u32 in_reset = -1, ready = 0;
467 unsigned long timeout = msecs_to_jiffies(mhi_cntrl->timeout_ms);
468
469 dev_dbg(dev, "Triggering MHI Reset in device\n");
470 mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
471
472 /* Wait for the reset bit to be cleared by the device */
473 ret = wait_event_timeout(mhi_cntrl->state_event,
474 mhi_read_reg_field(mhi_cntrl,
475 mhi_cntrl->regs,
476 MHICTRL,
477 MHICTRL_RESET_MASK,
478 MHICTRL_RESET_SHIFT,
479 &in_reset) ||
480 !in_reset, timeout);
481 if (!ret || in_reset)
482 dev_err(dev, "Device failed to exit MHI Reset state\n");
483
484 /*
485 * Device will clear BHI_INTVEC as a part of RESET processing,
486 * hence re-program it
487 */
488 mhi_write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0);
489
490 if (!MHI_IN_PBL(mhi_get_exec_env(mhi_cntrl))) {
491 /* wait for ready to be set */
492 ret = wait_event_timeout(mhi_cntrl->state_event,
493 mhi_read_reg_field(mhi_cntrl,
494 mhi_cntrl->regs,
495 MHISTATUS,
496 MHISTATUS_READY_MASK,
497 MHISTATUS_READY_SHIFT,
498 &ready)
499 || ready, timeout);
500 if ((!ret || !ready) &&
> 501 cur_state == MHI_PM_SYS_ERR_PROCESS) {
502 dev_err(dev,
503 "Device failed to enter READY state\n");
504 mutex_unlock(&mhi_cntrl->pm_mutex);
505 return;
506 }
507 }
508 }
509
510 dev_dbg(dev,
511 "Waiting for all pending event ring processing to complete\n");
512 mhi_event = mhi_cntrl->mhi_event;
513 for (i = 0; i < mhi_cntrl->total_ev_rings; i++, mhi_event++) {
514 if (mhi_event->offload_ev)
515 continue;
516 free_irq(mhi_cntrl->irq[mhi_event->irq], mhi_event);
517 tasklet_kill(&mhi_event->task);
518 }
519
520 /* Release lock and wait for all pending threads to complete */
521 mutex_unlock(&mhi_cntrl->pm_mutex);
522 dev_dbg(dev, "Waiting for all pending threads to complete\n");
523 wake_up_all(&mhi_cntrl->state_event);
524
525 dev_dbg(dev, "Reset all active channels and remove MHI devices\n");
526 device_for_each_child(&mhi_cntrl->mhi_dev->dev, NULL, mhi_destroy_device);
527
528 mutex_lock(&mhi_cntrl->pm_mutex);
529
530 WARN_ON(atomic_read(&mhi_cntrl->dev_wake));
531 WARN_ON(atomic_read(&mhi_cntrl->pending_pkts));
532
533 /* Reset the ev rings and cmd rings */
534 dev_dbg(dev, "Resetting EV CTXT and CMD CTXT\n");
535 mhi_cmd = mhi_cntrl->mhi_cmd;
536 cmd_ctxt = mhi_cntrl->mhi_ctxt->cmd_ctxt;
537 for (i = 0; i < NR_OF_CMD_RINGS; i++, mhi_cmd++, cmd_ctxt++) {
538 struct mhi_ring *ring = &mhi_cmd->ring;
539
540 ring->rp = ring->base;
541 ring->wp = ring->base;
542 cmd_ctxt->rp = cmd_ctxt->rbase;
543 cmd_ctxt->wp = cmd_ctxt->rbase;
544 }
545
546 mhi_event = mhi_cntrl->mhi_event;
547 er_ctxt = mhi_cntrl->mhi_ctxt->er_ctxt;
548 for (i = 0; i < mhi_cntrl->total_ev_rings; i++, er_ctxt++,
549 mhi_event++) {
550 struct mhi_ring *ring = &mhi_event->ring;
551
552 /* Skip offload events */
553 if (mhi_event->offload_ev)
554 continue;
555
556 ring->rp = ring->base;
557 ring->wp = ring->base;
558 er_ctxt->rp = er_ctxt->rbase;
559 er_ctxt->wp = er_ctxt->rbase;
560 }
561
562 /* Move to disable state */
563 write_lock_irq(&mhi_cntrl->pm_lock);
564 cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_DISABLE);
565 write_unlock_irq(&mhi_cntrl->pm_lock);
566 if (unlikely(cur_state != MHI_PM_DISABLE))
567 dev_err(dev, "Error moving from PM state: %s to: %s\n",
568 to_mhi_pm_state_str(cur_state),
569 to_mhi_pm_state_str(MHI_PM_DISABLE));
570
571 dev_dbg(dev, "Exiting with PM state: %s, MHI state: %s\n",
572 to_mhi_pm_state_str(mhi_cntrl->pm_state),
573 TO_MHI_STATE_STR(mhi_cntrl->dev_state));
574
575 mutex_unlock(&mhi_cntrl->pm_mutex);
576 }
577
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38504 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] mhi_bus: core: Wait for ready state after reset
Date: Wed, 17 Feb 2021 08:36:40 +0800 [thread overview]
Message-ID: <202102170848.iuwGefKm-lkp@intel.com> (raw)
In-Reply-To: <1613508745-32324-1-git-send-email-jhugo@codeaurora.org>
[-- Attachment #1: Type: text/plain, Size: 7304 bytes --]
Hi Jeffrey,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.11 next-20210216]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Jeffrey-Hugo/mhi_bus-core-Wait-for-ready-state-after-reset/20210217-045558
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git f40ddce88593482919761f74910f42f4b84c004b
config: x86_64-randconfig-a013-20210216 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
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://github.com/0day-ci/linux/commit/a9148d0d4715fb099ae777ecd89a1d3fab7eb7aa
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jeffrey-Hugo/mhi_bus-core-Wait-for-ready-state-after-reset/20210217-045558
git checkout a9148d0d4715fb099ae777ecd89a1d3fab7eb7aa
# 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@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/bus/mhi/core/pm.c:501:8: warning: variable 'cur_state' is uninitialized when used here [-Wuninitialized]
cur_state == MHI_PM_SYS_ERR_PROCESS) {
^~~~~~~~~
drivers/bus/mhi/core/pm.c:451:2: note: variable 'cur_state' is declared here
enum mhi_pm_state cur_state;
^
1 warning generated.
vim +/cur_state +501 drivers/bus/mhi/core/pm.c
447
448 /* Handle shutdown transitions */
449 static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl)
450 {
451 enum mhi_pm_state cur_state;
452 struct mhi_event *mhi_event;
453 struct mhi_cmd_ctxt *cmd_ctxt;
454 struct mhi_cmd *mhi_cmd;
455 struct mhi_event_ctxt *er_ctxt;
456 struct device *dev = &mhi_cntrl->mhi_dev->dev;
457 int ret, i;
458
459 dev_dbg(dev, "Processing disable transition with PM state: %s\n",
460 to_mhi_pm_state_str(mhi_cntrl->pm_state));
461
462 mutex_lock(&mhi_cntrl->pm_mutex);
463
464 /* Trigger MHI RESET so that the device will not access host memory */
465 if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) {
466 u32 in_reset = -1, ready = 0;
467 unsigned long timeout = msecs_to_jiffies(mhi_cntrl->timeout_ms);
468
469 dev_dbg(dev, "Triggering MHI Reset in device\n");
470 mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET);
471
472 /* Wait for the reset bit to be cleared by the device */
473 ret = wait_event_timeout(mhi_cntrl->state_event,
474 mhi_read_reg_field(mhi_cntrl,
475 mhi_cntrl->regs,
476 MHICTRL,
477 MHICTRL_RESET_MASK,
478 MHICTRL_RESET_SHIFT,
479 &in_reset) ||
480 !in_reset, timeout);
481 if (!ret || in_reset)
482 dev_err(dev, "Device failed to exit MHI Reset state\n");
483
484 /*
485 * Device will clear BHI_INTVEC as a part of RESET processing,
486 * hence re-program it
487 */
488 mhi_write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0);
489
490 if (!MHI_IN_PBL(mhi_get_exec_env(mhi_cntrl))) {
491 /* wait for ready to be set */
492 ret = wait_event_timeout(mhi_cntrl->state_event,
493 mhi_read_reg_field(mhi_cntrl,
494 mhi_cntrl->regs,
495 MHISTATUS,
496 MHISTATUS_READY_MASK,
497 MHISTATUS_READY_SHIFT,
498 &ready)
499 || ready, timeout);
500 if ((!ret || !ready) &&
> 501 cur_state == MHI_PM_SYS_ERR_PROCESS) {
502 dev_err(dev,
503 "Device failed to enter READY state\n");
504 mutex_unlock(&mhi_cntrl->pm_mutex);
505 return;
506 }
507 }
508 }
509
510 dev_dbg(dev,
511 "Waiting for all pending event ring processing to complete\n");
512 mhi_event = mhi_cntrl->mhi_event;
513 for (i = 0; i < mhi_cntrl->total_ev_rings; i++, mhi_event++) {
514 if (mhi_event->offload_ev)
515 continue;
516 free_irq(mhi_cntrl->irq[mhi_event->irq], mhi_event);
517 tasklet_kill(&mhi_event->task);
518 }
519
520 /* Release lock and wait for all pending threads to complete */
521 mutex_unlock(&mhi_cntrl->pm_mutex);
522 dev_dbg(dev, "Waiting for all pending threads to complete\n");
523 wake_up_all(&mhi_cntrl->state_event);
524
525 dev_dbg(dev, "Reset all active channels and remove MHI devices\n");
526 device_for_each_child(&mhi_cntrl->mhi_dev->dev, NULL, mhi_destroy_device);
527
528 mutex_lock(&mhi_cntrl->pm_mutex);
529
530 WARN_ON(atomic_read(&mhi_cntrl->dev_wake));
531 WARN_ON(atomic_read(&mhi_cntrl->pending_pkts));
532
533 /* Reset the ev rings and cmd rings */
534 dev_dbg(dev, "Resetting EV CTXT and CMD CTXT\n");
535 mhi_cmd = mhi_cntrl->mhi_cmd;
536 cmd_ctxt = mhi_cntrl->mhi_ctxt->cmd_ctxt;
537 for (i = 0; i < NR_OF_CMD_RINGS; i++, mhi_cmd++, cmd_ctxt++) {
538 struct mhi_ring *ring = &mhi_cmd->ring;
539
540 ring->rp = ring->base;
541 ring->wp = ring->base;
542 cmd_ctxt->rp = cmd_ctxt->rbase;
543 cmd_ctxt->wp = cmd_ctxt->rbase;
544 }
545
546 mhi_event = mhi_cntrl->mhi_event;
547 er_ctxt = mhi_cntrl->mhi_ctxt->er_ctxt;
548 for (i = 0; i < mhi_cntrl->total_ev_rings; i++, er_ctxt++,
549 mhi_event++) {
550 struct mhi_ring *ring = &mhi_event->ring;
551
552 /* Skip offload events */
553 if (mhi_event->offload_ev)
554 continue;
555
556 ring->rp = ring->base;
557 ring->wp = ring->base;
558 er_ctxt->rp = er_ctxt->rbase;
559 er_ctxt->wp = er_ctxt->rbase;
560 }
561
562 /* Move to disable state */
563 write_lock_irq(&mhi_cntrl->pm_lock);
564 cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_DISABLE);
565 write_unlock_irq(&mhi_cntrl->pm_lock);
566 if (unlikely(cur_state != MHI_PM_DISABLE))
567 dev_err(dev, "Error moving from PM state: %s to: %s\n",
568 to_mhi_pm_state_str(cur_state),
569 to_mhi_pm_state_str(MHI_PM_DISABLE));
570
571 dev_dbg(dev, "Exiting with PM state: %s, MHI state: %s\n",
572 to_mhi_pm_state_str(mhi_cntrl->pm_state),
573 TO_MHI_STATE_STR(mhi_cntrl->dev_state));
574
575 mutex_unlock(&mhi_cntrl->pm_mutex);
576 }
577
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38504 bytes --]
next prev parent reply other threads:[~2021-02-17 0:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-16 20:52 [PATCH] mhi_bus: core: Wait for ready state after reset Jeffrey Hugo
2021-02-17 0:36 ` kernel test robot [this message]
2021-02-17 0:36 ` kernel test robot
2021-02-19 8:37 ` Dan Carpenter
2021-02-19 8:37 ` Dan Carpenter
2021-02-19 8:37 ` Dan Carpenter
2021-02-17 2:58 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202102170848.iuwGefKm-lkp@intel.com \
--to=lkp@intel.com \
--cc=bbhatt@codeaurora.org \
--cc=clang-built-linux@googlegroups.com \
--cc=hemantk@codeaurora.org \
--cc=jhugo@codeaurora.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.