]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
gpu: host1x: Use tegra_dev_iommu_get_stream_id()
authorThierry Reding <treding@nvidia.com>
Thu, 17 Nov 2022 12:36:19 +0000 (13:36 +0100)
committerThierry Reding <treding@nvidia.com>
Fri, 27 Jan 2023 16:41:49 +0000 (17:41 +0100)
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>
drivers/gpu/host1x/context.c
drivers/gpu/host1x/hw/channel_hw.c

index c8e7994c2c9cd459a7ae676fb3c052f0462b31ce..8beedcf080abd4271ee7968bc95ac84d11999c82 100644 (file)
@@ -35,8 +35,6 @@ int host1x_memory_context_list_init(struct host1x *host1x)
        cdl->len = err / 4;
 
        for (i = 0; i < cdl->len; i++) {
-               struct iommu_fwspec *fwspec;
-
                ctx = &cdl->devs[i];
 
                ctx->host = host1x;
@@ -70,14 +68,12 @@ int host1x_memory_context_list_init(struct host1x *host1x)
                        goto del_devices;
                }
 
-               fwspec = dev_iommu_fwspec_get(&ctx->dev);
-               if (!fwspec || !device_iommu_mapped(&ctx->dev)) {
+               if (!tegra_dev_iommu_get_stream_id(&ctx->dev, &ctx->stream_id) ||
+                   !device_iommu_mapped(&ctx->dev)) {
                        dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i);
                        device_del(&ctx->dev);
                        goto del_devices;
                }
-
-               ctx->stream_id = fwspec->ids[0] & 0xffff;
        }
 
        return 0;
index 0a528573a792857c7aa776b6dd37d93af00f4cfe..d44b8de890be05b697a7c4b5be697b708cf41cbb 100644 (file)
@@ -179,14 +179,12 @@ static inline void synchronize_syncpt_base(struct host1x_job *job)
 static void host1x_channel_set_streamid(struct host1x_channel *channel)
 {
 #if HOST1X_HW >= 6
-       u32 sid = 0x7f;
-#ifdef CONFIG_IOMMU_API
-       struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent);
-       if (spec)
-               sid = spec->ids[0] & 0xffff;
-#endif
+       u32 stream_id;
+
+       if (!tegra_dev_iommu_get_stream_id(channel->dev->parent, &stream_id))
+               stream_id = TEGRA_STREAM_ID_BYPASS;
 
-       host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID);
+       host1x_ch_writel(channel, stream_id, HOST1X_CHANNEL_SMMU_STREAMID);
 #endif
 }