Skip to contentSkip to conversation

drm/amdgpu: sriov restrict max_pfn below AMDGPU_GMC_HOLE

PATCH In review wentalou 2 participants 2 messages Jan 24, 2019 – Jan 28, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

wentalou

author
#0 lore raw

PATCH 1/1 drm/amdgpu: sriov restrict max_pfn below AMDGPU_GMC_HOLE

sriov need to restrict max_pfn below AMDGPU_GMC_HOLE. access the hole results in a range fault interrupt IIRC.

Change-Id I0add197a24a54388a128a545056e9a9f0330abfb
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 3 +--
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 6 +++++-
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +1 -2
index dd3bd01..7e22be7 100644
@@ -26,8 +26,7 @@
 
 uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev)
 {
-	uint64_t addr = min(adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT,
-				AMDGPU_GMC_HOLE_START);
+	uint64_t addr = adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT;
 
 	addr -= AMDGPU_VA_RESERVED_SIZE;
 	addr = amdgpu_gmc_sign_extend(addr);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +5 -1
index 9c082f9..600259b 100644
@@ -965,7 +965,11 @@ static int gmc_v9_0_sw_init(void *handle)
 		 * vm size is 256TB (48bit), maximum size of Vega10,
 		 * block size 512 (9bit)
 		 */
-		amdgpu_vm_adjust_size(adev, 256 * 1024, 9, 3, 48);
+		/* sriov restrict max_pfn below AMDGPU_GMC_HOLE */
+		if (amdgpu_sriov_vf(adev))
+			amdgpu_vm_adjust_size(adev, 256 * 1024, 9, 3, 47);
+		else
+			amdgpu_vm_adjust_size(adev, 256 * 1024, 9, 3, 48);
 		break;
 	default:
 		break;
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): 1548301091-26581-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Am 24.01.19 um 04:38 schrieb wentalou:

Quoted 5 lines

sriov need to restrict max_pfn below AMDGPU_GMC_HOLE. access the hole results in a range fault interrupt IIRC.

Change-Id I0add197a24a54388a128a545056e9a9f0330abfb
Quoted 26 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 3 +--
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c   | 6 +++++-
  2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +1 -2
index dd3bd01..7e22be7 100644
@@ -26,8 +26,7 @@
 
  uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev)
  {
-	uint64_t addr = min(adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT,
-				AMDGPU_GMC_HOLE_START);
+	uint64_t addr = adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT;
 
  	addr -= AMDGPU_VA_RESERVED_SIZE;
  	addr = amdgpu_gmc_sign_extend(addr);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0 -0
index 9c082f9..600259b 100644
@@ -965,7 +965,11 @@ static int gmc_v9_0_sw_init(void *handle)
  		 * vm size is 256TB (48bit), maximum size of Vega10,
  		 * block size 512 (9bit)

drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_sw_init(void *handle) · line 975

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +5 -1
  		 */
-		amdgpu_vm_adjust_size(adev, 256 * 1024, 9, 3, 48);
+		/* sriov restrict max_pfn below AMDGPU_GMC_HOLE */
+		if (amdgpu_sriov_vf(adev))
+			amdgpu_vm_adjust_size(adev, 256 * 1024, 9, 3, 47);
+		else
+			amdgpu_vm_adjust_size(adev, 256 * 1024, 9, 3, 48);
  		break;
  	default:
  		break;

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