Skip to contentSkip to conversation

drm/amdgpu: IB size alignment on VCN5

PATCH In review Sonny Jiang 3 participants 5 messages Apr 15, 2024 – Apr 17, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: IB size alignment on VCN5

From: Sonny Jiang <[email protected]>

VCN5 IB size alignment adjusted.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
index 5d1b084eb631..94ae14e0989c 100644
@@ -509,7 +509,7 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 					++num_rings;
 		}
 		ib_start_alignment = 256;
-		ib_size_alignment = 4;
+		ib_size_alignment = 64;
 		break;
 	case AMDGPU_HW_IP_VCN_JPEG:
 		type = (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_JPEG)) ?
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -3
index bb85772b1374..7d176046498f 100644
@@ -731,7 +731,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring,
 	int i, r;
 
 	if (sq)
-		ib_size_dw += 8;
+		ib_size_dw += 16;
 
 	r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
 				     ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
@@ -861,7 +861,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
 	int i, r;
 
 	if (sq)
-		ib_size_dw += 8;
+		ib_size_dw += 16;
 
 	r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
 				     ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
@@ -928,7 +928,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
 	int i, r;
 
 	if (sq)
-		ib_size_dw += 8;
+		ib_size_dw += 16;
 
 	r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
 				     ib_size_dw * 4, AMDGPU_IB_POOL_DIRECT,
Signature · 1 line
2.43.2
#1 lore raw

PATCH 2/2 drm/amdgpu: IB test encode test package change for VCN5

From: Sonny Jiang <[email protected]>

VCN5 session info package interface changed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
index 7d176046498f..e08aacacc43e 100644
@@ -882,7 +882,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
 	ib->ptr[ib->length_dw++] = handle;
 	ib->ptr[ib->length_dw++] = upper_32_bits(addr);
 	ib->ptr[ib->length_dw++] = addr;
-	ib->ptr[ib->length_dw++] = 0x0000000b;
+	ib->ptr[ib->length_dw++] = 0x00000000;
 
 	ib->ptr[ib->length_dw++] = 0x00000014;
 	ib->ptr[ib->length_dw++] = 0x00000002; /* task info */
@@ -949,7 +949,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
 	ib->ptr[ib->length_dw++] = handle;
 	ib->ptr[ib->length_dw++] = upper_32_bits(addr);
 	ib->ptr[ib->length_dw++] = addr;
-	ib->ptr[ib->length_dw++] = 0x0000000b;
+	ib->ptr[ib->length_dw++] = 0x00000000;
 
 	ib->ptr[ib->length_dw++] = 0x00000014;
 	ib->ptr[ib->length_dw++] = 0x00000002;
Signature · 1 line
2.43.2
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: IB test encode test package change for VCN5

Quoted 24 lines · Sonny Jiang

From: Sonny Jiang <[email protected]>

VCN5 session info package interface changed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1 -1
index 7d176046498f..e08aacacc43e 100644
@@ -882,7 +882,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
        ib->ptr[ib->length_dw++] = handle;
        ib->ptr[ib->length_dw++] = upper_32_bits(addr);
        ib->ptr[ib->length_dw++] = addr;
-       ib->ptr[ib->length_dw++] = 0x0000000b;
+       ib->ptr[ib->length_dw++] = 0x00000000;
 
        ib->ptr[ib->length_dw++] = 0x00000014;
        ib->ptr[ib->length_dw++] = 0x00000002; /* task info */

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han · line 952

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1 -1
@@ -949,7 +949,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
        ib->ptr[ib->length_dw++] = handle;
        ib->ptr[ib->length_dw++] = upper_32_bits(addr);
        ib->ptr[ib->length_dw++] = addr;
-       ib->ptr[ib->length_dw++] = 0x0000000b;
+       ib->ptr[ib->length_dw++] = 0x00000000;

These patches are touching common files, are these changes safe on pre-VCN5 IPs?

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -1
        ib->ptr[ib->length_dw++] = 0x00000014;
        ib->ptr[ib->length_dw++] = 0x00000002;
--

2.43.2

#3 lore raw

Re: [PATCH 2/2] drm/amdgpu: IB test encode test package change for VCN5

[AMD Official Use Only - General]

These changes are for vcn_unified_ring_test_ib which only used on VCN4 and VCN5. The only exception is ib_size_alignment of hw_ip_info.

The VCN5 adds address_patch_enabled in session_info. VCN4 doesn't have it, so it should just ignore the extra 0.

typedef struct uve_session_info_s
{

    unsigned int                    interface_version;                              ///< The version of the firmware interface on which the host was built
    unsigned int                    sw_context_address_hi;                          ///< High address of software context buffer
    unsigned int                    sw_context_address_lo;                          ///< Low address of software context buffer
    unsigned int                    address_patch_enabled;                          ///< address patching enabled in UMD

} uve_session_info_t;

By my tests, I didn't find error. I may need more tests on mi300 asic.

Thanks,
Sonny

________________________________
From: Alex Deucher <[email protected]>
Sent: Monday, April 15, 2024 5:32 PM
To: Jiang, Sonny <[email protected]>
Cc: [email protected] <[email protected]>; Jiang, Sonny <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: IB test encode test package change for VCN5

Quoted 24 lines · Sonny Jiang

From: Sonny Jiang <[email protected]>

VCN5 session info package interface changed

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1 -1
index 7d176046498f..e08aacacc43e 100644
@@ -882,7 +882,7 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
        ib->ptr[ib->length_dw++] = handle;
        ib->ptr[ib->length_dw++] = upper_32_bits(addr);
        ib->ptr[ib->length_dw++] = addr;
-       ib->ptr[ib->length_dw++] = 0x0000000b;
+       ib->ptr[ib->length_dw++] = 0x00000000;
 
        ib->ptr[ib->length_dw++] = 0x00000014;
        ib->ptr[ib->length_dw++] = 0x00000002; /* task info */

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han · line 952

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1 -1
@@ -949,7 +949,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han
        ib->ptr[ib->length_dw++] = handle;
        ib->ptr[ib->length_dw++] = upper_32_bits(addr);
        ib->ptr[ib->length_dw++] = addr;
-       ib->ptr[ib->length_dw++] = 0x0000000b;
+       ib->ptr[ib->length_dw++] = 0x00000000;

These patches are touching common files, are these changes safe on pre-VCN5 IPs?

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +0 -1
        ib->ptr[ib->length_dw++] = 0x00000014;
        ib->ptr[ib->length_dw++] = 0x00000002;
--

2.43.2

#4 lore raw
In reply to Sonny Jiang

[AMD Official Use Only - General]

Quoted 25 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Sonny Jiang
Sent: Monday, April 15, 2024 5:25 PM
To: [email protected]
Cc: Jiang, Sonny <[email protected]>; Jiang, Sonny <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: IB size alignment on VCN5

From: Sonny Jiang <[email protected]>

VCN5 IB size alignment adjusted.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
index 5d1b084eb631..94ae14e0989c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_hw_ip_info(struct amdgpu_device · line 513

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
@@ -509,7 +509,7 @@ static int amdgpu_hw_ip_info(struct amdgpu_device
 *adev,
                                      ++num_rings;
              }
              ib_start_alignment = 256;
-             ib_size_alignment = 4;
+             ib_size_alignment = 64;

We don't want these impact on previous HW if that is really required.

Regards,
Leo

Quoted 42 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
              break;
      case AMDGPU_HW_IP_VCN_JPEG:

type = (amdgpu_device_ip_get_ip_block(adev,
AMD_IP_BLOCK_TYPE_JPEG)) ?

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1 -1
index bb85772b1374..7d176046498f 100644
@@ -731,7 +731,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct
 amdgpu_ring *ring,
      int i, r;
 
      if (sq)
-             ib_size_dw += 8;
+             ib_size_dw += 16;
 
      r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
                                   ib_size_dw * 4,
AMDGPU_IB_POOL_DIRECT, @@ -861,7 +861,7 @@ static int
amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand
      int i, r;

      if (sq)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1 -1
-             ib_size_dw += 8;
+             ib_size_dw += 16;
 
      r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
                                   ib_size_dw * 4,

AMDGPU_IB_POOL_DIRECT, @@ -928,7 +928,7 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han

      int i, r;

      if (sq)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +1 -1
-             ib_size_dw += 8;
+             ib_size_dw += 16;
 
      r = amdgpu_job_alloc_with_ib(ring->adev, NULL, NULL,
                                   ib_size_dw * 4,

AMDGPU_IB_POOL_DIRECT,
--
2.43.2