2012/12/3 Prathyush K <span dir="ltr"><<a href="mailto:prathyush.k@samsung.com" target="_blank">prathyush.k@samsung.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
According to the new IOMMU framework for exynos sysmmus, the owner<br>
of the sysmmu-tv is mixer (which is the actual device that does DMA)<br>
and not hdmi.<br>
The mmu-master in sysmmu-tv node is set as below in exynos5250.dtsi.<br>
sysmmu-tv {<br>
-<br>
mmu-master = <&mixer>;<br>
};<br>
<br>
This patch moves the iommu_on function from the hdmi context to the<br>
mixer context.<br></blockquote><div><br><br>Right, that works fine as is but the iommu support should be moved to mixer side anyway.<br>But this
patch hasn't been merged to mainline so we are enough to leave comment
so that this can be fixed. Otherwise, unnecessary commits could be
applied to mainline.<br>So I will post patch v2 for hdmi iommu support.<br><br>Thanks,<br>Inki Dae<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
And this patch is based on exynos-drm-next-iommu branch of<br>
git://<a href="http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos" target="_blank">git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos</a><br>
<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_hdmi.c | 8 ++++----<br>
drivers/gpu/drm/exynos/exynos_drm_hdmi.h | 2 +-<br>
drivers/gpu/drm/exynos/exynos_hdmi.c | 24 ------------------------<br>
drivers/gpu/drm/exynos/exynos_mixer.c | 23 +++++++++++++++++++++++<br>
4 files changed, 28 insertions(+), 29 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c<br>
index 997fb6e..8b771a3 100644<br>
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c<br>
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c<br>
@@ -368,8 +368,8 @@ static int hdmi_subdrv_probe(struct drm_device *drm_dev,<br>
ctx->hdmi_ctx->drm_dev = drm_dev;<br>
ctx->mixer_ctx->drm_dev = drm_dev;<br>
<br>
- if (hdmi_ops->iommu_on)<br>
- hdmi_ops->iommu_on(ctx->hdmi_ctx->ctx, true);<br>
+ if (mixer_ops->iommu_on)<br>
+ mixer_ops->iommu_on(ctx->mixer_ctx->ctx, true);<br>
<br>
return 0;<br>
}<br>
@@ -381,8 +381,8 @@ static void hdmi_subdrv_remove(struct drm_device *drm_dev, struct device *dev)<br>
<br>
ctx = get_ctx_from_subdrv(subdrv);<br>
<br>
- if (hdmi_ops->iommu_on)<br>
- hdmi_ops->iommu_on(ctx->hdmi_ctx->ctx, false);<br>
+ if (mixer_ops->iommu_on)<br>
+ mixer_ops->iommu_on(ctx->mixer_ctx->ctx, false);<br>
}<br>
<br>
static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)<br>
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h<br>
index 5c033d1..54b5223 100644<br>
--- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h<br>
+++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h<br>
@@ -50,7 +50,6 @@ struct exynos_hdmi_ops {<br>
int (*power_on)(void *ctx, int mode);<br>
<br>
/* manager */<br>
- int (*iommu_on)(void *ctx, bool enable);<br>
void (*mode_fixup)(void *ctx, struct drm_connector *connector,<br>
const struct drm_display_mode *mode,<br>
struct drm_display_mode *adjusted_mode);<br>
@@ -63,6 +62,7 @@ struct exynos_hdmi_ops {<br>
<br>
struct exynos_mixer_ops {<br>
/* manager */<br>
+ int (*iommu_on)(void *ctx, bool enable);<br>
int (*enable_vblank)(void *ctx, int pipe);<br>
void (*disable_vblank)(void *ctx);<br>
void (*dpms)(void *ctx, int mode);<br>
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c<br>
index d1a1d71..7df1d85 100644<br>
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c<br>
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c<br>
@@ -40,7 +40,6 @@<br>
<br>
#include "exynos_drm_drv.h"<br>
#include "exynos_drm_hdmi.h"<br>
-#include "exynos_drm_iommu.h"<br>
<br>
#include "exynos_hdmi.h"<br>
<br>
@@ -68,7 +67,6 @@ struct hdmi_resources {<br>
<br>
struct hdmi_context {<br>
struct device *dev;<br>
- struct drm_device *drm_dev;<br>
bool hpd;<br>
bool powered;<br>
bool dvi_mode;<br>
@@ -85,7 +83,6 @@ struct hdmi_context {<br>
int cur_conf;<br>
<br>
struct hdmi_resources res;<br>
- void *parent_ctx;<br>
<br>
int hpd_gpio;<br>
<br>
@@ -1947,25 +1944,6 @@ static void hdmi_conf_apply(struct hdmi_context *hdata)<br>
hdmi_regs_dump(hdata, "start");<br>
}<br>
<br>
-static int hdmi_iommu_on(void *ctx, bool enable)<br>
-{<br>
- struct exynos_drm_hdmi_context *drm_hdmi_ctx;<br>
- struct hdmi_context *hdata = ctx;<br>
- struct drm_device *drm_dev;<br>
-<br>
- drm_hdmi_ctx = hdata->parent_ctx;<br>
- drm_dev = drm_hdmi_ctx->drm_dev;<br>
-<br>
- if (is_drm_iommu_supported(drm_dev)) {<br>
- if (enable)<br>
- return drm_iommu_attach_device(drm_dev, hdata->dev);<br>
-<br>
- drm_iommu_detach_device(drm_dev, hdata->dev);<br>
- }<br>
-<br>
- return 0;<br>
-}<br>
-<br>
static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector,<br>
const struct drm_display_mode *mode,<br>
struct drm_display_mode *adjusted_mode)<br>
@@ -2122,7 +2100,6 @@ static struct exynos_hdmi_ops hdmi_ops = {<br>
.check_timing = hdmi_check_timing,<br>
<br>
/* manager */<br>
- .iommu_on = hdmi_iommu_on,<br>
.mode_fixup = hdmi_mode_fixup,<br>
.mode_set = hdmi_mode_set,<br>
.get_max_resol = hdmi_get_max_resol,<br>
@@ -2379,7 +2356,6 @@ static int __devinit hdmi_probe(struct platform_device *pdev)<br>
mutex_init(&hdata->hdmi_mutex);<br>
<br>
drm_hdmi_ctx->ctx = (void *)hdata;<br>
- hdata->parent_ctx = (void *)drm_hdmi_ctx;<br>
<br>
platform_set_drvdata(pdev, drm_hdmi_ctx);<br>
<br>
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c<br>
index 614b2e9..574ed3f 100644<br>
--- a/drivers/gpu/drm/exynos/exynos_mixer.c<br>
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c<br>
@@ -36,6 +36,7 @@<br>
<br>
#include "exynos_drm_drv.h"<br>
#include "exynos_drm_hdmi.h"<br>
+#include "exynos_drm_iommu.h"<br>
<br>
#define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev))<br>
<br>
@@ -80,6 +81,7 @@ enum mixer_version_id {<br>
<br>
struct mixer_context {<br>
struct device *dev;<br>
+ struct drm_device *drm_dev;<br>
int pipe;<br>
bool interlace;<br>
bool powered;<br>
@@ -90,6 +92,7 @@ struct mixer_context {<br>
struct mixer_resources mixer_res;<br>
struct hdmi_win_data win_data[MIXER_WIN_NR];<br>
enum mixer_version_id mxr_ver;<br>
+ void *parent_ctx;<br>
};<br>
<br>
struct mixer_drv_data {<br>
@@ -665,6 +668,24 @@ static void mixer_win_reset(struct mixer_context *ctx)<br>
spin_unlock_irqrestore(&res->reg_slock, flags);<br>
}<br>
<br>
+static int mixer_iommu_on(void *ctx, bool enable)<br>
+{<br>
+ struct exynos_drm_hdmi_context *drm_hdmi_ctx;<br>
+ struct mixer_context *mdata = ctx;<br>
+ struct drm_device *drm_dev;<br>
+<br>
+ drm_hdmi_ctx = mdata->parent_ctx;<br>
+ drm_dev = drm_hdmi_ctx->drm_dev;<br>
+<br>
+ if (is_drm_iommu_supported(drm_dev)) {<br>
+ if (enable)<br>
+ return drm_iommu_attach_device(drm_dev, mdata->dev);<br>
+<br>
+ drm_iommu_detach_device(drm_dev, mdata->dev);<br>
+ }<br>
+ return 0;<br>
+}<br>
+<br>
static void mixer_poweron(struct mixer_context *ctx)<br>
{<br>
struct mixer_resources *res = &ctx->mixer_res;<br>
@@ -866,6 +887,7 @@ static void mixer_win_disable(void *ctx, int win)<br>
<br>
static struct exynos_mixer_ops mixer_ops = {<br>
/* manager */<br>
+ .iommu_on = mixer_iommu_on,<br>
.enable_vblank = mixer_enable_vblank,<br>
.disable_vblank = mixer_disable_vblank,<br>
.dpms = mixer_dpms,<br>
@@ -1149,6 +1171,7 @@ static int __devinit mixer_probe(struct platform_device *pdev)<br>
}<br>
<br>
ctx->dev = &pdev->dev;<br>
+ ctx->parent_ctx = (void *)drm_hdmi_ctx;<br>
drm_hdmi_ctx->ctx = (void *)ctx;<br>
ctx->vp_enabled = drv->is_vp_enabled;<br>
ctx->mxr_ver = drv->version;<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.0.4<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>
</font></span></blockquote></div><br>