Am 25.01.2018 um 09:35 schrieb Chunming Zhou: > > > On 2018å¹´01æ??25æ?¥ 16:29, Christian König wrote: >> Am 25.01.2018 um 07:50 schrieb Chunming Zhou: >>> it will be used to set ttm dma allocation path. >> >> NAK, disabling swiotlb on the kernel command line should have the >> same effect. > The tricky is swiotlb is enabled by default, and there may be some > other drivers need it. > We only need not to use it amdgpu driver, so making it be disabled by > default makes sense, right? No, as Michel also wrote that is nothing a system administrator should decide about. There are simply to many cases where this won't work as intended. But as a start to improve the check you could take a look at adev->dev->iommu_group. If that is set to something then IOMMU should be active for our device and we can skip the DMA coherent allocator. Regards, Christian. > > Regards, > David Zhou >> >> If that doesn't work we really need to thing about how to improve the >> detection logic. >> >> When I have a free minute I will try to hack something together. >> >> Regards, >> Christian. >> >>> >>> Change-Id: I9fa936db751811779cea66598bba0b8cf4cfd869 >>> Signed-off-by: Chunming Zhou <david1.zhou at amd.com> >>> --- >>>  drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 1 + >>>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ >>>  2 files changed, 5 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >>> index 353186f3e58c..443bedb288e6 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >>> @@ -128,6 +128,7 @@ extern int amdgpu_job_hang_limit; >>>  extern int amdgpu_lbpw; >>>  extern int amdgpu_compute_multipipe; >>>  extern int amdgpu_gpu_recovery; >>> +extern int amdgpu_ttm_dma_allocation; >>>   #ifdef CONFIG_DRM_AMDGPU_SI >>>  extern int amdgpu_si_support; >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c >>> index d1a695864793..556135020c4d 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c >>> @@ -131,6 +131,7 @@ int amdgpu_job_hang_limit = 0; >>>  int amdgpu_lbpw = -1; >>>  int amdgpu_compute_multipipe = -1; >>>  int amdgpu_gpu_recovery = -1; /* auto */ >>> +int amdgpu_ttm_dma_allocation = 0; >>>   MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in >>> megabytes"); >>>  module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); >>> @@ -286,6 +287,9 @@ module_param_named(compute_multipipe, >>> amdgpu_compute_multipipe, int, 0444); >>>  MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 >>> = enable, 0 = disable, -1 = auto"); >>>  module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444); >>>  +MODULE_PARM_DESC(ttm_dma_allocation, "Enable TTM dma allocation, >>> (1 = enable, 0 = disable"); >>> +module_param_named(amdgpu_ttm_dma_allocation, >>> amdgpu_ttm_dma_allocation, int, 0444); >>> + >>>  #ifdef CONFIG_DRM_AMDGPU_SI >>>   #if defined(CONFIG_DRM_RADEON) || defined(CONFIG_DRM_RADEON_MODULE) >> >