Skip to contentSkip to conversation

uapi/drm:change Preamble Description

PATCH In review Monk Liu 2 participants 7 messages Mar 8, 2017 – Mar 9, 2017 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/4 uapi/drm:change Preamble Description

Preamble in linux doesn't mean it is CE PREAMBLE IB, instead it means this IB could be dropped if no ctx switch happens.

Change-Id I2a1e567bccc8abb6d9ce117d3f2eb93dfd649fa1
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -1
index 49358e7..1966fee 100644
@@ -426,7 +426,7 @@ union drm_amdgpu_cs {
 /* This IB should be submitted to CE */
 #define AMDGPU_IB_FLAG_CE	(1<<0)
 
-/* CE Preamble */
+/* Preamble flag, which means the IB could be dropped if no context switch */
 #define AMDGPU_IB_FLAG_PREAMBLE (1<<1)
 
 struct drm_amdgpu_cs_chunk_ib {
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#2 lore raw

PATCH 2/4 uapi/drm:add new flag for Preemption

In reply to a message not in the archive

when MCBP supported, we will set pre_enb bit for those IBs with PREEMPT flag tagged

Change-Id I753a850e6acdce56e22f873bc7fee8874c5a1a12
---
 include/uapi/drm/amdgpu_drm.h | 3 +++
 1 file changed, 3 insertions(+)
include/uapi/drm/amdgpu_drm.h +3 -0
index 1966fee..18ee1a4 100644
@@ -429,6 +429,9 @@ union drm_amdgpu_cs {
 /* Preamble flag, which means the IB could be dropped if no context switch */
 #define AMDGPU_IB_FLAG_PREAMBLE (1<<1)
 
+/* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */
+#define AMDGPU_IB_FLAG_PREEMPT (1<<2)
+
 struct drm_amdgpu_cs_chunk_ib {
 	__u32 _pad;
 	/** AMDGPU_IB_FLAG_* */
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#3 lore raw

PATCH 3/4 drm/amdgpu:protect cs submit

In reply to a message not in the archive

to prevent submit two or more IBs with PREEMPT flags.

Change-Id Icdac89ddc525436905b3544635fd8cfd9146cdfd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +12 -1
index aafe11e..cb7cc7b 100644
@@ -877,7 +877,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
 	struct amdgpu_fpriv *fpriv = parser->filp->driver_priv;
 	struct amdgpu_vm *vm = &fpriv->vm;
 	int i, j;
-	int r;
+	int r, ce_preempt = 0, de_preempt = 0;
 
 	for (i = 0, j = 0; i < parser->nchunks && j < parser->job->num_ibs; i++) {
 		struct amdgpu_cs_chunk *chunk;
@@ -892,6 +892,17 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
 		if (chunk->chunk_id != AMDGPU_CHUNK_ID_IB)
 			continue;
 
+		if (ib->flags & AMDGPU_IB_FLAG_PREEMPT) {
+			if (ib->flags & AMDGPU_IB_FLAG_CE)
+				ce_preempt++;
+			else
+				de_preempt++;
+		}
+
+		/* only one preemptible IB per submit for me/ce */
+		if (ce_preempt > 1 || de_preempt > 1)
+			return -EINVAL;
+
 		r = amdgpu_cs_get_ring(adev, chunk_ib->ip_type,
 				       chunk_ib->ip_instance, chunk_ib->ring,
 				       &ring);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#4 lore raw

PATCH 4/4 drm/amdgpu:enable MCBP for SR-IOV

In reply to a message not in the archive
Change-Id I779abc6a47593be0ff5234c3e2f2cdfd25ba70ca
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
index 8dba5ff..be49c30 100644
@@ -6552,6 +6552,10 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 
 	control |= ib->length_dw | (vm_id << 24);
 
+	if (ring && amdgpu_sriov_vf(ring->adev) &&
+		ib->flags & AMDGPU_IB_FLAG_PREEMPT)
+		control |= (1<<21);
+
 	amdgpu_ring_write(ring, header);
 	amdgpu_ring_write(ring,
 #ifdef __BIG_ENDIAN
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#6 lore raw

答复: [PATCH 4/4] drm/amdgpu:enable MCBP for SR-IOV

In reply to a message not in the archive

Anyone review the 4 patches and another libdrm patch ?

-----邮件原件-----
发件人: amd-gfx [mailto:[email protected]] 代表 Monk Liu 发送时间: Wednesday, March 08, 2017 3:54 PM
收件人: [email protected]
抄送: Liu, Monk <[email protected]>
主题: [PATCH 4/4] drm/amdgpu:enable MCBP for SR-IOV

Change-Id I779abc6a47593be0ff5234c3e2f2cdfd25ba70ca
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
index 8dba5ff..be49c30 100644
@@ -6552,6 +6552,10 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 
 	control |= ib->length_dw | (vm_id << 24);
 
+	if (ring && amdgpu_sriov_vf(ring->adev) &&
+		ib->flags & AMDGPU_IB_FLAG_PREEMPT)
+		control |= (1<<21);
+
 	amdgpu_ring_write(ring, header);
 	amdgpu_ring_write(ring,
 #ifdef __BIG_ENDIAN
Signature · 10 lines
2.7.4

_______________________________________________
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
#9 lore raw

Re: [PATCH 4/4] drm/amdgpu:enable MCBP for SR-IOV

In reply to a message not in the archive

You need a commit message here. Something like "apply the new IB flag during command submission".

Am 08.03.2017 um 08:54 schrieb Monk Liu:

Quoted 11 lines
Change-Id I779abc6a47593be0ff5234c3e2f2cdfd25ba70ca
---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index 8dba5ff..be49c30 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, · line 6558

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
@@ -6552,6 +6552,10 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 
  	control |= ib->length_dw | (vm_id << 24);
 
+	if (ring && amdgpu_sriov_vf(ring->adev) &&
+		ib->flags & AMDGPU_IB_FLAG_PREEMPT)
+		control |= (1<<21);
+

The check for ring being NULL is superfluous and the indentation of the "ib->flags & AMDGPU_IB_FLAG_PREEMPT" is wrong.

Apart from that the series is Reviewed-by: Christian König <[email protected]>.

Christian

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, · line 6561

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
  	amdgpu_ring_write(ring, header);
  	amdgpu_ring_write(ring,
  #ifdef __BIG_ENDIAN

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

#8 lore raw

Re: 答复: [PATCH 4/4] drm/amdgpu:enable MCBP for SR-IOV

In reply to a message not in the archive

Sorry my spam filter completely blocked this set, not idea why.

Did send out a review about a minute ago.

Christian.

Am 09.03.2017 um 05:19 schrieb Liu, Monk:

Quoted 22 lines

Anyone review the 4 patches and another libdrm patch ?

-----邮件原件-----
发件人: amd-gfx [mailto:[email protected]] 代表 Monk Liu 发送时间: Wednesday, March 08, 2017 3:54 PM
收件人: [email protected]
抄送: Liu, Monk <[email protected]>
主题: [PATCH 4/4] drm/amdgpu:enable MCBP for SR-IOV

Change-Id I779abc6a47593be0ff5234c3e2f2cdfd25ba70ca
---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index 8dba5ff..be49c30 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, · line 6561

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
@@ -6552,6 +6552,10 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 
  	control |= ib->length_dw | (vm_id << 24);
 
+	if (ring && amdgpu_sriov_vf(ring->adev) &&
+		ib->flags & AMDGPU_IB_FLAG_PREEMPT)
+		control |= (1<<21);
+
  	amdgpu_ring_write(ring, header);
  	amdgpu_ring_write(ring,
  #ifdef __BIG_ENDIAN

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