<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 3, 2013 at 2:33 AM, Stéphane Marchesin <span dir="ltr"><<a href="mailto:stephane.marchesin@gmail.com" target="_blank">stephane.marchesin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Wed, Dec 26, 2012 at 3:27 AM, Prathyush K <<a href="mailto:prathyush.k@samsung.com">prathyush.k@samsung.com</a>> wrote:<br>

> From: Akshu Agrawal <<a href="mailto:akshu.a@samsung.com">akshu.a@samsung.com</a>><br>
><br>
> If any fimd channel was already active, initializing iommu will result<br>
> in a PAGE FAULT (e.g. u-boot could have turned on the display and<br>
> not disabled it before the kernel starts). This patch checks if any<br>
> channel is active before initializing iommu and disables it.<br>
><br>
<br>
</div>Will that work if another drm exynos platform driver (let's say hdmi)<br>
starts before fimd and enables the iommu?<br>
<span class="HOEnZb"><font color="#888888"><br>
Stéphane<br>
</font></span><div class="HOEnZb"><div class="h5"><br></div></div></blockquote><div><br></div><div style>How can hdmi enable fimd's iommu?</div><div style><br></div><div style>iommu initialization has two parts in drm.<br>
</div><div style>A common mapping gets created first. This mapping is common to all devices of drm - fimd, mixer, exynos-drm etc.<br></div><div style>Then each device - calls attach_device to turn on its own iommu. so even if hdmi starts before fimd, hdmi will turn on its own iommu and will not affect fimd.<br>
</div><div style>Hope that clears your doubt.</div><div style><br></div><div style>Regards,</div><div style>Prathyush</div><div style><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">
> Signed-off-by: Akshu Agrawal <<a href="mailto:akshu.a@samsung.com">akshu.a@samsung.com</a>><br>
> Signed-off-by: Prathyush K <<a href="mailto:prathyush.k@samsung.com">prathyush.k@samsung.com</a>><br>
> ---<br>
>  drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++++++++++++++++++++++++++++--<br>
>  1 file changed, 29 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c<br>
> index f88eaa4..3aeedf5 100644<br>
> --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c<br>
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c<br>
> @@ -733,6 +733,28 @@ out:<br>
>         return IRQ_HANDLED;<br>
>  }<br>
><br>
> +static void fimd_clear_channel(struct device *dev)<br>
> +{<br>
> +       struct fimd_context *ctx = get_fimd_context(dev);<br>
> +       int win, ch_enabled = 0;<br>
> +<br>
> +       DRM_DEBUG_KMS("%s\n", __FILE__);<br>
> +<br>
> +       /* Check if any channel is enabled */<br>
> +       for (win = 0; win < WINDOWS_NR; win++) {<br>
> +               u32 val = readl(ctx->regs + SHADOWCON);<br>
> +               if (val & SHADOWCON_CHx_ENABLE(win)) {<br>
> +                       val &= ~SHADOWCON_CHx_ENABLE(win);<br>
> +                       writel(val, ctx->regs + SHADOWCON);<br>
> +                       ch_enabled = 1;<br>
> +               }<br>
> +       }<br>
> +<br>
> +       /* Wait for vsync, as disable channel takes effect at next vsync */<br>
> +       if (ch_enabled)<br>
> +               fimd_wait_for_vblank(dev);<br>
> +}<br>
> +<br>
>  static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev)<br>
>  {<br>
>         DRM_DEBUG_KMS("%s\n", __FILE__);<br>
> @@ -755,9 +777,14 @@ static int fimd_subdrv_probe(struct drm_device *drm_dev, struct device *dev)<br>
>         drm_dev->vblank_disable_allowed = 1;<br>
><br>
>         /* attach this sub driver to iommu mapping if supported. */<br>
> -       if (is_drm_iommu_supported(drm_dev))<br>
> +       if (is_drm_iommu_supported(drm_dev)) {<br>
> +               /*<br>
> +                * If any channel is already active, iommu will throw<br>
> +                * a PAGE FAULT when enabled. So clear any channel if enabled.<br>
> +                */<br>
> +               fimd_clear_channel(dev);<br>
>                 drm_iommu_attach_device(drm_dev, dev);<br>
> -<br>
> +       }<br>
>         return 0;<br>
>  }<br>
><br>
> --<br>
> 1.8.0<br>
><br>
> _______________________________________________<br>
> dri-devel mailing list<br>
> <a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
_______________________________________________<br>
dri-devel mailing list<br>
<a href="mailto:dri-devel@lists.freedesktop.org">dri-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/dri-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
</div></div></blockquote></div><br></div></div>