Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b31cf78b authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Ben Skeggs
Browse files

drm/nouveau/ttm: set the DMA mask for platform devices



So far the DMA mask was not set for platform devices, which limited them
to a 32-bit physical space. Allow dma_set_mask() to be called for
non-PCI devices, and also take the IOMMU bit into account since it could
restrict the physically addressable space.

Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 524883bb
Loading
Loading
Loading
Loading
+19 −6
Original line number Original line Diff line number Diff line
@@ -29,6 +29,9 @@
#include "nouveau_gem.h"
#include "nouveau_gem.h"


#include "drm_legacy.h"
#include "drm_legacy.h"

#include <core/tegra.h>

static int
static int
nouveau_vram_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
nouveau_vram_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
{
{
@@ -353,6 +356,17 @@ nouveau_ttm_init(struct nouveau_drm *drm)
		if (drm->agp.bridge ||
		if (drm->agp.bridge ||
		     !dma_supported(dev->dev, DMA_BIT_MASK(bits)))
		     !dma_supported(dev->dev, DMA_BIT_MASK(bits)))
			bits = 32;
			bits = 32;
	} else if (device->func->tegra) {
		struct nvkm_device_tegra *tegra = device->func->tegra(device);

		/*
		 * If the platform can use a IOMMU, then the addressable DMA
		 * space is constrained by the IOMMU bit
		 */
		if (tegra->func->iommu_bit)
			bits = min(bits, tegra->func->iommu_bit);

	}


	ret = dma_set_mask(dev->dev, DMA_BIT_MASK(bits));
	ret = dma_set_mask(dev->dev, DMA_BIT_MASK(bits));
	if (ret)
	if (ret)
@@ -361,7 +375,6 @@ nouveau_ttm_init(struct nouveau_drm *drm)
	ret = dma_set_coherent_mask(dev->dev, DMA_BIT_MASK(bits));
	ret = dma_set_coherent_mask(dev->dev, DMA_BIT_MASK(bits));
	if (ret)
	if (ret)
		dma_set_coherent_mask(dev->dev, DMA_BIT_MASK(32));
		dma_set_coherent_mask(dev->dev, DMA_BIT_MASK(32));
	}


	ret = nouveau_ttm_global_init(drm);
	ret = nouveau_ttm_global_init(drm);
	if (ret)
	if (ret)