freedreno/registers: Add json to describe perfctr groups

To generate the perfctr tables we need a bit more information than what
is in the .xml, such as which groups of SELECT regs correspond to which
sets of COUNTER regs, the enum type of the countables (ie. possible
SELECT reg values), etc.

It would be awkward to shoehorn this into an xml schema that is based on
describing registers.  But json is easy to consume.

Field description:
 - chip:   variant enum used for generating correct reg offsets
 - groups: array of entries for each group of counters/countables:
   - name:     group name
   - num:      the number of counters
   - reserved: array of counter indices reserved for KMD use
   - select_offset: Offset of the first selector reg, used in cases
               where same bank of selectors is used for both BR and
               BV
   - select:   the selector reg name
   - counter:  counter name if <reg64>, otherwise use counter_lo and
               counter_hi
   - countable_type: name of <enum> that defines selector reg values

Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40522>
This commit is contained in:
Rob Clark 2026-03-17 13:59:36 -07:00 committed by Marge Bot
parent 46791d4c52
commit 2b81514c3e
4 changed files with 570 additions and 0 deletions

View file

@ -0,0 +1,109 @@
{
"chip": "A2XX",
"groups": [
{
"name": "CP",
"num": 1,
"select": "CP_PERFCOUNTER_SELECT",
"counter_lo": "CP_PERFCOUNTER_LO",
"counter_hi": "CP_PERFCOUNTER_HI",
"countable_type": "a2xx_cp_perfcount_sel"
},
{
"name": "PA_SU",
"num": 4,
"select": "PA_SU_PERFCOUNTER{}_SELECT",
"counter_lo": "PA_SU_PERFCOUNTER{}_LOW",
"counter_hi": "PA_SU_PERFCOUNTER{}_HI",
"countable_type": "a2xx_su_perfcnt_select"
},
{
"name": "PA_SC",
"num": 1,
"select": "PA_SC_PERFCOUNTER{}_SELECT",
"counter_lo": "PA_SC_PERFCOUNTER{}_LOW",
"counter_hi": "PA_SC_PERFCOUNTER{}_HI",
"countable_type": "a2xx_sc_perfcnt_select"
},
{
"name": "VGT",
"num": 4,
"select": "VGT_PERFCOUNTER{}_SELECT",
"counter_lo": "VGT_PERFCOUNTER{}_LOW",
"counter_hi": "VGT_PERFCOUNTER{}_HI",
"countable_type": "a2xx_vgt_perfcount_select"
},
{
"name": "TCR",
"num": 2,
"select": "TCR_PERFCOUNTER{}_SELECT",
"counter_lo": "TCR_PERFCOUNTER{}_LOW",
"counter_hi": "TCR_PERFCOUNTER{}_HI",
"countable_type": "a2xx_tcr_perfcount_select"
},
{
"name": "TP0",
"num": 2,
"select": "TP0_PERFCOUNTER{}_SELECT",
"counter_lo": "TP0_PERFCOUNTER{}_LOW",
"counter_hi": "TP0_PERFCOUNTER{}_HI",
"countable_type": "a2xx_tp_perfcount_select"
},
{
"name": "TCM",
"num": 2,
"select": "TCM_PERFCOUNTER{}_SELECT",
"counter_lo": "TCM_PERFCOUNTER{}_LOW",
"counter_hi": "TCM_PERFCOUNTER{}_HI",
"countable_type": "a2xx_tcm_perfcount_select"
},
{
"name": "TCF",
"num": 12,
"select": "TCF_PERFCOUNTER{}_SELECT",
"counter_lo": "TCF_PERFCOUNTER{}_LOW",
"counter_hi": "TCF_PERFCOUNTER{}_HI",
"countable_type": "a2xx_tcf_perfcount_select"
},
{
"name": "SQ",
"num": 4,
"select": "SQ_PERFCOUNTER{}_SELECT",
"counter_lo": "SQ_PERFCOUNTER{}_LOW",
"counter_hi": "SQ_PERFCOUNTER{}_HI",
"countable_type": "a2xx_sq_perfcnt_select"
},
{
"name": "SX",
"num": 1,
"select": "SX_PERFCOUNTER{}_SELECT",
"counter_lo": "SX_PERFCOUNTER{}_LOW",
"counter_hi": "SX_PERFCOUNTER{}_HI",
"countable_type": "a2xx_sx_perfcnt_select"
},
{
"name": "MH",
"num": 2,
"select": "MH_PERFCOUNTER{}_SELECT",
"counter_lo": "MH_PERFCOUNTER{}_LOW",
"counter_hi": "MH_PERFCOUNTER{}_HI",
"countable_type": "a2xx_mh_perfcnt_select"
},
{
"name": "RBBM",
"num": 2,
"select": "RBBM_PERFCOUNTER{}_SELECT",
"counter_lo": "RBBM_PERFCOUNTER{}_LO",
"counter_hi": "RBBM_PERFCOUNTER{}_HI",
"countable_type": "a2xx_rbbm_perfcount1_sel"
},
{
"name": "RB",
"num": 4,
"select": "RB_PERFCOUNTER{}_SELECT",
"counter_lo": "RB_PERFCOUNTER{}_LOW",
"counter_hi": "RB_PERFCOUNTER{}_HI",
"countable_type": "a2xx_rb_perfcnt_select"
}
]
}

View file

@ -0,0 +1,128 @@
{
"chip": "A5XX",
"groups": [
{
"name": "CP",
"num": 8,
"reserved": [ 0 ],
"select": "CP_PERFCTR_CP_SEL_{}",
"counter_lo": "RBBM_PERFCTR_CP_{}_LO",
"counter_hi": "RBBM_PERFCTR_CP_{}_HI",
"countable_type": "a5xx_cp_perfcounter_select"
},
{
"name": "CCU",
"num": 4,
"select": "RB_PERFCTR_CCU_SEL_{}",
"counter_lo": "RBBM_PERFCTR_CCU_{}_LO",
"counter_hi": "RBBM_PERFCTR_CCU_{}_HI",
"countable_type": "a5xx_ccu_perfcounter_select"
},
{
"name": "TSE",
"num": 4,
"select": "GRAS_PERFCTR_TSE_SEL_{}",
"counter_lo": "RBBM_PERFCTR_TSE_{}_LO",
"counter_hi": "RBBM_PERFCTR_TSE_{}_HI",
"countable_type": "a5xx_tse_perfcounter_select"
},
{
"name": "RAS",
"num": 4,
"select": "GRAS_PERFCTR_RAS_SEL_{}",
"counter_lo": "RBBM_PERFCTR_RAS_{}_LO",
"counter_hi": "RBBM_PERFCTR_RAS_{}_HI",
"countable_type": "a5xx_ras_perfcounter_select"
},
{
"name": "LRZ",
"num": 4,
"select": "GRAS_PERFCTR_LRZ_SEL_{}",
"counter_lo": "RBBM_PERFCTR_LRZ_{}_LO",
"counter_hi": "RBBM_PERFCTR_LRZ_{}_HI",
"countable_type": "a5xx_lrz_perfcounter_select"
},
{
"name": "HLSQ",
"num": 8,
"select": "HLSQ_PERFCTR_HLSQ_SEL_{}",
"counter_lo": "RBBM_PERFCTR_HLSQ_{}_LO",
"counter_hi": "RBBM_PERFCTR_HLSQ_{}_HI",
"countable_type": "a5xx_hlsq_perfcounter_select"
},
{
"name": "PC",
"num": 8,
"select": "PC_PERFCTR_PC_SEL_{}",
"counter_lo": "RBBM_PERFCTR_PC_{}_LO",
"counter_hi": "RBBM_PERFCTR_PC_{}_HI",
"countable_type": "a5xx_pc_perfcounter_select"
},
{
"name": "RB",
"num": 8,
"select": "RB_PERFCTR_RB_SEL_{}",
"counter_lo": "RBBM_PERFCTR_RB_{}_LO",
"counter_hi": "RBBM_PERFCTR_RB_{}_HI",
"countable_type": "a5xx_rb_perfcounter_select"
},
{
"name": "RBBM",
"num": 4,
"reserved": [ 0 ],
"select": "RBBM_PERFCTR_RBBM_SEL_{}",
"counter_lo": "RBBM_PERFCTR_RBBM_{}_LO",
"counter_hi": "RBBM_PERFCTR_RBBM_{}_HI",
"countable_type": "a5xx_rbbm_perfcounter_select"
},
{
"name": "SP",
"num": 12,
"reserved": [ 0 ],
"select": "SP_PERFCTR_SP_SEL_{}",
"counter_lo": "RBBM_PERFCTR_SP_{}_LO",
"counter_hi": "RBBM_PERFCTR_SP_{}_HI",
"countable_type": "a5xx_sp_perfcounter_select"
},
{
"name": "TP",
"num": 8,
"select": "TPL1_PERFCTR_TP_SEL_{}",
"counter_lo": "RBBM_PERFCTR_TP_{}_LO",
"counter_hi": "RBBM_PERFCTR_TP_{}_HI",
"countable_type": "a5xx_tp_perfcounter_select"
},
{
"name": "UCHE",
"num": 8,
"select": "UCHE_PERFCTR_UCHE_SEL_{}",
"counter_lo": "RBBM_PERFCTR_UCHE_{}_LO",
"counter_hi": "RBBM_PERFCTR_UCHE_{}_HI",
"countable_type": "a5xx_uche_perfcounter_select"
},
{
"name": "VFD",
"num": 8,
"select": "VFD_PERFCTR_VFD_SEL_{}",
"counter_lo": "RBBM_PERFCTR_VFD_{}_LO",
"counter_hi": "RBBM_PERFCTR_VFD_{}_HI",
"countable_type": "a5xx_vfd_perfcounter_select"
},
{
"name": "VPC",
"num": 4,
"select": "VPC_PERFCTR_VPC_SEL_{}",
"counter_lo": "RBBM_PERFCTR_VPC_{}_LO",
"counter_hi": "RBBM_PERFCTR_VPC_{}_HI",
"countable_type": "a5xx_vpc_perfcounter_select"
},
{
"name": "VSC",
"num": 2,
"select": "VSC_PERFCTR_VSC_SEL_{}",
"counter_lo": "RBBM_PERFCTR_VSC_{}_LO",
"counter_hi": "RBBM_PERFCTR_VSC_{}_HI",
"countable_type": "a5xx_vsc_perfcounter_select"
}
]
}

