Skip to contentSkip to conversation

drm/amd/amdgpu/vcn_v2_0: Mark RB commands as KMD commands

PATCH Superseded Thai, Thong 2 participants 6 messages Jul 25, 2019 – Jul 26, 2019 4 messages not in the archive

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amd/amdgpu/vcn_v2_0: Mark RB commands as KMD commands

Sets the CMD_SOURCE bit for VCN 2.0 Decoder Ring Buffer commands. This bit was previously set by the RBC HW on older firmware. Newer firmware uses a SW RBC and this bit has to be set by the driver.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 12 ++++++------
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
index 5e2453ee6b29..4d3bf4adf1eb 100644
@@ -30,6 +30,7 @@
 #define AMDGPU_VCN_FIRMWARE_OFFSET	256
 #define AMDGPU_VCN_MAX_ENC_RINGS	3
 
+#define VCN_DEC_KMD_CMD			0x80000000
 #define VCN_DEC_CMD_FENCE		0x00000000
 #define VCN_DEC_CMD_TRAP		0x00000001
 #define VCN_DEC_CMD_WRITE_REG		0x00000004
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +6 -6
index bc9726787c97..7091aef95ff0 100644
@@ -1488,7 +1488,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));
 	amdgpu_ring_write(ring, 0);
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-	amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_START << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_START << 1));
 }
 
 /**
@@ -1501,7 +1501,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)
 static void vcn_v2_0_dec_ring_insert_end(struct amdgpu_ring *ring)
 {
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-	amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_END << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_END << 1));
 }
 
 /**
@@ -1546,7 +1546,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
 	amdgpu_ring_write(ring, upper_32_bits(addr) & 0xff);
 
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-	amdgpu_ring_write(ring, VCN_DEC_CMD_FENCE << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_FENCE << 1));
 
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));
 	amdgpu_ring_write(ring, 0);
@@ -1556,7 +1556,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
 
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-	amdgpu_ring_write(ring, VCN_DEC_CMD_TRAP << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_TRAP << 1));
 }
 
 /**
@@ -1600,7 +1600,7 @@ static void vcn_v2_0_dec_ring_emit_reg_wait(struct amdgpu_ring *ring,
 
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-	amdgpu_ring_write(ring, VCN_DEC_CMD_REG_READ_COND_WAIT << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_REG_READ_COND_WAIT << 1));
 }
 
 static void vcn_v2_0_dec_ring_emit_vm_flush(struct amdgpu_ring *ring,
@@ -1629,7 +1629,7 @@ static void vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring,
 
 	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-	amdgpu_ring_write(ring, VCN_DEC_CMD_WRITE_REG << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_WRITE_REG << 1));
 }
 
 /**
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 2/2 drm/amd/amdgpu/vcn_v2_0: Move VCN 2.0 specific dec ring test to vcn_v2_0

VCN 2.0 firmware now requires a packet start command to be sent before any other decode ring buffer command.

---
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 32 ++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +31 -1
index 7091aef95ff0..4b00481cf9e0 100644
@@ -2082,6 +2082,36 @@ static int vcn_v2_0_process_interrupt(struct amdgpu_device *adev,
 	return 0;
 }
 
+int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)
+{
+	struct amdgpu_device *adev = ring->adev;
+	uint32_t tmp = 0;
+	unsigned i;
+	int r;
+
+	WREG32(adev->vcn.external.scratch9, 0xCAFEDEAD);
+	r = amdgpu_ring_alloc(ring, 3);
+	if (r)
+		return r;
+	amdgpu_ring_write(ring, PACKET0(adev->vcn.internal.cmd, 0));
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_START << 1));
+	amdgpu_ring_write(ring, PACKET0(adev->vcn.internal.scratch9, 0));
+	amdgpu_ring_write(ring, 0xDEADBEEF);
+	amdgpu_ring_commit(ring);
+	for (i = 0; i < adev->usec_timeout; i++) {
+		tmp = RREG32(adev->vcn.external.scratch9);
+		if (tmp == 0xDEADBEEF)
+			break;
+		DRM_UDELAY(1);
+	}
+
+	if (i >= adev->usec_timeout)
+		r = -ETIMEDOUT;
+
+	return r;
+}
+
+
 static int vcn_v2_0_set_powergating_state(void *handle,
 					  enum amd_powergating_state state)
 {
@@ -2145,7 +2175,7 @@ static const struct amdgpu_ring_funcs vcn_v2_0_dec_ring_vm_funcs = {
 	.emit_ib = vcn_v2_0_dec_ring_emit_ib,
 	.emit_fence = vcn_v2_0_dec_ring_emit_fence,
 	.emit_vm_flush = vcn_v2_0_dec_ring_emit_vm_flush,
-	.test_ring = amdgpu_vcn_dec_ring_test_ring,
+	.test_ring = vcn_v2_0_dec_ring_test_ring,
 	.test_ib = amdgpu_vcn_dec_ring_test_ib,
 	.insert_nop = vcn_v2_0_dec_ring_insert_nop,
 	.insert_start = vcn_v2_0_dec_ring_insert_start,
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH v2 1/1 drm/amd/amdgpu/vcn_v2_0: Mark RB commands as KMD commands

Sets the CMD_SOURCE bit for VCN 2.0 Decoder Ring Buffer commands. This bit was previously set by the RBC HW on older firmware. Newer firmware uses a SW RBC and this bit has to be set by the driver.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  1 +
 drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 44 +++++++++++++++++++++----
 2 files changed, 38 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
index 5e2453ee6b29..4d3bf4adf1eb 100644
@@ -30,6 +30,7 @@
 #define AMDGPU_VCN_FIRMWARE_OFFSET	256
 #define AMDGPU_VCN_MAX_ENC_RINGS	3
 
+#define VCN_DEC_KMD_CMD			0x80000000
 #define VCN_DEC_CMD_FENCE		0x00000000
 #define VCN_DEC_CMD_TRAP		0x00000001
 #define VCN_DEC_CMD_WRITE_REG		0x00000004
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +37 -7

92 lines not on this page · raw message

Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw
In reply to a message not in the archive

Am 25.07.19 um 17:52 schrieb Thai, Thong:

Quoted 3 lines

Sets the CMD_SOURCE bit for VCN 2.0 Decoder Ring Buffer commands. This bit was previously set by the RBC HW on older firmware. Newer firmware uses a SW RBC and this bit has to be set by the driver.

Mhm, another question came to my mind: Would it now be possible for user space to set this flag and and gain access to the kernel driver commands?

Cause that could be a security problem.

Christian.

Quoted 69 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  1 +
  drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 12 ++++++------
  2 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
index 5e2453ee6b29..4d3bf4adf1eb 100644
@@ -30,6 +30,7 @@
  #define AMDGPU_VCN_FIRMWARE_OFFSET	256
  #define AMDGPU_VCN_MAX_ENC_RINGS	3
 
+#define VCN_DEC_KMD_CMD			0x80000000
  #define VCN_DEC_CMD_FENCE		0x00000000
  #define VCN_DEC_CMD_TRAP		0x00000001
  #define VCN_DEC_CMD_WRITE_REG		0x00000004
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +5 -5
index bc9726787c97..7091aef95ff0 100644
@@ -1488,7 +1488,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));
  	amdgpu_ring_write(ring, 0);
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-	amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_START << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_START << 1));
  }
 
  /**
@@ -1501,7 +1501,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)
  static void vcn_v2_0_dec_ring_insert_end(struct amdgpu_ring *ring)
  {
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-	amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_END << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_END << 1));
  }
 
  /**
@@ -1546,7 +1546,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
  	amdgpu_ring_write(ring, upper_32_bits(addr) & 0xff);
 
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-	amdgpu_ring_write(ring, VCN_DEC_CMD_FENCE << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_FENCE << 1));
 
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));
  	amdgpu_ring_write(ring, 0);
@@ -1556,7 +1556,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
 
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-	amdgpu_ring_write(ring, VCN_DEC_CMD_TRAP << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_TRAP << 1));
  }
 
  /**
@@ -1600,7 +1600,7 @@ static void vcn_v2_0_dec_ring_emit_reg_wait(struct amdgpu_ring *ring,
 
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-	amdgpu_ring_write(ring, VCN_DEC_CMD_REG_READ_COND_WAIT << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_REG_READ_COND_WAIT << 1));
  }
 
  static void vcn_v2_0_dec_ring_emit_vm_flush(struct amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring, · line 1635

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
@@ -1629,7 +1629,7 @@ static void vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring,
 
  	amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-	amdgpu_ring_write(ring, VCN_DEC_CMD_WRITE_REG << 1);
+	amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_WRITE_REG << 1));
  }
 
  /**

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 2a7d972a-5916-7d00-c8ad-5ff33363d993-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#7 lore raw

Well, not through this particular piece of code, since this explicitly sets it. But I would imagine someone could set the bit in userspace and insert KMD commands in the BO as part of some IB instructions - I’ll have a look.

________________________________
From: Christian König <[email protected]>
Sent: Friday, July 26, 2019 3:17:19 AM
To: Thai, Thong <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 1/2] drm/amd/amdgpu/vcn_v2_0: Mark RB commands as KMD commands

Am 25.07.19 um 17:52 schrieb Thai, Thong:

Quoted 3 lines

Sets the CMD_SOURCE bit for VCN 2.0 Decoder Ring Buffer commands. This bit was previously set by the RBC HW on older firmware. Newer firmware uses a SW RBC and this bit has to be set by the driver.

Mhm, another question came to my mind: Would it now be possible for user space to set this flag and and gain access to the kernel driver commands?

Cause that could be a security problem.

Christian.

Quoted 69 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  1 +
  drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 12 ++++++------
  2 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
index 5e2453ee6b29..4d3bf4adf1eb 100644
@@ -30,6 +30,7 @@
  #define AMDGPU_VCN_FIRMWARE_OFFSET  256
  #define AMDGPU_VCN_MAX_ENC_RINGS    3
 
+#define VCN_DEC_KMD_CMD                      0x80000000
  #define VCN_DEC_CMD_FENCE           0x00000000
  #define VCN_DEC_CMD_TRAP            0x00000001
  #define VCN_DEC_CMD_WRITE_REG               0x00000004
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +5 -5
index bc9726787c97..7091aef95ff0 100644
@@ -1488,7 +1488,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));
       amdgpu_ring_write(ring, 0);
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-     amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_START << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_START << 1));
  }
 
  /**
@@ -1501,7 +1501,7 @@ static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)
  static void vcn_v2_0_dec_ring_insert_end(struct amdgpu_ring *ring)
  {
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-     amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_END << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_PACKET_END << 1));
  }
 
  /**
@@ -1546,7 +1546,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
       amdgpu_ring_write(ring, upper_32_bits(addr) & 0xff);
 
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
-     amdgpu_ring_write(ring, VCN_DEC_CMD_FENCE << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_FENCE << 1));
 
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));
       amdgpu_ring_write(ring, 0);
@@ -1556,7 +1556,7 @@ static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64
 
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-     amdgpu_ring_write(ring, VCN_DEC_CMD_TRAP << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_TRAP << 1));
  }
 
  /**
@@ -1600,7 +1600,7 @@ static void vcn_v2_0_dec_ring_emit_reg_wait(struct amdgpu_ring *ring,
 
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-     amdgpu_ring_write(ring, VCN_DEC_CMD_REG_READ_COND_WAIT << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_REG_READ_COND_WAIT << 1));
  }
 
  static void vcn_v2_0_dec_ring_emit_vm_flush(struct amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring, · line 1635

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
@@ -1629,7 +1629,7 @@ static void vcn_v2_0_dec_ring_emit_wreg(struct amdgpu_ring *ring,
 
       amdgpu_ring_write(ring, PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));
 
-     amdgpu_ring_write(ring, VCN_DEC_CMD_WRITE_REG << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_WRITE_REG << 1));
  }
 
  /**

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): BN6PR1201MB0178F74D883BC13DD35CDC369DC00-6iU6OBHu2P+P5uQgMQGiHWrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#9 lore raw

Good point, this patch is Reviewed-by: Christian König <[email protected]>.

But please ping the firmware guys if that really could be an issue, Christian.

Am 26.07.19 um 12:45 schrieb Thai, Thong:

Quoted 117 lines

Well, not through this particular piece of code, since this explicitly sets it. But I would imagine someone could set the bit in userspace and insert KMD commands in the BO as part of some IB instructions - I’ll have a look.

------------------------------------------------------------------------
*From:* Christian König <[email protected]>
*Sent:* Friday, July 26, 2019 3:17:19 AM
*To:* Thai, Thong <[email protected]>; [email protected] <[email protected]> *Subject:* Re: [PATCH 1/2] drm/amd/amdgpu/vcn_v2_0: Mark RB commands as KMD commands
Am 25.07.19 um 17:52 schrieb Thai, Thong:

Quoted 3 lines

Sets the CMD_SOURCE bit for VCN 2.0 Decoder Ring Buffer commands. This bit was previously set by the RBC HW on older firmware. Newer firmware uses a SW RBC and this bit has to be set by the driver.

Mhm, another question came to my mind: Would it now be possible for user space to set this flag and and gain access to the kernel driver commands?

Cause that could be a security problem.

Christian.

Review

Quoted 8 lines

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h |  1 + drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c   | 12 ++++++------

   2 files changed, 7 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h

Review

Quoted 12 lines

index 5e2453ee6b29..4d3bf4adf1eb 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
@@ -30,6 +30,7 @@
    #define AMDGPU_VCN_FIRMWARE_OFFSET  256
    #define AMDGPU_VCN_MAX_ENC_RINGS    3
 
+#define VCN_DEC_KMD_CMD 0x80000000
    #define VCN_DEC_CMD_FENCE           0x00000000
    #define VCN_DEC_CMD_TRAP            0x00000001
    #define VCN_DEC_CMD_WRITE_REG 0x00000004
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void

Quoted 4 lines

index bc9726787c97..7091aef95ff0 100644

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
@@ -1488,7 +1488,7 @@ static void 

vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1488

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1490

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, 0);
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1491

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
-     amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_START << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | 

(VCN_DEC_CMD_PACKET_START << 1));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
    }
 
    /**
@@ -1501,7 +1501,7 @@ static void 

vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_insert_start(struct amdgpu_ring *ring)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
    static void vcn_v2_0_dec_ring_insert_end(struct amdgpu_ring *ring)
    {
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1504

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
-     amdgpu_ring_write(ring, VCN_DEC_CMD_PACKET_END << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | 

(VCN_DEC_CMD_PACKET_END << 1));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
    }
 
    /**
@@ -1546,7 +1546,7 @@ static void 

vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, upper_32_bits(addr) & 0xff);
 
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1549

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
-     amdgpu_ring_write(ring, VCN_DEC_CMD_FENCE << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_FENCE 

<< 1));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1550

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_DATA0_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, 0);
@@ -1556,7 +1556,7 @@ static void 

vcn_v2_0_dec_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1556

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1557

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
-     amdgpu_ring_write(ring, VCN_DEC_CMD_TRAP << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | (VCN_DEC_CMD_TRAP << 

1));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
    }
 
    /**
@@ -1600,7 +1600,7 @@ static void 

vcn_v2_0_dec_ring_emit_reg_wait(struct amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1600

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void · line 1601

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
-     amdgpu_ring_write(ring, VCN_DEC_CMD_REG_READ_COND_WAIT << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | 

(VCN_DEC_CMD_REG_READ_COND_WAIT << 1));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_emit_wreg(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
    }
 
    static void vcn_v2_0_dec_ring_emit_vm_flush(struct amdgpu_ring *ring,
@@ -1629,7 +1629,7 @@ static void vcn_v2_0_dec_ring_emit_wreg(struct 

amdgpu_ring *ring,

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_emit_wreg(struct · line 1629

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
         amdgpu_ring_write(ring, 

PACKET0(mmUVD_GPCOM_VCPU_CMD_INTERNAL_OFFSET, 0));

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_emit_wreg(struct · line 1630

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +1 -1
-     amdgpu_ring_write(ring, VCN_DEC_CMD_WRITE_REG << 1);
+     amdgpu_ring_write(ring, VCN_DEC_KMD_CMD | 

(VCN_DEC_CMD_WRITE_REG << 1));

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
    }
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c static void vcn_v2_0_dec_ring_emit_wreg(struct · line 1633

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +0 -0
    /**

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx