Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | From 7400784247be42beb996f7538547c56acd6cfa0c Mon Sep 17 00:00:00 2001 |
| 2 | From: Robin Murphy <robin.murphy@arm.com> |
| 3 | Date: Fri, 3 Dec 2021 11:44:59 +0000 |
| 4 | Subject: [PATCH 12/14] perf/arm-cmn: Demarcate CMN-600 specifics |
| 5 | |
| 6 | In preparation for supporting newer CMN products, let's introduce a |
| 7 | means to differentiate the features and events which are specific to a |
| 8 | particular IP from those which remain common to the whole family. The |
| 9 | newer designs have also smoothed off some of the rough edges in terms |
| 10 | of discoverability, so separate out the parts of the flow which have |
| 11 | effectively now become CMN-600 quirks. |
| 12 | |
| 13 | Signed-off-by: Robin Murphy <robin.murphy@arm.com> |
| 14 | Link: https://lore.kernel.org/r/9f6368cdca4c821d801138939508a5bba54ccabb.1638530442.git.robin.murphy@arm.com |
| 15 | Signed-off-by: Will Deacon <will@kernel.org> |
| 16 | |
| 17 | Upstream-Status: Backport [https://lore.kernel.org/r/9f6368cdca4c821d801138939508a5bba54ccabb.1638530442.git.robin.murphy@arm.com] |
| 18 | Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com> |
| 19 | --- |
| 20 | drivers/perf/arm-cmn.c | 313 +++++++++++++++++++++-------------------- |
| 21 | 1 file changed, 162 insertions(+), 151 deletions(-) |
| 22 | |
| 23 | diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c |
| 24 | index b89a081d26ff..92ff273fbe58 100644 |
| 25 | --- a/drivers/perf/arm-cmn.c |
| 26 | +++ b/drivers/perf/arm-cmn.c |
| 27 | @@ -151,7 +151,12 @@ |
| 28 | #define CMN_WP_DOWN 2 |
| 29 | |
| 30 | |
| 31 | -/* r0px probably don't exist in silicon, thankfully */ |
| 32 | +enum cmn_model { |
| 33 | + CMN_ANY = -1, |
| 34 | + CMN600 = 1, |
| 35 | +}; |
| 36 | + |
| 37 | +/* CMN-600 r0px shouldn't exist in silicon, thankfully */ |
| 38 | enum cmn_revision { |
| 39 | CMN600_R1P0, |
| 40 | CMN600_R1P1, |
| 41 | @@ -159,6 +164,7 @@ enum cmn_revision { |
| 42 | CMN600_R1P3, |
| 43 | CMN600_R2P0, |
| 44 | CMN600_R3P0, |
| 45 | + CMN600_R3P1, |
| 46 | }; |
| 47 | |
| 48 | enum cmn_node_type { |
| 49 | @@ -229,6 +235,7 @@ struct arm_cmn { |
| 50 | void __iomem *base; |
| 51 | |
| 52 | enum cmn_revision rev; |
| 53 | + enum cmn_model model; |
| 54 | u8 mesh_x; |
| 55 | u8 mesh_y; |
| 56 | u16 num_xps; |
| 57 | @@ -326,6 +333,7 @@ static unsigned int arm_cmn_get_index(u64 x[], unsigned int pos) |
| 58 | |
| 59 | struct arm_cmn_event_attr { |
| 60 | struct device_attribute attr; |
| 61 | + enum cmn_model model; |
| 62 | enum cmn_node_type type; |
| 63 | u8 eventid; |
| 64 | u8 occupid; |
| 65 | @@ -337,9 +345,10 @@ struct arm_cmn_format_attr { |
| 66 | int config; |
| 67 | }; |
| 68 | |
| 69 | -#define CMN_EVENT_ATTR(_name, _type, _eventid, _occupid) \ |
| 70 | +#define CMN_EVENT_ATTR(_model, _name, _type, _eventid, _occupid) \ |
| 71 | (&((struct arm_cmn_event_attr[]) {{ \ |
| 72 | .attr = __ATTR(_name, 0444, arm_cmn_event_show, NULL), \ |
| 73 | + .model = _model, \ |
| 74 | .type = _type, \ |
| 75 | .eventid = _eventid, \ |
| 76 | .occupid = _occupid, \ |
| 77 | @@ -386,12 +395,15 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj, |
| 78 | eattr = container_of(attr, typeof(*eattr), attr.attr); |
| 79 | type = eattr->type; |
| 80 | |
| 81 | + if (!(eattr->model & cmn->model)) |
| 82 | + return 0; |
| 83 | + |
| 84 | /* Watchpoints aren't nodes */ |
| 85 | if (type == CMN_TYPE_WP) |
| 86 | type = CMN_TYPE_XP; |
| 87 | |
| 88 | /* Revision-specific differences */ |
| 89 | - if (cmn->rev < CMN600_R1P2) { |
| 90 | + if (cmn->model == CMN600 && cmn->rev < CMN600_R1P2) { |
| 91 | if (type == CMN_TYPE_HNF && eattr->eventid == 0x1b) |
| 92 | return 0; |
| 93 | } |
| 94 | @@ -402,25 +414,27 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj, |
| 95 | return attr->mode; |
| 96 | } |
| 97 | |
| 98 | -#define _CMN_EVENT_DVM(_name, _event, _occup) \ |
| 99 | - CMN_EVENT_ATTR(dn_##_name, CMN_TYPE_DVM, _event, _occup) |
| 100 | +#define _CMN_EVENT_DVM(_model, _name, _event, _occup) \ |
| 101 | + CMN_EVENT_ATTR(_model, dn_##_name, CMN_TYPE_DVM, _event, _occup) |
| 102 | #define CMN_EVENT_DTC(_name) \ |
| 103 | - CMN_EVENT_ATTR(dtc_##_name, CMN_TYPE_DTC, 0, 0) |
| 104 | -#define _CMN_EVENT_HNF(_name, _event, _occup) \ |
| 105 | - CMN_EVENT_ATTR(hnf_##_name, CMN_TYPE_HNF, _event, _occup) |
| 106 | + CMN_EVENT_ATTR(CMN_ANY, dtc_##_name, CMN_TYPE_DTC, 0, 0) |
| 107 | +#define _CMN_EVENT_HNF(_model, _name, _event, _occup) \ |
| 108 | + CMN_EVENT_ATTR(_model, hnf_##_name, CMN_TYPE_HNF, _event, _occup) |
| 109 | #define CMN_EVENT_HNI(_name, _event) \ |
| 110 | - CMN_EVENT_ATTR(hni_##_name, CMN_TYPE_HNI, _event, 0) |
| 111 | + CMN_EVENT_ATTR(CMN_ANY, hni_##_name, CMN_TYPE_HNI, _event, 0) |
| 112 | #define __CMN_EVENT_XP(_name, _event) \ |
| 113 | - CMN_EVENT_ATTR(mxp_##_name, CMN_TYPE_XP, _event, 0) |
| 114 | -#define CMN_EVENT_SBSX(_name, _event) \ |
| 115 | - CMN_EVENT_ATTR(sbsx_##_name, CMN_TYPE_SBSX, _event, 0) |
| 116 | -#define CMN_EVENT_RNID(_name, _event) \ |
| 117 | - CMN_EVENT_ATTR(rnid_##_name, CMN_TYPE_RNI, _event, 0) |
| 118 | - |
| 119 | -#define CMN_EVENT_DVM(_name, _event) \ |
| 120 | - _CMN_EVENT_DVM(_name, _event, 0) |
| 121 | -#define CMN_EVENT_HNF(_name, _event) \ |
| 122 | - _CMN_EVENT_HNF(_name, _event, 0) |
| 123 | + CMN_EVENT_ATTR(CMN_ANY, mxp_##_name, CMN_TYPE_XP, _event, 0) |
| 124 | +#define CMN_EVENT_SBSX(_model, _name, _event) \ |
| 125 | + CMN_EVENT_ATTR(_model, sbsx_##_name, CMN_TYPE_SBSX, _event, 0) |
| 126 | +#define CMN_EVENT_RNID(_model, _name, _event) \ |
| 127 | + CMN_EVENT_ATTR(_model, rnid_##_name, CMN_TYPE_RNI, _event, 0) |
| 128 | +#define CMN_EVENT_MTSX(_name, _event) \ |
| 129 | + CMN_EVENT_ATTR(CMN_ANY, mtsx_##_name, CMN_TYPE_MTSX, _event, 0) |
| 130 | + |
| 131 | +#define CMN_EVENT_DVM(_model, _name, _event) \ |
| 132 | + _CMN_EVENT_DVM(_model, _name, _event, 0) |
| 133 | +#define CMN_EVENT_HNF(_model, _name, _event) \ |
| 134 | + _CMN_EVENT_HNF(_model, _name, _event, 0) |
| 135 | #define _CMN_EVENT_XP(_name, _event) \ |
| 136 | __CMN_EVENT_XP(e_##_name, (_event) | (0 << 2)), \ |
| 137 | __CMN_EVENT_XP(w_##_name, (_event) | (1 << 2)), \ |
| 138 | @@ -445,115 +459,115 @@ static struct attribute *arm_cmn_event_attrs[] = { |
| 139 | * slot, but our lazy short-cut of using the DTM counter index for |
| 140 | * the PMU index as well happens to avoid that by construction. |
| 141 | */ |
| 142 | - CMN_EVENT_DVM(rxreq_dvmop, 0x01), |
| 143 | - CMN_EVENT_DVM(rxreq_dvmsync, 0x02), |
| 144 | - CMN_EVENT_DVM(rxreq_dvmop_vmid_filtered, 0x03), |
| 145 | - CMN_EVENT_DVM(rxreq_retried, 0x04), |
| 146 | - _CMN_EVENT_DVM(rxreq_trk_occupancy_all, 0x05, 0), |
| 147 | - _CMN_EVENT_DVM(rxreq_trk_occupancy_dvmop, 0x05, 1), |
| 148 | - _CMN_EVENT_DVM(rxreq_trk_occupancy_dvmsync, 0x05, 2), |
| 149 | - |
| 150 | - CMN_EVENT_HNF(cache_miss, 0x01), |
| 151 | - CMN_EVENT_HNF(slc_sf_cache_access, 0x02), |
| 152 | - CMN_EVENT_HNF(cache_fill, 0x03), |
| 153 | - CMN_EVENT_HNF(pocq_retry, 0x04), |
| 154 | - CMN_EVENT_HNF(pocq_reqs_recvd, 0x05), |
| 155 | - CMN_EVENT_HNF(sf_hit, 0x06), |
| 156 | - CMN_EVENT_HNF(sf_evictions, 0x07), |
| 157 | - CMN_EVENT_HNF(dir_snoops_sent, 0x08), |
| 158 | - CMN_EVENT_HNF(brd_snoops_sent, 0x09), |
| 159 | - CMN_EVENT_HNF(slc_eviction, 0x0a), |
| 160 | - CMN_EVENT_HNF(slc_fill_invalid_way, 0x0b), |
| 161 | - CMN_EVENT_HNF(mc_retries, 0x0c), |
| 162 | - CMN_EVENT_HNF(mc_reqs, 0x0d), |
| 163 | - CMN_EVENT_HNF(qos_hh_retry, 0x0e), |
| 164 | - _CMN_EVENT_HNF(qos_pocq_occupancy_all, 0x0f, 0), |
| 165 | - _CMN_EVENT_HNF(qos_pocq_occupancy_read, 0x0f, 1), |
| 166 | - _CMN_EVENT_HNF(qos_pocq_occupancy_write, 0x0f, 2), |
| 167 | - _CMN_EVENT_HNF(qos_pocq_occupancy_atomic, 0x0f, 3), |
| 168 | - _CMN_EVENT_HNF(qos_pocq_occupancy_stash, 0x0f, 4), |
| 169 | - CMN_EVENT_HNF(pocq_addrhaz, 0x10), |
| 170 | - CMN_EVENT_HNF(pocq_atomic_addrhaz, 0x11), |
| 171 | - CMN_EVENT_HNF(ld_st_swp_adq_full, 0x12), |
| 172 | - CMN_EVENT_HNF(cmp_adq_full, 0x13), |
| 173 | - CMN_EVENT_HNF(txdat_stall, 0x14), |
| 174 | - CMN_EVENT_HNF(txrsp_stall, 0x15), |
| 175 | - CMN_EVENT_HNF(seq_full, 0x16), |
| 176 | - CMN_EVENT_HNF(seq_hit, 0x17), |
| 177 | - CMN_EVENT_HNF(snp_sent, 0x18), |
| 178 | - CMN_EVENT_HNF(sfbi_dir_snp_sent, 0x19), |
| 179 | - CMN_EVENT_HNF(sfbi_brd_snp_sent, 0x1a), |
| 180 | - CMN_EVENT_HNF(snp_sent_untrk, 0x1b), |
| 181 | - CMN_EVENT_HNF(intv_dirty, 0x1c), |
| 182 | - CMN_EVENT_HNF(stash_snp_sent, 0x1d), |
| 183 | - CMN_EVENT_HNF(stash_data_pull, 0x1e), |
| 184 | - CMN_EVENT_HNF(snp_fwded, 0x1f), |
| 185 | - |
| 186 | - CMN_EVENT_HNI(rrt_rd_occ_cnt_ovfl, 0x20), |
| 187 | - CMN_EVENT_HNI(rrt_wr_occ_cnt_ovfl, 0x21), |
| 188 | - CMN_EVENT_HNI(rdt_rd_occ_cnt_ovfl, 0x22), |
| 189 | - CMN_EVENT_HNI(rdt_wr_occ_cnt_ovfl, 0x23), |
| 190 | - CMN_EVENT_HNI(wdb_occ_cnt_ovfl, 0x24), |
| 191 | - CMN_EVENT_HNI(rrt_rd_alloc, 0x25), |
| 192 | - CMN_EVENT_HNI(rrt_wr_alloc, 0x26), |
| 193 | - CMN_EVENT_HNI(rdt_rd_alloc, 0x27), |
| 194 | - CMN_EVENT_HNI(rdt_wr_alloc, 0x28), |
| 195 | - CMN_EVENT_HNI(wdb_alloc, 0x29), |
| 196 | - CMN_EVENT_HNI(txrsp_retryack, 0x2a), |
| 197 | - CMN_EVENT_HNI(arvalid_no_arready, 0x2b), |
| 198 | - CMN_EVENT_HNI(arready_no_arvalid, 0x2c), |
| 199 | - CMN_EVENT_HNI(awvalid_no_awready, 0x2d), |
| 200 | - CMN_EVENT_HNI(awready_no_awvalid, 0x2e), |
| 201 | - CMN_EVENT_HNI(wvalid_no_wready, 0x2f), |
| 202 | - CMN_EVENT_HNI(txdat_stall, 0x30), |
| 203 | - CMN_EVENT_HNI(nonpcie_serialization, 0x31), |
| 204 | - CMN_EVENT_HNI(pcie_serialization, 0x32), |
| 205 | - |
| 206 | - CMN_EVENT_XP(txflit_valid, 0x01), |
| 207 | - CMN_EVENT_XP(txflit_stall, 0x02), |
| 208 | - CMN_EVENT_XP(partial_dat_flit, 0x03), |
| 209 | + CMN_EVENT_DVM(CMN600, rxreq_dvmop, 0x01), |
| 210 | + CMN_EVENT_DVM(CMN600, rxreq_dvmsync, 0x02), |
| 211 | + CMN_EVENT_DVM(CMN600, rxreq_dvmop_vmid_filtered, 0x03), |
| 212 | + CMN_EVENT_DVM(CMN600, rxreq_retried, 0x04), |
| 213 | + _CMN_EVENT_DVM(CMN600, rxreq_trk_occupancy_all, 0x05, 0), |
| 214 | + _CMN_EVENT_DVM(CMN600, rxreq_trk_occupancy_dvmop, 0x05, 1), |
| 215 | + _CMN_EVENT_DVM(CMN600, rxreq_trk_occupancy_dvmsync, 0x05, 2), |
| 216 | + |
| 217 | + CMN_EVENT_HNF(CMN_ANY, cache_miss, 0x01), |
| 218 | + CMN_EVENT_HNF(CMN_ANY, slc_sf_cache_access, 0x02), |
| 219 | + CMN_EVENT_HNF(CMN_ANY, cache_fill, 0x03), |
| 220 | + CMN_EVENT_HNF(CMN_ANY, pocq_retry, 0x04), |
| 221 | + CMN_EVENT_HNF(CMN_ANY, pocq_reqs_recvd, 0x05), |
| 222 | + CMN_EVENT_HNF(CMN_ANY, sf_hit, 0x06), |
| 223 | + CMN_EVENT_HNF(CMN_ANY, sf_evictions, 0x07), |
| 224 | + CMN_EVENT_HNF(CMN_ANY, dir_snoops_sent, 0x08), |
| 225 | + CMN_EVENT_HNF(CMN_ANY, brd_snoops_sent, 0x09), |
| 226 | + CMN_EVENT_HNF(CMN_ANY, slc_eviction, 0x0a), |
| 227 | + CMN_EVENT_HNF(CMN_ANY, slc_fill_invalid_way, 0x0b), |
| 228 | + CMN_EVENT_HNF(CMN_ANY, mc_retries, 0x0c), |
| 229 | + CMN_EVENT_HNF(CMN_ANY, mc_reqs, 0x0d), |
| 230 | + CMN_EVENT_HNF(CMN_ANY, qos_hh_retry, 0x0e), |
| 231 | + _CMN_EVENT_HNF(CMN_ANY, qos_pocq_occupancy_all, 0x0f, 0), |
| 232 | + _CMN_EVENT_HNF(CMN_ANY, qos_pocq_occupancy_read, 0x0f, 1), |
| 233 | + _CMN_EVENT_HNF(CMN_ANY, qos_pocq_occupancy_write, 0x0f, 2), |
| 234 | + _CMN_EVENT_HNF(CMN_ANY, qos_pocq_occupancy_atomic, 0x0f, 3), |
| 235 | + _CMN_EVENT_HNF(CMN_ANY, qos_pocq_occupancy_stash, 0x0f, 4), |
| 236 | + CMN_EVENT_HNF(CMN_ANY, pocq_addrhaz, 0x10), |
| 237 | + CMN_EVENT_HNF(CMN_ANY, pocq_atomic_addrhaz, 0x11), |
| 238 | + CMN_EVENT_HNF(CMN_ANY, ld_st_swp_adq_full, 0x12), |
| 239 | + CMN_EVENT_HNF(CMN_ANY, cmp_adq_full, 0x13), |
| 240 | + CMN_EVENT_HNF(CMN_ANY, txdat_stall, 0x14), |
| 241 | + CMN_EVENT_HNF(CMN_ANY, txrsp_stall, 0x15), |
| 242 | + CMN_EVENT_HNF(CMN_ANY, seq_full, 0x16), |
| 243 | + CMN_EVENT_HNF(CMN_ANY, seq_hit, 0x17), |
| 244 | + CMN_EVENT_HNF(CMN_ANY, snp_sent, 0x18), |
| 245 | + CMN_EVENT_HNF(CMN_ANY, sfbi_dir_snp_sent, 0x19), |
| 246 | + CMN_EVENT_HNF(CMN_ANY, sfbi_brd_snp_sent, 0x1a), |
| 247 | + CMN_EVENT_HNF(CMN_ANY, snp_sent_untrk, 0x1b), |
| 248 | + CMN_EVENT_HNF(CMN_ANY, intv_dirty, 0x1c), |
| 249 | + CMN_EVENT_HNF(CMN_ANY, stash_snp_sent, 0x1d), |
| 250 | + CMN_EVENT_HNF(CMN_ANY, stash_data_pull, 0x1e), |
| 251 | + CMN_EVENT_HNF(CMN_ANY, snp_fwded, 0x1f), |
| 252 | + |
| 253 | + CMN_EVENT_HNI(rrt_rd_occ_cnt_ovfl, 0x20), |
| 254 | + CMN_EVENT_HNI(rrt_wr_occ_cnt_ovfl, 0x21), |
| 255 | + CMN_EVENT_HNI(rdt_rd_occ_cnt_ovfl, 0x22), |
| 256 | + CMN_EVENT_HNI(rdt_wr_occ_cnt_ovfl, 0x23), |
| 257 | + CMN_EVENT_HNI(wdb_occ_cnt_ovfl, 0x24), |
| 258 | + CMN_EVENT_HNI(rrt_rd_alloc, 0x25), |
| 259 | + CMN_EVENT_HNI(rrt_wr_alloc, 0x26), |
| 260 | + CMN_EVENT_HNI(rdt_rd_alloc, 0x27), |
| 261 | + CMN_EVENT_HNI(rdt_wr_alloc, 0x28), |
| 262 | + CMN_EVENT_HNI(wdb_alloc, 0x29), |
| 263 | + CMN_EVENT_HNI(txrsp_retryack, 0x2a), |
| 264 | + CMN_EVENT_HNI(arvalid_no_arready, 0x2b), |
| 265 | + CMN_EVENT_HNI(arready_no_arvalid, 0x2c), |
| 266 | + CMN_EVENT_HNI(awvalid_no_awready, 0x2d), |
| 267 | + CMN_EVENT_HNI(awready_no_awvalid, 0x2e), |
| 268 | + CMN_EVENT_HNI(wvalid_no_wready, 0x2f), |
| 269 | + CMN_EVENT_HNI(txdat_stall, 0x30), |
| 270 | + CMN_EVENT_HNI(nonpcie_serialization, 0x31), |
| 271 | + CMN_EVENT_HNI(pcie_serialization, 0x32), |
| 272 | + |
| 273 | + CMN_EVENT_XP(txflit_valid, 0x01), |
| 274 | + CMN_EVENT_XP(txflit_stall, 0x02), |
| 275 | + CMN_EVENT_XP(partial_dat_flit, 0x03), |
| 276 | /* We treat watchpoints as a special made-up class of XP events */ |
| 277 | - CMN_EVENT_ATTR(watchpoint_up, CMN_TYPE_WP, 0, 0), |
| 278 | - CMN_EVENT_ATTR(watchpoint_down, CMN_TYPE_WP, 2, 0), |
| 279 | - |
| 280 | - CMN_EVENT_SBSX(rd_req, 0x01), |
| 281 | - CMN_EVENT_SBSX(wr_req, 0x02), |
| 282 | - CMN_EVENT_SBSX(cmo_req, 0x03), |
| 283 | - CMN_EVENT_SBSX(txrsp_retryack, 0x04), |
| 284 | - CMN_EVENT_SBSX(txdat_flitv, 0x05), |
| 285 | - CMN_EVENT_SBSX(txrsp_flitv, 0x06), |
| 286 | - CMN_EVENT_SBSX(rd_req_trkr_occ_cnt_ovfl, 0x11), |
| 287 | - CMN_EVENT_SBSX(wr_req_trkr_occ_cnt_ovfl, 0x12), |
| 288 | - CMN_EVENT_SBSX(cmo_req_trkr_occ_cnt_ovfl, 0x13), |
| 289 | - CMN_EVENT_SBSX(wdb_occ_cnt_ovfl, 0x14), |
| 290 | - CMN_EVENT_SBSX(rd_axi_trkr_occ_cnt_ovfl, 0x15), |
| 291 | - CMN_EVENT_SBSX(cmo_axi_trkr_occ_cnt_ovfl, 0x16), |
| 292 | - CMN_EVENT_SBSX(arvalid_no_arready, 0x21), |
| 293 | - CMN_EVENT_SBSX(awvalid_no_awready, 0x22), |
| 294 | - CMN_EVENT_SBSX(wvalid_no_wready, 0x23), |
| 295 | - CMN_EVENT_SBSX(txdat_stall, 0x24), |
| 296 | - CMN_EVENT_SBSX(txrsp_stall, 0x25), |
| 297 | - |
| 298 | - CMN_EVENT_RNID(s0_rdata_beats, 0x01), |
| 299 | - CMN_EVENT_RNID(s1_rdata_beats, 0x02), |
| 300 | - CMN_EVENT_RNID(s2_rdata_beats, 0x03), |
| 301 | - CMN_EVENT_RNID(rxdat_flits, 0x04), |
| 302 | - CMN_EVENT_RNID(txdat_flits, 0x05), |
| 303 | - CMN_EVENT_RNID(txreq_flits_total, 0x06), |
| 304 | - CMN_EVENT_RNID(txreq_flits_retried, 0x07), |
| 305 | - CMN_EVENT_RNID(rrt_occ_ovfl, 0x08), |
| 306 | - CMN_EVENT_RNID(wrt_occ_ovfl, 0x09), |
| 307 | - CMN_EVENT_RNID(txreq_flits_replayed, 0x0a), |
| 308 | - CMN_EVENT_RNID(wrcancel_sent, 0x0b), |
| 309 | - CMN_EVENT_RNID(s0_wdata_beats, 0x0c), |
| 310 | - CMN_EVENT_RNID(s1_wdata_beats, 0x0d), |
| 311 | - CMN_EVENT_RNID(s2_wdata_beats, 0x0e), |
| 312 | - CMN_EVENT_RNID(rrt_alloc, 0x0f), |
| 313 | - CMN_EVENT_RNID(wrt_alloc, 0x10), |
| 314 | - CMN_EVENT_RNID(rdb_unord, 0x11), |
| 315 | - CMN_EVENT_RNID(rdb_replay, 0x12), |
| 316 | - CMN_EVENT_RNID(rdb_hybrid, 0x13), |
| 317 | - CMN_EVENT_RNID(rdb_ord, 0x14), |
| 318 | + CMN_EVENT_ATTR(CMN_ANY, watchpoint_up, CMN_TYPE_WP, CMN_WP_UP, 0), |
| 319 | + CMN_EVENT_ATTR(CMN_ANY, watchpoint_down, CMN_TYPE_WP, CMN_WP_DOWN, 0), |
| 320 | + |
| 321 | + CMN_EVENT_SBSX(CMN_ANY, rd_req, 0x01), |
| 322 | + CMN_EVENT_SBSX(CMN_ANY, wr_req, 0x02), |
| 323 | + CMN_EVENT_SBSX(CMN_ANY, cmo_req, 0x03), |
| 324 | + CMN_EVENT_SBSX(CMN_ANY, txrsp_retryack, 0x04), |
| 325 | + CMN_EVENT_SBSX(CMN_ANY, txdat_flitv, 0x05), |
| 326 | + CMN_EVENT_SBSX(CMN_ANY, txrsp_flitv, 0x06), |
| 327 | + CMN_EVENT_SBSX(CMN_ANY, rd_req_trkr_occ_cnt_ovfl, 0x11), |
| 328 | + CMN_EVENT_SBSX(CMN_ANY, wr_req_trkr_occ_cnt_ovfl, 0x12), |
| 329 | + CMN_EVENT_SBSX(CMN_ANY, cmo_req_trkr_occ_cnt_ovfl, 0x13), |
| 330 | + CMN_EVENT_SBSX(CMN_ANY, wdb_occ_cnt_ovfl, 0x14), |
| 331 | + CMN_EVENT_SBSX(CMN_ANY, rd_axi_trkr_occ_cnt_ovfl, 0x15), |
| 332 | + CMN_EVENT_SBSX(CMN_ANY, cmo_axi_trkr_occ_cnt_ovfl, 0x16), |
| 333 | + CMN_EVENT_SBSX(CMN_ANY, arvalid_no_arready, 0x21), |
| 334 | + CMN_EVENT_SBSX(CMN_ANY, awvalid_no_awready, 0x22), |
| 335 | + CMN_EVENT_SBSX(CMN_ANY, wvalid_no_wready, 0x23), |
| 336 | + CMN_EVENT_SBSX(CMN_ANY, txdat_stall, 0x24), |
| 337 | + CMN_EVENT_SBSX(CMN_ANY, txrsp_stall, 0x25), |
| 338 | + |
| 339 | + CMN_EVENT_RNID(CMN_ANY, s0_rdata_beats, 0x01), |
| 340 | + CMN_EVENT_RNID(CMN_ANY, s1_rdata_beats, 0x02), |
| 341 | + CMN_EVENT_RNID(CMN_ANY, s2_rdata_beats, 0x03), |
| 342 | + CMN_EVENT_RNID(CMN_ANY, rxdat_flits, 0x04), |
| 343 | + CMN_EVENT_RNID(CMN_ANY, txdat_flits, 0x05), |
| 344 | + CMN_EVENT_RNID(CMN_ANY, txreq_flits_total, 0x06), |
| 345 | + CMN_EVENT_RNID(CMN_ANY, txreq_flits_retried, 0x07), |
| 346 | + CMN_EVENT_RNID(CMN_ANY, rrt_occ_ovfl, 0x08), |
| 347 | + CMN_EVENT_RNID(CMN_ANY, wrt_occ_ovfl, 0x09), |
| 348 | + CMN_EVENT_RNID(CMN_ANY, txreq_flits_replayed, 0x0a), |
| 349 | + CMN_EVENT_RNID(CMN_ANY, wrcancel_sent, 0x0b), |
| 350 | + CMN_EVENT_RNID(CMN_ANY, s0_wdata_beats, 0x0c), |
| 351 | + CMN_EVENT_RNID(CMN_ANY, s1_wdata_beats, 0x0d), |
| 352 | + CMN_EVENT_RNID(CMN_ANY, s2_wdata_beats, 0x0e), |
| 353 | + CMN_EVENT_RNID(CMN_ANY, rrt_alloc, 0x0f), |
| 354 | + CMN_EVENT_RNID(CMN_ANY, wrt_alloc, 0x10), |
| 355 | + CMN_EVENT_RNID(CMN600, rdb_unord, 0x11), |
| 356 | + CMN_EVENT_RNID(CMN600, rdb_replay, 0x12), |
| 357 | + CMN_EVENT_RNID(CMN600, rdb_hybrid, 0x13), |
| 358 | + CMN_EVENT_RNID(CMN600, rdb_ord, 0x14), |
| 359 | |
| 360 | NULL |
| 361 | }; |
| 362 | @@ -1386,15 +1400,14 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) |
| 363 | int i, j; |
| 364 | size_t sz; |
| 365 | |
| 366 | - cfg_region = cmn->base + rgn_offset; |
| 367 | - reg = readl_relaxed(cfg_region + CMN_CFGM_PERIPH_ID_2); |
| 368 | - cmn->rev = FIELD_GET(CMN_CFGM_PID2_REVISION, reg); |
| 369 | - dev_dbg(cmn->dev, "periph_id_2 revision: %d\n", cmn->rev); |
| 370 | - |
| 371 | arm_cmn_init_node_info(cmn, rgn_offset, &cfg); |
| 372 | if (cfg.type != CMN_TYPE_CFG) |
| 373 | return -ENODEV; |
| 374 | |
| 375 | + cfg_region = cmn->base + rgn_offset; |
| 376 | + reg = readl_relaxed(cfg_region + CMN_CFGM_PERIPH_ID_2); |
| 377 | + cmn->rev = FIELD_GET(CMN_CFGM_PID2_REVISION, reg); |
| 378 | + |
| 379 | reg = readq_relaxed(cfg_region + CMN_CHILD_INFO); |
| 380 | child_count = FIELD_GET(CMN_CI_CHILD_COUNT, reg); |
| 381 | child_poff = FIELD_GET(CMN_CI_CHILD_PTR_OFFSET, reg); |
| 382 | @@ -1507,13 +1520,14 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset) |
| 383 | cmn->mesh_x = cmn->num_xps; |
| 384 | cmn->mesh_y = cmn->num_xps / cmn->mesh_x; |
| 385 | |
| 386 | + dev_dbg(cmn->dev, "model %d, periph_id_2 revision %d\n", cmn->model, cmn->rev); |
| 387 | dev_dbg(cmn->dev, "mesh %dx%d, ID width %d\n", |
| 388 | cmn->mesh_x, cmn->mesh_y, arm_cmn_xyidbits(cmn)); |
| 389 | |
| 390 | return 0; |
| 391 | } |
| 392 | |
| 393 | -static int arm_cmn_acpi_probe(struct platform_device *pdev, struct arm_cmn *cmn) |
| 394 | +static int arm_cmn600_acpi_probe(struct platform_device *pdev, struct arm_cmn *cmn) |
| 395 | { |
| 396 | struct resource *cfg, *root; |
| 397 | |
| 398 | @@ -1540,21 +1554,11 @@ static int arm_cmn_acpi_probe(struct platform_device *pdev, struct arm_cmn *cmn) |
| 399 | return root->start - cfg->start; |
| 400 | } |
| 401 | |
| 402 | -static int arm_cmn_of_probe(struct platform_device *pdev, struct arm_cmn *cmn) |
| 403 | +static int arm_cmn600_of_probe(struct device_node *np) |
| 404 | { |
| 405 | - struct device_node *np = pdev->dev.of_node; |
| 406 | u32 rootnode; |
| 407 | - int ret; |
| 408 | |
| 409 | - cmn->base = devm_platform_ioremap_resource(pdev, 0); |
| 410 | - if (IS_ERR(cmn->base)) |
| 411 | - return PTR_ERR(cmn->base); |
| 412 | - |
| 413 | - ret = of_property_read_u32(np, "arm,root-node", &rootnode); |
| 414 | - if (ret) |
| 415 | - return ret; |
| 416 | - |
| 417 | - return rootnode; |
| 418 | + return of_property_read_u32(np, "arm,root-node", &rootnode) ?: rootnode; |
| 419 | } |
| 420 | |
| 421 | static int arm_cmn_probe(struct platform_device *pdev) |
| 422 | @@ -1569,12 +1573,19 @@ static int arm_cmn_probe(struct platform_device *pdev) |
| 423 | return -ENOMEM; |
| 424 | |
| 425 | cmn->dev = &pdev->dev; |
| 426 | + cmn->model = (unsigned long)device_get_match_data(cmn->dev); |
| 427 | platform_set_drvdata(pdev, cmn); |
| 428 | |
| 429 | - if (has_acpi_companion(cmn->dev)) |
| 430 | - rootnode = arm_cmn_acpi_probe(pdev, cmn); |
| 431 | - else |
| 432 | - rootnode = arm_cmn_of_probe(pdev, cmn); |
| 433 | + if (cmn->model == CMN600 && has_acpi_companion(cmn->dev)) { |
| 434 | + rootnode = arm_cmn600_acpi_probe(pdev, cmn); |
| 435 | + } else { |
| 436 | + rootnode = 0; |
| 437 | + cmn->base = devm_platform_ioremap_resource(pdev, 0); |
| 438 | + if (IS_ERR(cmn->base)) |
| 439 | + return PTR_ERR(cmn->base); |
| 440 | + if (cmn->model == CMN600) |
| 441 | + rootnode = arm_cmn600_of_probe(pdev->dev.of_node); |
| 442 | + } |
| 443 | if (rootnode < 0) |
| 444 | return rootnode; |
| 445 | |
| 446 | @@ -1637,7 +1648,7 @@ static int arm_cmn_remove(struct platform_device *pdev) |
| 447 | |
| 448 | #ifdef CONFIG_OF |
| 449 | static const struct of_device_id arm_cmn_of_match[] = { |
| 450 | - { .compatible = "arm,cmn-600", }, |
| 451 | + { .compatible = "arm,cmn-600", .data = (void *)CMN600 }, |
| 452 | {} |
| 453 | }; |
| 454 | MODULE_DEVICE_TABLE(of, arm_cmn_of_match); |
| 455 | @@ -1645,7 +1656,7 @@ MODULE_DEVICE_TABLE(of, arm_cmn_of_match); |
| 456 | |
| 457 | #ifdef CONFIG_ACPI |
| 458 | static const struct acpi_device_id arm_cmn_acpi_match[] = { |
| 459 | - { "ARMHC600", }, |
| 460 | + { "ARMHC600", CMN600 }, |
| 461 | {} |
| 462 | }; |
| 463 | MODULE_DEVICE_TABLE(acpi, arm_cmn_acpi_match); |
| 464 | -- |
| 465 | 2.25.1 |
| 466 | |