Skip to content

Commit b50ad38

Browse files
committed
drm/tegra: vic: 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>
1 parent b8cbb04 commit b50ad38

1 file changed

Lines changed: 14 additions & 25 deletions

File tree

  • drivers/gpu/drm/tegra

drivers/gpu/drm/tegra/vic.c

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,41 +56,30 @@ static void vic_writel(struct vic *vic, u32 value, unsigned int offset)
5656

5757
static int vic_boot(struct vic *vic)
5858
{
59-
#ifdef CONFIG_IOMMU_API
60-
struct iommu_fwspec *spec = dev_iommu_fwspec_get(vic->dev);
61-
#endif
62-
u32 fce_ucode_size, fce_bin_data_offset;
59+
u32 fce_ucode_size, fce_bin_data_offset, stream_id;
6360
void *hdr;
6461
int err = 0;
6562

66-
#ifdef CONFIG_IOMMU_API
67-
if (vic->config->supports_sid && spec) {
63+
if (vic->config->supports_sid && tegra_dev_iommu_get_stream_id(vic->dev, &stream_id)) {
6864
u32 value;
6965

7066
value = TRANSCFG_ATT(1, TRANSCFG_SID_FALCON) |
7167
TRANSCFG_ATT(0, TRANSCFG_SID_HW);
7268
vic_writel(vic, value, VIC_TFBIF_TRANSCFG);
7369

74-
if (spec->num_ids > 0) {
75-
value = spec->ids[0] & 0xffff;
76-
77-
/*
78-
* STREAMID0 is used for input/output buffers.
79-
* Initialize it to SID_VIC in case context isolation
80-
* is not enabled, and SID_VIC is used for both firmware
81-
* and data buffers.
82-
*
83-
* If context isolation is enabled, it will be
84-
* overridden by the SETSTREAMID opcode as part of
85-
* each job.
86-
*/
87-
vic_writel(vic, value, VIC_THI_STREAMID0);
88-
89-
/* STREAMID1 is used for firmware loading. */
90-
vic_writel(vic, value, VIC_THI_STREAMID1);
91-
}
70+
/*
71+
* STREAMID0 is used for input/output buffers. Initialize it to SID_VIC in case
72+
* context isolation is not enabled, and SID_VIC is used for both firmware and
73+
* data buffers.
74+
*
75+
* If context isolation is enabled, it will be overridden by the SETSTREAMID
76+
* opcode as part of each job.
77+
*/
78+
vic_writel(vic, stream_id, VIC_THI_STREAMID0);
79+
80+
/* STREAMID1 is used for firmware loading. */
81+
vic_writel(vic, stream_id, VIC_THI_STREAMID1);
9282
}
93-
#endif
9483

9584
/* setup clockgating registers */
9685
vic_writel(vic, CG_IDLE_CG_DLY_CNT(4) |

0 commit comments

Comments
 (0)