Hey Jeffy, Robin:
Some odd issues to report here.
On 23 March 2018 at 04:38, Jeffy Chen wrote:
> Move request_irq to the end of rk_iommu_probe().
>
> Suggested-by: Robin Murphy
> Signed-off-by: Jeffy Chen
> Acked-by: Robin Murphy
> ---
>
> Changes in v8: None
> Changes in v7: None
> Changes in v6: None
> Changes in v5: None
> Changes in v4: None
> Changes in v3:
> Loop platform_get_irq() as Robin suggested.
>
> Changes in v2: None
>
> drivers/iommu/rockchip-iommu.c | 38 +-
> 1 file changed, 9 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 73117dbe839e..ec3ff936aa60 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -90,8 +90,6 @@ struct rk_iommu {
> struct device *dev;
> void __iomem **bases;
> int num_mmu;
> - int *irq;
> - int num_irq;
> bool reset_disabled;
> struct iommu_device iommu;
> struct list_head node; /* entry in rk_iommu_domain.iommus */
> @@ -830,13 +828,6 @@ static int rk_iommu_attach_device(struct iommu_domain
> *domain,
>
> iommu->domain = domain;
>
> - for (i = 0; i < iommu->num_irq; i++) {
> - ret = devm_request_irq(iommu->dev, iommu->irq[i],
> rk_iommu_irq,
> - IRQF_SHARED, dev_name(dev), iommu);
> - if (ret)
> - return ret;
> - }
> -
> for (i = 0; i < iommu->num_mmu; i++) {
> rk_iommu_write(iommu->bases[i], RK_MMU_DTE_ADDR,
>rk_domain->dt_dma);
> @@ -885,9 +876,6 @@ static void rk_iommu_detach_device(struct iommu_domain
> *domain,
> }
> rk_iommu_disable_stall(iommu);
>
> - for (i = 0; i < iommu->num_irq; i++)
> - devm_free_irq(iommu->dev, iommu->irq[i], iommu);
> -
> iommu->domain = NULL;
>
> dev_dbg(dev, "Detached from iommu domain\n");
> @@ -1138,7 +1126,7 @@ static int rk_iommu_probe(struct platform_device *pdev)
> struct rk_iommu *iommu;
> struct resource *res;
> int num_res = pdev->num_resources;
> - int err, i;
> + int err, i, irq;
>
> iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL);
> if (!iommu)
> @@ -1165,23 +1153,15 @@ static int rk_iommu_probe(struct platform_device
> *pdev)
> if (iommu->num_mmu == 0)
> return PTR_ERR(iommu->bases[0]);
>
> - iommu->num_irq = platform_irq_count(pdev);
> - if (iommu->num_irq < 0)
> - return iommu->num_irq;
> - if (iommu->num_irq == 0)
> - return -ENXIO;
> + i = 0;
> + while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) {
> + if (irq < 0)
> + return irq;
>
> - iommu->irq = devm_kcalloc(dev, iommu->num_irq, sizeof(*iommu->irq),
> - GFP_KERNEL);
> - if (!iommu->irq)
> - return -ENOMEM;
> -
> - for (i = 0; i < iommu->num_irq; i++) {
> - iommu->irq[i] = platform_get_irq(pdev, i);
> - if (iommu->irq[i] < 0) {
> - dev_err(dev, "Failed to get IRQ, %d\n",
> iommu->irq[i]);
> - return -ENXIO;
> - }
> + err = devm_request_irq(iommu->dev, irq, rk_iommu_irq,
> + IRQF_SHARED, dev_name(dev), iommu);
> + if (err)
> + return err;
> }
>
> iommu->reset_disabled = device_property_read_bool(dev,
> --
> 2.11.0
>
>
Odd as it may be, this patch is causing problems with DRM,
on any recent kernel, either linux-next or v4.17-rc5 shows
the same issue.
I debugged this issue on a RK3288 Rock2 board connected to
a Samsung TV, but I also saw this warning on a RK3399 board.
The issue is a several-second stall at:
[..]
[2.091953] rockchip-drm display-subsystem: bound ff93.vop (ops
0xc078ebb4)
[2.100310] rockchip-drm display-subsystem: bound ff94.vop (ops
0xc078ebb4)
[2.108550] dwhdmi-rockchip ff98.hdmi: Detected HDMI TX controller
v2.00a with HDCP (DWC MHL PHY)
[2.119307] rockchip-drm display-subsystem: bound ff98.hdmi (ops
0xc0790860)
[2.127588] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[2.134988] [drm] No driver support for vblank timestamp query.
[boot stalls for several seconds]
followed by this warning:
[2.251400] [ cut here ]
[2.251465] WARNING: CPU: 2 PID: 38 at
/home/zeta/repos/linux/next/kernel/irq/manage.c:525 enable_irq+0x34/0x6c
[2.251479] Unbalanced enable for IRQ 49
[2.251490] Modules linked in:
[2.251537] CPU: 2 PID: 38 Comm: kworker/2:1 Not tainted
4.17.0-rc5-1-g5bc6dc2896ec-dirty #31
[2.251551] Hardware name: Rockchip (Device Tree)
[2.251595] Workqueue: events deferred_probe_work_func
[