Skip to contentSkip to conversation

drm/amdgpu/vpe: power on vpe when hw_init

PATCH In review Peyton Lee 4 participants 8 messages Mar 13, 2024 – Mar 19, 2024

Subsystems (2)
lore
Share & tools
lore

Peyton Lee

author
#0 lore raw

PATCH 1/1 drm/amdgpu/vpe: power on vpe when hw_init

To fix mode2 reset failure.
Should power on VPE when hw_init.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -0
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
 	struct amdgpu_vpe *vpe = &adev->vpe;
 	int ret;
 
+	/* Power on VPE */
+	ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE,
+						     AMD_PG_STATE_UNGATE);
+	if (ret)
+		return ret;
+
 	ret = vpe_load_microcode(vpe);
 	if (ret)
 		return ret;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Peyton Lee

To fix mode2 reset failure.
Should power on VPE when hw_init.

When does it get powered down again? Won't this leave it powered up?

Alex

Quoted 26 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -1
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
        struct amdgpu_vpe *vpe = &adev->vpe;
        int ret;
 
+       /* Power on VPE */
+       ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE,
+                                                    AMD_PG_STATE_UNGATE);
+       if (ret)
+               return ret;
+
        ret = vpe_load_microcode(vpe);
        if (ret)
                return ret;
--

2.34.1

#2 lore raw

[AMD Official Use Only - General]

Hi Alex,

There are two places where VPE will lose power: When there is a system call to vpe_hw_fini(), and the vpe-thread finds that VEP has no jobs in the queue. This patch is to make sure that VPE is power up before loading firmware.

Thanks,
Peyton
-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Wednesday, March 13, 2024 9:17 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]> 主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 3 lines · Peyton Lee

To fix mode2 reset failure.
Should power on VPE when hw_init.

When does it get powered down again? Won't this leave it powered up?

Alex

Quoted 26 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -1
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
        struct amdgpu_vpe *vpe = &adev->vpe;
        int ret;
 
+       /* Power on VPE */
+       ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE,
+                                                    AMD_PG_STATE_UNGATE);
+       if (ret)
+               return ret;
+
        ret = vpe_load_microcode(vpe);
        if (ret)
                return ret;
--

2.34.1

#3 lore raw
Quoted 7 lines · Peyton

[AMD Official Use Only - General]

Hi Alex,

There are two places where VPE will lose power: When there is a system call to vpe_hw_fini(), and the vpe-thread finds that VEP has no jobs in the queue. This patch is to make sure that VPE is power up before loading firmware.

I think it will continue to be powered up until a VPE job comes in and completes and the idle handler gets scheduled. If a VPE job doesn't come in, it will stay powered up I think.

Alex

Quoted 45 lines

Thanks,
Peyton
-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Wednesday, March 13, 2024 9:17 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]> 主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 3 lines · Peyton Lee

To fix mode2 reset failure.
Should power on VPE when hw_init.

When does it get powered down again? Won't this leave it powered up?

Alex

Quoted 26 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -1
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
        struct amdgpu_vpe *vpe = &adev->vpe;
        int ret;
 
+       /* Power on VPE */
+       ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE,
+                                                    AMD_PG_STATE_UNGATE);
+       if (ret)
+               return ret;
+
        ret = vpe_load_microcode(vpe);
        if (ret)
                return ret;
--

2.34.1

#4 lore raw

[AMD Official Use Only - General]

Hi Alex

Quoted 1 line

I think it will continue to be powered up until a VPE job comes in and completes and the idle handler gets scheduled. If a VPE job doesn't come in, it will stay powered up I think.

Yes, correct.
And after the VPE is called to do initialization, a simple test is executed for checking VPE status, and the idle handler gets scheduled to power off the VPE when the test finished.

Thanks,
Peyton

-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Thursday, March 14, 2024 8:58 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]> 主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 7 lines · Peyton

[AMD Official Use Only - General]

Hi Alex,

There are two places where VPE will lose power: When there is a system call to vpe_hw_fini(), and the vpe-thread finds that VEP has no jobs in the queue. This patch is to make sure that VPE is power up before loading firmware.

I think it will continue to be powered up until a VPE job comes in and completes and the idle handler gets scheduled. If a VPE job doesn't come in, it will stay powered up I think.

Alex

Quoted 48 lines

Thanks,
Peyton
-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Wednesday, March 13, 2024 9:17 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]>
主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 3 lines · Peyton Lee

To fix mode2 reset failure.
Should power on VPE when hw_init.

When does it get powered down again? Won't this leave it powered up?

Alex

Quoted 27 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -1
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
        struct amdgpu_vpe *vpe = &adev->vpe;
        int ret;
 
+       /* Power on VPE */
+       ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE,
+                                                    AMD_PG_STATE_UNGATE);
+       if (ret)
+               return ret;
+
        ret = vpe_load_microcode(vpe);
        if (ret)
                return ret;
--

2.34.1

#5 lore raw
Quoted 8 lines · Peyton

[AMD Official Use Only - General]

Hi Alex

Quoted 1 line

I think it will continue to be powered up until a VPE job comes in and completes and the idle handler gets scheduled. If a VPE job doesn't come in, it will stay powered up I think.

Yes, correct.
And after the VPE is called to do initialization, a simple test is executed for checking VPE status, and the idle handler gets scheduled to power off the VPE when the test finished.

Does the IB test take care of this? I just want to confirm that we aren't leaving it powered up unless a user runs a VPE workload which might not happen.

Alex

Quoted 72 lines

Thanks,
Peyton

-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Thursday, March 14, 2024 8:58 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]> 主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 7 lines · Peyton

[AMD Official Use Only - General]

Hi Alex,

There are two places where VPE will lose power: When there is a system call to vpe_hw_fini(), and the vpe-thread finds that VEP has no jobs in the queue. This patch is to make sure that VPE is power up before loading firmware.

I think it will continue to be powered up until a VPE job comes in and completes and the idle handler gets scheduled. If a VPE job doesn't come in, it will stay powered up I think.

Alex

Quoted 48 lines

Thanks,
Peyton
-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Wednesday, March 13, 2024 9:17 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]>
主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 3 lines · Peyton Lee

To fix mode2 reset failure.
Should power on VPE when hw_init.

When does it get powered down again? Won't this leave it powered up?

Alex

Quoted 27 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -1
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
        struct amdgpu_vpe *vpe = &adev->vpe;
        int ret;
 
+       /* Power on VPE */
+       ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE,
+                                                    AMD_PG_STATE_UNGATE);
+       if (ret)
+               return ret;
+
        ret = vpe_load_microcode(vpe);
        if (ret)
                return ret;
--

2.34.1

#6 lore raw

[AMD Official Use Only - General]

Hi Alex

Quoted 1 line

Does the IB test take care of this? I just want to confirm that we aren't leaving it powered up unless a user runs a VPE workload which might not happen.

Yes, the IB test take care of this.
The flow is like this: amdgpu_device_gpu_recover->amdgpu_do_asic_reset->amdgpu_ib_ring_tests Therefore, the idle thread is waked up and the VPE is powered off then.

Thanks,
Peyton

-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Friday, March 15, 2024 8:55 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]> 主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 8 lines · Peyton

[AMD Official Use Only - General]

Hi Alex

Quoted 1 line

I think it will continue to be powered up until a VPE job comes in and completes and the idle handler gets scheduled. If a VPE job doesn't come in, it will stay powered up I think.

Yes, correct.
And after the VPE is called to do initialization, a simple test is executed for checking VPE status, and the idle handler gets scheduled to power off the VPE when the test finished.

Does the IB test take care of this? I just want to confirm that we aren't leaving it powered up unless a user runs a VPE workload which might not happen.

Alex

Quoted 74 lines

Thanks,
Peyton

-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Thursday, March 14, 2024 8:58 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]>
主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 7 lines · Peyton

[AMD Official Use Only - General]

Hi Alex,

There are two places where VPE will lose power: When there is a system call to vpe_hw_fini(), and the vpe-thread finds that VEP has no jobs in the queue. This patch is to make sure that VPE is power up before loading firmware.

I think it will continue to be powered up until a VPE job comes in and completes and the idle handler gets scheduled. If a VPE job doesn't come in, it will stay powered up I think.

Alex

Quoted 48 lines

Thanks,
Peyton
-----原始郵件-----
寄件者: Alex Deucher <[email protected]>
寄件日期: Wednesday, March 13, 2024 9:17 PM
收件者: Lee, Peyton <[email protected]>
副本: [email protected]; Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]>
主旨: Re: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

Quoted 3 lines · Peyton Lee

To fix mode2 reset failure.
Should power on VPE when hw_init.

When does it get powered down again? Won't this leave it powered up?

Alex

Quoted 27 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -1
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
        struct amdgpu_vpe *vpe = &adev->vpe;
        int ret;
 
+       /* Power on VPE */
+       ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VPE,
+                                                    AMD_PG_STATE_UNGATE);
+       if (ret)
+               return ret;
+
        ret = vpe_load_microcode(vpe);
        if (ret)
                return ret;
--

2.34.1

Reviewed-by on v1 1/1
#7 lore raw
In reply to Peyton Lee

[Public]

Quoted 38 lines

-----Original Message-----
From: Lee, Peyton <[email protected]>
Sent: Wednesday, March 13, 2024 7:45 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Yifan <[email protected]>; Ma, Li <[email protected]>; Yu, Lang <[email protected]>; Lee, Peyton <[email protected]>
Subject: [PATCH] drm/amdgpu/vpe: power on vpe when hw_init

To fix mode2 reset failure.
Should power on VPE when hw_init.

---
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 6 ++++++

1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +6 -0
index 70c5cc80ecdc..ecfe0f36e83e 100644
@@ -396,6 +396,12 @@ static int vpe_hw_init(void *handle)
      struct amdgpu_vpe *vpe = &adev->vpe;
      int ret;
 
+      /* Power on VPE */
+      ret = amdgpu_device_ip_set_powergating_state(adev,
 AMD_IP_BLOCK_TYPE_VPE,
+                                                   AMD_PG_STATE_UNGATE);
+      if (ret)
+              return ret;
+
      ret = vpe_load_microcode(vpe);
      if (ret)
              return ret;

--
2.34.1