Skip to contentSkip to conversation

radeon/cik: Fix GFX IB test on Big-Endian

PATCH Applied Oded Gabbay 5 participants 14 messages Dec 4, 2015 – Dec 9, 2015

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

PATCH 1/3 radeon/cik: Fix GFX IB test on Big-Endian

This patch makes the IB test on the GFX ring pass for CI-based cards installed in Big-Endian machines.

---
 drivers/gpu/drm/radeon/cik.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/radeon/cik.c +1 -5
index 248953d..05d43a0 100644
@@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
 	control |= ib->length_dw | (vm_id << 24);
 
 	radeon_ring_write(ring, header);
-	radeon_ring_write(ring,
-#ifdef __BIG_ENDIAN
-			  (2 << 0) |
-#endif
-			  (ib->gpu_addr & 0xFFFFFFFC));
+	radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC));
 	radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
 	radeon_ring_write(ring, control);
 }
Signature · 1 line
2.5.0
#1 lore raw

PATCH 2/3 radeon: Fix VCE ring test for Big-Endian systems

This patch fixes the VCE ring test when running on Big-Endian machines. Every write to the ring needs to be translated to little-endian.

---
 drivers/gpu/drm/radeon/radeon_vce.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/radeon/radeon_vce.c +16 -16
index 574f62b..86f57e4 100644
@@ -699,12 +699,12 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev,
 {
 	uint64_t addr = semaphore->gpu_addr;
 
-	radeon_ring_write(ring, VCE_CMD_SEMAPHORE);
-	radeon_ring_write(ring, (addr >> 3) & 0x000FFFFF);
-	radeon_ring_write(ring, (addr >> 23) & 0x000FFFFF);
-	radeon_ring_write(ring, 0x01003000 | (emit_wait ? 1 : 0));
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_SEMAPHORE));
+	radeon_ring_write(ring, cpu_to_le32((addr >> 3) & 0x000FFFFF));
+	radeon_ring_write(ring, cpu_to_le32((addr >> 23) & 0x000FFFFF));
+	radeon_ring_write(ring, cpu_to_le32(0x01003000 | (emit_wait ? 1 : 0)));
 	if (!emit_wait)
-		radeon_ring_write(ring, VCE_CMD_END);
+		radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 
 	return true;
 }
@@ -719,10 +719,10 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev,
 void radeon_vce_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
 {
 	struct radeon_ring *ring = &rdev->ring[ib->ring];
-	radeon_ring_write(ring, VCE_CMD_IB);
-	radeon_ring_write(ring, ib->gpu_addr);
-	radeon_ring_write(ring, upper_32_bits(ib->gpu_addr));
-	radeon_ring_write(ring, ib->length_dw);
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_IB));
+	radeon_ring_write(ring, cpu_to_le32(ib->gpu_addr));
+	radeon_ring_write(ring, cpu_to_le32(upper_32_bits(ib->gpu_addr)));
+	radeon_ring_write(ring, cpu_to_le32(ib->length_dw));
 }
 
 /**
@@ -738,12 +738,12 @@ void radeon_vce_fence_emit(struct radeon_device *rdev,
 	struct radeon_ring *ring = &rdev->ring[fence->ring];
 	uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr;
 
-	radeon_ring_write(ring, VCE_CMD_FENCE);
-	radeon_ring_write(ring, addr);
-	radeon_ring_write(ring, upper_32_bits(addr));
-	radeon_ring_write(ring, fence->seq);
-	radeon_ring_write(ring, VCE_CMD_TRAP);
-	radeon_ring_write(ring, VCE_CMD_END);
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_FENCE));
+	radeon_ring_write(ring, cpu_to_le32(addr));
+	radeon_ring_write(ring, cpu_to_le32(upper_32_bits(addr)));
+	radeon_ring_write(ring, cpu_to_le32(fence->seq));
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_TRAP));
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 }
 
 /**
@@ -765,7 +765,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)
 			  ring->idx, r);
 		return r;
 	}
-	radeon_ring_write(ring, VCE_CMD_END);
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 	radeon_ring_unlock_commit(rdev, ring, false);
 
 	for (i = 0; i < rdev->usec_timeout; i++) {
Signature · 1 line
2.5.0
#2 lore raw

Re: [PATCH 2/3] radeon: Fix VCE ring test for Big-Endian systems

Quoted 67 lines · Oded Gabbay

This patch fixes the VCE ring test when running on Big-Endian machines. Every write to the ring needs to be translated to little-endian.

---
 drivers/gpu/drm/radeon/radeon_vce.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/radeon/radeon_vce.c +15 -15
index 574f62b..86f57e4 100644
@@ -699,12 +699,12 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev,
 {
 	uint64_t addr = semaphore->gpu_addr;
 
-	radeon_ring_write(ring, VCE_CMD_SEMAPHORE);
-	radeon_ring_write(ring, (addr >> 3) & 0x000FFFFF);
-	radeon_ring_write(ring, (addr >> 23) & 0x000FFFFF);
-	radeon_ring_write(ring, 0x01003000 | (emit_wait ? 1 : 0));
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_SEMAPHORE));
+	radeon_ring_write(ring, cpu_to_le32((addr >> 3) & 0x000FFFFF));
+	radeon_ring_write(ring, cpu_to_le32((addr >> 23) & 0x000FFFFF));
+	radeon_ring_write(ring, cpu_to_le32(0x01003000 | (emit_wait ? 1 : 0)));
 	if (!emit_wait)
-		radeon_ring_write(ring, VCE_CMD_END);
+		radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 
 	return true;
 }
@@ -719,10 +719,10 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev,
 void radeon_vce_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
 {
 	struct radeon_ring *ring = &rdev->ring[ib->ring];
-	radeon_ring_write(ring, VCE_CMD_IB);
-	radeon_ring_write(ring, ib->gpu_addr);
-	radeon_ring_write(ring, upper_32_bits(ib->gpu_addr));
-	radeon_ring_write(ring, ib->length_dw);
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_IB));
+	radeon_ring_write(ring, cpu_to_le32(ib->gpu_addr));
+	radeon_ring_write(ring, cpu_to_le32(upper_32_bits(ib->gpu_addr)));
+	radeon_ring_write(ring, cpu_to_le32(ib->length_dw));
 }
 
 /**
@@ -738,12 +738,12 @@ void radeon_vce_fence_emit(struct radeon_device *rdev,
 	struct radeon_ring *ring = &rdev->ring[fence->ring];
 	uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr;
 
-	radeon_ring_write(ring, VCE_CMD_FENCE);
-	radeon_ring_write(ring, addr);
-	radeon_ring_write(ring, upper_32_bits(addr));
-	radeon_ring_write(ring, fence->seq);
-	radeon_ring_write(ring, VCE_CMD_TRAP);
-	radeon_ring_write(ring, VCE_CMD_END);
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_FENCE));
+	radeon_ring_write(ring, cpu_to_le32(addr));
+	radeon_ring_write(ring, cpu_to_le32(upper_32_bits(addr)));
+	radeon_ring_write(ring, cpu_to_le32(fence->seq));
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_TRAP));
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 }
 
 /**

drivers/gpu/drm/radeon/radeon_vce.c int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · line 771

Quoted 8 lines
drivers/gpu/drm/radeon/radeon_vce.c +1 -1
@@ -765,7 +765,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)
 			  ring->idx, r);
 		return r;
 	}
-	radeon_ring_write(ring, VCE_CMD_END);
+	radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 	radeon_ring_unlock_commit(rdev, ring, false);
 
 	for (i = 0; i < rdev->usec_timeout; i++) {

A new helper function such as

static inline void radeon_ring_write_le(struct radeon_ring *ring, uint32_t v)

{
        radeon_ring_write(ring, cpu_to_le32(v));
}

might be nice for this.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH 2/3] radeon: Fix VCE ring test for Big-Endian systems

Quoted 84 lines · Michel Dänzer
Quoted 67 lines · Oded Gabbay

This patch fixes the VCE ring test when running on Big-Endian machines. Every write to the ring needs to be translated to little-endian.

---
 drivers/gpu/drm/radeon/radeon_vce.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/radeon/radeon_vce.c +15 -15
index 574f62b..86f57e4 100644
@@ -699,12 +699,12 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev,
 {
      uint64_t addr = semaphore->gpu_addr;
 
-     radeon_ring_write(ring, VCE_CMD_SEMAPHORE);
-     radeon_ring_write(ring, (addr >> 3) & 0x000FFFFF);
-     radeon_ring_write(ring, (addr >> 23) & 0x000FFFFF);
-     radeon_ring_write(ring, 0x01003000 | (emit_wait ? 1 : 0));
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_SEMAPHORE));
+     radeon_ring_write(ring, cpu_to_le32((addr >> 3) & 0x000FFFFF));
+     radeon_ring_write(ring, cpu_to_le32((addr >> 23) & 0x000FFFFF));
+     radeon_ring_write(ring, cpu_to_le32(0x01003000 | (emit_wait ? 1 : 0)));
      if (!emit_wait)
-             radeon_ring_write(ring, VCE_CMD_END);
+             radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 
      return true;
 }
@@ -719,10 +719,10 @@ bool radeon_vce_semaphore_emit(struct radeon_device *rdev,
 void radeon_vce_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
 {
      struct radeon_ring *ring = &rdev->ring[ib->ring];
-     radeon_ring_write(ring, VCE_CMD_IB);
-     radeon_ring_write(ring, ib->gpu_addr);
-     radeon_ring_write(ring, upper_32_bits(ib->gpu_addr));
-     radeon_ring_write(ring, ib->length_dw);
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_IB));
+     radeon_ring_write(ring, cpu_to_le32(ib->gpu_addr));
+     radeon_ring_write(ring, cpu_to_le32(upper_32_bits(ib->gpu_addr)));
+     radeon_ring_write(ring, cpu_to_le32(ib->length_dw));
 }
 
 /**
@@ -738,12 +738,12 @@ void radeon_vce_fence_emit(struct radeon_device *rdev,
      struct radeon_ring *ring = &rdev->ring[fence->ring];
      uint64_t addr = rdev->fence_drv[fence->ring].gpu_addr;
 
-     radeon_ring_write(ring, VCE_CMD_FENCE);
-     radeon_ring_write(ring, addr);
-     radeon_ring_write(ring, upper_32_bits(addr));
-     radeon_ring_write(ring, fence->seq);
-     radeon_ring_write(ring, VCE_CMD_TRAP);
-     radeon_ring_write(ring, VCE_CMD_END);
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_FENCE));
+     radeon_ring_write(ring, cpu_to_le32(addr));
+     radeon_ring_write(ring, cpu_to_le32(upper_32_bits(addr)));
+     radeon_ring_write(ring, cpu_to_le32(fence->seq));
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_TRAP));
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
 }
 
 /**

drivers/gpu/drm/radeon/radeon_vce.c int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · line 771

Quoted 8 lines
drivers/gpu/drm/radeon/radeon_vce.c +1 -1
@@ -765,7 +765,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)
                        ring->idx, r);
              return r;
      }
-     radeon_ring_write(ring, VCE_CMD_END);
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
      radeon_ring_unlock_commit(rdev, ring, false);
 
      for (i = 0; i < rdev->usec_timeout; i++) {

A new helper function such as

static inline void radeon_ring_write_le(struct radeon_ring *ring, uint32_t v)

{
        radeon_ring_write(ring, cpu_to_le32(v));
}
Quoted 6 lines

might be nice for this.

--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer

IMHO, I don't think this gives any benefit.
You would just need to replace every:

radeon_ring_write(ring, cpu_to_le32(SOME_DEFINE));

with

radeon_ring_write_le(ring, SOME_DEFINE);

So no reduce in code size. Also, if you change it in my code, I think you need to change it in the entire driver for consistency.

What's even more important, is that when I look at the above, it seems to me this change even makes the code *less* clear as you now need to go into radeon_ring_write_le to actually understand how the value is written.

Oded
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH 2/3] radeon: Fix VCE ring test for Big-Endian systems

Quoted 32 lines · Oded Gabbay
Quoted 15 lines · Michel Dänzer

drivers/gpu/drm/radeon/radeon_vce.c int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · line 771

Quoted 11 lines · Oded Gabbay
drivers/gpu/drm/radeon/radeon_vce.c +1 -1
@@ -765,7 +765,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)
                        ring->idx, r);
              return r;
      }
-     radeon_ring_write(ring, VCE_CMD_END);
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
      radeon_ring_unlock_commit(rdev, ring, false);
 
      for (i = 0; i < rdev->usec_timeout; i++) {

A new helper function such as

Quoted 6 lines

static inline void radeon_ring_write_le(struct radeon_ring *ring, uint32_t v)

{
        radeon_ring_write(ring, cpu_to_le32(v));
}

might be nice for this.

IMHO, I don't think this gives any benefit.
You would just need to replace every:

radeon_ring_write(ring, cpu_to_le32(SOME_DEFINE));

with

radeon_ring_write_le(ring, SOME_DEFINE);

Quoted 7 lines

So no reduce in code size. Also, if you change it in my code, I think you need to change it in the entire driver for consistency.

What's even more important, is that when I look at the above, it seems to me this change even makes the code *less* clear as you now need to go into radeon_ring_write_le to actually understand how the value is written.

Sprinkling cpu_to_le32 all over the place just seems a bit ugly to me, but I don't feel strongly about it. I.e. I'm fine with the patch as is, it was just a suggestion.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

Re: [PATCH 2/3] radeon: Fix VCE ring test for Big-Endian systems

Quoted 36 lines · Michel Dänzer
Quoted 35 lines · Oded Gabbay
Quoted 15 lines · Michel Dänzer

drivers/gpu/drm/radeon/radeon_vce.c int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring) · line 771

Quoted 11 lines · Oded Gabbay
drivers/gpu/drm/radeon/radeon_vce.c +1 -1
@@ -765,7 +765,7 @@ int radeon_vce_ring_test(struct radeon_device *rdev, struct radeon_ring *ring)
                        ring->idx, r);
              return r;
      }
-     radeon_ring_write(ring, VCE_CMD_END);
+     radeon_ring_write(ring, cpu_to_le32(VCE_CMD_END));
      radeon_ring_unlock_commit(rdev, ring, false);
 
      for (i = 0; i < rdev->usec_timeout; i++) {

A new helper function such as

Quoted 6 lines

static inline void radeon_ring_write_le(struct radeon_ring *ring, uint32_t v)

{
        radeon_ring_write(ring, cpu_to_le32(v));
}

might be nice for this.

IMHO, I don't think this gives any benefit.
You would just need to replace every:

radeon_ring_write(ring, cpu_to_le32(SOME_DEFINE));

with

radeon_ring_write_le(ring, SOME_DEFINE);

So no reduce in code size. Also, if you change it in my code, I think you need to change it in the entire driver for consistency.

Quoted 8 lines
Quoted 4 lines

What's even more important, is that when I look at the above, it seems to me this change even makes the code *less* clear as you now need to go into radeon_ring_write_le to actually understand how the value is written.

Sprinkling cpu_to_le32 all over the place just seems a bit ugly to me, but I don't feel strongly about it. I.e. I'm fine with the patch as is, it was just a suggestion.

I agree, having cpu_to_le32 repeated over and over makes code messy, harder to read, harder to fit 80 chars (which is already often violated in radeon code). radeon_ring_write_le sounds self explanatory.

Signature · 5 lines
Rafał
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

PATCH 3/3 radeon: Fix VCE IB test on Big-Endian systems

In reply to Oded Gabbay

This patch makes the VCE IB test pass on Big-Endian systems. It converts to little-endian the contents of the VCE message.

---
 drivers/gpu/drm/radeon/radeon_vce.c | 68 ++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 34 deletions(-)
drivers/gpu/drm/radeon/radeon_vce.c +34 -34
index 86f57e4..7eb1ae7 100644
@@ -361,31 +361,31 @@ int radeon_vce_get_create_msg(struct radeon_device *rdev, int ring,
 
 	/* stitch together an VCE create msg */
 	ib.length_dw = 0;
-	ib.ptr[ib.length_dw++] = 0x0000000c; /* len */
-	ib.ptr[ib.length_dw++] = 0x00000001; /* session cmd */
-	ib.ptr[ib.length_dw++] = handle;
-
-	ib.ptr[ib.length_dw++] = 0x00000030; /* len */
-	ib.ptr[ib.length_dw++] = 0x01000001; /* create cmd */
-	ib.ptr[ib.length_dw++] = 0x00000000;
-	ib.ptr[ib.length_dw++] = 0x00000042;
-	ib.ptr[ib.length_dw++] = 0x0000000a;
-	ib.ptr[ib.length_dw++] = 0x00000001;
-	ib.ptr[ib.length_dw++] = 0x00000080;
-	ib.ptr[ib.length_dw++] = 0x00000060;
-	ib.ptr[ib.length_dw++] = 0x00000100;
-	ib.ptr[ib.length_dw++] = 0x00000100;
-	ib.ptr[ib.length_dw++] = 0x0000000c;
-	ib.ptr[ib.length_dw++] = 0x00000000;
-
-	ib.ptr[ib.length_dw++] = 0x00000014; /* len */
-	ib.ptr[ib.length_dw++] = 0x05000005; /* feedback buffer */
-	ib.ptr[ib.length_dw++] = upper_32_bits(dummy);
-	ib.ptr[ib.length_dw++] = dummy;
-	ib.ptr[ib.length_dw++] = 0x00000001;
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000c); /* len */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001); /* session cmd */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(handle);
+
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000030); /* len */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x01000001); /* create cmd */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000000);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000042);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000a);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000080);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000060);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000100);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000100);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000c);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000000);
+
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000014); /* len */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x05000005); /* feedback buffer */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(upper_32_bits(dummy));
+	ib.ptr[ib.length_dw++] = cpu_to_le32(dummy);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001);
 
 	for (i = ib.length_dw; i < ib_size_dw; ++i)
-		ib.ptr[i] = 0x0;
+		ib.ptr[i] = cpu_to_le32(0x0);
 
 	r = radeon_ib_schedule(rdev, &ib, NULL, false);
 	if (r) {
@@ -428,21 +428,21 @@ int radeon_vce_get_destroy_msg(struct radeon_device *rdev, int ring,
 
 	/* stitch together an VCE destroy msg */
 	ib.length_dw = 0;
-	ib.ptr[ib.length_dw++] = 0x0000000c; /* len */
-	ib.ptr[ib.length_dw++] = 0x00000001; /* session cmd */
-	ib.ptr[ib.length_dw++] = handle;
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x0000000c); /* len */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001); /* session cmd */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(handle);
 
-	ib.ptr[ib.length_dw++] = 0x00000014; /* len */
-	ib.ptr[ib.length_dw++] = 0x05000005; /* feedback buffer */
-	ib.ptr[ib.length_dw++] = upper_32_bits(dummy);
-	ib.ptr[ib.length_dw++] = dummy;
-	ib.ptr[ib.length_dw++] = 0x00000001;
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000014); /* len */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x05000005); /* feedback buffer */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(upper_32_bits(dummy));
+	ib.ptr[ib.length_dw++] = cpu_to_le32(dummy);
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000001);
 
-	ib.ptr[ib.length_dw++] = 0x00000008; /* len */
-	ib.ptr[ib.length_dw++] = 0x02000001; /* destroy cmd */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x00000008); /* len */
+	ib.ptr[ib.length_dw++] = cpu_to_le32(0x02000001); /* destroy cmd */
 
 	for (i = ib.length_dw; i < ib_size_dw; ++i)
-		ib.ptr[i] = 0x0;
+		ib.ptr[i] = cpu_to_le32(0x0);
 
 	r = radeon_ib_schedule(rdev, &ib, NULL, false);
 	if (r) {
Signature · 1 line
2.5.0
#7 lore raw
In reply to Oded Gabbay

Patch #1 & #2 are Reviewed-by: Christian König <[email protected]>

For patch #3:

Couldn't we just in a loop go over all the dw in the IB and swap them after writing them? That would simplify the patch massively.

And line like the one below just look a bit odd to me:

Review

Quoted 3 lines

for (i = ib.length_dw; i < ib_size_dw; ++i)

(quoted diff) +1 -1
-		ib.ptr[i] = 0x0;
+		ib.ptr[i] = cpu_to_le32(0x0);

Alternatively a helper function adding DW to an IB with swapping could do it as well.

Regards,
Christian.

Quoted 26 lines · Oded Gabbay

This patch makes the IB test on the GFX ring pass for CI-based cards installed in Big-Endian machines.

---
  drivers/gpu/drm/radeon/cik.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/radeon/cik.c +1 -5
index 248953d..05d43a0 100644
@@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib)
  	control |= ib->length_dw | (vm_id << 24);
 
  	radeon_ring_write(ring, header);
-	radeon_ring_write(ring,
-#ifdef __BIG_ENDIAN
-			  (2 << 0) |
-#endif
-			  (ib->gpu_addr & 0xFFFFFFFC));
+	radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC));
  	radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
  	radeon_ring_write(ring, control);
  }
#8 lore raw
Quoted 6 lines · Christian König

Patch #1 & #2 are Reviewed-by: Christian König <[email protected]>

For patch #3:

Couldn't we just in a loop go over all the dw in the IB and swap them after writing them? That would simplify the patch massively.

I guess we could do that, however I made the fix similar to the same code in the uvd module (See radeon_uvd_get_create_msg() for example)

Quoted 7 lines

And line like the one below just look a bit odd to me:

Quoted 4 lines
        for (i = ib.length_dw; i < ib_size_dw; ++i)
(quoted diff) +1 -1
-               ib.ptr[i] = 0x0;
+               ib.ptr[i] = cpu_to_le32(0x0);

Same remark as above. I added it in the last second before sending the patch just to be similar to uvd code. I guess maybe it is to remind people to do it if they ever change that zero value to something else ???

Quoted 4 lines

Alternatively a helper function adding DW to an IB with swapping could do it as well.

Don't you think its an overkill ? It's just a few places in the code.

Quoted 24 lines

Regards,
Christian.

Quoted 19 lines · Oded Gabbay

This patch makes the IB test on the GFX ring pass for CI-based cards installed in Big-Endian machines.

---
  drivers/gpu/drm/radeon/cik.c | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/radeon/cik.c +0 -1
index 248953d..05d43a0 100644
@@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device
 *rdev, struct radeon_ib *ib)
        control |= ib->length_dw | (vm_id << 24);
        radeon_ring_write(ring, header);
-       radeon_ring_write(ring,
Quoted 10 lines

drivers/gpu/drm/radeon/cik.c void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) · line 4179

Quoted 8 lines
drivers/gpu/drm/radeon/cik.c +1 -4
-#ifdef __BIG_ENDIAN
-                         (2 << 0) |
-#endif
-                         (ib->gpu_addr & 0xFFFFFFFC));
+       radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC));
        radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
        radeon_ring_write(ring, control);
  }

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw
Quoted 20 lines · Oded Gabbay
Quoted 6 lines · Christian König

Patch #1 & #2 are Reviewed-by: Christian König <[email protected]>

For patch #3:

Couldn't we just in a loop go over all the dw in the IB and swap them after writing them? That would simplify the patch massively.

I guess we could do that, however I made the fix similar to the same code in the uvd module (See radeon_uvd_get_create_msg() for example)

Quoted 4 lines

And line like the one below just look a bit odd to me:

Quoted 3 lines
         for (i = ib.length_dw; i < ib_size_dw; ++i)
(quoted diff) +1 -1
-               ib.ptr[i] = 0x0;
+               ib.ptr[i] = cpu_to_le32(0x0);

Same remark as above. I added it in the last second before sending the patch just to be similar to uvd code. I guess maybe it is to remind people to do it if they ever change that zero value to something else ???

Quoted 4 lines
Quoted 3 lines

Alternatively a helper function adding DW to an IB with swapping could do it as well.

Don't you think its an overkill ? It's just a few places in the code.

Yeah, true indeed. Ok then let's just stick with the coding style like it is in radeon_uvd_get_create_msg().

So the patch is Reviewed-by: Christian König <[email protected]>.

It sound like you have hardware to test this combination, so could you try to get it working on for amdgpu as well?

Shouldn't be to much of a hassle, since amdgpu only supports CIK and VI generation for now and I think we never enabled the hardware swapping in amdgpu.

Thanks in advance,
Christian.

Quoted 25 lines
Quoted 25 lines

Regards,
Christian.

Quoted 19 lines · Oded Gabbay

This patch makes the IB test on the GFX ring pass for CI-based cards installed in Big-Endian machines.

---
   drivers/gpu/drm/radeon/cik.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/radeon/cik.c +0 -2
index 248953d..05d43a0 100644
@@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device
 *rdev, struct radeon_ib *ib)
         control |= ib->length_dw | (vm_id << 24);
         radeon_ring_write(ring, header);
-       radeon_ring_write(ring,
-#ifdef __BIG_ENDIAN
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/radeon/cik.c void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) · line 4179

Quoted 7 lines
drivers/gpu/drm/radeon/cik.c +1 -3
-                         (2 << 0) |
-#endif
-                         (ib->gpu_addr & 0xFFFFFFFC));
+       radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC));
         radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
         radeon_ring_write(ring, control);
   }

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw
Quoted 31 lines · Christian König
Quoted 30 lines · Oded Gabbay
Quoted 8 lines · Christian König

Patch #1 & #2 are Reviewed-by: Christian König <[email protected]>

For patch #3:

Couldn't we just in a loop go over all the dw in the IB and swap them after
writing them? That would simplify the patch massively.

I guess we could do that, however I made the fix similar to the same code in the uvd module (See radeon_uvd_get_create_msg() for example)

Quoted 5 lines

And line like the one below just look a bit odd to me:

Quoted 4 lines
         for (i = ib.length_dw; i < ib_size_dw; ++i)
(quoted diff) +1 -1
-               ib.ptr[i] = 0x0;
+               ib.ptr[i] = cpu_to_le32(0x0);

Same remark as above. I added it in the last second before sending the patch just to be similar to uvd code. I guess maybe it is to remind people to do it if they ever change that zero value to something else ???

Quoted 4 lines

Alternatively a helper function adding DW to an IB with swapping could do it
as well.

Quoted 7 lines
Quoted 1 line

Don't you think its an overkill ? It's just a few places in the code.

Yeah, true indeed. Ok then let's just stick with the coding style like it is in radeon_uvd_get_create_msg().

So the patch is Reviewed-by: Christian König <[email protected]>.

Thanks!

Quoted 3 lines

It sound like you have hardware to test this combination, so could you try to get it working on for amdgpu as well?

Yes, I have a BE machine that I can test amdgpu with. However, I only have a Bonaire card. Is it worth doing it for CIK ? It's only for debug support, no ?

Quoted 45 lines

Shouldn't be to much of a hassle, since amdgpu only supports CIK and VI generation for now and I think we never enabled the hardware swapping in amdgpu.

Thanks in advance,
Christian.

Quoted 35 lines
Quoted 35 lines

Regards,
Christian.

Quoted 27 lines · Oded Gabbay

This patch makes the IB test on the GFX ring pass for CI-based cards installed in Big-Endian machines.

---
   drivers/gpu/drm/radeon/cik.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/radeon/cik.c +1 -5
index 248953d..05d43a0 100644
@@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device
 *rdev, struct radeon_ib *ib)
         control |= ib->length_dw | (vm_id << 24);
         radeon_ring_write(ring, header);
-       radeon_ring_write(ring,
-#ifdef __BIG_ENDIAN
-                         (2 << 0) |
-#endif
-                         (ib->gpu_addr & 0xFFFFFFFC));
+       radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC));
         radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
         radeon_ring_write(ring, control);
   }
#11 lore raw
Quoted 32 lines · Oded Gabbay
Quoted 31 lines · Christian König
Quoted 21 lines · Oded Gabbay
Quoted 7 lines · Christian König

Patch #1 & #2 are Reviewed-by: Christian König <[email protected]>

For patch #3:

Couldn't we just in a loop go over all the dw in the IB and swap them after
writing them? That would simplify the patch massively.

I guess we could do that, however I made the fix similar to the same code in the uvd module (See radeon_uvd_get_create_msg() for example)

Quoted 4 lines

And line like the one below just look a bit odd to me:

Quoted 3 lines
          for (i = ib.length_dw; i < ib_size_dw; ++i)
(quoted diff) +1 -1
-               ib.ptr[i] = 0x0;
+               ib.ptr[i] = cpu_to_le32(0x0);

Same remark as above. I added it in the last second before sending the patch just to be similar to uvd code. I guess maybe it is to remind people to do it if they ever change that zero value to something else ???

Quoted 5 lines
Quoted 4 lines

Alternatively a helper function adding DW to an IB with swapping could do it
as well.

Don't you think its an overkill ? It's just a few places in the code.

Yeah, true indeed. Ok then let's just stick with the coding style like it is in radeon_uvd_get_create_msg().

Quoted 8 lines
Quoted 1 line

So the patch is Reviewed-by: Christian König <[email protected]>.

Thanks!

Quoted 2 lines

It sound like you have hardware to test this combination, so could you try to get it working on for amdgpu as well?

Yes, I have a BE machine that I can test amdgpu with. However, I only have a Bonaire card. Is it worth doing it for CIK ? It's only for debug support, no ?

Yeah, CIK support in amdgpu was only for debugging and bringup.

But since it's only shared code you touch when it works with CIK it should work with VI as well and that's rather interesting to us.

Regards,
Christian.

Quoted 33 lines
Quoted 33 lines

Shouldn't be to much of a hassle, since amdgpu only supports CIK and VI generation for now and I think we never enabled the hardware swapping in amdgpu.

Thanks in advance,
Christian.

Quoted 24 lines
Quoted 24 lines

Regards,
Christian.

Quoted 19 lines · Oded Gabbay

This patch makes the IB test on the GFX ring pass for CI-based cards installed in Big-Endian machines.

---
    drivers/gpu/drm/radeon/cik.c | 6 +-----
    1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/radeon/cik.c +0 -2
index 248953d..05d43a0 100644
@@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device
 *rdev, struct radeon_ib *ib)
          control |= ib->length_dw | (vm_id << 24);
          radeon_ring_write(ring, header);
-       radeon_ring_write(ring,
-#ifdef __BIG_ENDIAN
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/radeon/cik.c void cik_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) · line 4179

Quoted 7 lines
drivers/gpu/drm/radeon/cik.c +1 -3
-                         (2 << 0) |
-#endif
-                         (ib->gpu_addr & 0xFFFFFFFC));
+       radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC));
          radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
          radeon_ring_write(ring, control);
    }

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

PATCH 1/3 radeon/cik: Fix GFX IB test on Big-Endian

OK, I'll take a look
Oded

Quoted 1 line

Yeah, CIK support in amdgpu was only for debugging and bringup. But since it's only shared code you touch when it works with CIK it should work with VI as well and that's rather interesting to us. Regards, Christian.

Applied
#13 lore raw
In reply to Christian König
Quoted 31 lines · Christian König
Quoted 30 lines · Oded Gabbay
Quoted 8 lines · Christian König

Patch #1 & #2 are Reviewed-by: Christian König <[email protected]>

For patch #3:

Couldn't we just in a loop go over all the dw in the IB and swap them after
writing them? That would simplify the patch massively.

I guess we could do that, however I made the fix similar to the same code in the uvd module (See radeon_uvd_get_create_msg() for example)

Quoted 5 lines

And line like the one below just look a bit odd to me:

Quoted 4 lines
         for (i = ib.length_dw; i < ib_size_dw; ++i)
(quoted diff) +1 -1
-               ib.ptr[i] = 0x0;
+               ib.ptr[i] = cpu_to_le32(0x0);

Same remark as above. I added it in the last second before sending the patch just to be similar to uvd code. I guess maybe it is to remind people to do it if they ever change that zero value to something else ???

Quoted 4 lines

Alternatively a helper function adding DW to an IB with swapping could do it
as well.

Quoted 7 lines
Quoted 1 line

Don't you think its an overkill ? It's just a few places in the code.

Yeah, true indeed. Ok then let's just stick with the coding style like it is in radeon_uvd_get_create_msg().

So the patch is Reviewed-by: Christian König <[email protected]>.

Applied the series. Thanks!

Alex

Quoted 48 lines

It sound like you have hardware to test this combination, so could you try to get it working on for amdgpu as well?

Shouldn't be to much of a hassle, since amdgpu only supports CIK and VI generation for now and I think we never enabled the hardware swapping in amdgpu.

Thanks in advance,
Christian.

Quoted 35 lines
Quoted 35 lines

Regards,
Christian.

Quoted 27 lines · Oded Gabbay

This patch makes the IB test on the GFX ring pass for CI-based cards installed in Big-Endian machines.

---
   drivers/gpu/drm/radeon/cik.c | 6 +-----
   1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/radeon/cik.c +1 -5
index 248953d..05d43a0 100644
@@ -4173,11 +4173,7 @@ void cik_ring_ib_execute(struct radeon_device
 *rdev, struct radeon_ib *ib)
         control |= ib->length_dw | (vm_id << 24);
         radeon_ring_write(ring, header);
-       radeon_ring_write(ring,
-#ifdef __BIG_ENDIAN
-                         (2 << 0) |
-#endif
-                         (ib->gpu_addr & 0xFFFFFFFC));
+       radeon_ring_write(ring, (ib->gpu_addr & 0xFFFFFFFC));
         radeon_ring_write(ring, upper_32_bits(ib->gpu_addr) & 0xFFFF);
         radeon_ring_write(ring, control);
   }