mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 02:01:36 +03:00
drivers: gpu: Fix IOMMU support for Linux v6.13
In Linux v6.13, commit f6440fcc9c7b ("iommu: Remove
iommu_domain_alloc()") removed iommu_domain_alloc() and was replaced by
iommu_paging_domain_alloc(). Use conftest to detect if the function
iommu_paging_domain_alloc() is supported by the kernel and update the
Tegra DRM and Host1x drivers accordingly.
Bug 4991705
Change-Id: I86221d96232396fdb6bdccf40c412e029881c513
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261695
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -1185,6 +1185,9 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev)
|
||||
|
||||
static int host1x_drm_probe(struct host1x_device *dev)
|
||||
{
|
||||
#if defined(NV_IOMMU_PAGING_DOMAIN_ALLOC_PRESENT) /* Linux v6.11 */
|
||||
struct device *dma_dev = dev->dev.parent;
|
||||
#endif
|
||||
struct tegra_drm *tegra;
|
||||
struct drm_device *drm;
|
||||
int err;
|
||||
@@ -1199,8 +1202,13 @@ static int host1x_drm_probe(struct host1x_device *dev)
|
||||
goto put;
|
||||
}
|
||||
|
||||
#if defined(NV_IOMMU_PAGING_DOMAIN_ALLOC_PRESENT) /* Linux v6.11 */
|
||||
if (host1x_drm_wants_iommu(dev) && device_iommu_mapped(dma_dev)) {
|
||||
tegra->domain = iommu_paging_domain_alloc(dma_dev);
|
||||
#else
|
||||
if (host1x_drm_wants_iommu(dev) && iommu_present(&platform_bus_type)) {
|
||||
tegra->domain = iommu_domain_alloc(&platform_bus_type);
|
||||
#endif
|
||||
if (!tegra->domain) {
|
||||
err = -ENOMEM;
|
||||
goto free;
|
||||
|
||||
Reference in New Issue
Block a user