Skip to contentSkip to conversation

GPR read support via debugfs (v2)

PATCH New Tom St Denis 6 participants 10 messages Dec 6, 2016 – Dec 7, 2016 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

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

#2 lore raw

PATCH 1/3 drm/amd/amdgpu: Add debugfs support for reading GPRs (v2)

Implemented for SGPRs for GFX v8 initially.

(v2) cleanup minor whitespace and remove sanity check and
addressing is in dwords not bytes

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 67 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c      | 25 +++++++++++
 3 files changed, 94 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 4f64bb16a8d3..2834451eef8a 100644
@@ -844,6 +844,8 @@ struct amdgpu_gfx_funcs {
 	uint64_t (*get_gpu_clock_counter)(struct amdgpu_device *adev);
 	void (*select_se_sh)(struct amdgpu_device *adev, u32 se_num, u32 sh_num, u32 instance);
 	void (*read_wave_data)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t *dst, int *no_fields);
+	void (*read_wave_vgprs)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t thread, uint32_t start, uint32_t size, uint32_t *dst);
+	void (*read_wave_sgprs)(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t start, uint32_t size, uint32_t *dst);
 };
 
 struct amdgpu_gfx {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +67 -0

91 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +25 -0
index 9b8d3fe67adb..180309f5784c 100644
@@ -5184,6 +5184,21 @@ static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t simd, uint32_
 	return RREG32(mmSQ_IND_DATA);
 }
 
+static void wave_read_regs(struct amdgpu_device *adev, uint32_t simd,
+			   uint32_t wave, uint32_t thread,
+			   uint32_t regno, uint32_t num, uint32_t *out)
+{
+	WREG32(mmSQ_IND_INDEX,
+		(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
+		(simd << SQ_IND_INDEX__SIMD_ID__SHIFT) |
+		(regno << SQ_IND_INDEX__INDEX__SHIFT) |
+		(thread << SQ_IND_INDEX__THREAD_ID__SHIFT) |
+		(SQ_IND_INDEX__FORCE_READ_MASK) |
+		(SQ_IND_INDEX__AUTO_INCR_MASK));
+	while (num--)
+		*(out++) = RREG32(mmSQ_IND_DATA);
+}
+
 static void gfx_v8_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t *dst, int *no_fields)
 {
 	/* type 0 wave data */
@@ -5208,11 +5223,21 @@ static void gfx_v8_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, u
 	dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0);
 }
 
+static void gfx_v8_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
+				     uint32_t wave, uint32_t start,
+				     uint32_t size, uint32_t *dst)
+{
+	wave_read_regs(
+		adev, simd, wave, 0,
+		start + SQIND_WAVE_SGPRS_OFFSET, size, dst);
+}
+
 
 static const struct amdgpu_gfx_funcs gfx_v8_0_gfx_funcs = {
 	.get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter,
 	.select_se_sh = &gfx_v8_0_select_se_sh,
 	.read_wave_data = &gfx_v8_0_read_wave_data,
+	.read_wave_sgprs = &gfx_v8_0_read_wave_sgprs,
 };
 
 static int gfx_v8_0_early_init(void *handle)
Signature · 6 lines
2.10.0

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

PATCH 2/3 drm/amd/amdgpu: Add gpr reading for GFX v6

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +25 -0
index c0b2f4ebadea..01b58c65f37c 100644
@@ -2827,6 +2827,21 @@ static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t simd, uint32_
 	return RREG32(mmSQ_IND_DATA);
 }
 
+static void wave_read_regs(struct amdgpu_device *adev, uint32_t simd,
+			   uint32_t wave, uint32_t thread,
+			   uint32_t regno, uint32_t num, uint32_t *out)
+{
+	WREG32(mmSQ_IND_INDEX,
+		(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
+		(simd << SQ_IND_INDEX__SIMD_ID__SHIFT) |
+		(regno << SQ_IND_INDEX__INDEX__SHIFT) |
+		(thread << SQ_IND_INDEX__THREAD_ID__SHIFT) |
+		(SQ_IND_INDEX__FORCE_READ_MASK) |
+		(SQ_IND_INDEX__AUTO_INCR_MASK));
+	while (num--)
+		*(out++) = RREG32(mmSQ_IND_DATA);
+}
+
 static void gfx_v6_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t *dst, int *no_fields)
 {
 	/* type 0 wave data */
@@ -2851,10 +2866,20 @@ static void gfx_v6_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, u
 	dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0);
 }
 
+static void gfx_v6_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
+				     uint32_t wave, uint32_t start,
+				     uint32_t size, uint32_t *dst)
+{
+	wave_read_regs(
+		adev, simd, wave, 0,
+		start + SQIND_WAVE_SGPRS_OFFSET, size, dst);
+}
+
 static const struct amdgpu_gfx_funcs gfx_v6_0_gfx_funcs = {
 	.get_gpu_clock_counter = &gfx_v6_0_get_gpu_clock_counter,
 	.select_se_sh = &gfx_v6_0_select_se_sh,
 	.read_wave_data = &gfx_v6_0_read_wave_data,
+	.read_wave_sgprs = &gfx_v6_0_read_wave_sgprs,
 };
 
 static int gfx_v6_0_early_init(void *handle)
