Skip to contentSkip to conversation

drm/amdgpu:Enable Full Zero Frame Buffer feature

PATCH NAK Feifei Xu 6 participants 22 messages Feb 7, 2018 – Feb 8, 2018 13 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Feifei Xu

author
#0 lore raw

cover drm/amdgpu:Enable Full Zero Frame Buffer feature

This patch-set enabled Full Zero Frame Buffer. And fixed hardcoded base offset of vram pages issue.

Enable the ZFB by: modprobe amdgpu zfb={zfb_size,zfb_phy_offset}

Feifei Xu (6):
drm/amdgpu: Fix hardcoded base offset of vram pages drm/amdgpu: add new member in amdgpu_mc for zfb support drm/amdgpu: add amdgpu module parameter for zfb drm/amdgpu: init zfb start address and size drm/amdgpu: user reserved zfb to init vram base offset and size drm/amdgpu: program system bit for pte/pde when ZFB is enabled

Hawking Zhang (3):
drm/amdgpu: enable physical transaction for ptd/pde when ZFB is
enabled
drm/amdgpu: program AGP aperture as frame buffer when ZFB is enabled drm/amdgpu: init mc base address for zfb

 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    |  5 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h    |  5 ++++
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c   | 35 +++++++++++++++++++++------
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      | 29 +++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c    | 39 +++++++++++++++++++++++-------
 7 files changed, 101 insertions(+), 25 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518006892-14121-1-git-send-email-Feifei.Xu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 1/9 drm/amdgpu: Fix hardcoded base offset of vram pages

In gmc_v9_0_vram_gtt_location(),the vram_base_offset is hardcoded to 0 in dGPU. Fix it by reading mmMC_VM_FB_OFFSET or return zfb_phys_addr if ZFB is enabled.

Change-Id I585b7d4d96ebab2a5d7178fe8d1d6a746ef0c72a
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -4
index 0a1868b..27f50c8 100644
@@ -686,10 +686,7 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,
 	amdgpu_device_vram_location(adev, &adev->gmc, base);
 	amdgpu_device_gart_location(adev, mc);
 	/* base offset of vram pages */
-	if (adev->flags & AMD_IS_APU)
-		adev->vm_manager.vram_base_offset = gfxhub_v1_0_get_mc_fb_offset(adev);
-	else
-		adev->vm_manager.vram_base_offset = 0;
+	adev->vm_manager.vram_base_offset = gfxhub_v1_0_get_mc_fb_offset(adev);
 }
 
 /**
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518006892-14121-2-git-send-email-Feifei.Xu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 1/9] drm/amdgpu: Fix hardcoded base offset of vram pages

Am 07.02.2018 um 13:34 schrieb Feifei Xu:

Quoted 7 lines

In gmc_v9_0_vram_gtt_location(),the vram_base_offset is hardcoded to 0 in dGPU. Fix it by reading mmMC_VM_FB_OFFSET or return zfb_phys_addr if ZFB is enabled.

Change-Id I585b7d4d96ebab2a5d7178fe8d1d6a746ef0c72a
Quoted 10 lines
---
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 0a1868b..27f50c8 100644
@@ -686,10 +686,7 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,
  	amdgpu_device_vram_location(adev, &adev->gmc, base);

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev, · line 692

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -4
  	amdgpu_device_gart_location(adev, mc);
  	/* base offset of vram pages */
-	if (adev->flags & AMD_IS_APU)
-		adev->vm_manager.vram_base_offset = gfxhub_v1_0_get_mc_fb_offset(adev);
-	else
-		adev->vm_manager.vram_base_offset = 0;
+	adev->vm_manager.vram_base_offset = gfxhub_v1_0_get_mc_fb_offset(adev);
  }
 
  /**

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#5 lore raw

PATCH 2/9 drm/amdgpu: add new member in amdgpu_mc for zfb support

In reply to a message not in the archive
Change-Id I43ab31a68e93ef264fb8d8dd8a3dba59e2962fad
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +5 -0
index f4b82ef7..fd5f767 100644
@@ -107,6 +107,11 @@ struct amdgpu_gmc {
 	atomic_t                vm_fault_info_updated;
 
 	const struct amdgpu_gmc_funcs	*gmc_funcs;
+
+	/* zero frame buffer */
+	bool		enable_zfb;
+	u64		zfb_phys_addr;
+	u64		zfb_size;
 };
 
 #endif
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518006892-14121-3-git-send-email-Feifei.Xu-5C7GfCeVMHo@public.gmane.org

