drm/amdgpu: add kiq version interface for RREG32
Subsystems (2)
PATCH 1/2 drm/amdgpu: add kiq version interface for RREG32
Reading some registers by mmio will result in hang when GPU is in "gfxoff" state.
This problem can be solved by GPU in "ring command packages" way.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
@@ -1016,10 +1016,13 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define AMDGPU_REGS_IDX (1<<0)#define AMDGPU_REGS_NO_KIQ (1<<1) +#define AMDGPU_REGS_KIQ (1<<2)#define RREG32_NO_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_NO_KIQ)#define WREG32_NO_KIQ (reg, v) amdgpu_mm_wreg(adev, (reg), (v), AMDGPU_REGS_NO_KIQ) +#define RREG32_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_KIQ) +#define RREG8 (reg) amdgpu_mm_rreg8(adev, (reg))#define WREG8 (reg, v) amdgpu_mm_wreg8(adev, (reg), (v))
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -217,7 +217,7 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg, {uint32_t ret; -if (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)) +if ((acc_flags &AMDGPU_REGS_KIQ ) || (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)))return amdgpu_virt_kiq_rreg (adev, reg);if ((reg *4 ) < adev->rmmio_size && !(acc_flags &AMDGPU_REGS_IDX ))
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/2 drm/amdgpu: reading CP_MEM_SLP_CNTL register using RREG32_KIQ macro
Reading CP_MEM_SLP_CNTL register with RREG32_SOC15 macro will lead to hang when GPU is in "gfxoff" state.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -4702,7 +4702,7 @@ static void gfx_v9_0_get_clockgating_state(void *handle, u32 *flags) *flags |=AMD_CG_SUPPORT_GFX_RLC_LS |AMD_CG_SUPPORT_GFX_MGLS ;/* AMD_CG_SUPPORT_GFX_CP_LS */ - data =RREG32_SOC15 (GC ,0 , mmCP_MEM_SLP_CNTL); + data =RREG32_KIQ (SOC15_REG_OFFSET (GC ,0 , mmCP_MEM_SLP_CNTL));if (data &CP_MEM_SLP_CNTL__CP_MEM_LS_EN_MASK ) *flags |=AMD_CG_SUPPORT_GFX_CP_LS |AMD_CG_SUPPORT_GFX_MGLS ;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amdgpu: reading CP_MEM_SLP_CNTL register using RREG32_KIQ macro
Quoted 13 lines · chen gong
Reading
CP_MEM_SLP_CNTLregister withRREG32_SOC15macro will lead to hang when GPU is in "gfxoff" state.Signed-off-by chen gong <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_get_clockgating_state(void *handle, u32 *flags) · line 4705
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-1@@ -4702,7 +4702,7 @@ static void gfx_v9_0_get_clockgating_state(void *handle, u32 *flags) *flags |=AMD_CG_SUPPORT_GFX_RLC_LS |AMD_CG_SUPPORT_GFX_MGLS ;/* AMD_CG_SUPPORT_GFX_CP_LS */ - data =RREG32_SOC15 (GC ,0 , mmCP_MEM_SLP_CNTL); + data =RREG32_KIQ (SOC15_REG_OFFSET (GC ,0 , mmCP_MEM_SLP_CNTL));
We should use kiq instead of mmio access for the whole gfx_v9_0_get_clockgating_state().
Thanks,
Ray
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0if (data &CP_MEM_SLP_CNTL__CP_MEM_LS_EN_MASK ) *flags |=AMD_CG_SUPPORT_GFX_CP_LS |AMD_CG_SUPPORT_GFX_MGLS ;Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cray.huang%40amd.com%7Cc8b2a8c2091f4336ee5708d79811af07%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637145074034487948&sdata=emUuTvGn3FGbQGrIs%2FkoR3d0YAQYvHUjBqA5cYlkL2g%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 6 lines · chen gong
Reading some registers by mmio will result in hang when GPU is in "gfxoff" state.
This problem can be solved by GPU in "ring command packages" way.
Signed-off-by chen gong <[email protected]>
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -1016,10 +1016,13 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define AMDGPU_REGS_IDX (1<<0)#define AMDGPU_REGS_NO_KIQ (1<<1) +#define AMDGPU_REGS_KIQ (1<<2)#define RREG32_NO_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_NO_KIQ)#define WREG32_NO_KIQ (reg, v) amdgpu_mm_wreg(adev, (reg), (v), AMDGPU_REGS_NO_KIQ) +#define RREG32_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_KIQ) +#define RREG8 (reg) amdgpu_mm_rreg8(adev, (reg))#define WREG8 (reg, v) amdgpu_mm_wreg8(adev, (reg), (v))drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -217,7 +217,7 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg, {uint32_t ret; -if (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)) +if ((acc_flags &AMDGPU_REGS_KIQ ) || (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)))return amdgpu_virt_kiq_rreg (adev, reg);if ((reg *4 ) < adev->rmmio_size && !(acc_flags &AMDGPU_REGS_IDX ))Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cray.huang%40amd.com%7C30ace3a1329f439cb69508d79811d5aa%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637145074676514100&sdata=t6rAUcThU9cmcu5Rwh%2BuHFDtj7Yie4tRN%2FgF2OSBZ00%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 41 lines · Huang Rui
Quoted 6 lines · chen gong
Reading some registers by mmio will result in hang when GPU is in "gfxoff" state.
This problem can be solved by GPU in "ring command packages" way.
Signed-off-by chen gong <[email protected]>Acked-by Huang Rui <[email protected]>Quoted 31 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -1016,10 +1016,13 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define AMDGPU_REGS_IDX (1<<0)#define AMDGPU_REGS_NO_KIQ (1<<1) +#define AMDGPU_REGS_KIQ (1<<2)#define RREG32_NO_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_NO_KIQ)#define WREG32_NO_KIQ (reg, v) amdgpu_mm_wreg(adev, (reg), (v), AMDGPU_REGS_NO_KIQ) +#define RREG32_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_KIQ) +#define RREG8 (reg) amdgpu_mm_rreg8(adev, (reg))#define WREG8 (reg, v) amdgpu_mm_wreg8(adev, (reg), (v))drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -217,7 +217,7 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg, {uint32_t ret;
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg, · line 221
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1-if (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)) +if ((acc_flags &AMDGPU_REGS_KIQ ) || (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)))return amdgpu_virt_kiq_rreg (adev, reg);
Hi Curry,
I read this patch again, we would better move the amdgpu_virt_kiq_rreg/amdgpu_virt_kiq_wreg out of amdgpu_virt to amdgpu.h.
Because these functions are not only used for virtualization but also for the case while gfxoff enabled. We will continue using this interface instead of MMIO access in KFD driver as well.
Thanks,
Ray
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if ((reg *4 ) < adev->rmmio_size && !(acc_flags &AMDGPU_REGS_IDX ))Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cray.huang%40amd.com%7C30ace3a1329f439cb69508d79811d5aa%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637145074676514100&sdata=t6rAUcThU9cmcu5Rwh%2BuHFDtj7Yie4tRN%2FgF2OSBZ00%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Christian König
maintainerAm 14.01.20 um 05:20 schrieb Huang Rui:
Quoted 46 lines · Huang Rui
Quoted 40 lines · chen gong
Quoted 6 lines
Reading some registers by mmio will result in hang when GPU is in "gfxoff" state.
This problem can be solved by GPU in "ring command packages" way.
Signed-off-by chen gong <[email protected]>Acked-by Huang Rui <[email protected]>Quoted 31 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-0@@ -1016,10 +1016,13 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define AMDGPU_REGS_IDX (1<<0)#define AMDGPU_REGS_NO_KIQ (1<<1) +#define AMDGPU_REGS_KIQ (1<<2)#define RREG32_NO_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_NO_KIQ)#define WREG32_NO_KIQ (reg, v) amdgpu_mm_wreg(adev, (reg), (v), AMDGPU_REGS_NO_KIQ) +#define RREG32_KIQ (reg) amdgpu_mm_rreg(adev, (reg), AMDGPU_REGS_KIQ) +#define RREG8 (reg) amdgpu_mm_rreg8(adev, (reg))#define WREG8 (reg, v) amdgpu_mm_wreg8(adev, (reg), (v))drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0@@ -217,7 +217,7 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg, {uint32_t ret;Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg, · line 221
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1-if (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)) +if ((acc_flags &AMDGPU_REGS_KIQ ) || (!(acc_flags &AMDGPU_REGS_NO_KIQ ) &&amdgpu_sriov_runtime (adev)))return amdgpu_virt_kiq_rreg (adev, reg);Hi Curry,
Quoted 6 lines
I read this patch again, we would better move the amdgpu_virt_kiq_rreg/amdgpu_virt_kiq_wreg out of
amdgpu_virttoamdgpu.h.Because these functions are not only used for virtualization but also for the case while gfxoff enabled. We will continue using this interface instead of MMIO access in KFD driver as well.
Yes, that is a really good idea.
We should probably start a amdgpu_kiq.c file and move quite a bunch of stuff over there.
Regards,
Christian.
Quoted 13 lines
Thanks,
RayQuoted 9 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0if ((reg *4 ) < adev->rmmio_size && !(acc_flags &AMDGPU_REGS_IDX ))Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cray.huang%40amd.com%7C30ace3a1329f439cb69508d79811d5aa%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637145074676514100&sdata=t6rAUcThU9cmcu5Rwh%2BuHFDtj7Yie4tRN%2FgF2OSBZ00%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx