* [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-05 12:04 ` Miaoqian Lin
0 siblings, 0 replies; 14+ messages in thread
From: Miaoqian Lin @ 2022-01-05 12:04 UTC (permalink / raw)
Cc: linmq006, Emma Anholt, David Airlie, Daniel Vetter, Eric Anholt,
dri-devel, linux-kernel
The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index bd46396a1ae0..4f293aa733b8 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -300,6 +300,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
v3d_gem_destroy(drm);
dma_free:
dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
+pm_disable:
+ pm_runtime_disable(dev);
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
2022-01-05 12:04 ` Miaoqian Lin
@ 2022-01-05 22:37 ` kernel test robot
-1 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-01-05 22:37 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: llvm, kbuild-all
Hi Miaoqian,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm/drm-next]
[also build test WARNING on linux/master linus/master v5.16-rc8 next-20220105]
[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/Miaoqian-Lin/drm-v3d-Fix-PM-disable-depth-imbalance-in-v3d_platform_drm_probe/20220105-200602
base: git://anongit.freedesktop.org/drm/drm drm-next
config: riscv-randconfig-r013-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060655.NBwUPRqC-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/9e89d2b210d16b00d43b6cf5a8e70495403da480
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miaoqian-Lin/drm-v3d-Fix-PM-disable-depth-imbalance-in-v3d_platform_drm_probe/20220105-200602
git checkout 9e89d2b210d16b00d43b6cf5a8e70495403da480
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/gpu/drm/v3d/
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/gpu/drm/v3d/v3d_drv.c:303:1: warning: unused label 'pm_disable' [-Wunused-label]
pm_disable:
^~~~~~~~~~~
1 warning generated.
vim +/pm_disable +303 drivers/gpu/drm/v3d/v3d_drv.c
213
214 static int v3d_platform_drm_probe(struct platform_device *pdev)
215 {
216 struct device *dev = &pdev->dev;
217 struct drm_device *drm;
218 struct v3d_dev *v3d;
219 int ret;
220 u32 mmu_debug;
221 u32 ident1;
222
223 v3d = devm_drm_dev_alloc(dev, &v3d_drm_driver, struct v3d_dev, drm);
224 if (IS_ERR(v3d))
225 return PTR_ERR(v3d);
226
227 drm = &v3d->drm;
228
229 platform_set_drvdata(pdev, drm);
230
231 ret = map_regs(v3d, &v3d->hub_regs, "hub");
232 if (ret)
233 return ret;
234
235 ret = map_regs(v3d, &v3d->core_regs[0], "core0");
236 if (ret)
237 return ret;
238
239 mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO);
240 dma_set_mask_and_coherent(dev,
241 DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)));
242 v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
243
244 ident1 = V3D_READ(V3D_HUB_IDENT1);
245 v3d->ver = (V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_TVER) * 10 +
246 V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_REV));
247 v3d->cores = V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_NCORES);
248 WARN_ON(v3d->cores > 1); /* multicore not yet implemented */
249
250 v3d->reset = devm_reset_control_get_exclusive(dev, NULL);
251 if (IS_ERR(v3d->reset)) {
252 ret = PTR_ERR(v3d->reset);
253
254 if (ret == -EPROBE_DEFER)
255 return ret;
256
257 v3d->reset = NULL;
258 ret = map_regs(v3d, &v3d->bridge_regs, "bridge");
259 if (ret) {
260 dev_err(dev,
261 "Failed to get reset control or bridge regs\n");
262 return ret;
263 }
264 }
265
266 if (v3d->ver < 41) {
267 ret = map_regs(v3d, &v3d->gca_regs, "gca");
268 if (ret)
269 return ret;
270 }
271
272 v3d->mmu_scratch = dma_alloc_wc(dev, 4096, &v3d->mmu_scratch_paddr,
273 GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO);
274 if (!v3d->mmu_scratch) {
275 dev_err(dev, "Failed to allocate MMU scratch page\n");
276 return -ENOMEM;
277 }
278
279 pm_runtime_use_autosuspend(dev);
280 pm_runtime_set_autosuspend_delay(dev, 50);
281 pm_runtime_enable(dev);
282
283 ret = v3d_gem_init(drm);
284 if (ret)
285 goto dma_free;
286
287 ret = v3d_irq_init(v3d);
288 if (ret)
289 goto gem_destroy;
290
291 ret = drm_dev_register(drm, 0);
292 if (ret)
293 goto irq_disable;
294
295 return 0;
296
297 irq_disable:
298 v3d_irq_disable(v3d);
299 gem_destroy:
300 v3d_gem_destroy(drm);
301 dma_free:
302 dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> 303 pm_disable:
304 pm_runtime_disable(dev);
305 return ret;
306 }
307
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-05 22:37 ` kernel test robot
0 siblings, 0 replies; 14+ messages in thread
From: kernel test robot @ 2022-01-05 22:37 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5073 bytes --]
Hi Miaoqian,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm/drm-next]
[also build test WARNING on linux/master linus/master v5.16-rc8 next-20220105]
[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/Miaoqian-Lin/drm-v3d-Fix-PM-disable-depth-imbalance-in-v3d_platform_drm_probe/20220105-200602
base: git://anongit.freedesktop.org/drm/drm drm-next
config: riscv-randconfig-r013-20220105 (https://download.01.org/0day-ci/archive/20220106/202201060655.NBwUPRqC-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/9e89d2b210d16b00d43b6cf5a8e70495403da480
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Miaoqian-Lin/drm-v3d-Fix-PM-disable-depth-imbalance-in-v3d_platform_drm_probe/20220105-200602
git checkout 9e89d2b210d16b00d43b6cf5a8e70495403da480
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/gpu/drm/v3d/
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/gpu/drm/v3d/v3d_drv.c:303:1: warning: unused label 'pm_disable' [-Wunused-label]
pm_disable:
^~~~~~~~~~~
1 warning generated.
vim +/pm_disable +303 drivers/gpu/drm/v3d/v3d_drv.c
213
214 static int v3d_platform_drm_probe(struct platform_device *pdev)
215 {
216 struct device *dev = &pdev->dev;
217 struct drm_device *drm;
218 struct v3d_dev *v3d;
219 int ret;
220 u32 mmu_debug;
221 u32 ident1;
222
223 v3d = devm_drm_dev_alloc(dev, &v3d_drm_driver, struct v3d_dev, drm);
224 if (IS_ERR(v3d))
225 return PTR_ERR(v3d);
226
227 drm = &v3d->drm;
228
229 platform_set_drvdata(pdev, drm);
230
231 ret = map_regs(v3d, &v3d->hub_regs, "hub");
232 if (ret)
233 return ret;
234
235 ret = map_regs(v3d, &v3d->core_regs[0], "core0");
236 if (ret)
237 return ret;
238
239 mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO);
240 dma_set_mask_and_coherent(dev,
241 DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)));
242 v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH);
243
244 ident1 = V3D_READ(V3D_HUB_IDENT1);
245 v3d->ver = (V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_TVER) * 10 +
246 V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_REV));
247 v3d->cores = V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_NCORES);
248 WARN_ON(v3d->cores > 1); /* multicore not yet implemented */
249
250 v3d->reset = devm_reset_control_get_exclusive(dev, NULL);
251 if (IS_ERR(v3d->reset)) {
252 ret = PTR_ERR(v3d->reset);
253
254 if (ret == -EPROBE_DEFER)
255 return ret;
256
257 v3d->reset = NULL;
258 ret = map_regs(v3d, &v3d->bridge_regs, "bridge");
259 if (ret) {
260 dev_err(dev,
261 "Failed to get reset control or bridge regs\n");
262 return ret;
263 }
264 }
265
266 if (v3d->ver < 41) {
267 ret = map_regs(v3d, &v3d->gca_regs, "gca");
268 if (ret)
269 return ret;
270 }
271
272 v3d->mmu_scratch = dma_alloc_wc(dev, 4096, &v3d->mmu_scratch_paddr,
273 GFP_KERNEL | __GFP_NOWARN | __GFP_ZERO);
274 if (!v3d->mmu_scratch) {
275 dev_err(dev, "Failed to allocate MMU scratch page\n");
276 return -ENOMEM;
277 }
278
279 pm_runtime_use_autosuspend(dev);
280 pm_runtime_set_autosuspend_delay(dev, 50);
281 pm_runtime_enable(dev);
282
283 ret = v3d_gem_init(drm);
284 if (ret)
285 goto dma_free;
286
287 ret = v3d_irq_init(v3d);
288 if (ret)
289 goto gem_destroy;
290
291 ret = drm_dev_register(drm, 0);
292 if (ret)
293 goto irq_disable;
294
295 return 0;
296
297 irq_disable:
298 v3d_irq_disable(v3d);
299 gem_destroy:
300 v3d_gem_destroy(drm);
301 dma_free:
302 dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> 303 pm_disable:
304 pm_runtime_disable(dev);
305 return ret;
306 }
307
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
2022-01-05 12:04 ` Miaoqian Lin
@ 2022-01-06 11:57 ` Dave Stevenson
-1 siblings, 0 replies; 14+ messages in thread
From: Dave Stevenson @ 2022-01-06 11:57 UTC (permalink / raw)
To: Miaoqian Lin
Cc: David Airlie, Eric Anholt, DRI Development, LKML, Emma Anholt
Thanks for the patch.
On Wed, 5 Jan 2022 at 12:04, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..4f293aa733b8 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -300,6 +300,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_gem_destroy(drm);
> dma_free:
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> +pm_disable:
> + pm_runtime_disable(dev);
The dma_alloc_wc is done before the pm_runtime_enable, so the cleanup
should be in the opposite order.
Functionally it makes minimal difference in this case as
pm_runtime_enable can't fail, but could cause confusion/errors should
any other initialisation step be added between the two.
The pm_disable label is also unused so not necessary, however if
reversing the order then renaming dma_free to pm_disable would be
sensible.
Dave
> return ret;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-06 11:57 ` Dave Stevenson
0 siblings, 0 replies; 14+ messages in thread
From: Dave Stevenson @ 2022-01-06 11:57 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Emma Anholt, David Airlie, LKML, DRI Development, Eric Anholt
Thanks for the patch.
On Wed, 5 Jan 2022 at 12:04, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..4f293aa733b8 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -300,6 +300,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_gem_destroy(drm);
> dma_free:
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> +pm_disable:
> + pm_runtime_disable(dev);
The dma_alloc_wc is done before the pm_runtime_enable, so the cleanup
should be in the opposite order.
Functionally it makes minimal difference in this case as
pm_runtime_enable can't fail, but could cause confusion/errors should
any other initialisation step be added between the two.
The pm_disable label is also unused so not necessary, however if
reversing the order then renaming dma_free to pm_disable would be
sensible.
Dave
> return ret;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
2022-01-06 11:57 ` Dave Stevenson
@ 2022-01-06 12:46 ` Miaoqian Lin
-1 siblings, 0 replies; 14+ messages in thread
From: Miaoqian Lin @ 2022-01-06 12:46 UTC (permalink / raw)
To: dave.stevenson; +Cc: linmq006, emma, airlied, linux-kernel, dri-devel, eric
The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
Changes in v2
- put pm_runtime_disable before dma_free_wc
- rename dma_free to pm_disable
---
drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index bd46396a1ae0..7d500dd5314e 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
ret = v3d_gem_init(drm);
if (ret)
- goto dma_free;
+ goto pm_disable;
ret = v3d_irq_init(v3d);
if (ret)
@@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
v3d_irq_disable(v3d);
gem_destroy:
v3d_gem_destroy(drm);
-dma_free:
+pm_disable:
+ pm_runtime_disable(dev);
dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-06 12:46 ` Miaoqian Lin
0 siblings, 0 replies; 14+ messages in thread
From: Miaoqian Lin @ 2022-01-06 12:46 UTC (permalink / raw)
To: dave.stevenson; +Cc: airlied, dri-devel, emma, eric, linmq006, linux-kernel
The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
Changes in v2
- put pm_runtime_disable before dma_free_wc
- rename dma_free to pm_disable
---
drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index bd46396a1ae0..7d500dd5314e 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
ret = v3d_gem_init(drm);
if (ret)
- goto dma_free;
+ goto pm_disable;
ret = v3d_irq_init(v3d);
if (ret)
@@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
v3d_irq_disable(v3d);
gem_destroy:
v3d_gem_destroy(drm);
-dma_free:
+pm_disable:
+ pm_runtime_disable(dev);
dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
return ret;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 14+ messages in thread* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
2022-01-06 12:46 ` Miaoqian Lin
@ 2022-01-07 11:03 ` Dave Stevenson
-1 siblings, 0 replies; 14+ messages in thread
From: Dave Stevenson @ 2022-01-07 11:03 UTC (permalink / raw)
To: Miaoqian Lin
Cc: David Airlie, Eric Anholt, Eric Anholt, DRI Development, LKML
On Thu, 6 Jan 2022 at 12:47, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Thanks for the update - that looks good to me.
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> ---
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..7d500dd5314e 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>
> ret = v3d_gem_init(drm);
> if (ret)
> - goto dma_free;
> + goto pm_disable;
>
> ret = v3d_irq_init(v3d);
> if (ret)
> @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_irq_disable(v3d);
> gem_destroy:
> v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> + pm_runtime_disable(dev);
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> return ret;
> }
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-07 11:03 ` Dave Stevenson
0 siblings, 0 replies; 14+ messages in thread
From: Dave Stevenson @ 2022-01-07 11:03 UTC (permalink / raw)
To: Miaoqian Lin
Cc: David Airlie, DRI Development, Eric Anholt, Eric Anholt, LKML
On Thu, 6 Jan 2022 at 12:47, Miaoqian Lin <linmq006@gmail.com> wrote:
>
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Thanks for the update - that looks good to me.
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> ---
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..7d500dd5314e 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>
> ret = v3d_gem_init(drm);
> if (ret)
> - goto dma_free;
> + goto pm_disable;
>
> ret = v3d_irq_init(v3d);
> if (ret)
> @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_irq_disable(v3d);
> gem_destroy:
> v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> + pm_runtime_disable(dev);
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> return ret;
> }
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
2022-01-06 12:46 ` Miaoqian Lin
@ 2022-01-09 17:48 ` Melissa Wen
-1 siblings, 0 replies; 14+ messages in thread
From: Melissa Wen @ 2022-01-09 17:48 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: emma, dave.stevenson, airlied, linux-kernel, dri-devel, eric
[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]
On 01/06, Miaoqian Lin wrote:
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..7d500dd5314e 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>
> ret = v3d_gem_init(drm);
> if (ret)
> - goto dma_free;
> + goto pm_disable;
>
> ret = v3d_irq_init(v3d);
> if (ret)
> @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_irq_disable(v3d);
> gem_destroy:
> v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> + pm_runtime_disable(dev);
Hi,
I see this pm_runtime_disable balancing is also missing for
v3d_platform_drm_remove(), right?
BR,
Melissa
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> return ret;
> }
> --
> 2.17.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-09 17:48 ` Melissa Wen
0 siblings, 0 replies; 14+ messages in thread
From: Melissa Wen @ 2022-01-09 17:48 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: dave.stevenson, emma, airlied, linux-kernel, dri-devel, eric
[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]
On 01/06, Miaoqian Lin wrote:
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
>
> Fixes: 57692c9 ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index bd46396a1ae0..7d500dd5314e 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -282,7 +282,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>
> ret = v3d_gem_init(drm);
> if (ret)
> - goto dma_free;
> + goto pm_disable;
>
> ret = v3d_irq_init(v3d);
> if (ret)
> @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_irq_disable(v3d);
> gem_destroy:
> v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> + pm_runtime_disable(dev);
Hi,
I see this pm_runtime_disable balancing is also missing for
v3d_platform_drm_remove(), right?
BR,
Melissa
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> return ret;
> }
> --
> 2.17.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
2022-01-09 17:48 ` Melissa Wen
@ 2022-01-10 3:05 ` Miaoqian Lin
-1 siblings, 0 replies; 14+ messages in thread
From: Miaoqian Lin @ 2022-01-10 3:05 UTC (permalink / raw)
To: Melissa Wen; +Cc: emma, dave.stevenson, airlied, linux-kernel, dri-devel, eric
Hi Melissa,
On Sun, Jan 09, 2022 at 04:48:17PM -0100, Melissa Wen wrote:
> On 01/06, Miaoqian Lin wrote:
> > The pm_runtime_enable will increase power disable depth.
> > If the probe fails, we should use pm_runtime_disable() to balance
> > pm_runtime_enable().
> >
> > if (ret)
> > - goto dma_free;
> > + goto pm_disable;
> >
> > ret = v3d_irq_init(v3d);
> > if (ret)
> > @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> > v3d_irq_disable(v3d);
> > gem_destroy:
> > v3d_gem_destroy(drm);
> > -dma_free:
> > +pm_disable:
> > + pm_runtime_disable(dev);
>
> Hi,
>
> I see this pm_runtime_disable balancing is also missing for
> v3d_platform_drm_remove(), right?
>
I think, yes.
> > dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> > return ret;
> > }
> > --
> > 2.17.1
> >
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] drm/v3d: Fix PM disable depth imbalance in v3d_platform_drm_probe
@ 2022-01-10 3:05 ` Miaoqian Lin
0 siblings, 0 replies; 14+ messages in thread
From: Miaoqian Lin @ 2022-01-10 3:05 UTC (permalink / raw)
To: Melissa Wen; +Cc: dave.stevenson, emma, airlied, linux-kernel, dri-devel, eric
Hi Melissa,
On Sun, Jan 09, 2022 at 04:48:17PM -0100, Melissa Wen wrote:
> On 01/06, Miaoqian Lin wrote:
> > The pm_runtime_enable will increase power disable depth.
> > If the probe fails, we should use pm_runtime_disable() to balance
> > pm_runtime_enable().
> >
> > if (ret)
> > - goto dma_free;
> > + goto pm_disable;
> >
> > ret = v3d_irq_init(v3d);
> > if (ret)
> > @@ -298,7 +298,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> > v3d_irq_disable(v3d);
> > gem_destroy:
> > v3d_gem_destroy(drm);
> > -dma_free:
> > +pm_disable:
> > + pm_runtime_disable(dev);
>
> Hi,
>
> I see this pm_runtime_disable balancing is also missing for
> v3d_platform_drm_remove(), right?
>
I think, yes.
> > dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> > return ret;
> > }
> > --
> > 2.17.1
> >
^ permalink raw reply [flat|nested] 14+ messages in thread