Skip to content

Commit 0a2f637

Browse files
author
Christoph Hellwig
committed
drm/nouveau: stop using is_swiotlb_active
Drivers have no business looking into dma-mapping internals and check what backend is used. Unfortunstely the DRM core is still broken and tries to do plain page allocations instead of using DMA API allocators by default and uses various bandaids on when to use dma_alloc_coherent. Switch nouveau to use the same (broken) scheme as amdgpu and radeon to remove the last driver user of is_swiotlb_active. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Lyude Paul <[email protected]>
1 parent 693405c commit 0a2f637

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/gpu/drm/nouveau/nouveau_ttm.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
*/
2525

2626
#include <linux/limits.h>
27-
#include <linux/swiotlb.h>
2827

2928
#include <drm/ttm/ttm_range_manager.h>
29+
#include <drm/drm_cache.h>
3030

3131
#include "nouveau_drv.h"
3232
#include "nouveau_gem.h"
@@ -265,7 +265,6 @@ nouveau_ttm_init(struct nouveau_drm *drm)
265265
struct nvkm_pci *pci = device->pci;
266266
struct nvif_mmu *mmu = &drm->client.mmu;
267267
struct drm_device *dev = drm->dev;
268-
bool need_swiotlb = false;
269268
int typei, ret;
270269

271270
ret = nouveau_ttm_init_host(drm, 0);
@@ -300,13 +299,10 @@ nouveau_ttm_init(struct nouveau_drm *drm)
300299
drm->agp.cma = pci->agp.cma;
301300
}
302301

303-
#if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
304-
need_swiotlb = is_swiotlb_active(dev->dev);
305-
#endif
306-
307302
ret = ttm_device_init(&drm->ttm.bdev, &nouveau_bo_driver, drm->dev->dev,
308303
dev->anon_inode->i_mapping,
309-
dev->vma_offset_manager, need_swiotlb,
304+
dev->vma_offset_manager,
305+
drm_need_swiotlb(drm->client.mmu.dmabits),
310306
drm->client.mmu.dmabits <= 32);
311307
if (ret) {
312308
NV_ERROR(drm, "error initialising bo driver, %d\n", ret);

0 commit comments

Comments
 (0)