public inbox for amd-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu:Remove unused code
@ 2018-10-02 13:20 James Zhu
       [not found] ` <1538486426-5306-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: James Zhu @ 2018-10-02 13:20 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: james.zhu-5C7GfCeVMHo

The following WREG32_SOC15_DPG_MODE will overwrite register
mmUVD_CGC_CTRL. This code can be removed.

Signed-off-by: James Zhu <James.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
index 63d7f97..fbc05ef 100644
--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
@@ -601,8 +601,6 @@ static void vcn_v1_0_clock_gating_dpg_mode(struct amdgpu_device *adev, uint8_t s
 		reg_data = 0 << UVD_CGC_CTRL__DYN_CLOCK_MODE__SHIFT;
 	reg_data |= 1 << UVD_CGC_CTRL__CLK_GATE_DLY_TIMER__SHIFT;
 	reg_data |= 4 << UVD_CGC_CTRL__CLK_OFF_DELAY__SHIFT;
-	WREG32_SOC15_DPG_MODE(UVD, 0, mmUVD_CGC_CTRL, reg_data, 0xFFFFFFFF, sram_sel);
-
 	reg_data &= ~(UVD_CGC_CTRL__UDEC_RE_MODE_MASK |
 		 UVD_CGC_CTRL__UDEC_CM_MODE_MASK |
 		 UVD_CGC_CTRL__UDEC_IT_MODE_MASK |
-- 
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] 4+ messages in thread

* Re: [PATCH] drm/amdgpu:Remove unused code
       [not found] ` <1538486426-5306-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
@ 2018-10-03 13:14   ` Leo Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Leo Liu @ 2018-10-03 13:14 UTC (permalink / raw)
  To: James Zhu, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: james.zhu-5C7GfCeVMHo

Reviewed-by: Leo Liu <leo.liu@amd.com>


On 10/02/2018 09:20 AM, James Zhu wrote:
> The following WREG32_SOC15_DPG_MODE will overwrite register
> mmUVD_CGC_CTRL. This code can be removed.
>
> Signed-off-by: James Zhu <James.Zhu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> index 63d7f97..fbc05ef 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
> @@ -601,8 +601,6 @@ static void vcn_v1_0_clock_gating_dpg_mode(struct amdgpu_device *adev, uint8_t s
>   		reg_data = 0 << UVD_CGC_CTRL__DYN_CLOCK_MODE__SHIFT;
>   	reg_data |= 1 << UVD_CGC_CTRL__CLK_GATE_DLY_TIMER__SHIFT;
>   	reg_data |= 4 << UVD_CGC_CTRL__CLK_OFF_DELAY__SHIFT;
> -	WREG32_SOC15_DPG_MODE(UVD, 0, mmUVD_CGC_CTRL, reg_data, 0xFFFFFFFF, sram_sel);
> -
>   	reg_data &= ~(UVD_CGC_CTRL__UDEC_RE_MODE_MASK |
>   		 UVD_CGC_CTRL__UDEC_CM_MODE_MASK |
>   		 UVD_CGC_CTRL__UDEC_IT_MODE_MASK |

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

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

* [PATCH] drm/amdgpu : remove unused code
@ 2024-03-04  9:16 jesse.zhang
  2024-03-04 12:51 ` Christian König
  0 siblings, 1 reply; 4+ messages in thread
From: jesse.zhang @ 2024-03-04  9:16 UTC (permalink / raw)
  To: amd-gfx
  Cc: Alexander.Deucher, aaron.liu, Felix.Kuehling, Jesse Zhang,
	Jesse Zhang

From: Jesse Zhang <jesse.zhang@amd.com>

Remove the unused function - amdgpu_vm_pt_is_root_clean
and remove the impossible condition

v1: entries == 0 is not possible any more,
   so this condition could probably be removed (Felix)

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h    |  2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 61 ++++++-----------------
 2 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index 7f95039bb37d..047ec1930d12 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -537,8 +537,6 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 			int level, bool immediate, struct amdgpu_bo_vm **vmbo,
 			int32_t xcp_id);
 void amdgpu_vm_pt_free_root(struct amdgpu_device *adev, struct amdgpu_vm *vm);
-bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,
-				struct amdgpu_vm *vm);
 
 int amdgpu_vm_pde_update(struct amdgpu_vm_update_params *params,
 			 struct amdgpu_vm_bo_base *entry);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
index 8bce4da67131..7ecddb77b3ae 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
@@ -367,6 +367,7 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 	struct amdgpu_bo *bo = &vmbo->bo;
 	uint64_t addr;
 	int r, idx;
+	uint64_t value = 0, flags = 0;
 
 	/* Figure out our place in the hierarchy */
 	if (ancestor->parent) {
@@ -409,27 +410,24 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 
 	addr = 0;
 
-	if (entries) {
-		uint64_t value = 0, flags = 0;
-
-		if (adev->asic_type >= CHIP_VEGA10) {
-			if (level != AMDGPU_VM_PTB) {
-				/* Handle leaf PDEs as PTEs */
-				flags |= AMDGPU_PDE_PTE;
-				amdgpu_gmc_get_vm_pde(adev, level,
-						      &value, &flags);
-			} else {
-				/* Workaround for fault priority problem on GMC9 */
-				flags = AMDGPU_PTE_EXECUTABLE;
-			}
-		}
 
-		r = vm->update_funcs->update(&params, vmbo, addr, 0, entries,
-					     value, flags);
-		if (r)
-			goto exit;
+	if (adev->asic_type >= CHIP_VEGA10) {
+		if (level != AMDGPU_VM_PTB) {
+			/* Handle leaf PDEs as PTEs */
+			flags |= AMDGPU_PDE_PTE;
+			amdgpu_gmc_get_vm_pde(adev, level,
+					      &value, &flags);
+		} else {
+			/* Workaround for fault priority problem on GMC9 */
+			flags = AMDGPU_PTE_EXECUTABLE;
+		}
 	}
 
+	r = vm->update_funcs->update(&params, vmbo, addr, 0, entries,
+				     value, flags);
+	if (r)
+		goto exit;
+
 	r = vm->update_funcs->commit(&params, NULL);
 exit:
 	drm_dev_exit(idx);
@@ -673,33 +671,6 @@ void amdgpu_vm_pt_free_root(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	amdgpu_vm_pt_free_dfs(adev, vm, NULL, false);
 }
 
-/**
- * amdgpu_vm_pt_is_root_clean - check if a root PD is clean
- *
- * @adev: amdgpu_device pointer
- * @vm: the VM to check
- *
- * Check all entries of the root PD, if any subsequent PDs are allocated,
- * it means there are page table creating and filling, and is no a clean
- * VM
- *
- * Returns:
- *	0 if this VM is clean
- */
-bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,
-				struct amdgpu_vm *vm)
-{
-	enum amdgpu_vm_level root = adev->vm_manager.root_level;
-	unsigned int entries = amdgpu_vm_pt_num_entries(adev, root);
-	unsigned int i = 0;
-
-	for (i = 0; i < entries; i++) {
-		if (to_amdgpu_bo_vm(vm->root.bo)->entries[i].bo)
-			return false;
-	}
-	return true;
-}
-
 /**
  * amdgpu_vm_pde_update - update a single level in the hierarchy
  *
-- 
2.25.1


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

* Re: [PATCH] drm/amdgpu : remove unused code
  2024-03-04  9:16 [PATCH] drm/amdgpu : remove unused code jesse.zhang
@ 2024-03-04 12:51 ` Christian König
  0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2024-03-04 12:51 UTC (permalink / raw)
  To: jesse.zhang, amd-gfx; +Cc: Alexander.Deucher, aaron.liu, Felix.Kuehling

Am 04.03.24 um 10:16 schrieb jesse.zhang@amd.com:
> From: Jesse Zhang <jesse.zhang@amd.com>
>
> Remove the unused function - amdgpu_vm_pt_is_root_clean
> and remove the impossible condition
>
> v1: entries == 0 is not possible any more,
>     so this condition could probably be removed (Felix)
>
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h    |  2 -
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | 61 ++++++-----------------
>   2 files changed, 16 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> index 7f95039bb37d..047ec1930d12 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
> @@ -537,8 +537,6 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>   			int level, bool immediate, struct amdgpu_bo_vm **vmbo,
>   			int32_t xcp_id);
>   void amdgpu_vm_pt_free_root(struct amdgpu_device *adev, struct amdgpu_vm *vm);
> -bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,
> -				struct amdgpu_vm *vm);
>   
>   int amdgpu_vm_pde_update(struct amdgpu_vm_update_params *params,
>   			 struct amdgpu_vm_bo_base *entry);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> index 8bce4da67131..7ecddb77b3ae 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
> @@ -367,6 +367,7 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>   	struct amdgpu_bo *bo = &vmbo->bo;
>   	uint64_t addr;
>   	int r, idx;
> +	uint64_t value = 0, flags = 0;

Please don't initialize the values here.

Rather move that before the if (... >= VEGA10) below.

With that fixed feel free to add Reviewed-by: Christian König 
<christian.koenig@amd.com>

Regards,
Christian.

>   
>   	/* Figure out our place in the hierarchy */
>   	if (ancestor->parent) {
> @@ -409,27 +410,24 @@ int amdgpu_vm_pt_clear(struct amdgpu_device *adev, struct amdgpu_vm *vm,
>   
>   	addr = 0;
>   
> -	if (entries) {
> -		uint64_t value = 0, flags = 0;
> -
> -		if (adev->asic_type >= CHIP_VEGA10) {
> -			if (level != AMDGPU_VM_PTB) {
> -				/* Handle leaf PDEs as PTEs */
> -				flags |= AMDGPU_PDE_PTE;
> -				amdgpu_gmc_get_vm_pde(adev, level,
> -						      &value, &flags);
> -			} else {
> -				/* Workaround for fault priority problem on GMC9 */
> -				flags = AMDGPU_PTE_EXECUTABLE;
> -			}
> -		}
>   
> -		r = vm->update_funcs->update(&params, vmbo, addr, 0, entries,
> -					     value, flags);
> -		if (r)
> -			goto exit;
> +	if (adev->asic_type >= CHIP_VEGA10) {
> +		if (level != AMDGPU_VM_PTB) {
> +			/* Handle leaf PDEs as PTEs */
> +			flags |= AMDGPU_PDE_PTE;
> +			amdgpu_gmc_get_vm_pde(adev, level,
> +					      &value, &flags);
> +		} else {
> +			/* Workaround for fault priority problem on GMC9 */
> +			flags = AMDGPU_PTE_EXECUTABLE;
> +		}
>   	}
>   
> +	r = vm->update_funcs->update(&params, vmbo, addr, 0, entries,
> +				     value, flags);
> +	if (r)
> +		goto exit;
> +
>   	r = vm->update_funcs->commit(&params, NULL);
>   exit:
>   	drm_dev_exit(idx);
> @@ -673,33 +671,6 @@ void amdgpu_vm_pt_free_root(struct amdgpu_device *adev, struct amdgpu_vm *vm)
>   	amdgpu_vm_pt_free_dfs(adev, vm, NULL, false);
>   }
>   
> -/**
> - * amdgpu_vm_pt_is_root_clean - check if a root PD is clean
> - *
> - * @adev: amdgpu_device pointer
> - * @vm: the VM to check
> - *
> - * Check all entries of the root PD, if any subsequent PDs are allocated,
> - * it means there are page table creating and filling, and is no a clean
> - * VM
> - *
> - * Returns:
> - *	0 if this VM is clean
> - */
> -bool amdgpu_vm_pt_is_root_clean(struct amdgpu_device *adev,
> -				struct amdgpu_vm *vm)
> -{
> -	enum amdgpu_vm_level root = adev->vm_manager.root_level;
> -	unsigned int entries = amdgpu_vm_pt_num_entries(adev, root);
> -	unsigned int i = 0;
> -
> -	for (i = 0; i < entries; i++) {
> -		if (to_amdgpu_bo_vm(vm->root.bo)->entries[i].bo)
> -			return false;
> -	}
> -	return true;
> -}
> -
>   /**
>    * amdgpu_vm_pde_update - update a single level in the hierarchy
>    *


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

end of thread, other threads:[~2024-03-04 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-04  9:16 [PATCH] drm/amdgpu : remove unused code jesse.zhang
2024-03-04 12:51 ` Christian König
  -- strict thread matches above, loose matches on Subject: below --
2018-10-02 13:20 [PATCH] drm/amdgpu:Remove " James Zhu
     [not found] ` <1538486426-5306-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-10-03 13:14   ` Leo Liu

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