#7 lore raw

Re: [PATCH 2/9] drm/amdgpu: add new member in amdgpu_mc for zfb support

Am 07.02.2018 um 13:34 schrieb Feifei Xu:

Quoted 12 lines
Change-Id I43ab31a68e93ef264fb8d8dd8a3dba59e2962fad
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +0 -0
index f4b82ef7..fd5f767 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_gmc { · line 112

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +3 -0
@@ -107,6 +107,11 @@ struct amdgpu_gmc {
  	atomic_t                vm_fault_info_updated;
 
  	const struct amdgpu_gmc_funcs	*gmc_funcs;
+
+	/* zero frame buffer */
+	bool		enable_zfb;

Please drop the enable_zfb member, setting size to zero should be enough to note that.

Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h struct amdgpu_gmc { · line 117

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
+	u64		zfb_phys_addr;
+	u64		zfb_size;
  };
 
  #endif

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#8 lore raw

PATCH 3/9 drm/amdgpu: add amdgpu module parameter for zfb

In reply to a message not in the archive

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
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index 3897179..af84815 100644
@@ -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;
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518006892-14121-4-git-send-email-Feifei.Xu-5C7GfCeVMHo@public.gmane.org

#10 lore raw

Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

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:

Quoted 38 lines

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
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
  2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
index 3897179..af84815 100644
@@ -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);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444); · line 300

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
@@ -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;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1af9466c-df71-4484-fc5d-9409e08c84d7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#12 lore raw

Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

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:

Quoted 50 lines

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:

Quoted 38 lines

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

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++

  2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 3897179..af84815 100644
@@ -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);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
@@ -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");
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
   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;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): b8912e67-6522-4526-99db-719f2af3a8ad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#14 lore raw

Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Quoted 6 lines · Christian König

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.

Have you tried CMA? In early time, I tried it. If CMA is enabled, then ttm dma pool allocation will use cma, and when cma is used up, then ttm dma pool allocation will fail. Not sure if the issue is fixed now.

Regards,
David Zhou

Quoted 67 lines

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:

Quoted 50 lines

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:

Quoted 38 lines

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

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++

  2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 3897179..af84815 100644
@@ -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);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
@@ -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");
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -0
   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;

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): df90d619-bba6-370f-0aba-3e2e5de0923e-5C7GfCeVMHo@public.gmane.org

#16 lore raw

RE: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Apart from the allocation failure, reserving 1024M cma is also not realistic....

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Thursday, February 08, 2018 12:35
To: Koenig, Christian <[email protected]>; Xu, Feifei <[email protected]>; [email protected]
Subject: Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Quoted 6 lines · Christian König

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.

Have you tried CMA? In early time, I tried it. If CMA is enabled, then ttm dma pool allocation will use cma, and when cma is used up, then ttm dma pool allocation will fail. Not sure if the issue is fixed now.

Regards,
David Zhou

Quoted 76 lines

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:

Quoted 58 lines

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:

Quoted 42 lines

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

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++

  2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 3897179..af84815 100644
@@ -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");

Quoted 9 lines
Quoted 8 lines

  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)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
+module_param_array_named(zfb, amdgpu_zfb, ulong, NULL, 0444);
+

  #ifdef CONFIG_DRM_AMDGPU_SI
    int amdgpu_si_support = 1;

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): DM5PR1201MB247506F18FE9FF309194AAA0FCF30-grEf7a3NxMAyj5E7E3lLiWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#18 lore raw

Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Am 08.02.2018 um 05:51 schrieb Zhang, Hawking:

Quoted 1 line

Apart from the allocation failure, reserving 1024M cma is also not realistic....

Sure it is, I just tried it and it works perfectly fine. The option even accepts a G postfix for gigabytes, e.g. I can specify cma=8G on my 32GB Ryzen box and get exactly 8GB CMA space reserved.

Regarding the allocation failure using the DMA path there was a thread quite some time ago. IIRC the argument was that TTM only allocates a single page at a time and so should never run into any CMA allocator and according to my tests at least with IOMMU enabled that seems to be fixed now.

The key point is that CMA was specially crafted to avoid all those mem= workarounds and I think this is now a must have. See here https://de.slideshare.net/kerneltlv/continguous-memory-allocator-in-the-linux-kernel as well.

Regards,
Christian.

Quoted 101 lines

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Thursday, February 08, 2018 12:35
To: Koenig, Christian <[email protected]>; Xu, Feifei <[email protected]>; [email protected]
Subject: Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Quoted 6 lines · Christian König

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.

Have you tried CMA? In early time, I tried it. If CMA is enabled, then ttm dma pool allocation will use cma, and when cma is used up, then ttm dma pool allocation will fail. Not sure if the issue is fixed now.

Regards,
David Zhou

Quoted 69 lines

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:

Quoted 62 lines

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:

Quoted 46 lines

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
---
   drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
   2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index 3897179..af84815 100644
@@ -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)");

Quoted 8 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
+module_param_array_named(zfb, amdgpu_zfb, ulong, NULL, 0444);
+
   #ifdef CONFIG_DRM_AMDGPU_SI
     int amdgpu_si_support = 1;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c138007b-81e1-dee5-6cbb-479e65e948f6-5C7GfCeVMHo@public.gmane.org

#20 lore raw

RE: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

For the CMA, I have some concern.
First, it is strongly depend on other module's robustness which can use CMA memory with flag __GFP_MOVABLE.
My mean is dma_alloc_coherent sometimes will fail because its owner cannot migrate its memory out from CMA range because some internal bugs. Second because memory migration, the CMA memory allocation performance is not very good as normal.
When I used CMA feature with 3.16 kernel encountered more issues.

So not pretty sure CMA module and other modules are very robust in 4.15 kernel.

Thanks
Roger(Hongbo.He)

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Thursday, February 08, 2018 4:10 PM
To: Zhang, Hawking <[email protected]>; Zhou, David(ChunMing) <[email protected]>; Xu, Feifei <[email protected]>; [email protected]
Subject: Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Am 08.02.2018 um 05:51 schrieb Zhang, Hawking:

Quoted 1 line

Apart from the allocation failure, reserving 1024M cma is also not realistic....

Sure it is, I just tried it and it works perfectly fine. The option even accepts a G postfix for gigabytes, e.g. I can specify cma=8G on my 32GB Ryzen box and get exactly 8GB CMA space reserved.

Regarding the allocation failure using the DMA path there was a thread quite some time ago. IIRC the argument was that TTM only allocates a single page at a time and so should never run into any CMA allocator and according to my tests at least with IOMMU enabled that seems to be fixed now.

The key point is that CMA was specially crafted to avoid all those mem= workarounds and I think this is now a must have. See here https://de.slideshare.net/kerneltlv/continguous-memory-allocator-in-the-linux-kernel
as well.

Regards,
Christian.

Quoted 105 lines

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Thursday, February 08, 2018 12:35
To: Koenig, Christian <[email protected]>; Xu, Feifei <[email protected]>; [email protected]
Subject: Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Quoted 6 lines · Christian König

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.

Have you tried CMA? In early time, I tried it. If CMA is enabled, then ttm dma pool allocation will use cma, and when cma is used up, then ttm dma pool allocation will fail. Not sure if the issue is fixed now.

Regards,
David Zhou

Quoted 70 lines

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:

Quoted 63 lines

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:

Quoted 47 lines

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
---
   drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
   2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index 3897179..af84815 100644
@@ -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)");

Quoted 8 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
+module_param_array_named(zfb, amdgpu_zfb, ulong, NULL, 0444);
+
   #ifdef CONFIG_DRM_AMDGPU_SI
     int amdgpu_si_support = 1;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MWHPR1201MB01273FCBCD83E36C98D31A10FDF30-3iK1xFAIwjq9imrIu4W8xGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#22 lore raw

Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Well ZFB is only for emulation, so the risk should be minimal.