Signature · 6 lines
2.10.0

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

PATCH 3/3 drm/amd/amdgpu: Add gpr reading for GFX v7

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +25 -0
index bbef2e86ea1f..4c4fb9bdd185 100644
@@ -4374,6 +4374,21 @@ static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t simd, uint32_
 	return RREG32(mmSQ_IND_DATA);
 }
 
+static void wave_read_regs(struct amdgpu_device *adev, uint32_t simd,
+			   uint32_t wave, uint32_t thread,
+			   uint32_t regno, uint32_t num, uint32_t *out)
+{
+	WREG32(mmSQ_IND_INDEX,
+		(wave << SQ_IND_INDEX__WAVE_ID__SHIFT) |
+		(simd << SQ_IND_INDEX__SIMD_ID__SHIFT) |
+		(regno << SQ_IND_INDEX__INDEX__SHIFT) |
+		(thread << SQ_IND_INDEX__THREAD_ID__SHIFT) |
+		(SQ_IND_INDEX__FORCE_READ_MASK) |
+		(SQ_IND_INDEX__AUTO_INCR_MASK));
+	while (num--)
+		*(out++) = RREG32(mmSQ_IND_DATA);
+}
+
 static void gfx_v7_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t *dst, int *no_fields)
 {
 	/* type 0 wave data */
@@ -4398,10 +4413,20 @@ static void gfx_v7_0_read_wave_data(struct amdgpu_device *adev, uint32_t simd, u
 	dst[(*no_fields)++] = wave_read_ind(adev, simd, wave, ixSQ_WAVE_M0);
 }
 
+static void gfx_v7_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t simd,
+				     uint32_t wave, uint32_t start,
+				     uint32_t size, uint32_t *dst)
+{
+	wave_read_regs(
+		adev, simd, wave, 0,
+		start + SQIND_WAVE_SGPRS_OFFSET, size, dst);
+}
+
 static const struct amdgpu_gfx_funcs gfx_v7_0_gfx_funcs = {
 	.get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter,
 	.select_se_sh = &gfx_v7_0_select_se_sh,
 	.read_wave_data = &gfx_v7_0_read_wave_data,
+	.read_wave_sgprs = &gfx_v7_0_read_wave_sgprs,
 };
 
 static const struct amdgpu_rlc_funcs gfx_v7_0_rlc_funcs = {
Signature · 6 lines
2.10.0

_______________________________________________
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

This series is,

Quoted 10 lines · Tom St Denis

These patches introduce debugfs access to read GPRs (SGPRs for now).

(v2): Fixes white space, addressing is in dwords not bytes, and removes
the buggy sanity checking.

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): b0979deb-7d97-f81f-65af-3a0800d55e4b-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org

Acked-by Edward O'Callaghan
#7 lore raw

Thanks.

Could use a RB/NAK from Christian or Alex when they get the time :-)

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Edward O'Callaghan <[email protected]>
Sent: Tuesday, December 6, 2016 17:15
To: Tom St Denis; [email protected]
Subject: Re: GPR read support via debugfs (v2)

This series is,

Quoted 9 lines · Tom St Denis

These patches introduce debugfs access to read GPRs (SGPRs for now).

(v2): Fixes white space, addressing is in dwords not bytes, and removes
the buggy sanity checking.

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

amd-gfx Info Page - lists.freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

Quoted 1 line

_______________________________________________
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): CY4PR12MB1768F2C7EF86AE04BB957AEAF7850-rpdhrqHFk06yjjPBNVDk/[email protected]

Reviewed-by
#9 lore raw

Patches look fine to me. Assuming they are useful to Marek and Nicolai, the patches are:

Quoted 40 lines · Tom

Thanks.

Could use a RB/NAK from Christian or Alex when they get the time :-)

Tom

------------------------------
*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Edward O'Callaghan <[email protected]>
*Sent:* Tuesday, December 6, 2016 17:15
*To:* Tom St Denis; [email protected] *Subject:* Re: GPR read support via debugfs (v2)

This series is,

Quoted 9 lines · Tom St Denis

These patches introduce debugfs access to read GPRs (SGPRs for now).

(v2): Fixes white space, addressing is in dwords not bytes, and removes
the buggy sanity checking.

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

amd-gfx Info Page - lists.freedesktop.org
<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

Quoted 1 line
Quoted 6 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CADnq5_OJJFGDLt405YdQN3k6O5jbM_t0miDo=ZenMp9jG9QjcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Reviewed-by Alex Deucher Acked-by Edward O'Callaghan
#11 lore raw

Hi Alex,

I'll wait on pushing it until I hear back from one of them.

Cheers,

Tom

________________________________
From: Alex Deucher <[email protected]>
Sent: Wednesday, December 7, 2016 12:32
To: StDenis, Tom
Cc: Edward O'Callaghan; [email protected]
Subject: Re: GPR read support via debugfs (v2)

Patches look fine to me. Assuming they are useful to Marek and Nicolai, the patches are:

On Wed, Dec 7, 2016 at 12:05 PM, StDenis, Tom <[email protected]<mailto:[email protected]>> wrote:

Thanks.

Could use a RB/NAK from Christian or Alex when they get the time :-)

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Edward O'Callaghan <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 6, 2016 17:15
To: Tom St Denis; [email protected]<mailto:[email protected]>
Subject: Re: GPR read support via debugfs (v2)

This series is,

Quoted 9 lines · Tom St Denis

These patches introduce debugfs access to read GPRs (SGPRs for now).

(v2): Fixes white space, addressing is in dwords not bytes, and removes
the buggy sanity checking.

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

amd-gfx Info Page - lists.freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx> lists.freedesktop.org<http://lists.freedesktop.org>
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

Quoted 1 line

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

_______________________________________________
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): CY4PR12MB1768C0C95CA7F8A50E07C28AF7850-rpdhrqHFk06yjjPBNVDk/[email protected]

#13 lore raw

Yeah, it can be useful for GPU hang debugging.

Marek

Quoted 72 lines · Tom

Hi Alex,

I'll wait on pushing it until I hear back from one of them.

Cheers,

Tom

------------------------------
*From:* Alex Deucher <[email protected]> *Sent:* Wednesday, December 7, 2016 12:32
*To:* StDenis, Tom
*Cc:* Edward O'Callaghan; [email protected]

*Subject:* Re: GPR read support via debugfs (v2)

Patches look fine to me. Assuming they are useful to Marek and Nicolai, the patches are:

Quoted 40 lines · Tom

Thanks.

Could use a RB/NAK from Christian or Alex when they get the time :-)

Tom

------------------------------
*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Edward O'Callaghan <[email protected]>
*Sent:* Tuesday, December 6, 2016 17:15
*To:* Tom St Denis; [email protected] *Subject:* Re: GPR read support via debugfs (v2)

This series is,

Quoted 9 lines · Tom St Denis

These patches introduce debugfs access to read GPRs (SGPRs for now).

(v2): Fixes white space, addressing is in dwords not bytes, and removes
the buggy sanity checking.

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

amd-gfx Info Page - lists.freedesktop.org
<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

Quoted 1 line
Quoted 6 lines

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

Quoted 6 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): CAAxE2A6d6XuB8wSG2foFEsVVgJcZh5fVXYKRwsRQA=ao6q5f4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#15 lore raw

Completely agree, couldn't take a look but feel free to add my Acked-by: Christian König <[email protected]>.

Christian.

Am 07.12.2016 um 18:59 schrieb Marek Olšák:

Quoted 103 lines

Yeah, it can be useful for GPU hang debugging.

Marek

On Wed, Dec 7, 2016 at 6:49 PM, StDenis, Tom <[email protected] <mailto:[email protected]>> wrote:

Hi Alex,

I'll wait on pushing it until I hear back from one of them.

Cheers,

Tom

------------------------------------------------------------------------
*From:* Alex Deucher <[email protected] <mailto:[email protected]>>
*Sent:* Wednesday, December 7, 2016 12:32
*To:* StDenis, Tom
*Cc:* Edward O'Callaghan; [email protected] <mailto:[email protected]>

*Subject:* Re: GPR read support via debugfs (v2) Patches look fine to me. Assuming they are useful to Marek and Nicolai, the patches are:

<mailto:[email protected]>>

On Wed, Dec 7, 2016 at 12:05 PM, StDenis, Tom <[email protected] <mailto:[email protected]>> wrote:

Thanks.

Could use a RB/NAK from Christian or Alex when they get the time :-)

Tom

------------------------------------------------------------------------
*From:* amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org <mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>> on behalf of Edward O'Callaghan <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, December 6, 2016 17:15
*To:* Tom St Denis; [email protected] <mailto:[email protected]> *Subject:* Re: GPR read support via debugfs (v2)
This series is,

<mailto:[email protected]>>

On 12/07/2016 01:50 AM, Tom St Denis wrote:
> These patches introduce debugfs access to read GPRs (SGPRs for now).
>
> (v2): Fixes white space, addressing is in dwords not bytes, and removes
> the buggy sanity checking.
>
> _______________________________________________
> amd-gfx mailing list
> [email protected] <mailto:[email protected]> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx
<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
amd-gfx Info Page - lists.freedesktop.org
<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org <http://lists.freedesktop.org>
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

>

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

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

Quoted 4 lines

_______________________________________________
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