[PATCH v5 3/9] gpu: host1x: Add context device management code

2022-05-16 Thread cyndis
From: Mikko Perttunen Add code to register context devices from device tree, allocate them out and manage their refcounts. Signed-off-by: Mikko Perttunen --- v2: * Directly set DMA mask instead of inheriting from Host1x. * Use iommu-map instead of custom DT property. v4: * Use u64 instead of dm

[PATCH v5 0/9] Host1x context isolation support

2022-05-16 Thread cyndis
From: Mikko Perttunen *** New in v5: Rebased Renamed host1x_context to host1x_memory_context Small change in DRM side client driver ops to reduce churn with some upcoming changes Add NVDEC support *** *** New in v4: Addressed review comments. See individual patches. *** *** New in v3: Add

[PATCH v5 2/9] gpu: host1x: Add context bus

2022-05-16 Thread cyndis
From: Mikko Perttunen The context bus is a "dummy" bus that contains struct devices that correspond to IOMMU contexts assigned through Host1x to processes. Even when host1x itself is built as a module, the bus is registered in built-in code so that the built-in ARM SMMU driver is able to referen

[PATCH v5 8/9] drm/tegra: Support context isolation

2022-05-16 Thread cyndis
From: Mikko Perttunen For engines that support context isolation, allocate a context when opening a channel, and set up stream ID offset and context fields when submitting a job. As of this commit, the stream ID offset and fallback stream ID are not used when context isolation is disabled. Howev

[PATCH v5 4/9] gpu: host1x: Program context stream ID on submission

2022-05-16 Thread cyndis
From: Mikko Perttunen Add code to do stream ID switching at the beginning of a job. The stream ID is switched to the stream ID specified by the context passed in the job structure. Before switching the stream ID, an OP_DONE wait is done on the channel's engine to ensure that there is no residual

[PATCH v5 7/9] drm/tegra: falcon: Set DMACTX field on DMA transactions

2022-05-16 Thread cyndis
From: Mikko Perttunen The DMACTX field determines which context, as specified in the TRANSCFG register, is used. While during boot it doesn't matter which is used, later on it matters and this value is reused by the firmware. Signed-off-by: Mikko Perttunen --- drivers/gpu/drm/tegra/falcon.c |

[PATCH v5 6/9] arm64: tegra: Add Host1x context stream IDs on Tegra186+

2022-05-16 Thread cyndis
From: Mikko Perttunen Add Host1x context stream IDs on systems that support Host1x context isolation. Host1x and attached engines can use these stream IDs to allow isolation between memory used by different processes. The specified stream IDs must match those configured by the hypervisor, if one

[PATCH v5 1/9] dt-bindings: host1x: Add iommu-map property

2022-05-16 Thread cyndis
From: Mikko Perttunen Add schema information for specifying context stream IDs. This uses the standard iommu-map property. Signed-off-by: Mikko Perttunen Reviewed-by: Robin Murphy --- v3: * New patch v4: * Remove memory-contexts subnode. --- .../bindings/display/tegra/nvidia,tegra20-host1x.ya

[PATCH v5 9/9] drm/tegra: Implement stream ID related callbacks on engines

2022-05-16 Thread cyndis
From: Mikko Perttunen Implement the get_streamid_offset and can_use_memory_ctx callbacks required for supporting context isolation. Since old firmware on VIC cannot support context isolation without hacks that we don't want to implement, check the firmware binary to see if context isolation shoul

[PATCH v5 5/9] iommu/arm-smmu: Attach to host1x context device bus

2022-05-16 Thread cyndis
From: Mikko Perttunen Set itself as the IOMMU for the host1x context device bus, containing "dummy" devices used for Host1x context isolation. Signed-off-by: Mikko Perttunen --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iom

[PATCH v4 8/9] drm/tegra: Support context isolation

2022-03-01 Thread cyndis
From: Mikko Perttunen For engines that support context isolation, allocate a context when opening a channel, and set up stream ID offset and context fields when submitting a job. Signed-off-by: Mikko Perttunen --- v4: * Separate error and output values in get_streamid_offset API * Improve error

[PATCH v4 6/9] arm64: tegra: Add Host1x context stream IDs on Tegra186+

2022-03-01 Thread cyndis
From: Mikko Perttunen Add Host1x context stream IDs on systems that support Host1x context isolation. Host1x and attached engines can use these stream IDs to allow isolation between memory used by different processes. The specified stream IDs must match those configured by the hypervisor, if one

[PATCH v4 2/9] gpu: host1x: Add context bus

2022-03-01 Thread cyndis
From: Mikko Perttunen The context bus is a "dummy" bus that contains struct devices that correspond to IOMMU contexts assigned through Host1x to processes. Even when host1x itself is built as a module, the bus is registered in built-in code so that the built-in ARM SMMU driver is able to referen

[PATCH v4 1/9] dt-bindings: host1x: Add iommu-map property

2022-03-01 Thread cyndis
From: Mikko Perttunen Add schema information for specifying context stream IDs. This uses the standard iommu-map property. Signed-off-by: Mikko Perttunen --- v3: * New patch v4: * Remove memory-contexts subnode. --- .../bindings/display/tegra/nvidia,tegra20-host1x.yaml| 5 + 1 file

[PATCH v4 4/9] gpu: host1x: Program context stream ID on submission

2022-03-01 Thread cyndis
From: Mikko Perttunen Add code to do stream ID switching at the beginning of a job. The stream ID is switched to the stream ID specified by the context passed in the job structure. Before switching the stream ID, an OP_DONE wait is done on the channel's engine to ensure that there is no residual

[PATCH v4 7/9] drm/tegra: falcon: Set DMACTX field on DMA transactions

2022-03-01 Thread cyndis
From: Mikko Perttunen The DMACTX field determines which context, as specified in the TRANSCFG register, is used. While during boot it doesn't matter which is used, later on it matters and this value is reused by the firmware. Signed-off-by: Mikko Perttunen --- drivers/gpu/drm/tegra/falcon.c |

[PATCH v4 9/9] drm/tegra: vic: Implement get_streamid_offset

2022-03-01 Thread cyndis
From: Mikko Perttunen Implement the get_streamid_offset required for supporting context isolation. Since old firmware cannot support context isolation without hacks that we don't want to implement, check the firmware binary to see if context isolation should be enabled. Signed-off-by: Mikko Pert

[PATCH v4 3/9] gpu: host1x: Add context device management code

2022-03-01 Thread cyndis
From: Mikko Perttunen Add code to register context devices from device tree, allocate them out and manage their refcounts. Signed-off-by: Mikko Perttunen --- v2: * Directly set DMA mask instead of inheriting from Host1x. * Use iommu-map instead of custom DT property. v4: * Use u64 instead of dm

[PATCH v4 5/9] iommu/arm-smmu: Attach to host1x context device bus

2022-03-01 Thread cyndis
From: Mikko Perttunen Set itself as the IOMMU for the host1x context device bus, containing "dummy" devices used for Host1x context isolation. Signed-off-by: Mikko Perttunen --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iom

[PATCH v4 0/9] Host1x context isolation support

2022-03-01 Thread cyndis
From: Mikko Perttunen *** New in v4: Addressed review comments. See individual patches. *** *** New in v3: Added device tree bindings for new property. *** *** New in v2: Added support for Tegra194 Use standard iommu-map property instead of custom mechanism *** This series adds support for