Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Thierry Reding <treding@nvidia.com>

+7 -13
+2 -6
drivers/gpu/host1x/context.c
··· 35 35 cdl->len = err / 4; 36 36 37 37 for (i = 0; i < cdl->len; i++) { 38 - struct iommu_fwspec *fwspec; 39 - 40 38 ctx = &cdl->devs[i]; 41 39 42 40 ctx->host = host1x; ··· 68 70 goto del_devices; 69 71 } 70 72 71 - fwspec = dev_iommu_fwspec_get(&ctx->dev); 72 - if (!fwspec || !device_iommu_mapped(&ctx->dev)) { 73 + if (!tegra_dev_iommu_get_stream_id(&ctx->dev, &ctx->stream_id) || 74 + !device_iommu_mapped(&ctx->dev)) { 73 75 dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i); 74 76 device_del(&ctx->dev); 75 77 goto del_devices; 76 78 } 77 - 78 - ctx->stream_id = fwspec->ids[0] & 0xffff; 79 79 } 80 80 81 81 return 0;
+5 -7
drivers/gpu/host1x/hw/channel_hw.c
··· 179 179 static void host1x_channel_set_streamid(struct host1x_channel *channel) 180 180 { 181 181 #if HOST1X_HW >= 6 182 - u32 sid = 0x7f; 183 - #ifdef CONFIG_IOMMU_API 184 - struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); 185 - if (spec) 186 - sid = spec->ids[0] & 0xffff; 187 - #endif 182 + u32 stream_id; 188 183 189 - host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); 184 + if (!tegra_dev_iommu_get_stream_id(channel->dev->parent, &stream_id)) 185 + stream_id = TEGRA_STREAM_ID_BYPASS; 186 + 187 + host1x_ch_writel(channel, stream_id, HOST1X_CHANNEL_SMMU_STREAMID); 190 188 #endif 191 189 } 192 190