Hi Feifei, ok the correct approach of doing this: 1. Compile the kernel with CONFIG_DMA_CMA. 2. Specify cma=1025M on the kernel command line. 3. Call dma_alloc_coherent() to allocate up to 1GB of memory for ZFB. Couldn't figure out of hand what alignment is necessary here, but that should just be a typing exercise. Regards, Christian. Am 07.02.2018 um 14:18 schrieb Christian König: > Hi Feifei, > > mhm, so you're approach is to limit the memory the Linux kernel grab > using the mem= parameter and then give that memory to amdgpu, correct? > > If that's the case then this is most likely a NAK. Cause this sounds > like a perfect example for the CMA. > > Never worked with that subsystem before, but in theory you should be > able to give the cma=1G parameter to the kernel and by doing so you > reserve 1GB of contiguous memory for use by device drivers. > > Going to dig a bit deeper into that and trying to find to > documentation about it, > Christian. > > Am 07.02.2018 um 13:34 schrieb Feifei Xu: >> Users can pass in an array to decide enable/disable Zero Frame Buffer. >> zfb[0] = zfb_size(MB), zfb[1] = zfb_phys_addr(MB). >> If zbf_size > 0, zfb is enabled. Otherwise disabled. >> Usage for example: >>     modprobe amdgpu zfb={256,4096} >> >> Change-Id: I340fcb36b5655f24551056e685b74559d7599680 >> Signed-off-by: Feifei Xu <Feifei.Xu at amd.com> >> --- >>  drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 1 + >>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++ >>  2 files changed, 6 insertions(+) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> index 1b4c5ad..be79cb1 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h >> @@ -129,6 +129,7 @@ extern int amdgpu_job_hang_limit; >>  extern int amdgpu_lbpw; >>  extern int amdgpu_compute_multipipe; >>  extern int amdgpu_gpu_recovery; >> +extern ulong amdgpu_zfb[]; >>   #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 3897179..af84815 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c >> @@ -132,6 +132,7 @@ int amdgpu_job_hang_limit = 0; >>  int amdgpu_lbpw = -1; >>  int amdgpu_compute_multipipe = -1; >>  int amdgpu_gpu_recovery = -1; /* auto */ >> +ulong amdgpu_zfb[2] = {0,4096UL}; /* {0,0x100000000} */ >>   MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in >> megabytes"); >>  module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); >> @@ -290,6 +291,10 @@ 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(zfb, >> +        "Enable Zero Frame Buffer feature (zfb will be set like >> xxxx,xxxx(zfb_size MB,zfb_phys_addr MB),default disabled)"); >> +module_param_array_named(zfb, amdgpu_zfb, ulong, NULL, 0444); >> + >>  #ifdef CONFIG_DRM_AMDGPU_SI >>   int amdgpu_si_support = 1; >