[08/11] drm/amdgpu/vce4: replaced with virt_alloc_mm_table

Submitted by Yu, Xiangliang on April 24, 2017, 6:58 a.m.

Details

Message ID 1493017089-23101-9-git-send-email-Xiangliang.Yu@amd.com
State New
Headers show
Series "Enable UVD and PSP loading for SRIOV" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Yu, Xiangliang April 24, 2017, 6:58 a.m.
Used virt_alloc_mm_table function to allocate MM table memory.

Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
index a3d9d4d..a34cdbd 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
@@ -444,20 +444,9 @@  static int vce_v4_0_sw_init(void *handle)
 			return r;
 	}
 
-	if (amdgpu_sriov_vf(adev)) {
-		r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
-					    AMDGPU_GEM_DOMAIN_VRAM,
-					    &adev->virt.mm_table.bo,
-					    &adev->virt.mm_table.gpu_addr,
-					    (void *)&adev->virt.mm_table.cpu_addr);
-		if (!r) {
-			memset((void *)adev->virt.mm_table.cpu_addr, 0, PAGE_SIZE);
-			printk("mm table gpu addr = 0x%llx, cpu addr = %p. \n",
-			       adev->virt.mm_table.gpu_addr,
-			       adev->virt.mm_table.cpu_addr);
-		}
+	r = amdgpu_virt_alloc_mm_table(adev);
+	if (r)
 		return r;
-	}
 
 	return r;
 }
@@ -468,10 +457,7 @@  static int vce_v4_0_sw_fini(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	/* free MM table */
-	if (amdgpu_sriov_vf(adev))
-		amdgpu_bo_free_kernel(&adev->virt.mm_table.bo,
-				      &adev->virt.mm_table.gpu_addr,
-				      (void *)&adev->virt.mm_table.cpu_addr);
+	amdgpu_virt_free_mm_table(adev);
 
 	r = amdgpu_vce_suspend(adev);
 	if (r)

Comments

> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Xiangliang Yu

> Sent: Monday, April 24, 2017 2:58 AM

> To: amd-gfx@lists.freedesktop.org

> Cc: Yu, Xiangliang

> Subject: [PATCH 08/11] drm/amdgpu/vce4: replaced with

> virt_alloc_mm_table

> 

> Used virt_alloc_mm_table function to allocate MM table memory.

> 

> Signed-off-by: Xiangliang Yu <Xiangliang.Yu@amd.com>


Reviewed-by: Alex Deucher <alexander.deucher@amd.com>


> ---

>  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 20 +++-----------------

>  1 file changed, 3 insertions(+), 17 deletions(-)

> 

> diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

> b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

> index a3d9d4d..a34cdbd 100644

> --- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

> +++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c

> @@ -444,20 +444,9 @@ static int vce_v4_0_sw_init(void *handle)

>  			return r;

>  	}

> 

> -	if (amdgpu_sriov_vf(adev)) {

> -		r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,

> -					    AMDGPU_GEM_DOMAIN_VRAM,

> -					    &adev->virt.mm_table.bo,

> -					    &adev->virt.mm_table.gpu_addr,

> -					    (void *)&adev-

> >virt.mm_table.cpu_addr);

> -		if (!r) {

> -			memset((void *)adev->virt.mm_table.cpu_addr, 0,

> PAGE_SIZE);

> -			printk("mm table gpu addr = 0x%llx, cpu addr = %p.

> \n",

> -			       adev->virt.mm_table.gpu_addr,

> -			       adev->virt.mm_table.cpu_addr);

> -		}

> +	r = amdgpu_virt_alloc_mm_table(adev);

> +	if (r)

>  		return r;

> -	}

> 

>  	return r;

>  }

> @@ -468,10 +457,7 @@ static int vce_v4_0_sw_fini(void *handle)

>  	struct amdgpu_device *adev = (struct amdgpu_device *)handle;

> 

>  	/* free MM table */

> -	if (amdgpu_sriov_vf(adev))

> -		amdgpu_bo_free_kernel(&adev->virt.mm_table.bo,

> -				      &adev->virt.mm_table.gpu_addr,

> -				      (void *)&adev->virt.mm_table.cpu_addr);

> +	amdgpu_virt_free_mm_table(adev);

> 

>  	r = amdgpu_vce_suspend(adev);

>  	if (r)

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx