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

gpu: host1x: Add MLOCK release code on Tegra234

With the full-featured opcode sequence using MLOCKs, we need to also
unlock those MLOCKs in the event of a timeout. However, it turns out
that on Tegra186/Tegra194, by default, we don't need to do this;
furthermore, on Tegra234 it is much simpler to do; so only implement
this on Tegra234 for the time being.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Mikko Perttunen and committed by
Thierry Reding
a94b8a77 1411796f

+41
+34
drivers/gpu/host1x/hw/cdma_hw.c
··· 238 238 cdma_timeout_restart(cdma, getptr); 239 239 } 240 240 241 + static void timeout_release_mlock(struct host1x_cdma *cdma) 242 + { 243 + #if HOST1X_HW >= 8 244 + /* Tegra186 and Tegra194 require a more complicated MLOCK release 245 + * sequence. Furthermore, those chips by default don't enforce MLOCKs, 246 + * so it turns out that if we don't /actually/ need MLOCKs, we can just 247 + * ignore them. 248 + * 249 + * As such, for now just implement this on Tegra234 where things are 250 + * stricter but also easy to implement. 251 + */ 252 + struct host1x_channel *ch = cdma_to_channel(cdma); 253 + struct host1x *host1x = cdma_to_host1x(cdma); 254 + u32 offset; 255 + 256 + switch (ch->client->class) { 257 + case HOST1X_CLASS_VIC: 258 + offset = HOST1X_COMMON_VIC_MLOCK; 259 + break; 260 + case HOST1X_CLASS_NVDEC: 261 + offset = HOST1X_COMMON_NVDEC_MLOCK; 262 + break; 263 + default: 264 + WARN(1, "%s was not updated for class %u", __func__, ch->client->class); 265 + return; 266 + } 267 + 268 + host1x_common_writel(host1x, 0x0, offset); 269 + #endif 270 + } 271 + 241 272 /* 242 273 * If this timeout fires, it indicates the current sync_queue entry has 243 274 * exceeded its TTL and the userctx should be timed out and remaining ··· 318 287 319 288 /* stop HW, resetting channel/module */ 320 289 host1x_hw_cdma_freeze(host1x, cdma); 290 + 291 + /* release any held MLOCK */ 292 + timeout_release_mlock(cdma); 321 293 322 294 host1x_cdma_update_sync_queue(cdma, ch->dev); 323 295 mutex_unlock(&cdma->lock);
+7
drivers/gpu/host1x/hw/hw_host1x08_common.h
··· 2 2 /* 3 3 * Copyright (c) 2022 NVIDIA Corporation. 4 4 */ 5 + 6 + #define HOST1X_COMMON_OFA_MLOCK 0x4050 7 + #define HOST1X_COMMON_NVJPG1_MLOCK 0x4070 8 + #define HOST1X_COMMON_VIC_MLOCK 0x4078 9 + #define HOST1X_COMMON_NVENC_MLOCK 0x407c 10 + #define HOST1X_COMMON_NVDEC_MLOCK 0x4080 11 + #define HOST1X_COMMON_NVJPG_MLOCK 0x4084