View file

@ -0,0 +1,105 @@
{
"chip": "A6XX",
"groups": [
{
"name": "CP",
"num": 14,
"reserved": [ 0 ],
"select": "CP_PERFCTR_CP_SEL",
"counter": "RBBM_PERFCTR_CP",
"countable_type": "a6xx_cp_perfcounter_select"
},
{
"name": "CCU",
"num": 5,
"select": "RB_PERFCTR_CCU_SEL",
"counter": "RBBM_PERFCTR_CCU",
"countable_type": "a6xx_ccu_perfcounter_select"
},
{
"name": "TSE",
"num": 4,
"select": "GRAS_PERFCTR_TSE_SEL",
"counter": "RBBM_PERFCTR_TSE",
"countable_type": "a6xx_tse_perfcounter_select"
},
{
"name": "RAS",
"num": 4,
"select": "GRAS_PERFCTR_RAS_SEL",
"counter": "RBBM_PERFCTR_RAS",
"countable_type": "a6xx_ras_perfcounter_select"
},
{
"name": "LRZ",
"num": 4,
"select": "GRAS_PERFCTR_LRZ_SEL",
"counter": "RBBM_PERFCTR_LRZ",
"countable_type": "a6xx_lrz_perfcounter_select"
},
{
"name": "HLSQ",
"num": 6,
"select": "HLSQ_PERFCTR_HLSQ_SEL",
"counter": "RBBM_PERFCTR_HLSQ",
"countable_type": "a6xx_hlsq_perfcounter_select"
},
{
"name": "PC",
"num": 8,
"select": "PC_PERFCTR_PC_SEL",
"counter": "RBBM_PERFCTR_PC",
"countable_type": "a6xx_pc_perfcounter_select"
},
{
"name": "RB",
"num": 8,
"select": "RB_PERFCTR_RB_SEL",
"counter": "RBBM_PERFCTR_RB",
"countable_type": "a6xx_rb_perfcounter_select"
},
{
"name": "SP",
"num": 24,
"reserved": [ 0 ],
"select": "SP_PERFCTR_SP_SEL",
"counter": "RBBM_PERFCTR_SP",
"countable_type": "a6xx_sp_perfcounter_select"
},
{
"name": "TP",
"num": 12,
"select": "TPL1_PERFCTR_TP_SEL",
"counter": "RBBM_PERFCTR_TP",
"countable_type": "a6xx_tp_perfcounter_select"
},
{
"name": "UCHE",
"num": 12,
"select": "UCHE_PERFCTR_UCHE_SEL",
"counter": "RBBM_PERFCTR_UCHE",
"countable_type": "a6xx_uche_perfcounter_select"
},
{
"name": "VFD",
"num": 8,
"select": "VFD_PERFCTR_VFD_SEL",
"counter": "RBBM_PERFCTR_VFD",
"countable_type": "a6xx_vfd_perfcounter_select"
},
{
"name": "VPC",
"num": 6,
"select": "VPC_PERFCTR_VPC_SEL",
"counter": "RBBM_PERFCTR_VPC",
"countable_type": "a6xx_vpc_perfcounter_select"
},
{
"name": "VSC",
"num": 2,
"select": "VSC_PERFCTR_VSC_SEL",
"counter": "RBBM_PERFCTR_VSC",
"countable_type": "a6xx_vsc_perfcounter_select"
}
]
}

View file

@ -0,0 +1,228 @@
{
"chip": "A7XX",
"groups": [
{
"name": "CP",
"num": 14,
"reserved": [ 0 ],
"select": "CP_PERFCTR_CP_SEL",
"counter": "RBBM_PERFCTR_CP",
"countable_type": "a7xx_cp_perfcounter_select"
},
{
"name": "RBBM",
"num": 4,
"select": "RBBM_PERFCTR_RBBM_SEL",
"counter": "RBBM_PERFCTR_RBBM",
"countable_type": "a7xx_rbbm_perfcounter_select"
},
{
"name": "PC",
"pipe": "BR",
"num": 8,
"select": "PC_PERFCTR_PC_SEL",
"counter": "RBBM_PERFCTR_PC",
"countable_type": "a7xx_pc_perfcounter_select"
},
{
"name": "VFD",
"pipe": "BR",
"num": 8,
"select": "VFD_PERFCTR_VFD_SEL",
"counter": "RBBM_PERFCTR_VFD",
"countable_type": "a7xx_vfd_perfcounter_select"
},
{
"name": "HLSQ",
"pipe": "BR",
"num": 6,
"select": "SP_PERFCTR_HLSQ_SEL",
"counter": "RBBM_PERFCTR_HLSQ",
"countable_type": "a7xx_hlsq_perfcounter_select"
},
{
"name": "VPC",
"pipe": "BR",
"num": 6,
"select": "VPC_PERFCTR_VPC_SEL",
"counter": "RBBM_PERFCTR_VPC",
"countable_type": "a7xx_vpc_perfcounter_select"
},
{
"name": "TSE",
"pipe": "BR",
"num": 4,
"select": "GRAS_PERFCTR_TSE_SEL",
"counter": "RBBM_PERFCTR_TSE",
"countable_type": "a7xx_tse_perfcounter_select"
},
{
"name": "RAS",
"pipe": "BR",
"num": 4,
"select": "GRAS_PERFCTR_RAS_SEL",
"counter": "RBBM_PERFCTR_RAS",
"countable_type": "a7xx_ras_perfcounter_select"
},
{
"name": "UCHE",
"num": 12,
"select": "UCHE_PERFCTR_UCHE_SEL",
"counter": "RBBM_PERFCTR_UCHE",
"countable_type": "a7xx_uche_perfcounter_select"
},
{
"name": "TP",
"pipe": "BR",
"num": 12,
"select": "TPL1_PERFCTR_TP_SEL",
"counter": "RBBM_PERFCTR_TP",
"countable_type": "a7xx_tp_perfcounter_select"
},
{
"name": "SP",
"pipe": "BR",
"num": 24,
"select": "SP_PERFCTR_SP_SEL",
"counter": "RBBM_PERFCTR_SP",
"countable_type": "a7xx_sp_perfcounter_select"
},
{
"name": "RB",
"num": 8,
"select": "RB_PERFCTR_RB_SEL",
"counter": "RBBM_PERFCTR_RB",
"countable_type": "a7xx_rb_perfcounter_select"
},
{
"name": "VSC",
"num": 2,
"select": "VSC_PERFCTR_VSC_SEL",
"counter": "RBBM_PERFCTR_VSC",
"countable_type": "a7xx_vsc_perfcounter_select"
},
{
"name": "CCU",
"num": 5,
"select": "RB_PERFCTR_CCU_SEL",
"counter": "RBBM_PERFCTR_CCU",
"countable_type": "a7xx_ccu_perfcounter_select"
},
{
"name": "LRZ",
"pipe": "BR",
"num": 4,
"select": "GRAS_PERFCTR_LRZ_SEL",
"counter": "RBBM_PERFCTR_LRZ",
"countable_type": "a7xx_lrz_perfcounter_select"
},
{
"name": "CMP",
"num": 4,
"select": "RB_PERFCTR_CMP_SEL",
"counter": "RBBM_PERFCTR_CMP",
"countable_type": "a7xx_cmp_perfcounter_select"
},
{
"name": "UFC",
"pipe": "BR",
"num": 4,
"select": "RB_PERFCTR_UFC_SEL",
"counter": "RBBM_PERFCTR_UFC",
"countable_type": "a7xx_ufc_perfcounter_select"
},
{
"name": "BV_CP",
"num": 7,
"select": "CP_BV_PERFCTR_CP_SEL",
"counter": "RBBM_PERFCTR2_CP",
"countable_type": "a7xx_cp_perfcounter_select"
},
{
"name": "BV_PC",
"pipe": "BV",
"num": 8,
"select_offset": 8,
"select": "PC_PERFCTR_PC_SEL",
"counter": "RBBM_PERFCTR_BV_PC",
"countable_type": "a7xx_pc_perfcounter_select"
},
{
"name": "BV_VFD",
"pipe": "BV",
"num": 8,
"select_offset": 8,
"select": "VFD_PERFCTR_VFD_SEL",
"counter": "RBBM_PERFCTR_BV_VFD",
"countable_type": "a7xx_vfd_perfcounter_select"
},
{
"name": "BV_VPC",
"pipe": "BV",
"num": 6,
"select_offset": 6,
"select": "VPC_PERFCTR_VPC_SEL",
"counter": "RBBM_PERFCTR_BV_VPC",
"countable_type": "a7xx_vpc_perfcounter_select"
},
{
"name": "BV_TP",
"pipe": "BV",
"num": 6,
"select_offset": 12,
"select": "TPL1_PERFCTR_TP_SEL",
"counter": "RBBM_PERFCTR2_TP",
"countable_type": "a7xx_tp_perfcounter_select"
},
{
"name": "BV_SP",
"pipe": "BV",
"num": 12,
"select_offset": 24,
"select": "SP_PERFCTR_SP_SEL",
"counter": "RBBM_PERFCTR2_SP",
"countable_type": "a7xx_sp_perfcounter_select"
},
{
"name": "BV_UFC",
"pipe": "BV",
"num": 2,
"select_offset": 4,
"select": "RB_PERFCTR_UFC_SEL",
"counter": "RBBM_PERFCTR2_UFC",
"countable_type": "a7xx_ufc_perfcounter_select"
},
{
"name": "BV_TSE",
"pipe": "BV",
"num": 4,
"select": "GRAS_PERFCTR_TSE_SEL",
"counter": "RBBM_PERFCTR_BV_TSE",
"countable_type": "a7xx_tse_perfcounter_select"
},
{
"name": "BV_RAS",
"pipe": "BV",
"num": 4,
"select": "GRAS_PERFCTR_RAS_SEL",
"counter": "RBBM_PERFCTR_BV_RAS",
"countable_type": "a7xx_ras_perfcounter_select"
},
{
"name": "BV_LRZ",
"pipe": "BV",
"num": 4,
"select": "GRAS_PERFCTR_LRZ_SEL",
"counter": "RBBM_PERFCTR_BV_LRZ",
"countable_type": "a7xx_lrz_perfcounter_select"
},
{
"name": "BV_HLSQ",
"pipe": "BV",
"num": 6,
"select": "SP_PERFCTR_HLSQ_SEL",
"counter": "RBBM_PERFCTR2_HLSQ",
"countable_type": "a7xx_hlsq_perfcounter_select"
}
]
}