If the card is capable of more than 32-bit, then use the default TTM page pool code which allocates from anywhere in the memory.
Note: If the 'ttm.no_dma' parameter is set, the override is ignored and the default TTM pool is used.
CC: Ben Skeggs bskeggs@redhat.com CC: Francisco Jerez currojerez@riseup.net CC: Dave Airlie airlied@redhat.com Signed-off-by: Konrad Rzeszutek Wilk konrad.wilk@oracle.com --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 1 + drivers/gpu/drm/nouveau/nouveau_sgdma.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 8e15923..f52c2db 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -178,6 +178,7 @@ static struct drm_info_list nouveau_debugfs_list[] = { { "memory", nouveau_debugfs_memory_info, 0, NULL }, { "vbios.rom", nouveau_debugfs_vbios_image, 0, NULL }, { "ttm_page_pool", ttm_page_alloc_debugfs, 0, NULL }, + { "ttm_dma_page_pool", ttm_dma_page_alloc_debugfs, 0, NULL }, }; #define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 9b570c3..e0d4474 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c @@ -2,6 +2,7 @@ #include "nouveau_drv.h" #include <linux/pagemap.h> #include <linux/slab.h> +#include <ttm/ttm_page_alloc.h>
#define NV_CTXDMA_PAGE_SHIFT 12 #define NV_CTXDMA_PAGE_SIZE (1 << NV_CTXDMA_PAGE_SHIFT) @@ -417,6 +418,10 @@ nouveau_sgdma_init_ttm(struct drm_device *dev) nvbe->dev = dev;
nvbe->backend.func = dev_priv->gart_info.func; + if ((dev->dev) && (dma_get_mask(dev->dev) <= DMA_BIT_MASK(32))) { + if (ttm_dma_override(nvbe->backend.func)) + nvbe->backend.dev = dev->dev; + } return &nvbe->backend; }