drm/amdgpu: Add client id helpers to mmhub
Subsystems (2)
PATCH 1/5 drm/amdgpu: Add client id helpers to mmhub
Add data structure and helpers to get client id data of mmhub.
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h +25 -0
@@ -66,12 +66,37 @@ struct amdgpu_mmhub_funcs {int (*get_xgmi_info)(struct amdgpu_device *adev); }; +struct amdgpu_mmhub_client_ids { +const char *const (*names)[2 ]; +unsigned int size; +}; +struct amdgpu_mmhub {struct ras_common_if *ras_if;const struct amdgpu_mmhub_funcs *funcs;struct amdgpu_mmhub_ras *ras; +struct amdgpu_mmhub_client_ids client_ids; }; +static inline void +amdgpu_mmhub_init_client_info (struct amdgpu_mmhub *mmhub, +const char *const (*names)[2 ], +unsigned int size) +{ + mmhub->client_ids.names = names; + mmhub->client_ids.size = size; +} + +static inline const char * +amdgpu_mmhub_client_name (struct amdgpu_mmhub *mmhub, +u32 cid,bool is_write) +{ +if (cid < mmhub->client_ids.size) +return mmhub->client_ids.names[cid][is_write]; + +return NULL ; +} +int amdgpu_mmhub_ras_sw_init (struct amdgpu_device *adev);#endif
Signature · 1 line
2.49.0
PATCH 2/5 drm/amdgpu: Add client ids for mmhub v4.x
Initialize client ids for mmhub v4.x
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c | 15 ++++++--------- drivers/gpu/drm/amd/amdgpu/mmhub_v4_2_0.c | 15 ++++++--------- 2 files changed, 12 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c +6 -9
@@ -90,7 +90,7 @@ mmhub_v4_1_0_print_l2_protection_fault_status(struct amdgpu_device *adev, uint32_t status) {uint32_t cid, rw; -const char *mmhub_cid =NULL ; +const char *mmhub_cid; cid =REG_GET_FIELD (status,MMVM_L2_PROTECTION_FAULT_STATUS_LO32 ,CID );
@@ -100,14 +100,7 @@ mmhub_v4_1_0_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS_LO32:0x%08X\n" , status); -switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { -case IP_VERSION (4 ,1 ,0 ): - mmhub_cid = mmhub_client_ids_v4_1_0[cid][rw]; -break ; -default : - mmhub_cid =NULL ; -break ; - } + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
@@ -514,6 +507,10 @@ static void mmhub_v4_1_0_init(struct amdgpu_device *adev)SOC15_REG_OFFSET (MMHUB ,0 , regMMVM_CONTEXTS_DISABLE); hub->vmhub_funcs = &mmhub_v4_1_0_vmhub_funcs; + +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_v4_1_0, +ARRAY_SIZE (mmhub_client_ids_v4_1_0)); }static u64 mmhub_v4_1_0_get_fb_location (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v4_2_0.c +6 -9
@@ -716,7 +716,7 @@ mmhub_v4_2_0_print_l2_protection_fault_status(struct amdgpu_device *adev, uint32_t status) {uint32_t cid, rw; -const char *mmhub_cid =NULL ; +const char *mmhub_cid; cid =REG_GET_FIELD (status,MMVM_L2_PROTECTION_FAULT_STATUS_LO32 ,CID );
@@ -726,14 +726,7 @@ mmhub_v4_2_0_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS_LO32:0x%08X\n" , status); -switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { -case IP_VERSION (4 ,2 ,0 ): - mmhub_cid = mmhub_client_ids_v4_2_0[cid][rw]; -break ; -default : - mmhub_cid =NULL ; -break ; - } + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
@@ -824,6 +817,10 @@ static void mmhub_v4_2_0_init(struct amdgpu_device *adev) mid_mask = adev->aid_mask;mmhub_v4_2_0_mid_init (adev, mid_mask); + +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_v4_2_0, +ARRAY_SIZE (mmhub_client_ids_v4_2_0)); } static void
Signature · 1 line
2.49.0
PATCH 3/5 drm/amdgpu: Add client ids for mmhub v3.x
In reply to Lijo LazarInitialize client ids for mmhub v3.x
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 16 +++---- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c | 17 +++---- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c | 9 ++-- drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c | 55 +++++++++++++---------- 4 files changed, 49 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +6 -10
@@ -97,7 +97,7 @@ mmhub_v3_0_print_l2_protection_fault_status(struct amdgpu_device *adev, uint32_t status) {uint32_t cid, rw; -const char *mmhub_cid =NULL ; +const char *mmhub_cid; cid =REG_GET_FIELD (status,MMVM_L2_PROTECTION_FAULT_STATUS ,CID );
@@ -107,15 +107,7 @@ mmhub_v3_0_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { -case IP_VERSION (3 ,0 ,0 ): -case IP_VERSION (3 ,0 ,1 ): - mmhub_cid = mmhub_client_ids_v3_0_0[cid][rw]; -break ; -default : - mmhub_cid =NULL ; -break ; - } + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
@@ -520,6 +512,10 @@ static void mmhub_v3_0_init(struct amdgpu_device *adev)SOC15_REG_OFFSET (MMHUB ,0 , regMMVM_CONTEXTS_DISABLE); hub->vmhub_funcs = &mmhub_v3_0_vmhub_funcs; + +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_v3_0_0, +ARRAY_SIZE (mmhub_client_ids_v3_0_0)); }static u64 mmhub_v3_0_get_fb_location (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c +6 -11
@@ -104,7 +104,7 @@ mmhub_v3_0_1_print_l2_protection_fault_status(struct amdgpu_device *adev, uint32_t status) {uint32_t cid, rw; -const char *mmhub_cid =NULL ; +const char *mmhub_cid; cid =REG_GET_FIELD (status,MMVM_L2_PROTECTION_FAULT_STATUS ,CID );
@@ -114,16 +114,7 @@ mmhub_v3_0_1_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); - -switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { -case IP_VERSION (3 ,0 ,1 ): - mmhub_cid = mmhub_client_ids_v3_0_1[cid][rw]; -break ; -default : - mmhub_cid =NULL ; -break ; - } - + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
@@ -503,6 +494,10 @@ static void mmhub_v3_0_1_init(struct amdgpu_device *adev)MMVM_CONTEXT1_CNTL__EXECUTE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK ; hub->vmhub_funcs = &mmhub_v3_0_1_vmhub_funcs; + +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_v3_0_1, +ARRAY_SIZE (mmhub_client_ids_v3_0_1)); }static u64 mmhub_v3_0_1_get_fb_location (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_2.c +6 -3
@@ -97,7 +97,7 @@ mmhub_v3_0_2_print_l2_protection_fault_status(struct amdgpu_device *adev, uint32_t status) {uint32_t cid, rw; -const char *mmhub_cid =NULL ; +const char *mmhub_cid; cid =REG_GET_FIELD (status,MMVM_L2_PROTECTION_FAULT_STATUS ,CID );
@@ -107,8 +107,7 @@ mmhub_v3_0_2_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); - - mmhub_cid = mmhub_client_ids_v3_0_2[cid][rw]; + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
@@ -509,6 +508,10 @@ static void mmhub_v3_0_2_init(struct amdgpu_device *adev)SOC15_REG_OFFSET (MMHUB ,0 , regMMVM_L2_BANK_SELECT_RESERVED_CID2); hub->vmhub_funcs = &mmhub_v3_0_2_vmhub_funcs; + +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_v3_0_2, +ARRAY_SIZE (mmhub_client_ids_v3_0_2)); }static u64 mmhub_v3_0_2_get_fb_location (struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c +31 -24
79 lines not on this page · raw message
Signature · 1 line
2.49.0
PATCH 4/5 drm/amdgpu: Add client ids for mmhub v2.x
In reply to Lijo LazarInitialize client ids for mmhub v2.x
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 46 ++++++++++++++++--------- drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c | 17 ++++----- 2 files changed, 35 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +29 -17
@@ -141,7 +141,7 @@ mmhub_v2_0_print_l2_protection_fault_status(struct amdgpu_device *adev, uint32_t status) {uint32_t cid, rw; -const char *mmhub_cid =NULL ; +const char *mmhub_cid; cid =REG_GET_FIELD (status,MMVM_L2_PROTECTION_FAULT_STATUS ,CID );
@@ -151,22 +151,7 @@ mmhub_v2_0_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { -case IP_VERSION (2 ,0 ,0 ): -case IP_VERSION (2 ,0 ,2 ): - mmhub_cid = mmhub_client_ids_navi1x[cid][rw]; -break ; -case IP_VERSION (2 ,1 ,0 ): -case IP_VERSION (2 ,1 ,1 ): - mmhub_cid = mmhub_client_ids_sienna_cichlid[cid][rw]; -break ; -case IP_VERSION (2 ,1 ,2 ): - mmhub_cid = mmhub_client_ids_beige_goby[cid][rw]; -break ; -default : - mmhub_cid =NULL ; -break ; - } + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
@@ -518,6 +503,31 @@ static const struct amdgpu_vmhub_funcs mmhub_v2_0_vmhub_funcs = { .get_invalidate_req = mmhub_v2_0_get_invalidate_req, }; +static void mmhub_v2_0_init_client_info (struct amdgpu_device *adev) +{ +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { +case IP_VERSION (2 ,0 ,0 ): +case IP_VERSION (2 ,0 ,2 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_navi1x, +ARRAY_SIZE (mmhub_client_ids_navi1x)); +break ; +case IP_VERSION (2 ,1 ,0 ): +case IP_VERSION (2 ,1 ,1 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_sienna_cichlid, +ARRAY_SIZE (mmhub_client_ids_sienna_cichlid)); +break ; +case IP_VERSION (2 ,1 ,2 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_beige_goby, +ARRAY_SIZE (mmhub_client_ids_beige_goby)); +break ; +default : +break ; + } +} +static void mmhub_v2_0_init (struct amdgpu_device *adev) {struct amdgpu_vmhub *hub = &adev->vmhub[AMDGPU_MMHUB0 (0 )];
@@ -558,6 +568,8 @@ static void mmhub_v2_0_init(struct amdgpu_device *adev)MMVM_CONTEXT1_CNTL__EXECUTE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK ; hub->vmhub_funcs = &mmhub_v2_0_vmhub_funcs; + +mmhub_v2_0_init_client_info (adev); } static void mmhub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c +6 -11
@@ -80,7 +80,7 @@ mmhub_v2_3_print_l2_protection_fault_status(struct amdgpu_device *adev, uint32_t status) {uint32_t cid, rw; -const char *mmhub_cid =NULL ; +const char *mmhub_cid; cid =REG_GET_FIELD (status,MMVM_L2_PROTECTION_FAULT_STATUS ,CID );
@@ -90,16 +90,7 @@ mmhub_v2_3_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { -case IP_VERSION (2 ,3 ,0 ): -case IP_VERSION (2 ,4 ,0 ): -case IP_VERSION (2 ,4 ,1 ): - mmhub_cid = mmhub_client_ids_vangogh[cid][rw]; -break ; -default : - mmhub_cid =NULL ; -break ; - } + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n",
@@ -486,6 +477,10 @@ static void mmhub_v2_3_init(struct amdgpu_device *adev)MMVM_CONTEXT1_CNTL__EXECUTE_PROTECTION_FAULT_ENABLE_INTERRUPT_MASK ; hub->vmhub_funcs = &mmhub_v2_3_vmhub_funcs; + +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_vangogh, +ARRAY_SIZE (mmhub_client_ids_vangogh)); } static void
Signature · 1 line
2.49.0
PATCH 5/5 drm/amdgpu: Add client ids for gmcv9 mmhubs
In reply to Lijo LazarInitialize client ids for gmcv9 mmhubs
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 78 +++++++++++++++++---------- 1 file changed, 49 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +49 -29
@@ -660,35 +660,7 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev, gfxhub_client_ids[cid], cid); }else { -switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { -case IP_VERSION (9 ,0 ,0 ): - mmhub_cid = mmhub_client_ids_vega10[cid][rw]; -break ; -case IP_VERSION (9 ,3 ,0 ): - mmhub_cid = mmhub_client_ids_vega12[cid][rw]; -break ; -case IP_VERSION (9 ,4 ,0 ): - mmhub_cid = mmhub_client_ids_vega20[cid][rw]; -break ; -case IP_VERSION (9 ,4 ,1 ): - mmhub_cid = mmhub_client_ids_arcturus[cid][rw]; -break ; -case IP_VERSION (9 ,1 ,0 ): -case IP_VERSION (9 ,2 ,0 ): - mmhub_cid = mmhub_client_ids_raven[cid][rw]; -break ; -case IP_VERSION (1 ,5 ,0 ): -case IP_VERSION (2 ,4 ,0 ): - mmhub_cid = mmhub_client_ids_renoir[cid][rw]; -break ; -case IP_VERSION (1 ,8 ,0 ): -case IP_VERSION (9 ,4 ,2 ): - mmhub_cid = mmhub_client_ids_aldebaran[cid][rw]; -break ; -default : - mmhub_cid =NULL ; -break ; - } + mmhub_cid =amdgpu_mmhub_client_name (&adev->mmhub, cid, rw);dev_err (adev->dev,"\t Faulty UTCL2 client ID: %s (0x%x)\n" , mmhub_cid ? mmhub_cid :"unknown" , cid); }
@@ -1428,6 +1400,52 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev) } } +static void gmc_v9_0_init_mmhub_client_info (struct amdgpu_device *adev) +{ +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) { +case IP_VERSION (9 ,0 ,0 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_vega10, +ARRAY_SIZE (mmhub_client_ids_vega10)); +break ; +case IP_VERSION (9 ,3 ,0 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_vega12, +ARRAY_SIZE (mmhub_client_ids_vega12)); +break ; +case IP_VERSION (9 ,4 ,0 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_vega20, +ARRAY_SIZE (mmhub_client_ids_vega20)); +break ; +case IP_VERSION (9 ,4 ,1 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_arcturus, +ARRAY_SIZE (mmhub_client_ids_arcturus)); +break ; +case IP_VERSION (9 ,1 ,0 ): +case IP_VERSION (9 ,2 ,0 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_raven, +ARRAY_SIZE (mmhub_client_ids_raven)); +break ; +case IP_VERSION (1 ,5 ,0 ): +case IP_VERSION (2 ,4 ,0 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_renoir, +ARRAY_SIZE (mmhub_client_ids_renoir)); +break ; +case IP_VERSION (1 ,8 ,0 ): +case IP_VERSION (9 ,4 ,2 ): +amdgpu_mmhub_init_client_info (&adev->mmhub, + mmhub_client_ids_aldebaran, +ARRAY_SIZE (mmhub_client_ids_aldebaran)); +break ; +default : +break ; + } +} +static void gmc_v9_0_set_mmhub_funcs (struct amdgpu_device *adev) {switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {
@@ -1445,6 +1463,8 @@ static void gmc_v9_0_set_mmhub_funcs(struct amdgpu_device *adev) adev->mmhub.funcs = &mmhub_v1_0_funcs;break ; } + +gmc_v9_0_init_mmhub_client_info (adev); }static void gmc_v9_0_set_mmhub_ras_funcs (struct amdgpu_device *adev)
Signature · 1 line
2.49.0
Quoted 4 lines · Lijo Lazar
Add data structure and helpers to get client id data of mmhub.
Signed-off-by Lijo Lazar <[email protected]>
Series is:
Reviewed-by Alex Deucher <[email protected]>
Quoted 49 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.h +25
-1@@ -66,12 +66,37 @@ struct amdgpu_mmhub_funcs {int (*get_xgmi_info)(struct amdgpu_device *adev); }; +struct amdgpu_mmhub_client_ids { +const char *const (*names)[2 ]; +unsigned int size; +}; +struct amdgpu_mmhub {struct ras_common_if *ras_if;const struct amdgpu_mmhub_funcs *funcs;struct amdgpu_mmhub_ras *ras; +struct amdgpu_mmhub_client_ids client_ids; }; +static inline void +amdgpu_mmhub_init_client_info (struct amdgpu_mmhub *mmhub, +const char *const (*names)[2 ], +unsigned int size) +{ + mmhub->client_ids.names = names; + mmhub->client_ids.size = size; +} + +static inline const char * +amdgpu_mmhub_client_name (struct amdgpu_mmhub *mmhub, +u32 cid,bool is_write) +{ +if (cid < mmhub->client_ids.size) +return mmhub->client_ids.names[cid][is_write]; + +return NULL ; +} +int amdgpu_mmhub_ras_sw_init (struct amdgpu_device *adev);#endif --2.49.0