2023-10-25 12:11:32

by Kaiwei Liu

[permalink] [raw]
Subject: [PATCH 1/3] dmaengine: sprd: support dma device suspend/resume

From: "kaiwei.liu" <[email protected]>

The DMA doesn't support device suspend/resume before, now
some modules using DMA have add device suspend/resume which
may invalidate the DMA runtime suspend/reusume mechanism and
result in abnormal DMA suspend/resume. So here add relative
interface for DMA device suspend/resume.

Signed-off-by: kaiwei.liu <[email protected]>
---
drivers/dma/sprd-dma.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 08fcf1ec368c..0fa950dfa4f0 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -1291,10 +1291,30 @@ static int __maybe_unused sprd_dma_runtime_resume(struct device *dev)
return ret;
}

+static int sprd_dma_suspend_noirq(struct device *dev)
+{
+ if ((pm_runtime_status_suspended(dev)) ||
+ (atomic_read(&(dev->power.usage_count)) > 1))
+ return 0;
+
+ return sprd_dma_runtime_suspend(dev);
+}
+
+static int sprd_dma_resume_early(struct device *dev)
+{
+ if ((pm_runtime_status_suspended(dev)) ||
+ (atomic_read(&(dev->power.usage_count)) > 1))
+ return 0;
+
+ return sprd_dma_runtime_resume(dev);
+}
+
static const struct dev_pm_ops sprd_dma_pm_ops = {
SET_RUNTIME_PM_OPS(sprd_dma_runtime_suspend,
sprd_dma_runtime_resume,
NULL)
+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(sprd_dma_suspend_noirq,
+ sprd_dma_resume_early)
};

static struct platform_driver sprd_dma_driver = {
--
2.17.1


2023-10-25 17:47:29

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/3] dmaengine: sprd: support dma device suspend/resume

Hi Kaiwei,

kernel test robot noticed the following build warnings:

[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on linus/master v6.6-rc7 next-20231025]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Kaiwei-Liu/dmaengine-sprd-delete-enable-opreation-in-probe/20231025-201524
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link: https://lore.kernel.org/r/20231025120500.8914-1-kaiwei.liu%40unisoc.com
patch subject: [PATCH 1/3] dmaengine: sprd: support dma device suspend/resume
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20231026/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231026/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/dma/sprd-dma.c: In function 'sprd_dma_suspend_noirq':
drivers/dma/sprd-dma.c:1296:38: error: 'struct dev_pm_info' has no member named 'usage_count'
1296 | (atomic_read(&(dev->power.usage_count)) > 1))
| ^
drivers/dma/sprd-dma.c: In function 'sprd_dma_resume_early':
drivers/dma/sprd-dma.c:1305:38: error: 'struct dev_pm_info' has no member named 'usage_count'
1305 | (atomic_read(&(dev->power.usage_count)) > 1))
| ^
drivers/dma/sprd-dma.c: At top level:
>> drivers/dma/sprd-dma.c:1302:12: warning: 'sprd_dma_resume_early' defined but not used [-Wunused-function]
1302 | static int sprd_dma_resume_early(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/dma/sprd-dma.c:1293:12: warning: 'sprd_dma_suspend_noirq' defined but not used [-Wunused-function]
1293 | static int sprd_dma_suspend_noirq(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~


vim +/sprd_dma_resume_early +1302 drivers/dma/sprd-dma.c

1292
> 1293 static int sprd_dma_suspend_noirq(struct device *dev)
1294 {
1295 if ((pm_runtime_status_suspended(dev)) ||
1296 (atomic_read(&(dev->power.usage_count)) > 1))
1297 return 0;
1298
1299 return sprd_dma_runtime_suspend(dev);
1300 }
1301
> 1302 static int sprd_dma_resume_early(struct device *dev)
1303 {
1304 if ((pm_runtime_status_suspended(dev)) ||
1305 (atomic_read(&(dev->power.usage_count)) > 1))
1306 return 0;
1307
1308 return sprd_dma_runtime_resume(dev);
1309 }
1310

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

2023-11-01 13:02:49

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/3] dmaengine: sprd: support dma device suspend/resume

Hi Kaiwei,

kernel test robot noticed the following build errors:

[auto build test ERROR on vkoul-dmaengine/next]
[also build test ERROR on linus/master v6.6 next-20231101]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Kaiwei-Liu/dmaengine-sprd-delete-enable-opreation-in-probe/20231025-201524
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
patch link: https://lore.kernel.org/r/20231025120500.8914-1-kaiwei.liu%40unisoc.com
patch subject: [PATCH 1/3] dmaengine: sprd: support dma device suspend/resume
config: openrisc-allyesconfig (https://download.01.org/0day-ci/archive/20231101/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231101/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/dma/sprd-dma.c: In function 'sprd_dma_suspend_noirq':
>> drivers/dma/sprd-dma.c:1296:38: error: 'struct dev_pm_info' has no member named 'usage_count'
1296 | (atomic_read(&(dev->power.usage_count)) > 1))
| ^
drivers/dma/sprd-dma.c: In function 'sprd_dma_resume_early':
drivers/dma/sprd-dma.c:1305:38: error: 'struct dev_pm_info' has no member named 'usage_count'
1305 | (atomic_read(&(dev->power.usage_count)) > 1))
| ^
drivers/dma/sprd-dma.c: At top level:
drivers/dma/sprd-dma.c:1302:12: warning: 'sprd_dma_resume_early' defined but not used [-Wunused-function]
1302 | static int sprd_dma_resume_early(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/dma/sprd-dma.c:1293:12: warning: 'sprd_dma_suspend_noirq' defined but not used [-Wunused-function]
1293 | static int sprd_dma_suspend_noirq(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~~


vim +1296 drivers/dma/sprd-dma.c

1292
1293 static int sprd_dma_suspend_noirq(struct device *dev)
1294 {
1295 if ((pm_runtime_status_suspended(dev)) ||
> 1296 (atomic_read(&(dev->power.usage_count)) > 1))
1297 return 0;
1298
1299 return sprd_dma_runtime_suspend(dev);
1300 }
1301

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