According to my test CMA works fine and I think it is a must have for upstreaming ZFB.

Regards,
Christian.

Am 08.02.2018 um 09:40 schrieb He, Roger:

Quoted 133 lines

For the CMA, I have some concern.
First, it is strongly depend on other module's robustness which can use CMA memory with flag __GFP_MOVABLE.
My mean is dma_alloc_coherent sometimes will fail because its owner cannot migrate its memory out from CMA range because some internal bugs. Second because memory migration, the CMA memory allocation performance is not very good as normal.
When I used CMA feature with 3.16 kernel encountered more issues.

So not pretty sure CMA module and other modules are very robust in 4.15 kernel.

Thanks
Roger(Hongbo.He)

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Thursday, February 08, 2018 4:10 PM
To: Zhang, Hawking <[email protected]>; Zhou, David(ChunMing) <[email protected]>; Xu, Feifei <[email protected]>; [email protected]
Subject: Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Am 08.02.2018 um 05:51 schrieb Zhang, Hawking:

Quoted 1 line

Apart from the allocation failure, reserving 1024M cma is also not realistic....

Sure it is, I just tried it and it works perfectly fine. The option even accepts a G postfix for gigabytes, e.g. I can specify cma=8G on my 32GB Ryzen box and get exactly 8GB CMA space reserved.

Regarding the allocation failure using the DMA path there was a thread quite some time ago. IIRC the argument was that TTM only allocates a single page at a time and so should never run into any CMA allocator and according to my tests at least with IOMMU enabled that seems to be fixed now.

The key point is that CMA was specially crafted to avoid all those mem= workarounds and I think this is now a must have. See here https://de.slideshare.net/kerneltlv/continguous-memory-allocator-in-the-linux-kernel
as well.

Regards,
Christian.

Quoted 104 lines

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Chunming Zhou
Sent: Thursday, February 08, 2018 12:35
To: Koenig, Christian <[email protected]>; Xu, Feifei <[email protected]>; [email protected]
Subject: Re: [PATCH 3/9] drm/amdgpu: add amdgpu module parameter for zfb

Quoted 6 lines · Christian König

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.

Have you tried CMA? In early time, I tried it. If CMA is enabled, then ttm dma pool allocation will use cma, and when cma is used up, then ttm dma pool allocation will fail. Not sure if the issue is fixed now.

Regards,
David Zhou

Quoted 78 lines

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:

Quoted 59 lines

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:

Quoted 43 lines

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
---
    drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
    drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
    2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 1b4c5ad..be79cb1 100644
@@ -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;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index 3897179..af84815 100644
@@ -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,

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Quoted 8 lines

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)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
+module_param_array_named(zfb, amdgpu_zfb, ulong, NULL, 0444);
+
    #ifdef CONFIG_DRM_AMDGPU_SI
      int amdgpu_si_support = 1;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#23 lore raw

PATCH 4/9 drm/amdgpu: init zfb start address and size

In reply to a message not in the archive

Use module parameter passed from user to initialize zfb start address and size.

Change-Id Idd0ae02ef8010ec36baa4b03b01981e97b3e748a
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 -0
index dc8f221..519f09f 100644
@@ -859,6 +859,18 @@ static void amdgpu_device_check_arguments(struct amdgpu_device *adev)
 		dev_warn(adev->dev, "lockup_timeout msut be > 0, adjusting to 10000\n");
 		amdgpu_lockup_timeout = 10000;
 	}
+
+	if (amdgpu_zfb[0] > 0) {
+		dev_warn(adev->dev,
+			 "Zero Frame Buffer is enabled\n");
+		adev->gmc.enable_zfb = true;
+		adev->gmc.zfb_phys_addr = amdgpu_zfb[1] << 20;
+        adev->gmc.zfb_size = amdgpu_zfb[0] << 20;
+	} else {
+		adev->gmc.enable_zfb = false;
+		adev->gmc.zfb_phys_addr = 0;
+		adev->gmc.zfb_size = 0;
+	}
 }
 
 /**
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#24 lore raw

PATCH 5/9 drm/amdgpu: user reserved zfb to init vram base offset and size

In reply to a message not in the archive
Change-Id I3beb3ca3f958fdd63b3ce7068b59ebf957b49a5a
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c |  5 ++++-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 18 +++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +4 -1
index 94a07bc..ec09c32 100644
@@ -32,7 +32,10 @@
 
 u64 gfxhub_v1_0_get_mc_fb_offset(struct amdgpu_device *adev)
 {
-	return (u64)RREG32_SOC15(GC, 0, mmMC_VM_FB_OFFSET) << 24;
+	if (adev->gmc.enable_zfb)
+		return adev->gmc.zfb_phys_addr;
+	else
+		return (u64)RREG32_SOC15(GC, 0, mmMC_VM_FB_OFFSET) << 24;
 }
 
 static void gfxhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +13 -5
index 27f50c8..8fd7b01 100644
@@ -745,9 +745,12 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
 		adev->gmc.vram_width = numchan * chansize;
 	}
 
-	/* size in MB on si */
-	adev->gmc.mc_vram_size =
-		adev->nbio_funcs->get_memsize(adev) * 1024ULL * 1024ULL;
+	if (adev->gmc.enable_zfb)
+		adev->gmc.mc_vram_size = adev->gmc.zfb_size;
+	else
+		/* size in MB on si */
+		adev->gmc.mc_vram_size =
+			adev->nbio_funcs->get_memsize(adev) * 1024ULL * 1024ULL;
 	adev->gmc.real_vram_size = adev->gmc.mc_vram_size;
 
 #if !defined(BUILD_AS_DKMS) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
@@ -757,8 +760,13 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
 			return r;
 	}
 #endif
-	adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
-	adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
+	if ( adev->gmc.enable_zfb) {
+		adev->gmc.aper_base = adev->gmc.zfb_phys_addr;
+		adev->gmc.aper_size = adev->gmc.zfb_size;
+	} else {
+		adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
+		adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
+	}
 
 #ifdef CONFIG_X86_64
 	if (adev->flags & AMD_IS_APU) {
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518006892-14121-6-git-send-email-Feifei.Xu-5C7GfCeVMHo@public.gmane.org

#26 lore raw

Re: [PATCH 5/9] drm/amdgpu: user reserved zfb to init vram base offset and size

Am 07.02.2018 um 13:34 schrieb Feifei Xu:

Quoted 13 lines
Change-Id I3beb3ca3f958fdd63b3ce7068b59ebf957b49a5a
---
  drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c |  5 ++++-
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 18 +++++++++++++-----
  2 files changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +0 -0
index 94a07bc..ec09c32 100644

drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c line 38

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +4 -1
@@ -32,7 +32,10 @@
 
  u64 gfxhub_v1_0_get_mc_fb_offset(struct amdgpu_device *adev)
  {
-	return (u64)RREG32_SOC15(GC, 0, mmMC_VM_FB_OFFSET) << 24;
+	if (adev->gmc.enable_zfb)
+		return adev->gmc.zfb_phys_addr;
+	else
+		return (u64)RREG32_SOC15(GC, 0, mmMC_VM_FB_OFFSET) << 24;

NAK, please do this in the calling function in gmc_v9_0.c. E.g. the code you removed in patch #1.

Quoted 26 lines
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +0 -0
  }
 
  static void gfxhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +6 -3
index 27f50c8..8fd7b01 100644
@@ -745,9 +745,12 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
  		adev->gmc.vram_width = numchan * chansize;
  	}
 
-	/* size in MB on si */
-	adev->gmc.mc_vram_size =
-		adev->nbio_funcs->get_memsize(adev) * 1024ULL * 1024ULL;
+	if (adev->gmc.enable_zfb)
+		adev->gmc.mc_vram_size = adev->gmc.zfb_size;
+	else
+		/* size in MB on si */
+		adev->gmc.mc_vram_size =
+			adev->nbio_funcs->get_memsize(adev) * 1024ULL * 1024ULL;
  	adev->gmc.real_vram_size = adev->gmc.mc_vram_size;
 
  #if !defined(BUILD_AS_DKMS) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
@@ -757,8 +760,13 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
  			return r;
  	}

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · line 769

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -2
  #endif
-	adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
-	adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
+	if ( adev->gmc.enable_zfb) {
+		adev->gmc.aper_base = adev->gmc.zfb_phys_addr;
+		adev->gmc.aper_size = adev->gmc.zfb_size;
+	} else {
+		adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
+		adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
+	}

Please handle the "#ifdef CONFIG_X86_64" below correctly as well. E.g. this code would break if ZFB is enable on an APU otherwise.

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_mc_init(struct amdgpu_device *adev) · line 772

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
  #ifdef CONFIG_X86_64
  	if (adev->flags & AMD_IS_APU) {

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#27 lore raw

PATCH 6/9 drm/amdgpu: enable physical transaction for ptd/pde when ZFB is enabled

In reply to a message not in the archive

From: Hawking Zhang <[email protected]>

Change-Id I298b78b160f3894bdd56d9a14a20fbb7fb2ac645
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 9 +++++++--
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c  | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +7 -2
index ec09c32..f716d65 100644
@@ -158,8 +158,13 @@ static void gfxhub_v1_0_init_cache_regs(struct amdgpu_device *adev)
 	WREG32_SOC15(GC, 0, mmVM_L2_CNTL3, tmp);
 
 	tmp = mmVM_L2_CNTL4_DEFAULT;
-	tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
-	tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0);
+	if (adev->gmc.enable_zfb) {
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 1);
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 1);
+	} else {
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0);
+	}
 	WREG32_SOC15(GC, 0, mmVM_L2_CNTL4, tmp);
 }
 
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +7 -2
index 717e81c..c3e3a35 100644
@@ -166,8 +166,13 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev)
 	}
 
 	tmp = mmVM_L2_CNTL4_DEFAULT;
-	tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
-	tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0);
+	if (adev->gmc.enable_zfb) {
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 1);
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 1);
+	} else {
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
+		tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PTE_REQUEST_PHYSICAL, 0);
+	}
 	WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL4, tmp);
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#28 lore raw

PATCH 7/9 drm/amdgpu: program AGP aperture as frame buffer when ZFB is enabled

In reply to a message not in the archive

From: Hawking Zhang <[email protected]>

Change-Id I32e6321da74a1bd87f13adbe8e7738023738e6d5
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 19 +++++++++++++++----
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c  | 19 +++++++++++++++----
 2 files changed, 30 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +15 -4
index f716d65..f7e616b 100644
@@ -74,10 +74,21 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
 {
 	uint64_t value;
 
-	/* Disable AGP. */
-	WREG32_SOC15(GC, 0, mmMC_VM_AGP_BASE, 0);
-	WREG32_SOC15(GC, 0, mmMC_VM_AGP_TOP, 0);
-	WREG32_SOC15(GC, 0, mmMC_VM_AGP_BOT, 0xFFFFFFFF);
+	if (adev->gmc.enable_zfb) {
+		/* Disable LFB */
+		WREG32_SOC15(GC, 0, mmMC_VM_FB_LOCATION_TOP, 0);
+		WREG32_SOC15(GC, 0, mmMC_VM_FB_LOCATION_BASE, 0x00FFFFFF);
+
+		/* Enable AGP */
+		WREG32_SOC15(GC, 0, mmMC_VM_AGP_BASE, adev->gmc.zfb_phys_addr >> 24);
+		WREG32_SOC15(GC, 0, mmMC_VM_AGP_TOP, adev->gmc.vram_end >> 24);
+		WREG32_SOC15(GC, 0, mmMC_VM_AGP_BOT, adev->gmc.vram_start >> 24);
+	} else {
+		/* Disable AGP. */
+		WREG32_SOC15(GC, 0, mmMC_VM_AGP_BASE, 0);
+		WREG32_SOC15(GC, 0, mmMC_VM_AGP_TOP, 0);
+		WREG32_SOC15(GC, 0, mmMC_VM_AGP_BOT, 0xFFFFFFFF);
+	}
 
 	/* Program the system aperture low logical page number. */
 	WREG32_SOC15(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +15 -4
index c3e3a35..b539fd1 100644
@@ -82,10 +82,21 @@ static void mmhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
 	uint64_t value;
 	uint32_t tmp;
 
-	/* Disable AGP. */
-	WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BASE, 0);
-	WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_TOP, 0);
-	WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BOT, 0x00FFFFFF);
+	if (adev->gmc.enable_zfb) {
+		/* Disable LFB */
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_TOP, 0);
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_BASE, 0x00FFFFFF);
+
+		/* Enable AGP */
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BASE, adev->gmc.zfb_phys_addr >> 24);
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_TOP, adev->gmc.vram_end >> 24);
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BOT, adev->gmc.vram_start >> 24);
+	} else {
+		/* Disable AGP. */
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BASE, 0);
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_TOP, 0);
+		WREG32_SOC15(MMHUB, 0, mmMC_VM_AGP_BOT, 0x00FFFFFF);
+	}
 
 	/* Program the system aperture low logical page number. */
 	WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR,
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#29 lore raw

PATCH 8/9 drm/amdgpu: init mc base address for zfb

In reply to a message not in the archive

From: Hawking Zhang <[email protected]>

Change-Id I89b9ff36b62eb685a9e2d87e2058d200b92f5034
---
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +6 -3
index b539fd1..c56ab47 100644
@@ -38,9 +38,12 @@
 u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev)
 {
 	u64 base = RREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_BASE);
-
-	base &= MC_VM_FB_LOCATION_BASE__FB_BASE_MASK;
-	base <<= 24;
+	if (adev->gmc.enable_zfb) {
+		base = 0xF400000000ULL;
+	} else {
+		base &= MC_VM_FB_LOCATION_BASE__FB_BASE_MASK;
+		base <<= 24;
+	}
 
 	return base;
 }
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518006892-14121-9-git-send-email-Feifei.Xu-5C7GfCeVMHo@public.gmane.org

#31 lore raw

Re: [PATCH 8/9] drm/amdgpu: init mc base address for zfb

Am 07.02.2018 um 13:34 schrieb Feifei Xu:

Quoted 6 lines

From: Hawking Zhang <[email protected]>

Change-Id I89b9ff36b62eb685a9e2d87e2058d200b92f5034

NAK, please do that in gmc_v9_0_vram_gtt_location() instead. The function you modify here should only read the programmed FB location from the MM HUB.

Christian.

Quoted 14 lines
---
  drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +0 -2
index b539fd1..c56ab47 100644
@@ -38,9 +38,12 @@
  u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev)
  {
  	u64 base = RREG32_SOC15(MMHUB, 0, mmMC_VM_FB_LOCATION_BASE);
-
-	base &= MC_VM_FB_LOCATION_BASE__FB_BASE_MASK;

drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c line 49

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +6 -1
-	base <<= 24;
+	if (adev->gmc.enable_zfb) {
+		base = 0xF400000000ULL;
+	} else {
+		base &= MC_VM_FB_LOCATION_BASE__FB_BASE_MASK;
+		base <<= 24;
+	}
 
  	return base;
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author
#32 lore raw

PATCH 9/9 drm/amdgpu: program system bit for pte/pde when ZFB is enabled

In reply to a message not in the archive
Change-Id Icfb8c1df201d3f22f1d8cdbaee55de6bebac8df6
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 2 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 6 ++++++
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c  | 2 ++
 3 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +2 -0
index f7e616b..dc1dc7c 100644
@@ -47,6 +47,8 @@ static void gfxhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev)
 		+ adev->vm_manager.vram_base_offset;
 	value &= 0x0000FFFFFFFFF000ULL;
 	value |= 0x1; /*valid bit*/
+	if (adev->gmc.enable_zfb)
+		value |= 0x2; /*system bit*/
 
 	WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32,
 		     lower_32_bits(value));
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +6 -0
index 8fd7b01..48f71ac 100644
@@ -470,6 +470,9 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
 	if (flags & AMDGPU_VM_PAGE_WRITEABLE)
 		pte_flag |= AMDGPU_PTE_WRITEABLE;
 
+	if (adev->gmc.enable_zfb)
+		pte_flag |= AMDGPU_PTE_SYSTEM;
+
 	switch (flags & AMDGPU_VM_MTYPE_MASK) {
 	case AMDGPU_VM_MTYPE_DEFAULT:
 		pte_flag |= AMDGPU_PTE_MTYPE(MTYPE_NC);
@@ -505,6 +508,9 @@ static void gmc_v9_0_get_vm_pde(struct amdgpu_device *adev, int level,
 			adev->gmc.vram_start;
 	BUG_ON(*addr & 0xFFFF00000000003FULL);
 
+	if (adev->gmc.enable_zfb)
+		*flags |= AMDGPU_PTE_SYSTEM;
+
 	if (!adev->gmc.translate_further)
 		return;
 
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +2 -0
index c56ab47..5d94373 100644
@@ -57,6 +57,8 @@ static void mmhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev)
 		adev->vm_manager.vram_base_offset;
 	value &= 0x0000FFFFFFFFF000ULL;
 	value |= 0x1; /* valid bit */
+	if (adev->gmc.enable_zfb)
+		value |= 0x2; /* system bit*/
 
 	WREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32,
 		     lower_32_bits(value));
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1518006892-14121-10-git-send-email-Feifei.Xu-5C7GfCeVMHo@public.gmane.org

#34 lore raw

Re: [PATCH 9/9] drm/amdgpu: program system bit for pte/pde when ZFB is enabled

Am 07.02.2018 um 13:34 schrieb Feifei Xu:

Quoted 14 lines
Change-Id Icfb8c1df201d3f22f1d8cdbaee55de6bebac8df6
---
  drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 2 ++
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c    | 6 ++++++
  drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c  | 2 ++
  3 files changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +0 -0
index f7e616b..dc1dc7c 100644

drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c static void gfxhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev) · line 51

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +2 -0
@@ -47,6 +47,8 @@ static void gfxhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev)
  		+ adev->vm_manager.vram_base_offset;
  	value &= 0x0000FFFFFFFFF000ULL;
  	value |= 0x1; /*valid bit*/
+	if (adev->gmc.enable_zfb)
+		value |= 0x2; /*system bit*/

Please change that to use the gmc_v9_0_get_vm_pde() callback here for consistency.

Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c +0 -0
  	WREG32_SOC15(GC, 0, mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32,
  		     lower_32_bits(value));
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +6 -0
index 8fd7b01..48f71ac 100644
@@ -470,6 +470,9 @@ static uint64_t gmc_v9_0_get_vm_pte_flags(struct amdgpu_device *adev,
  	if (flags & AMDGPU_VM_PAGE_WRITEABLE)
  		pte_flag |= AMDGPU_PTE_WRITEABLE;
 
+	if (adev->gmc.enable_zfb)
+		pte_flag |= AMDGPU_PTE_SYSTEM;
+
  	switch (flags & AMDGPU_VM_MTYPE_MASK) {
  	case AMDGPU_VM_MTYPE_DEFAULT:
  		pte_flag |= AMDGPU_PTE_MTYPE(MTYPE_NC);
@@ -505,6 +508,9 @@ static void gmc_v9_0_get_vm_pde(struct amdgpu_device *adev, int level,
  			adev->gmc.vram_start;
  	BUG_ON(*addr & 0xFFFF00000000003FULL);
 
+	if (adev->gmc.enable_zfb)
+		*flags |= AMDGPU_PTE_SYSTEM;
+
  	if (!adev->gmc.translate_further)
  		return;
 
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +0 -0
index c56ab47..5d94373 100644

drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c static void mmhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev) · line 61

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +2 -0
@@ -57,6 +57,8 @@ static void mmhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev)
  		adev->vm_manager.vram_base_offset;
  	value &= 0x0000FFFFFFFFF000ULL;
  	value |= 0x1; /* valid bit */
+	if (adev->gmc.enable_zfb)
+		value |= 0x2; /* system bit*/

Dito.

Christian.

drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c static void mmhub_v1_0_init_gart_pt_regs(struct amdgpu_device *adev) · line 64

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c +0 -0
  	WREG32_SOC15(MMHUB, 0, mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32,
  		     lower_32_bits(value));

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx