amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume fail
@ 2020-11-09 19:41 Sonny Jiang
  2020-11-13 22:33 ` Jiang, Sonny
  0 siblings, 1 reply; 3+ messages in thread
From: Sonny Jiang @ 2020-11-09 19:41 UTC (permalink / raw)
  To: amd-gfx; +Cc: Sonny Jiang

The SI UVD firmware validate key is stored at the end of firmware,
which is changed during resume while playing video. So get the key
at sw_init and store it for fw validate using.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c   | 20 +++++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
index 5eb63288d157..edbb8194ee81 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
@@ -67,6 +67,7 @@ struct amdgpu_uvd {
 	unsigned		harvest_config;
 	/* store image width to adjust nb memory state */
 	unsigned		decode_image_width;
+	uint32_t                keyselect;
 };
 
 int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
index 7cf4b11a65c5..3a5dce634cda 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
@@ -277,15 +277,8 @@ static void uvd_v3_1_mc_resume(struct amdgpu_device *adev)
  */
 static int uvd_v3_1_fw_validate(struct amdgpu_device *adev)
 {
-	void *ptr;
-	uint32_t ucode_len, i;
-	uint32_t keysel;
-
-	ptr = adev->uvd.inst[0].cpu_addr;
-	ptr += 192 + 16;
-	memcpy(&ucode_len, ptr, 4);
-	ptr += ucode_len;
-	memcpy(&keysel, ptr, 4);
+	int i;
+	uint32_t keysel = adev->uvd.keyselect;
 
 	WREG32(mmUVD_FW_START, keysel);
 
@@ -550,6 +543,8 @@ static int uvd_v3_1_sw_init(void *handle)
 	struct amdgpu_ring *ring;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	int r;
+	void *ptr;
+	uint32_t ucode_len;
 
 	/* UVD TRAP */
 	r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, 124, &adev->uvd.inst->irq);
@@ -560,6 +555,13 @@ static int uvd_v3_1_sw_init(void *handle)
 	if (r)
 		return r;
 
+	/* Retrieval firmware validate key */
+	ptr = adev->uvd.inst[0].cpu_addr;
+	ptr += 192 + 16;
+	memcpy(&ucode_len, ptr, 4);
+	ptr += ucode_len;
+	memcpy(&adev->uvd.keyselect, ptr, 4);
+
 	ring = &adev->uvd.inst->ring;
 	sprintf(ring->name, "uvd");
 	r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0,
-- 
2.25.1

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

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

* Re: [PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume fail
  2020-11-09 19:41 [PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume fail Sonny Jiang
@ 2020-11-13 22:33 ` Jiang, Sonny
  2020-11-16 18:06   ` Leo Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Jiang, Sonny @ 2020-11-13 22:33 UTC (permalink / raw)
  To: amd-gfx


[-- Attachment #1.1: Type: text/plain, Size: 2910 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Ping.
________________________________
From: Jiang, Sonny <Sonny.Jiang@amd.com>
Sent: Monday, November 9, 2020 2:41 PM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Jiang, Sonny <Sonny.Jiang@amd.com>
Subject: [PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume fail

The SI UVD firmware validate key is stored at the end of firmware,
which is changed during resume while playing video. So get the key
at sw_init and store it for fw validate using.

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  1 +
 drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c   | 20 +++++++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
index 5eb63288d157..edbb8194ee81 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
@@ -67,6 +67,7 @@ struct amdgpu_uvd {
         unsigned                harvest_config;
         /* store image width to adjust nb memory state */
         unsigned                decode_image_width;
+       uint32_t                keyselect;
 };

 int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
index 7cf4b11a65c5..3a5dce634cda 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
@@ -277,15 +277,8 @@ static void uvd_v3_1_mc_resume(struct amdgpu_device *adev)
  */
 static int uvd_v3_1_fw_validate(struct amdgpu_device *adev)
 {
-       void *ptr;
-       uint32_t ucode_len, i;
-       uint32_t keysel;
-
-       ptr = adev->uvd.inst[0].cpu_addr;
-       ptr += 192 + 16;
-       memcpy(&ucode_len, ptr, 4);
-       ptr += ucode_len;
-       memcpy(&keysel, ptr, 4);
+       int i;
+       uint32_t keysel = adev->uvd.keyselect;

         WREG32(mmUVD_FW_START, keysel);

@@ -550,6 +543,8 @@ static int uvd_v3_1_sw_init(void *handle)
         struct amdgpu_ring *ring;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         int r;
+       void *ptr;
+       uint32_t ucode_len;

         /* UVD TRAP */
         r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, 124, &adev->uvd.inst->irq);
@@ -560,6 +555,13 @@ static int uvd_v3_1_sw_init(void *handle)
         if (r)
                 return r;

+       /* Retrieval firmware validate key */
+       ptr = adev->uvd.inst[0].cpu_addr;
+       ptr += 192 + 16;
+       memcpy(&ucode_len, ptr, 4);
+       ptr += ucode_len;
+       memcpy(&adev->uvd.keyselect, ptr, 4);
+
         ring = &adev->uvd.inst->ring;
         sprintf(ring->name, "uvd");
         r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0,
--
2.25.1


[-- Attachment #1.2: Type: text/html, Size: 5591 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

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

* Re: [PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume fail
  2020-11-13 22:33 ` Jiang, Sonny
@ 2020-11-16 18:06   ` Leo Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Leo Liu @ 2020-11-16 18:06 UTC (permalink / raw)
  To: Jiang, Sonny, amd-gfx


[-- Attachment #1.1: Type: text/plain, Size: 3727 bytes --]

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


On 2020-11-13 5:33 p.m., Jiang, Sonny wrote:
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> [AMD Official Use Only - Internal Distribution Only]
>
>
> Ping.
> ------------------------------------------------------------------------
> *From:* Jiang, Sonny <Sonny.Jiang@amd.com>
> *Sent:* Monday, November 9, 2020 2:41 PM
> *To:* amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
> *Cc:* Jiang, Sonny <Sonny.Jiang@amd.com>
> *Subject:* [PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume 
> fail
> The SI UVD firmware validate key is stored at the end of firmware,
> which is changed during resume while playing video. So get the key
> at sw_init and store it for fw validate using.
>
> Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  1 +
>  drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c   | 20 +++++++++++---------
>  2 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> index 5eb63288d157..edbb8194ee81 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> @@ -67,6 +67,7 @@ struct amdgpu_uvd {
>          unsigned                harvest_config;
>          /* store image width to adjust nb memory state */
>          unsigned                decode_image_width;
> +       uint32_t                keyselect;
>  };
>
>  int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
> diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c 
> b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
> index 7cf4b11a65c5..3a5dce634cda 100644
> --- a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c
> @@ -277,15 +277,8 @@ static void uvd_v3_1_mc_resume(struct 
> amdgpu_device *adev)
>   */
>  static int uvd_v3_1_fw_validate(struct amdgpu_device *adev)
>  {
> -       void *ptr;
> -       uint32_t ucode_len, i;
> -       uint32_t keysel;
> -
> -       ptr = adev->uvd.inst[0].cpu_addr;
> -       ptr += 192 + 16;
> -       memcpy(&ucode_len, ptr, 4);
> -       ptr += ucode_len;
> -       memcpy(&keysel, ptr, 4);
> +       int i;
> +       uint32_t keysel = adev->uvd.keyselect;
>
>          WREG32(mmUVD_FW_START, keysel);
>
> @@ -550,6 +543,8 @@ static int uvd_v3_1_sw_init(void *handle)
>          struct amdgpu_ring *ring;
>          struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>          int r;
> +       void *ptr;
> +       uint32_t ucode_len;
>
>          /* UVD TRAP */
>          r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, 124, 
> &adev->uvd.inst->irq);
> @@ -560,6 +555,13 @@ static int uvd_v3_1_sw_init(void *handle)
>          if (r)
>                  return r;
>
> +       /* Retrieval firmware validate key */
> +       ptr = adev->uvd.inst[0].cpu_addr;
> +       ptr += 192 + 16;
> +       memcpy(&ucode_len, ptr, 4);
> +       ptr += ucode_len;
> +       memcpy(&adev->uvd.keyselect, ptr, 4);
> +
>          ring = &adev->uvd.inst->ring;
>          sprintf(ring->name, "uvd");
>          r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0,
> -- 
> 2.25.1
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cleo.liu%40amd.com%7C695a4d51b81b4a08dbe208d888242256%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637409036097906257%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=8u1TK45gYH0hQ8dn5x1A9ckXIYQjGCedmkp8mpt4EW4%3D&amp;reserved=0

[-- Attachment #1.2: Type: text/html, Size: 9435 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

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

end of thread, other threads:[~2020-11-16 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09 19:41 [PATCH v2] drm/amdgpu: fix SI UVD firmware validate resume fail Sonny Jiang
2020-11-13 22:33 ` Jiang, Sonny
2020-11-16 18:06   ` Leo Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).