drm/amdgpu: decode the ctxid for SMC to host IH
Subsystems (2)
PATCH 1/2 drm/amdgpu: decode the ctxid for SMC to host IH
Driver needs that to tell the different events raised from SMC.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 1 + drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 1 + drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 1 + 3 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +1 -0
@@ -55,6 +55,7 @@ struct amdgpu_iv_entry {unsigned timestamp_src;unsigned pasid;unsigned pasid_src; +unsigned ctxid;/* for SMC to Host interrupt */ unsigned src_data[AMDGPU_IRQ_SRC_DATA_MAX_SIZE_DW ];const uint32_t *iv_entry; };
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +1 -0
@@ -470,6 +470,7 @@ static void navi10_ih_decode_iv(struct amdgpu_device *adev, entry->timestamp_src = dw[2 ] >>31 ; entry->pasid = dw[3 ] &0xffff ; entry->pasid_src = dw[3 ] >>31 ; + entry->ctxid = dw[4 ]; entry->src_data[0 ] = dw[4 ]; entry->src_data[1 ] = dw[5 ]; entry->src_data[2 ] = dw[6 ];
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +1 -0
@@ -460,6 +460,7 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev, entry->timestamp_src = dw[2 ] >>31 ; entry->pasid = dw[3 ] &0xffff ; entry->pasid_src = dw[3 ] >>31 ; + entry->ctxid = dw[4 ]; entry->src_data[0 ] = dw[4 ]; entry->src_data[1 ] = dw[5 ]; entry->src_data[2 ] = dw[6 ];
Signature · 6 lines
2.26.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amd/powerplay: report correct AC/DC event based on ctxid
'ctxid' is used to distinguish different events raised from SMC. 0x3 and 0x4 are for AC and DC power mode.
--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +13 -2
@@ -1522,6 +1522,7 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev, {uint32_t client_id = entry->client_id;uint32_t src_id = entry->src_id; +uint32_t ctxid = entry->ctxid;if (client_id ==SOC15_IH_CLIENTID_THM ) {switch (src_id) {
@@ -1547,8 +1548,18 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev, } }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) { -if (src_id ==0xfe ) -smu_v11_0_ack_ac_dc_interrupt (&adev->smu); +if (src_id ==0xfe ) { +switch (ctxid) { +case 0x3 : +dev_info (adev->dev,"Switched to AC mode!\n" ); +smu_v11_0_ack_ac_dc_interrupt (&adev->smu); +break ; +case 0x4 : +dev_info (adev->dev,"Switched to DC mode!\n" ); +smu_v11_0_ack_ac_dc_interrupt (&adev->smu); +break ; + } + } }return 0 ;
Signature · 6 lines
2.26.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amd/powerplay: report correct AC/DC event based on ctxid
Quoted 15 lines · Evan Quan
'ctxid' is used to distinguish different events raised from SMC.
0x3and0x4are for AC and DC power mode.Change-Id I7dbcb053fe9cea7c70e0a33afc2115b3745f6186Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0
drivers/gpu/drm/amd/powerplay/smu_v11_0.c static int smu_v11_0_irq_process(struct amdgpu_device *adev, · line 1525
Quoted 4 lines
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +1
-0@@ -1522,6 +1522,7 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev, {uint32_t client_id = entry->client_id;uint32_t src_id = entry->src_id; +uint32_t ctxid = entry->ctxid;
As noted by Christian, just use the entry->src_data[0] directly.
Quoted 7 lines
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +0
-0if (client_id ==SOC15_IH_CLIENTID_THM ) {switch (src_id) {@@ -1547,8 +1548,18 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev, } }else if (client_id ==SOC15_IH_CLIENTID_MP1 ) {
drivers/gpu/drm/amd/powerplay/smu_v11_0.c static int smu_v11_0_irq_process(struct amdgpu_device *adev, · line 1558
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +8
-2-if (src_id ==0xfe ) -smu_v11_0_ack_ac_dc_interrupt (&adev->smu); +if (src_id ==0xfe ) { +switch (ctxid) { +case 0x3 : +dev_info (adev->dev,"Switched to AC mode!\n" ); +smu_v11_0_ack_ac_dc_interrupt (&adev->smu); +break ; +case 0x4 : +dev_info (adev->dev,"Switched to DC mode!\n" );
Might want to make these dev_debug so we don't spam the logs. With those fixed, patch is:
Quoted 10 lines
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +4
-1+smu_v11_0_ack_ac_dc_interrupt (&adev->smu); +break ; + } + } }return 0 ; --2.26.2
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
Christian König
NAKAm 08.05.20 um 12:02 schrieb Evan Quan:
Quoted 1 line
Driver needs that to tell the different events raised from SMC.
NAK, the ctxid is filled in by the SMC and not by the IH. We only decode fields here which are filled in by the IH.
Just use src_data[0] when you need some SMC specific bits.
Christian.
Quoted 38 lines
Change-Id I0e44e22527182fbb45a2db4fc3b1cd73fb17ba33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 1 + drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 1 + drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 1 + 3 files changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +1
-0@@ -55,6 +55,7 @@ struct amdgpu_iv_entry {unsigned timestamp_src;unsigned pasid;unsigned pasid_src; +unsigned ctxid;/* for SMC to Host interrupt */ unsigned src_data[AMDGPU_IRQ_SRC_DATA_MAX_SIZE_DW ];const uint32_t *iv_entry; };drivers/gpu/drm/amd/amdgpu/navi10_ih.c +1
-0@@ -470,6 +470,7 @@ static void navi10_ih_decode_iv(struct amdgpu_device *adev, entry->timestamp_src = dw[2 ] >>31 ; entry->pasid = dw[3 ] &0xffff ; entry->pasid_src = dw[3 ] >>31 ; + entry->ctxid = dw[4 ]; entry->src_data[0 ] = dw[4 ]; entry->src_data[1 ] = dw[5 ]; entry->src_data[2 ] = dw[6 ];drivers/gpu/drm/amd/amdgpu/vega10_ih.c +0
-0
drivers/gpu/drm/amd/amdgpu/vega10_ih.c static void vega10_ih_decode_iv(struct amdgpu_device *adev, · line 466
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +1
-0@@ -460,6 +460,7 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev, entry->timestamp_src = dw[2 ] >>31 ; entry->pasid = dw[3 ] &0xffff ; entry->pasid_src = dw[3 ] >>31 ; + entry->ctxid = dw[4 ]; entry->src_data[0 ] = dw[4 ]; entry->src_data[1 ] = dw[5 ]; entry->src_data[2 ] = dw[6 ];
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quan, Evan
NAK[AMD Official Use Only - Internal Distribution Only]
OK. Reasonable. Will update the patches.
BR,
Evan
-----Original Message-----
From: Christian König <[email protected]>
Sent: Friday, May 8, 2020 6:53 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: decode the ctxid for SMC to host IH
Am 08.05.20 um 12:02 schrieb Evan Quan:
Quoted 1 line
Driver needs that to tell the different events raised from SMC.
NAK, the ctxid is filled in by the SMC and not by the IH. We only decode fields here which are filled in by the IH.
Just use src_data[0] when you need some SMC specific bits.
Christian.
Quoted 41 lines
Change-Id I0e44e22527182fbb45a2db4fc3b1cd73fb17ba33Signed-off-by Evan Quan <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 1 + drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 1 + drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 1 + 3 files changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +1
-0@@ -55,6 +55,7 @@ struct amdgpu_iv_entry {unsigned timestamp_src;unsigned pasid;unsigned pasid_src; +unsigned ctxid;/* for SMC to Host interrupt */ unsigned src_data[AMDGPU_IRQ_SRC_DATA_MAX_SIZE_DW ];const uint32_t *iv_entry; };drivers/gpu/drm/amd/amdgpu/navi10_ih.c +1
-0@@ -470,6 +470,7 @@ static void navi10_ih_decode_iv(struct amdgpu_device *adev, entry->timestamp_src = dw[2 ] >>31 ; entry->pasid = dw[3 ] &0xffff ; entry->pasid_src = dw[3 ] >>31 ; +entry->ctxid = dw[4 ]; entry->src_data[0 ] = dw[4 ]; entry->src_data[1 ] = dw[5 ]; entry->src_data[2 ] = dw[6 ];drivers/gpu/drm/amd/amdgpu/vega10_ih.c +0
-0
drivers/gpu/drm/amd/amdgpu/vega10_ih.c static void vega10_ih_decode_iv(struct amdgpu_device *adev, · line 466
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +1
-0@@ -460,6 +460,7 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev, entry->timestamp_src = dw[2 ] >>31 ; entry->pasid = dw[3 ] &0xffff ; entry->pasid_src = dw[3 ] >>31 ; +entry->ctxid = dw[4 ]; entry->src_data[0 ] = dw[4 ]; entry->src_data[1 ] = dw[5 ]; entry->src_data[2 ] = dw[6 ];
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx