AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: sriov restrict max_pfn below AMDGPU_GMC_HOLE
@ 2019-01-24  3:38 wentalou
       [not found] ` <1548301091-26581-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: wentalou @ 2019-01-24  3:38 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: wentalou

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

Change-Id: I0add197a24a54388a128a545056e9a9f0330abfb
Signed-off-by: Wentao Lou <Wentao.Lou@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
index dd3bd01..7e22be7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
@@ -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);
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 9c082f9..600259b 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -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;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: sriov restrict max_pfn below AMDGPU_GMC_HOLE
       [not found] ` <1548301091-26581-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org>
@ 2019-01-28  8:55   ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2019-01-28  8:55 UTC (permalink / raw)
  To: wentalou, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 24.01.19 um 04:38 schrieb wentalou:
> sriov need to restrict max_pfn below AMDGPU_GMC_HOLE.
> access the hole results in a range fault interrupt IIRC.
>
> Change-Id: I0add197a24a54388a128a545056e9a9f0330abfb
> Signed-off-by: Wentao Lou <Wentao.Lou@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> index dd3bd01..7e22be7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c
> @@ -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);
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 9c082f9..600259b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -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;

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-28  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-24  3:38 [PATCH] drm/amdgpu: sriov restrict max_pfn below AMDGPU_GMC_HOLE wentalou
     [not found] ` <1548301091-26581-1-git-send-email-Wentao.Lou-5C7GfCeVMHo@public.gmane.org>
2019-01-28  8:55   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox