lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 14 Jul 2021 19:17:14 +0800
From:   Yong Wu <yong.wu@...iatek.com>
To:     Dafna Hirschfeld <dafna.hirschfeld@...labora.com>
CC:     Matthias Brugger <matthias.bgg@...il.com>,
        Joerg Roedel <joro@...tes.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
        David Airlie <airlied@...ux.ie>,
        "Mauro Carvalho Chehab" <mchehab@...nel.org>,
        Evan Green <evgreen@...omium.org>,
        Robin Murphy <robin.murphy@....com>,
        Tomasz Figa <tfiga@...omium.org>,
        "Will Deacon" <will.deacon@....com>,
        <linux-mediatek@...ts.infradead.org>,
        <srv_heupstream@...iatek.com>, <devicetree@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <iommu@...ts.linux-foundation.org>, <youlin.pei@...iatek.com>,
        Nicolas Boichat <drinkcat@...omium.org>,
        Matthias Kaehlcke <mka@...omium.org>, <anan.sun@...iatek.com>,
        <ming-fan.chen@...iatek.com>, <yi.kuo@...iatek.com>,
        <acourbot@...omium.org>, <linux-media@...r.kernel.org>,
        <dri-devel@...ts.freedesktop.org>, Daniel Vetter <daniel@...ll.ch>,
        Chun-Kuang Hu <chunkuang.hu@...nel.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Xia Jiang <xia.jiang@...iatek.com>,
        Tiffany Lin <tiffany.lin@...iatek.com>,
        Hsin-Yi Wang <hsinyi@...omium.org>,
        "Eizan Miyamoto" <eizan@...omium.org>,
        <anthony.huang@...iatek.com>,
        Yongqiang Niu <yongqiang.niu@...iatek.com>,
        CK Hu <ck.hu@...iatek.com>, <yongqiang.niu@...iatek.com>
Subject: Re: [PATCH v6 06/11] drm/mediatek: Add pm runtime support for ovl
 and rdma

On Wed, 2021-07-14 at 10:44 +0200, Dafna Hirschfeld wrote:
> 
> On 14.07.21 04:56, Yong Wu wrote:
> > From: Yongqiang Niu <yongqiang.niu@...iatek.com>
> > 
> > Prepare for smi cleaning up "mediatek,larb".
> > 
> > Display use the dispsys device to call pm_rumtime_get_sync before.
> > This patch add pm_runtime_xx with ovl and rdma device whose nodes has
> > "iommus" property, then display could help pm_runtime_get for smi via
> > ovl or rdma device.
> > 
> > CC: CK Hu <ck.hu@...iatek.com>
> > Signed-off-by: Yongqiang Niu <yongqiang.niu@...iatek.com>
> > Signed-off-by: Yong Wu <yong.wu@...iatek.com>
> > (Yong: Use pm_runtime_resume_and_get instead of pm_runtime_get_sync)
> > Acked-by: Chun-Kuang Hu <chunkuang.hu@...nel.org>
> > ---
> >   drivers/gpu/drm/mediatek/mtk_disp_ovl.c  |  9 ++++++++-
> >   drivers/gpu/drm/mediatek/mtk_disp_rdma.c |  9 ++++++++-
> >   drivers/gpu/drm/mediatek/mtk_drm_crtc.c  | 12 +++++++++++-
> >   3 files changed, 27 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > index fa9d79963cd3..ea5760f856ec 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_ovl.c
> > @@ -11,6 +11,7 @@
> >   #include <linux/of_device.h>
> >   #include <linux/of_irq.h>
> >   #include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> >   #include <linux/soc/mediatek/mtk-cmdq.h>
> >   
> >   #include "mtk_disp_drv.h"
> > @@ -414,15 +415,21 @@ static int mtk_disp_ovl_probe(struct platform_device *pdev)
> >   		return ret;
> >   	}
> >   
> > +	pm_runtime_enable(dev);
> > +
> >   	ret = component_add(dev, &mtk_disp_ovl_component_ops);
> > -	if (ret)
> > +	if (ret) {
> > +		pm_runtime_disable(dev);
> >   		dev_err(dev, "Failed to add component: %d\n", ret);
> > +	}
> >   
> >   	return ret;
> >   }
> >   
> >   static int mtk_disp_ovl_remove(struct platform_device *pdev)
> >   {
> > +	pm_runtime_disable(&pdev->dev);
> > +
> >   	return 0;
> >   }
> >   
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> > index 705f28ceb4dd..0f31d1c8e37c 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> > @@ -9,6 +9,7 @@
> >   #include <linux/of_device.h>
> >   #include <linux/of_irq.h>
> >   #include <linux/platform_device.h>
> > +#include <linux/pm_runtime.h>
> >   #include <linux/soc/mediatek/mtk-cmdq.h>
> >   
> >   #include "mtk_disp_drv.h"
> > @@ -327,9 +328,13 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
> >   
> >   	platform_set_drvdata(pdev, priv);
> >   
> > +	pm_runtime_enable(dev);
> > +
> >   	ret = component_add(dev, &mtk_disp_rdma_component_ops);
> > -	if (ret)
> > +	if (ret) {
> > +		pm_runtime_disable(dev);
> >   		dev_err(dev, "Failed to add component: %d\n", ret);
> > +	}
> >   
> >   	return ret;
> >   }
> > @@ -338,6 +343,8 @@ static int mtk_disp_rdma_remove(struct platform_device *pdev)
> >   {
> >   	component_del(&pdev->dev, &mtk_disp_rdma_component_ops);
> >   
> > +	pm_runtime_disable(&pdev->dev);
> > +
> >   	return 0;
> >   }
> >   
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > index 474efb844249..08e3f352377d 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> > @@ -557,9 +557,15 @@ static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc,
> >   		return;
> >   	}
> >   
> > +	ret = pm_runtime_resume_and_get(comp->dev);
> > +	if (ret < 0)
> > +		DRM_DEV_ERROR(comp->dev, "Failed to enable power domain: %d\n",
> > +			      ret);
> 
> shouldn't the code return in case of failure here?

After confirm with yongqiang, We will fix this in next version.

Thanks.

> 
> Thanks,
> Dafna
> 
> > +
> >   	ret = mtk_crtc_ddp_hw_init(mtk_crtc);
> >   	if (ret) {
> >   		mtk_smi_larb_put(comp->larb_dev);
> > +		pm_runtime_put(comp->dev);
> >   		return;
> >   	}
> >   
> > @@ -572,7 +578,7 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
> >   {
> >   	struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
> >   	struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0];
> > -	int i;
> > +	int i, ret;
> >   
> >   	DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id);
> >   	if (!mtk_crtc->enabled)
> > @@ -596,6 +602,10 @@ static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc,
> >   	drm_crtc_vblank_off(crtc);
> >   	mtk_crtc_ddp_hw_fini(mtk_crtc);
> >   	mtk_smi_larb_put(comp->larb_dev);
> > +	ret = pm_runtime_put(comp->dev);
> > +	if (ret < 0)
> > +		DRM_DEV_ERROR(comp->dev, "Failed to disable power domain: %d\n",
> > +			      ret);
> >   
> >   	mtk_crtc->enabled = false;
> >   }
> > 
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