Commit 9026ba72 authored by Thierry Reding's avatar Thierry Reding

gpu: host1x: Use tegra_dev_iommu_get_stream_id()

Use the newly implemented tegra_dev_iommu_get_stream_id() helper to
encapsulate and centralize the IOMMU stream ID access.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 900cd8f0
...@@ -35,8 +35,6 @@ int host1x_memory_context_list_init(struct host1x *host1x) ...@@ -35,8 +35,6 @@ int host1x_memory_context_list_init(struct host1x *host1x)
cdl->len = err / 4; cdl->len = err / 4;
for (i = 0; i < cdl->len; i++) { for (i = 0; i < cdl->len; i++) {
struct iommu_fwspec *fwspec;
ctx = &cdl->devs[i]; ctx = &cdl->devs[i];
ctx->host = host1x; ctx->host = host1x;
...@@ -70,14 +68,12 @@ int host1x_memory_context_list_init(struct host1x *host1x) ...@@ -70,14 +68,12 @@ int host1x_memory_context_list_init(struct host1x *host1x)
goto del_devices; goto del_devices;
} }
fwspec = dev_iommu_fwspec_get(&ctx->dev); if (!tegra_dev_iommu_get_stream_id(&ctx->dev, &ctx->stream_id) ||
if (!fwspec || !device_iommu_mapped(&ctx->dev)) { !device_iommu_mapped(&ctx->dev)) {
dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i); dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i);
device_del(&ctx->dev); device_del(&ctx->dev);
goto del_devices; goto del_devices;
} }
ctx->stream_id = fwspec->ids[0] & 0xffff;
} }
return 0; return 0;
......
...@@ -179,14 +179,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job) ...@@ -179,14 +179,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job)
static void host1x_channel_set_streamid(struct host1x_channel *channel) static void host1x_channel_set_streamid(struct host1x_channel *channel)
{ {
#if HOST1X_HW >= 6 #if HOST1X_HW >= 6
u32 sid = 0x7f; u32 stream_id;
#ifdef CONFIG_IOMMU_API
struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); if (!tegra_dev_iommu_get_stream_id(channel->dev->parent, &stream_id))
if (spec) stream_id = TEGRA_STREAM_ID_BYPASS;
sid = spec->ids[0] & 0xffff;
#endif
host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); host1x_ch_writel(channel, stream_id, HOST1X_CHANNEL_SMMU_STREAMID);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment