Small tidy up of CIK code
Subsystems (2)
cover Small tidy up of CIK code
This series tidy up CIK code a bit.
It uses some functions already available to remove redundant code in GMC7 and CIK SDMA.
Some GOLDEN defines are moved into GFX7, the only place where they are used. It fixes coding style in VI and DCE8.
Alexandre Demers (5):
drm/amdgpu: use gmc_v7_0_is_idle() since it is available under GMC7 drm/amdgpu: use cik_sdma_is_idle() in CIK SDMA drm/amdgpu: small cleanup to CIK SDMA
drm/amdgpu: move X_GB_ADDR_CONFIG_GOLDEN in GFX7 drm/amdgpu: fix style in dce_v8_0.c and in vi.c
drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 18 ++++-------------- drivers/gpu/drm/amd/amdgpu/cikd.h | 3 --- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 3 +++ drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 9 +-------- drivers/gpu/drm/amd/amdgpu/vi.c | 8 ++++++++ 6 files changed, 18 insertions(+), 31 deletions(-)
Signature · 1 line
2.49.0
PATCH 1/5 drm/amdgpu: use gmc_v7_0_is_idle() since it is available under GMC7
gmc_v7_0_is_idle() does exactly what we need, so use it.
--- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -8
@@ -1156,17 +1156,10 @@ static bool gmc_v7_0_is_idle(void *handle)static int gmc_v7_0_wait_for_idle (struct amdgpu_ip_block *ip_block) {unsigned int i; -u32 tmp;struct amdgpu_device *adev = ip_block->adev;for (i =0 ; i < adev->usec_timeout; i++) { -/* read MC_STATUS */ - tmp =RREG32 (mmSRBM_STATUS) & (SRBM_STATUS__MCB_BUSY_MASK | -SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK | -SRBM_STATUS__MCC_BUSY_MASK | -SRBM_STATUS__MCD_BUSY_MASK | -SRBM_STATUS__VMC_BUSY_MASK ); -if (!tmp) +if (gmc_v7_0_is_idle (adev))return 0 ;udelay (1 ); }
Signature · 1 line
2.49.0
Re: [PATCH 1/5] drm/amdgpu: use gmc_v7_0_is_idle() since it is available under GMC7
Applied 1-4 with some minor fixes.
Alex
Quoted 34 lines · Alexandre Demers
gmc_v7_0_is_idle()does exactly what we need, so use it.Signed-off-by Alexandre Demers <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1
-9@@ -1156,17 +1156,10 @@ static bool gmc_v7_0_is_idle(void *handle)static int gmc_v7_0_wait_for_idle (struct amdgpu_ip_block *ip_block) {unsigned int i; -u32 tmp;struct amdgpu_device *adev = ip_block->adev;for (i =0 ; i < adev->usec_timeout; i++) { -/* read MC_STATUS */ - tmp =RREG32 (mmSRBM_STATUS) & (SRBM_STATUS__MCB_BUSY_MASK | -SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK | -SRBM_STATUS__MCC_BUSY_MASK | -SRBM_STATUS__MCD_BUSY_MASK | -SRBM_STATUS__VMC_BUSY_MASK ); -if (!tmp) +if (gmc_v7_0_is_idle (adev))return 0 ;udelay (1 ); } --2.49.0
PATCH 2/5 drm/amdgpu: use cik_sdma_is_idle() in CIK SDMA
In reply to Alexandre Demerscik_sdma_is_idle() does exactly what we need, so use it.
--- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +1 -5
@@ -1038,14 +1038,10 @@ static bool cik_sdma_is_idle(void *handle)static int cik_sdma_wait_for_idle (struct amdgpu_ip_block *ip_block) {unsigned i; -u32 tmp;struct amdgpu_device *adev = ip_block->adev;for (i =0 ; i < adev->usec_timeout; i++) { - tmp =RREG32 (mmSRBM_STATUS2) & (SRBM_STATUS2__SDMA_BUSY_MASK | -SRBM_STATUS2__SDMA1_BUSY_MASK ); - -if (!tmp) +if (cik_sdma_is_idle (adev))return 0 ;udelay (1 ); }
Signature · 1 line
2.49.0
PATCH 3/5 drm/amdgpu: small cleanup to CIK SDMA
In reply to Alexandre DemersTidy cik_sdma_hw_init() by returning directly cik_sdma_start()'s result.
Keep amdgpu_cik_gpu_check_soft_reset() early declaration with others.
--- drivers/gpu/drm/amd/amdgpu/cik_sdma.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik_sdma.c +3 -9
@@ -56,6 +56,8 @@ static void cik_sdma_set_buffer_funcs(struct amdgpu_device *adev);static void cik_sdma_set_vm_pte_funcs (struct amdgpu_device *adev);static int cik_sdma_soft_reset (struct amdgpu_ip_block *ip_block); +u32 amdgpu_cik_gpu_check_soft_reset (struct amdgpu_device *adev); +MODULE_FIRMWARE ("amdgpu/bonaire_sdma.bin" );MODULE_FIRMWARE ("amdgpu/bonaire_sdma1.bin" );MODULE_FIRMWARE ("amdgpu/hawaii_sdma.bin" );
@@ -67,9 +69,6 @@ MODULE_FIRMWARE("amdgpu/kabini_sdma1.bin");MODULE_FIRMWARE ("amdgpu/mullins_sdma.bin" );MODULE_FIRMWARE ("amdgpu/mullins_sdma1.bin" ); -u32 amdgpu_cik_gpu_check_soft_reset (struct amdgpu_device *adev); - -static void cik_sdma_free_microcode (struct amdgpu_device *adev) {int i;
@@ -991,14 +990,9 @@ static int cik_sdma_sw_fini(struct amdgpu_ip_block *ip_block)static int cik_sdma_hw_init (struct amdgpu_ip_block *ip_block) { -int r;struct amdgpu_device *adev = ip_block->adev; - r =cik_sdma_start (adev); -if (r) -return r; - -return r; +return cik_sdma_start (adev); }static int cik_sdma_hw_fini (struct amdgpu_ip_block *ip_block)
Signature · 1 line
2.49.0
PATCH 4/5 drm/amdgpu: move X_GB_ADDR_CONFIG_GOLDEN in GFX7
In reply to Alexandre Demers[BONAIRE|HAWAII]_GB_ADDR_CONFIG_GOLDEN are only used by GFX7. So keep them where they are needed.
--- drivers/gpu/drm/amd/amdgpu/cikd.h | 3 --- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/cikd.h +0 -3
@@ -60,9 +60,6 @@#define AUD5_REGISTER_OFFSET (0x179d - 0x1780)#define AUD6_REGISTER_OFFSET (0x17a4 - 0x1780) -#define BONAIRE_GB_ADDR_CONFIG_GOLDEN 0x12010001 -#define HAWAII_GB_ADDR_CONFIG_GOLDEN 0x12011003 -#define PIPEID (x) ((x) << 0)#define MEID (x) ((x) << 2)#define VMID (x) ((x) << 4)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -0
@@ -55,6 +55,9 @@#define GFX7_NUM_GFX_RINGS 1#define GFX7_MEC_HPD_SIZE 2048 +#define BONAIRE_GB_ADDR_CONFIG_GOLDEN 0x12010001 +#define HAWAII_GB_ADDR_CONFIG_GOLDEN 0x12011003 +static void gfx_v7_0_set_ring_funcs (struct amdgpu_device *adev);static void gfx_v7_0_set_irq_funcs (struct amdgpu_device *adev);static void gfx_v7_0_set_gds_init (struct amdgpu_device *adev);
Signature · 1 line
2.49.0
[PATCH 6/5] drm/amdgpu: fix style in dce_v8_0.c and in vi.c
In reply to Alexandre DemersBring things on a single line and fix spacing.
--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/vi.c | 8 ++++++++ 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3 -7
@@ -3233,8 +3233,7 @@ static const struct amd_ip_funcs dce_v8_0_ip_funcs = { .set_powergating_state = dce_v8_0_set_powergating_state, }; -static void -dce_v8_0_encoder_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_encoder_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {
@@ -3330,8 +3329,7 @@ static void dce_v8_0_ext_commit(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_ext_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {
@@ -3343,8 +3341,7 @@ static void dce_v8_0_ext_disable(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) +static void dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) { }
@@ -3407,7 +3404,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev, amdgpu_encoder->devices |= supported_device;return ; } - }/* add a new one */
drivers/gpu/drm/amd/amdgpu/vi.c +8 -0
@@ -61,19 +61,27 @@#include "vid.h" #include "vi.h" +#include "gmc_v8_0.h" #include "gmc_v7_0.h" +#include "gfx_v8_0.h" +#include "sdma_v2_4.h" #include "sdma_v3_0.h" +#include "dce_v10_0.h" #include "dce_v11_0.h" +#include "iceland_ih.h" #include "tonga_ih.h" #include "cz_ih.h" +#include "uvd_v5_0.h" #include "uvd_v6_0.h" +#include "vce_v3_0.h" +#if defined(CONFIG_DRM_AMD_ACP )#include "amdgpu_acp.h" #endif
Signature · 1 line
2.49.0
Re: [PATCH 6/5] drm/amdgpu: fix style in dce_v8_0.c and in vi.c
This should be titled patch 5/5. There was initially another one in the lot about radeon. However, it was removed from the series and sent alone.
Alexandre
Quoted 86 lines · Alexandre Demers
Bring things on a single line and fix spacing.
Signed-off-by Alexandre Demers <[email protected]>--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/vi.c | 8 ++++++++ 2 files changed, 11 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3
-7@@ -3233,8 +3233,7 @@ static const struct amd_ip_funcs dce_v8_0_ip_funcs = { .set_powergating_state = dce_v8_0_set_powergating_state, }; -static void -dce_v8_0_encoder_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_encoder_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3330,8 +3329,7 @@ static void dce_v8_0_ext_commit(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_ext_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3343,8 +3341,7 @@ static void dce_v8_0_ext_disable(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) +static void dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) { }@@ -3407,7 +3404,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev, amdgpu_encoder->devices |= supported_device;return ; } - }/* add a new one */ drivers/gpu/drm/amd/amdgpu/vi.c +8
-1@@ -61,19 +61,27 @@#include "vid.h" #include "vi.h" +#include "gmc_v8_0.h" #include "gmc_v7_0.h" +#include "gfx_v8_0.h" +#include "sdma_v2_4.h" #include "sdma_v3_0.h" +#include "dce_v10_0.h" #include "dce_v11_0.h" +#include "iceland_ih.h" #include "tonga_ih.h" #include "cz_ih.h" +#include "uvd_v5_0.h" #include "uvd_v6_0.h" +#include "vce_v3_0.h" +#if defined(CONFIG_DRM_AMD_ACP )#include "amdgpu_acp.h" #endif --2.49.0
Re: [PATCH 6/5] drm/amdgpu: fix style in dce_v8_0.c and in vi.c
In reply to Alexandre DemersQuoted 72 lines · Alexandre Demers
Bring things on a single line and fix spacing.
Signed-off-by Alexandre Demers <[email protected]>--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/vi.c | 8 ++++++++ 2 files changed, 11 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3
-7@@ -3233,8 +3233,7 @@ static const struct amd_ip_funcs dce_v8_0_ip_funcs = { .set_powergating_state = dce_v8_0_set_powergating_state, }; -static void -dce_v8_0_encoder_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_encoder_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3330,8 +3329,7 @@ static void dce_v8_0_ext_commit(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_ext_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3343,8 +3341,7 @@ static void dce_v8_0_ext_disable(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) +static void dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) { }@@ -3407,7 +3404,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev, amdgpu_encoder->devices |= supported_device;return ; } - }/* add a new one */ drivers/gpu/drm/amd/amdgpu/vi.c +5
-0@@ -61,19 +61,27 @@#include "vid.h" #include "vi.h" +#include "gmc_v8_0.h" #include "gmc_v7_0.h" +#include "gfx_v8_0.h" +#include "sdma_v2_4.h" #include "sdma_v3_0.h" +#include "dce_v10_0.h" #include "dce_v11_0.h" +#include "iceland_ih.h"
drivers/gpu/drm/amd/amdgpu/vi.c line 86
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vi.c +3
-0#include "tonga_ih.h" #include "cz_ih.h" +#include "uvd_v5_0.h" #include "uvd_v6_0.h" +#include "vce_v3_0.h" + #if defined(CONFIG_DRM_AMD_ACP)> #include "amdgpu_acp.h"#endif
What is the reason for these changes? Unless this actually fixes some style warning, I'd drop this change.
Alex
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vi.c +0
-1--2.49.0
Re: [PATCH 6/5] drm/amdgpu: fix style in dce_v8_0.c and in vi.c
Quoted 89 lines · Alex Deucher
Quoted 72 lines · Alexandre Demers
Bring things on a single line and fix spacing.
Signed-off-by Alexandre Demers <[email protected]>--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/vi.c | 8 ++++++++ 2 files changed, 11 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3
-7@@ -3233,8 +3233,7 @@ static const struct amd_ip_funcs dce_v8_0_ip_funcs = { .set_powergating_state = dce_v8_0_set_powergating_state, }; -static void -dce_v8_0_encoder_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_encoder_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3330,8 +3329,7 @@ static void dce_v8_0_ext_commit(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_ext_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3343,8 +3341,7 @@ static void dce_v8_0_ext_disable(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) +static void dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) { }@@ -3407,7 +3404,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev, amdgpu_encoder->devices |= supported_device;return ; } - }/* add a new one */ drivers/gpu/drm/amd/amdgpu/vi.c +5
-0@@ -61,19 +61,27 @@#include "vid.h" #include "vi.h" +#include "gmc_v8_0.h" #include "gmc_v7_0.h" +#include "gfx_v8_0.h" +#include "sdma_v2_4.h" #include "sdma_v3_0.h" +#include "dce_v10_0.h" #include "dce_v11_0.h" +#include "iceland_ih.h" drivers/gpu/drm/amd/amdgpu/vi.c line 86
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vi.c +3
-0#include "tonga_ih.h" #include "cz_ih.h" +#include "uvd_v5_0.h" #include "uvd_v6_0.h" +#include "vce_v3_0.h" + #if defined(CONFIG_DRM_AMD_ACP)> #include "amdgpu_acp.h"#endif What is the reason for these changes? Unless this actually fixes some style warning, I'd drop this change.
Quoted 2 lines
Alex
Readability. Nothing more, nothing less. I'm leaving this up to you to decide if you want it in or not.
Alexandre
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vi.c +0
-1--2.49.0
Re: [PATCH 6/5] drm/amdgpu: fix style in dce_v8_0.c and in vi.c
Quoted 91 lines · Alexandre Demers
Quoted 89 lines · Alex Deucher
Quoted 72 lines · Alexandre Demers
Bring things on a single line and fix spacing.
Signed-off-by Alexandre Demers <[email protected]>--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 10 +++------- drivers/gpu/drm/amd/amdgpu/vi.c | 8 ++++++++ 2 files changed, 11 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3
-7@@ -3233,8 +3233,7 @@ static const struct amd_ip_funcs dce_v8_0_ip_funcs = { .set_powergating_state = dce_v8_0_set_powergating_state, }; -static void -dce_v8_0_encoder_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_encoder_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3330,8 +3329,7 @@ static void dce_v8_0_ext_commit(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_mode_set (struct drm_encoder *encoder, +static void dce_v8_0_ext_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode) {@@ -3343,8 +3341,7 @@ static void dce_v8_0_ext_disable(struct drm_encoder *encoder) } -static void -dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) +static void dce_v8_0_ext_dpms (struct drm_encoder *encoder,int mode) { }@@ -3407,7 +3404,6 @@ static void dce_v8_0_encoder_add(struct amdgpu_device *adev, amdgpu_encoder->devices |= supported_device;return ; } - }/* add a new one */ drivers/gpu/drm/amd/amdgpu/vi.c +5
-0@@ -61,19 +61,27 @@#include "vid.h" #include "vi.h" +#include "gmc_v8_0.h" #include "gmc_v7_0.h" +#include "gfx_v8_0.h" +#include "sdma_v2_4.h" #include "sdma_v3_0.h" +#include "dce_v10_0.h" #include "dce_v11_0.h" +#include "iceland_ih.h" drivers/gpu/drm/amd/amdgpu/vi.c line 86
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vi.c +3
-0#include "tonga_ih.h" #include "cz_ih.h" +#include "uvd_v5_0.h" #include "uvd_v6_0.h" +#include "vce_v3_0.h" + #if defined(CONFIG_DRM_AMD_ACP)> #include "amdgpu_acp.h"#endif What is the reason for these changes? Unless this actually fixes some style warning, I'd drop this change.
Quoted 4 lines
Quoted 2 lines
Alex
Readability. Nothing more, nothing less. I'm leaving this up to you to decide if you want it in or not.
Can you drop this hunk when you send your next respin?
Alex
Quoted 5 lines
Alexandre
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/vi.c +0
-1--2.49.0