History

Merge tag 'coresight-next-v5.19' of gitolite.kernel.org:pub/scm/linux/kernel/git/coresight/linux into char-misc-next

Mathieu writes: Coresight changes for v5.19 This pull request includes: - Work to uniformise access to the ETMv4 registers, making it easier to look for and change register accesses. - A correction to a probing failure when looking for links between devices. - The replacement of a call to mutex_lock() with a mutex_trylock() in the panic notifier of the cpu-debug infrastructure to avoid a possible deadlock. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> * tag 'coresight-next-v5.19' of gitolite.kernel.org:pub/scm/linux/kernel/git/coresight/linux: coresight: cpu-debug: Replace mutex with mutex_trylock on panic notifier coresight: core: Fix coresight device probe failure issue coresight: etm4x: Cleanup TRCRSCTLRn register accesses coresight: etm4x: Cleanup TRCBBCTLR register accesses coresight: etm4x: Cleanup TRCSSPCICRn register accesses coresight: etm4x: Cleanup TRCSSCCRn and TRCSSCSRn register accesses coresight: etm4x: Cleanup TRCACATRn register accesses coresight: etm3x: Cleanup ETMTECR1 register accesses coresight: etm4x: Cleanup TRCVICTLR register accesses coresight: etm4x: Cleanup TRCSTALLCTLR register accesses coresight: etm4x: Cleanup TRCEVENTCTL1R register accesses coresight: etm4x: Cleanup TRCCONFIGR register accesses coresight: etm4x: Cleanup TRCIDR5 register accesses coresight: etm4x: Cleanup TRCIDR4 register accesses coresight: etm4x: Cleanup TRCIDR3 register accesses coresight: etm4x: Cleanup TRCIDR2 register accesses coresight: etm4x: Cleanup TRCIDR0 register accesses

Greg Kroah-Hartman committed 4 years ago

Commit 9c518db2 parents e727efe 1adff547 files · +268 −212Browse files

Unified · Split

7 files
  1. drivers/hwtracing/coresight/coresight-core.c +22 −11
  2. drivers/hwtracing/coresight/coresight-cpu-debug.c +4 −3
  3. drivers/hwtracing/coresight/coresight-etm3x-core.c +1 −1
  4. drivers/hwtracing/coresight/coresight-etm3x-sysfs.c +1 −1
  5. drivers/hwtracing/coresight/coresight-etm4x-core.c +44 −92
  6. drivers/hwtracing/coresight/coresight-etm4x-sysfs.c +94 −86
  7. drivers/hwtracing/coresight/coresight-etm4x.h +102 −18
drivers/hwtracing/coresight/coresight-core.c+22−11
@@ -1379,7 +1379,7 @@ static int coresight_fixup_device_conns(struct coresight_device *csdev) · 1378 unmodified lines
1379 continue;1379 continue;
1380 conn->child_dev =1380 conn->child_dev =
1381 coresight_find_csdev_by_fwnode(conn->child_fwnode);1381 coresight_find_csdev_by_fwnode(conn->child_fwnode);
1382 if (conn->child_dev) {1382 if (conn->child_dev && conn->child_dev->has_conns_grp) {
1383 ret = coresight_make_links(csdev, conn,1383 ret = coresight_make_links(csdev, conn,
1384 conn->child_dev);1384 conn->child_dev);
1385 if (ret)1385 if (ret)
@@ -1571,6 +1571,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) · 185 unmodified lines
1571 int nr_refcnts = 1;1571 int nr_refcnts = 1;
1572 atomic_t *refcnts = NULL;1572 atomic_t *refcnts = NULL;
1573 struct coresight_device *csdev;1573 struct coresight_device *csdev;
1574 bool registered = false;
1574 1575
1575 csdev = kzalloc(sizeof(*csdev), GFP_KERNEL);1576 csdev = kzalloc(sizeof(*csdev), GFP_KERNEL);
1576 if (!csdev) {1577 if (!csdev) {
@@ -1591,7 +1592,8 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) · 14 unmodified lines
1591 refcnts = kcalloc(nr_refcnts, sizeof(*refcnts), GFP_KERNEL);1592 refcnts = kcalloc(nr_refcnts, sizeof(*refcnts), GFP_KERNEL);
1592 if (!refcnts) {1593 if (!refcnts) {
1593 ret = -ENOMEM;1594 ret = -ENOMEM;
1594 goto err_free_csdev;1595 kfree(csdev);
1596 goto err_out;
1595 }1597 }
1596 1598
1597 csdev->refcnt = refcnts;1599 csdev->refcnt = refcnts;
@@ -1616,6 +1618,13 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) · 18 unmodified lines
1616 csdev->dev.fwnode = fwnode_handle_get(dev_fwnode(desc->dev));1618 csdev->dev.fwnode = fwnode_handle_get(dev_fwnode(desc->dev));
1617 dev_set_name(&csdev->dev, "%s", desc->name);1619 dev_set_name(&csdev->dev, "%s", desc->name);
1618 1620
1621 /*
1622 * Make sure the device registration and the connection fixup
1623 * are synchronised, so that we don't see uninitialised devices
1624 * on the coresight bus while trying to resolve the connections.
1625 */
1626 mutex_lock(&coresight_mutex);
1627
1619 ret = device_register(&csdev->dev);1628 ret = device_register(&csdev->dev);
1620 if (ret) {1629 if (ret) {
1621 put_device(&csdev->dev);1630 put_device(&csdev->dev);
@@ -1623,7 +1632,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) · 1 unmodified line
1623 * All resources are free'd explicitly via1632 * All resources are free'd explicitly via
1624 * coresight_device_release(), triggered from put_device().1633 * coresight_device_release(), triggered from put_device().
1625 */1634 */
1626 goto err_out;1635 goto out_unlock;
1627 }1636 }
1628 1637
1629 if (csdev->type == CORESIGHT_DEV_TYPE_SINK ||1638 if (csdev->type == CORESIGHT_DEV_TYPE_SINK ||
@@ -1638,11 +1647,11 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) · 8 unmodified lines
1638 * from put_device(), which is in turn called from1647 * from put_device(), which is in turn called from
1639 * function device_unregister().1648 * function device_unregister().
1640 */1649 */
1641 goto err_out;1650 goto out_unlock;
1642 }1651 }
1643 }1652 }
1644 1653 /* Device is now registered */
1645 mutex_lock(&coresight_mutex);1654 registered = true;
1646 1655
1647 ret = coresight_create_conns_sysfs_group(csdev);1656 ret = coresight_create_conns_sysfs_group(csdev);
1648 if (!ret)1657 if (!ret)
@@ -1652,16 +1661,18 @@ struct coresight_device *coresight_register(struct coresight_desc *desc) · 3 unmodified lines
1652 if (!ret && cti_assoc_ops && cti_assoc_ops->add)1661 if (!ret && cti_assoc_ops && cti_assoc_ops->add)
1653 cti_assoc_ops->add(csdev);1662 cti_assoc_ops->add(csdev);
1654 1663
1664out_unlock:
1655 mutex_unlock(&coresight_mutex);1665 mutex_unlock(&coresight_mutex);
1656 if (ret) {1666 /* Success */
1667 if (!ret)
1668 return csdev;
1669
1670 /* Unregister the device if needed */
1671 if (registered) {
1657 coresight_unregister(csdev);1672 coresight_unregister(csdev);
1658 return ERR_PTR(ret);1673 return ERR_PTR(ret);
1659 }1674 }
1660 1675
1661 return csdev;
1662
1663err_free_csdev:
1664 kfree(csdev);
1665err_out:1676err_out:
1666 /* Cleanup the connection information */1677 /* Cleanup the connection information */
1667 coresight_release_platform_data(NULL, desc->pdata);1678 coresight_release_platform_data(NULL, desc->pdata);
drivers/hwtracing/coresight/coresight-cpu-debug.c+4−3
@@ -380,9 +380,10 @@ static int debug_notifier_call(struct notifier_block *self, · 379 unmodified lines
380 int cpu;380 int cpu;
381 struct debug_drvdata *drvdata;381 struct debug_drvdata *drvdata;
382 382
383 mutex_lock(&debug_lock);383 /* Bail out if we can't acquire the mutex or the functionality is off */
384 if (!mutex_trylock(&debug_lock))
385 return NOTIFY_DONE;
384 386
385 /* Bail out if the functionality is disabled */
386 if (!debug_enable)387 if (!debug_enable)
387 goto skip_dump;388 goto skip_dump;
388 389
@@ -401,7 +402,7 @@ static int debug_notifier_call(struct notifier_block *self, · 12 unmodified lines
401 402
402skip_dump:403skip_dump:
403 mutex_unlock(&debug_lock);404 mutex_unlock(&debug_lock);
404 return 0;405 return NOTIFY_DONE;
405}406}
406 407
407static struct notifier_block debug_notifier = {408static struct notifier_block debug_notifier = {
drivers/hwtracing/coresight/coresight-etm3x-core.c+1−1
@@ -204,7 +204,7 @@ void etm_set_default(struct etm_config *config) · 203 unmodified lines
204 * set all bits in register 0x007, the ETMTECR2, to 0204 * set all bits in register 0x007, the ETMTECR2, to 0
205 * set register 0x008, the ETMTEEVR, to 0x6F (TRUE).205 * set register 0x008, the ETMTEEVR, to 0x6F (TRUE).
206 */206 */
207 config->enable_ctrl1 = BIT(24);207 config->enable_ctrl1 = ETMTECR1_INC_EXC;
208 config->enable_ctrl2 = 0x0;208 config->enable_ctrl2 = 0x0;
209 config->enable_event = ETM_HARD_WIRE_RES_A;209 config->enable_event = ETM_HARD_WIRE_RES_A;
210 210
drivers/hwtracing/coresight/coresight-etm3x-sysfs.c+1−1
@@ -474,7 +474,7 @@ static ssize_t addr_start_store(struct device *dev, · 473 unmodified lines
474 config->addr_val[idx] = val;474 config->addr_val[idx] = val;
475 config->addr_type[idx] = ETM_ADDR_TYPE_START;475 config->addr_type[idx] = ETM_ADDR_TYPE_START;
476 config->startstop_ctrl |= (1 << idx);476 config->startstop_ctrl |= (1 << idx);
477 config->enable_ctrl1 |= BIT(25);477 config->enable_ctrl1 |= ETMTECR1_START_STOP;
478 spin_unlock(&drvdata->spinlock);478 spin_unlock(&drvdata->spinlock);
479 479
480 return size;480 return size;
drivers/hwtracing/coresight/coresight-etm4x-core.c+44−92
@@ -443,7 +443,7 @@ static int etm4_enable_hw(struct etmv4_drvdata *drvdata) · 442 unmodified lines
443 for (i = 0; i < drvdata->nr_ss_cmp; i++) {443 for (i = 0; i < drvdata->nr_ss_cmp; i++) {
444 /* always clear status bit on restart if using single-shot */444 /* always clear status bit on restart if using single-shot */
445 if (config->ss_ctrl[i] || config->ss_pe_cmp[i])445 if (config->ss_ctrl[i] || config->ss_pe_cmp[i])
446 config->ss_status[i] &= ~BIT(31);446 config->ss_status[i] &= ~TRCSSCSRn_STATUS;
447 etm4x_relaxed_write32(csa, config->ss_ctrl[i], TRCSSCCRn(i));447 etm4x_relaxed_write32(csa, config->ss_ctrl[i], TRCSSCCRn(i));
448 etm4x_relaxed_write32(csa, config->ss_status[i], TRCSSCSRn(i));448 etm4x_relaxed_write32(csa, config->ss_status[i], TRCSSCSRn(i));
449 if (etm4x_sspcicrn_present(drvdata, i))449 if (etm4x_sspcicrn_present(drvdata, i))
@@ -633,7 +633,7 @@ static int etm4_parse_event_config(struct coresight_device *csdev, · 183 unmodified lines
633 633
634 /* Go from generic option to ETMv4 specifics */634 /* Go from generic option to ETMv4 specifics */
635 if (attr->config & BIT(ETM_OPT_CYCACC)) {635 if (attr->config & BIT(ETM_OPT_CYCACC)) {
636 config->cfg |= BIT(4);636 config->cfg |= TRCCONFIGR_CCI;
637 /* TRM: Must program this for cycacc to work */637 /* TRM: Must program this for cycacc to work */
638 config->ccctlr = ETM_CYC_THRESHOLD_DEFAULT;638 config->ccctlr = ETM_CYC_THRESHOLD_DEFAULT;
639 }639 }
@@ -653,14 +653,14 @@ static int etm4_parse_event_config(struct coresight_device *csdev, · 13 unmodified lines
653 goto out;653 goto out;
654 654
655 /* bit[11], Global timestamp tracing bit */655 /* bit[11], Global timestamp tracing bit */
656 config->cfg |= BIT(11);656 config->cfg |= TRCCONFIGR_TS;
657 }657 }
658 658
659 /* Only trace contextID when runs in root PID namespace */659 /* Only trace contextID when runs in root PID namespace */
660 if ((attr->config & BIT(ETM_OPT_CTXTID)) &&660 if ((attr->config & BIT(ETM_OPT_CTXTID)) &&
661 task_is_in_init_pid_ns(current))661 task_is_in_init_pid_ns(current))
662 /* bit[6], Context ID tracing bit */662 /* bit[6], Context ID tracing bit */
663 config->cfg |= BIT(ETM4_CFG_BIT_CTXTID);663 config->cfg |= TRCCONFIGR_CID;
664 664
665 /*665 /*
666 * If set bit ETM_OPT_CTXTID2 in perf config, this asks to trace VMID666 * If set bit ETM_OPT_CTXTID2 in perf config, this asks to trace VMID
@@ -672,17 +672,15 @@ static int etm4_parse_event_config(struct coresight_device *csdev, · 5 unmodified lines
672 ret = -EINVAL;672 ret = -EINVAL;
673 goto out;673 goto out;
674 }674 }
675
676 /* Only trace virtual contextID when runs in root PID namespace */675 /* Only trace virtual contextID when runs in root PID namespace */
677 if (task_is_in_init_pid_ns(current))676 if (task_is_in_init_pid_ns(current))
678 config->cfg |= BIT(ETM4_CFG_BIT_VMID) |677 config->cfg |= TRCCONFIGR_VMID | TRCCONFIGR_VMIDOPT;
679 BIT(ETM4_CFG_BIT_VMID_OPT);
680 }678 }
681 679
682 /* return stack - enable if selected and supported */680 /* return stack - enable if selected and supported */
683 if ((attr->config & BIT(ETM_OPT_RETSTK)) && drvdata->retstack)681 if ((attr->config & BIT(ETM_OPT_RETSTK)) && drvdata->retstack)
684 /* bit[12], Return stack enable bit */682 /* bit[12], Return stack enable bit */
685 config->cfg |= BIT(12);683 config->cfg |= TRCCONFIGR_RS;
686 684
687 /*685 /*
688 * Set any selected configuration and preset.686 * Set any selected configuration and preset.
@@ -1097,107 +1095,67 @@ static void etm4_init_arch_data(void *info) · 408 unmodified lines
1097 etmidr0 = etm4x_relaxed_read32(csa, TRCIDR0);1095 etmidr0 = etm4x_relaxed_read32(csa, TRCIDR0);
1098 1096
1099 /* INSTP0, bits[2:1] P0 tracing support field */1097 /* INSTP0, bits[2:1] P0 tracing support field */
1100 if (BMVAL(etmidr0, 1, 2) == 0b11)1098 drvdata->instrp0 = !!(FIELD_GET(TRCIDR0_INSTP0_MASK, etmidr0) == 0b11);
1101 drvdata->instrp0 = true;
1102 else
1103 drvdata->instrp0 = false;
1104
1105 /* TRCBB, bit[5] Branch broadcast tracing support bit */1099 /* TRCBB, bit[5] Branch broadcast tracing support bit */
1106 if (BMVAL(etmidr0, 5, 5))1100 drvdata->trcbb = !!(etmidr0 & TRCIDR0_TRCBB);
1107 drvdata->trcbb = true;
1108 else
1109 drvdata->trcbb = false;
1110
1111 /* TRCCOND, bit[6] Conditional instruction tracing support bit */1101 /* TRCCOND, bit[6] Conditional instruction tracing support bit */
1112 if (BMVAL(etmidr0, 6, 6))1102 drvdata->trccond = !!(etmidr0 & TRCIDR0_TRCCOND);
1113 drvdata->trccond = true;
1114 else
1115 drvdata->trccond = false;
1116
1117 /* TRCCCI, bit[7] Cycle counting instruction bit */1103 /* TRCCCI, bit[7] Cycle counting instruction bit */
1118 if (BMVAL(etmidr0, 7, 7))1104 drvdata->trccci = !!(etmidr0 & TRCIDR0_TRCCCI);
1119 drvdata->trccci = true;
1120 else
1121 drvdata->trccci = false;
1122
1123 /* RETSTACK, bit[9] Return stack bit */1105 /* RETSTACK, bit[9] Return stack bit */
1124 if (BMVAL(etmidr0, 9, 9))1106 drvdata->retstack = !!(etmidr0 & TRCIDR0_RETSTACK);
1125 drvdata->retstack = true;
1126 else
1127 drvdata->retstack = false;
1128
1129 /* NUMEVENT, bits[11:10] Number of events field */1107 /* NUMEVENT, bits[11:10] Number of events field */
1130 drvdata->nr_event = BMVAL(etmidr0, 10, 11);1108 drvdata->nr_event = FIELD_GET(TRCIDR0_NUMEVENT_MASK, etmidr0);
1131 /* QSUPP, bits[16:15] Q element support field */1109 /* QSUPP, bits[16:15] Q element support field */
1132 drvdata->q_support = BMVAL(etmidr0, 15, 16);1110 drvdata->q_support = FIELD_GET(TRCIDR0_QSUPP_MASK, etmidr0);
1133 /* TSSIZE, bits[28:24] Global timestamp size field */1111 /* TSSIZE, bits[28:24] Global timestamp size field */
1134 drvdata->ts_size = BMVAL(etmidr0, 24, 28);1112 drvdata->ts_size = FIELD_GET(TRCIDR0_TSSIZE_MASK, etmidr0);
1135 1113
1136 /* maximum size of resources */1114 /* maximum size of resources */
1137 etmidr2 = etm4x_relaxed_read32(csa, TRCIDR2);1115 etmidr2 = etm4x_relaxed_read32(csa, TRCIDR2);
1138 /* CIDSIZE, bits[9:5] Indicates the Context ID size */1116 /* CIDSIZE, bits[9:5] Indicates the Context ID size */
1139 drvdata->ctxid_size = BMVAL(etmidr2, 5, 9);1117 drvdata->ctxid_size = FIELD_GET(TRCIDR2_CIDSIZE_MASK, etmidr2);
1140 /* VMIDSIZE, bits[14:10] Indicates the VMID size */1118 /* VMIDSIZE, bits[14:10] Indicates the VMID size */
1141 drvdata->vmid_size = BMVAL(etmidr2, 10, 14);1119 drvdata->vmid_size = FIELD_GET(TRCIDR2_VMIDSIZE_MASK, etmidr2);
1142 /* CCSIZE, bits[28:25] size of the cycle counter in bits minus 12 */1120 /* CCSIZE, bits[28:25] size of the cycle counter in bits minus 12 */
1143 drvdata->ccsize = BMVAL(etmidr2, 25, 28);1121 drvdata->ccsize = FIELD_GET(TRCIDR2_CCSIZE_MASK, etmidr2);
1144 1122
1145 etmidr3 = etm4x_relaxed_read32(csa, TRCIDR3);1123 etmidr3 = etm4x_relaxed_read32(csa, TRCIDR3);
1146 /* CCITMIN, bits[11:0] minimum threshold value that can be programmed */1124 /* CCITMIN, bits[11:0] minimum threshold value that can be programmed */
1147 drvdata->ccitmin = BMVAL(etmidr3, 0, 11);1125 drvdata->ccitmin = FIELD_GET(TRCIDR3_CCITMIN_MASK, etmidr3);
1148 /* EXLEVEL_S, bits[19:16] Secure state instruction tracing */1126 /* EXLEVEL_S, bits[19:16] Secure state instruction tracing */
1149 drvdata->s_ex_level = BMVAL(etmidr3, 16, 19);1127 drvdata->s_ex_level = FIELD_GET(TRCIDR3_EXLEVEL_S_MASK, etmidr3);
1150 drvdata->config.s_ex_level = drvdata->s_ex_level;1128 drvdata->config.s_ex_level = drvdata->s_ex_level;
1151 /* EXLEVEL_NS, bits[23:20] Non-secure state instruction tracing */1129 /* EXLEVEL_NS, bits[23:20] Non-secure state instruction tracing */
1152 drvdata->ns_ex_level = BMVAL(etmidr3, 20, 23);1130 drvdata->ns_ex_level = FIELD_GET(TRCIDR3_EXLEVEL_NS_MASK, etmidr3);
1153
1154 /*1131 /*
1155 * TRCERR, bit[24] whether a trace unit can trace a1132 * TRCERR, bit[24] whether a trace unit can trace a
1156 * system error exception.1133 * system error exception.
1157 */1134 */
1158 if (BMVAL(etmidr3, 24, 24))1135 drvdata->trc_error = !!(etmidr3 & TRCIDR3_TRCERR);
1159 drvdata->trc_error = true;
1160 else
1161 drvdata->trc_error = false;
1162
1163 /* SYNCPR, bit[25] implementation has a fixed synchronization period? */1136 /* SYNCPR, bit[25] implementation has a fixed synchronization period? */
1164 if (BMVAL(etmidr3, 25, 25))1137 drvdata->syncpr = !!(etmidr3 & TRCIDR3_SYNCPR);
1165 drvdata->syncpr = true;
1166 else
1167 drvdata->syncpr = false;
1168
1169 /* STALLCTL, bit[26] is stall control implemented? */1138 /* STALLCTL, bit[26] is stall control implemented? */
1170 if (BMVAL(etmidr3, 26, 26))1139 drvdata->stallctl = !!(etmidr3 & TRCIDR3_STALLCTL);
1171 drvdata->stallctl = true;
1172 else
1173 drvdata->stallctl = false;
1174
1175 /* SYSSTALL, bit[27] implementation can support stall control? */1140 /* SYSSTALL, bit[27] implementation can support stall control? */
1176 if (BMVAL(etmidr3, 27, 27))1141 drvdata->sysstall = !!(etmidr3 & TRCIDR3_SYSSTALL);
1177 drvdata->sysstall = true;
1178 else
1179 drvdata->sysstall = false;
1180
1181 /*1142 /*
1182 * NUMPROC - the number of PEs available for tracing, 5bits1143 * NUMPROC - the number of PEs available for tracing, 5bits
1183 * = TRCIDR3.bits[13:12]bits[30:28]1144 * = TRCIDR3.bits[13:12]bits[30:28]
1184 * bits[4:3] = TRCIDR3.bits[13:12] (since etm-v4.2, otherwise RES0)1145 * bits[4:3] = TRCIDR3.bits[13:12] (since etm-v4.2, otherwise RES0)
1185 * bits[3:0] = TRCIDR3.bits[30:28]1146 * bits[3:0] = TRCIDR3.bits[30:28]
1186 */1147 */
1187 drvdata->nr_pe = (BMVAL(etmidr3, 12, 13) << 3) | BMVAL(etmidr3, 28, 30);1148 drvdata->nr_pe = (FIELD_GET(TRCIDR3_NUMPROC_HI_MASK, etmidr3) << 3) |
1188 1149 FIELD_GET(TRCIDR3_NUMPROC_LO_MASK, etmidr3);
1189 /* NOOVERFLOW, bit[31] is trace overflow prevention supported */1150 /* NOOVERFLOW, bit[31] is trace overflow prevention supported */
1190 if (BMVAL(etmidr3, 31, 31))1151 drvdata->nooverflow = !!(etmidr3 & TRCIDR3_NOOVERFLOW);
1191 drvdata->nooverflow = true;
1192 else
1193 drvdata->nooverflow = false;
1194 1152
1195 /* number of resources trace unit supports */1153 /* number of resources trace unit supports */
1196 etmidr4 = etm4x_relaxed_read32(csa, TRCIDR4);1154 etmidr4 = etm4x_relaxed_read32(csa, TRCIDR4);
1197 /* NUMACPAIRS, bits[0:3] number of addr comparator pairs for tracing */1155 /* NUMACPAIRS, bits[0:3] number of addr comparator pairs for tracing */
1198 drvdata->nr_addr_cmp = BMVAL(etmidr4, 0, 3);1156 drvdata->nr_addr_cmp = FIELD_GET(TRCIDR4_NUMACPAIRS_MASK, etmidr4);
1199 /* NUMPC, bits[15:12] number of PE comparator inputs for tracing */1157 /* NUMPC, bits[15:12] number of PE comparator inputs for tracing */
1200 drvdata->nr_pe_cmp = BMVAL(etmidr4, 12, 15);1158 drvdata->nr_pe_cmp = FIELD_GET(TRCIDR4_NUMPC_MASK, etmidr4);
1201 /*1159 /*
1202 * NUMRSPAIR, bits[19:16]1160 * NUMRSPAIR, bits[19:16]
1203 * The number of resource pairs conveyed by the HW starts at 0, i.e a1161 * The number of resource pairs conveyed by the HW starts at 0, i.e a
@@ -1208,7 +1166,7 @@ static void etm4_init_arch_data(void *info) · 4 unmodified lines
1208 * the default TRUE and FALSE resource selectors are omitted.1166 * the default TRUE and FALSE resource selectors are omitted.
1209 * Otherwise for values 0x1 and above the number is N + 1 as per v4.2.1167 * Otherwise for values 0x1 and above the number is N + 1 as per v4.2.
1210 */1168 */
1211 drvdata->nr_resource = BMVAL(etmidr4, 16, 19);1169 drvdata->nr_resource = FIELD_GET(TRCIDR4_NUMRSPAIR_MASK, etmidr4);
1212 if ((drvdata->arch < ETM_ARCH_V4_3) || (drvdata->nr_resource > 0))1170 if ((drvdata->arch < ETM_ARCH_V4_3) || (drvdata->nr_resource > 0))
1213 drvdata->nr_resource += 1;1171 drvdata->nr_resource += 1;
1214 /*1172 /*
@@ -1216,45 +1174,39 @@ static void etm4_init_arch_data(void *info) · 1 unmodified line
1216 * comparator control for tracing. Read any status regs as these1174 * comparator control for tracing. Read any status regs as these
1217 * also contain RO capability data.1175 * also contain RO capability data.
1218 */1176 */
1219 drvdata->nr_ss_cmp = BMVAL(etmidr4, 20, 23);1177 drvdata->nr_ss_cmp = FIELD_GET(TRCIDR4_NUMSSCC_MASK, etmidr4);
1220 for (i = 0; i < drvdata->nr_ss_cmp; i++) {1178 for (i = 0; i < drvdata->nr_ss_cmp; i++) {
1221 drvdata->config.ss_status[i] =1179 drvdata->config.ss_status[i] =
1222 etm4x_relaxed_read32(csa, TRCSSCSRn(i));1180 etm4x_relaxed_read32(csa, TRCSSCSRn(i));
1223 }1181 }
1224 /* NUMCIDC, bits[27:24] number of Context ID comparators for tracing */1182 /* NUMCIDC, bits[27:24] number of Context ID comparators for tracing */
1225 drvdata->numcidc = BMVAL(etmidr4, 24, 27);1183 drvdata->numcidc = FIELD_GET(TRCIDR4_NUMCIDC_MASK, etmidr4);
1226 /* NUMVMIDC, bits[31:28] number of VMID comparators for tracing */1184 /* NUMVMIDC, bits[31:28] number of VMID comparators for tracing */
1227 drvdata->numvmidc = BMVAL(etmidr4, 28, 31);1185 drvdata->numvmidc = FIELD_GET(TRCIDR4_NUMVMIDC_MASK, etmidr4);
1228 1186
1229 etmidr5 = etm4x_relaxed_read32(csa, TRCIDR5);1187 etmidr5 = etm4x_relaxed_read32(csa, TRCIDR5);
1230 /* NUMEXTIN, bits[8:0] number of external inputs implemented */1188 /* NUMEXTIN, bits[8:0] number of external inputs implemented */
1231 drvdata->nr_ext_inp = BMVAL(etmidr5, 0, 8);1189 drvdata->nr_ext_inp = FIELD_GET(TRCIDR5_NUMEXTIN_MASK, etmidr5);
1232 /* TRACEIDSIZE, bits[21:16] indicates the trace ID width */1190 /* TRACEIDSIZE, bits[21:16] indicates the trace ID width */
1233 drvdata->trcid_size = BMVAL(etmidr5, 16, 21);1191 drvdata->trcid_size = FIELD_GET(TRCIDR5_TRACEIDSIZE_MASK, etmidr5);
1234 /* ATBTRIG, bit[22] implementation can support ATB triggers? */1192 /* ATBTRIG, bit[22] implementation can support ATB triggers? */
1235 if (BMVAL(etmidr5, 22, 22))1193 drvdata->atbtrig = !!(etmidr5 & TRCIDR5_ATBTRIG);
1236 drvdata->atbtrig = true;
1237 else
1238 drvdata->atbtrig = false;
1239 /*1194 /*
1240 * LPOVERRIDE, bit[23] implementation supports1195 * LPOVERRIDE, bit[23] implementation supports
1241 * low-power state override1196 * low-power state override
1242 */1197 */
1243 if (BMVAL(etmidr5, 23, 23) && (!drvdata->skip_power_up))1198 drvdata->lpoverride = (etmidr5 & TRCIDR5_LPOVERRIDE) && (!drvdata->skip_power_up);
1244 drvdata->lpoverride = true;
1245 else
1246 drvdata->lpoverride = false;
1247 /* NUMSEQSTATE, bits[27:25] number of sequencer states implemented */1199 /* NUMSEQSTATE, bits[27:25] number of sequencer states implemented */
1248 drvdata->nrseqstate = BMVAL(etmidr5, 25, 27);1200 drvdata->nrseqstate = FIELD_GET(TRCIDR5_NUMSEQSTATE_MASK, etmidr5);
1249 /* NUMCNTR, bits[30:28] number of counters available for tracing */1201 /* NUMCNTR, bits[30:28] number of counters available for tracing */
1250 drvdata->nr_cntr = BMVAL(etmidr5, 28, 30);1202 drvdata->nr_cntr = FIELD_GET(TRCIDR5_NUMCNTR_MASK, etmidr5);
1251 etm4_cs_lock(drvdata, csa);1203 etm4_cs_lock(drvdata, csa);
1252 cpu_detect_trace_filtering(drvdata);1204 cpu_detect_trace_filtering(drvdata);
1253}1205}
1254 1206
1255static inline u32 etm4_get_victlr_access_type(struct etmv4_config *config)1207static inline u32 etm4_get_victlr_access_type(struct etmv4_config *config)
1256{1208{
1257 return etm4_get_access_type(config) << TRCVICTLR_EXLEVEL_SHIFT;1209 return etm4_get_access_type(config) << __bf_shf(TRCVICTLR_EXLEVEL_MASK);
1258}1210}
1259 1211
1260/* Set ELx trace filter access in the TRCVICTLR register */1212/* Set ELx trace filter access in the TRCVICTLR register */
@@ -1280,7 +1232,7 @@ static void etm4_set_default_config(struct etmv4_config *config) · 19 unmodified lines
1280 config->ts_ctrl = 0x0;1232 config->ts_ctrl = 0x0;
1281 1233
1282 /* TRCVICTLR::EVENT = 0x01, select the always on logic */1234 /* TRCVICTLR::EVENT = 0x01, select the always on logic */
1283 config->vinst_ctrl = BIT(0);1235 config->vinst_ctrl = FIELD_PREP(TRCVICTLR_EVENT_MASK, 0x01);
1284 1236
1285 /* TRCVICTLR::EXLEVEL_NS:EXLEVELS: Set kernel / user filtering */1237 /* TRCVICTLR::EXLEVEL_NS:EXLEVELS: Set kernel / user filtering */
1286 etm4_set_victlr_access(config);1238 etm4_set_victlr_access(config);
@@ -1389,7 +1341,7 @@ static void etm4_set_default_filter(struct etmv4_config *config) · 102 unmodified lines
1389 * TRCVICTLR::SSSTATUS == 1, the start-stop logic is1341 * TRCVICTLR::SSSTATUS == 1, the start-stop logic is
1390 * in the started state1342 * in the started state
1391 */1343 */
1392 config->vinst_ctrl |= BIT(9);1344 config->vinst_ctrl |= TRCVICTLR_SSSTATUS;
1393 config->mode |= ETM_MODE_VIEWINST_STARTSTOP;1345 config->mode |= ETM_MODE_VIEWINST_STARTSTOP;
1394 1346
1395 /* No start-stop filtering for ViewInst */1347 /* No start-stop filtering for ViewInst */
@@ -1493,7 +1445,7 @@ static int etm4_set_event_filters(struct etmv4_drvdata *drvdata, · 97 unmodified lines
1493 * TRCVICTLR::SSSTATUS == 1, the start-stop logic is1445 * TRCVICTLR::SSSTATUS == 1, the start-stop logic is
1494 * in the started state1446 * in the started state
1495 */1447 */
1496 config->vinst_ctrl |= BIT(9);1448 config->vinst_ctrl |= TRCVICTLR_SSSTATUS;
1497 1449
1498 /* No start-stop filtering for ViewInst */1450 /* No start-stop filtering for ViewInst */
1499 config->vissctlr = 0x0;1451 config->vissctlr = 0x0;
@@ -1521,7 +1473,7 @@ static int etm4_set_event_filters(struct etmv4_drvdata *drvdata, · 21 unmodified lines
1521 * etm4_disable_perf().1473 * etm4_disable_perf().
1522 */1474 */
1523 if (filters->ssstatus)1475 if (filters->ssstatus)
1524 config->vinst_ctrl |= BIT(9);1476 config->vinst_ctrl |= TRCVICTLR_SSSTATUS;
1525 1477
1526 /* No include/exclude filtering for ViewInst */1478 /* No include/exclude filtering for ViewInst */
1527 config->viiectlr = 0x0;1479 config->viiectlr = 0x0;
drivers/hwtracing/coresight/coresight-etm4x-sysfs.c+94−86
@@ -22,7 +22,7 @@ static int etm4_set_mode_exclude(struct etmv4_drvdata *drvdata, bool exclude) · 21 unmodified lines
22 * TRCACATRn.TYPE bit[1:0]: type of comparison22 * TRCACATRn.TYPE bit[1:0]: type of comparison
23 * the trace unit performs23 * the trace unit performs
24 */24 */
25 if (BMVAL(config->addr_acc[idx], 0, 1) == ETM_INSTR_ADDR) {25 if (FIELD_GET(TRCACATRn_TYPE_MASK, config->addr_acc[idx]) == TRCACATRn_TYPE_ADDR) {
26 if (idx % 2 != 0)26 if (idx % 2 != 0)
27 return -EINVAL;27 return -EINVAL;
28 28
@@ -180,12 +180,12 @@ static ssize_t reset_store(struct device *dev, · 151 unmodified lines
180 180
181 /* Disable data tracing: do not trace load and store data transfers */181 /* Disable data tracing: do not trace load and store data transfers */
182 config->mode &= ~(ETM_MODE_LOAD | ETM_MODE_STORE);182 config->mode &= ~(ETM_MODE_LOAD | ETM_MODE_STORE);
183 config->cfg &= ~(BIT(1) | BIT(2));183 config->cfg &= ~(TRCCONFIGR_INSTP0_LOAD | TRCCONFIGR_INSTP0_STORE);
184 184
185 /* Disable data value and data address tracing */185 /* Disable data value and data address tracing */
186 config->mode &= ~(ETM_MODE_DATA_TRACE_ADDR |186 config->mode &= ~(ETM_MODE_DATA_TRACE_ADDR |
187 ETM_MODE_DATA_TRACE_VAL);187 ETM_MODE_DATA_TRACE_VAL);
188 config->cfg &= ~(BIT(16) | BIT(17));188 config->cfg &= ~(TRCCONFIGR_DA | TRCCONFIGR_DV);
189 189
190 /* Disable all events tracing */190 /* Disable all events tracing */
191 config->eventctrl0 = 0x0;191 config->eventctrl0 = 0x0;
@@ -206,11 +206,11 @@ static ssize_t reset_store(struct device *dev, · 14 unmodified lines
206 * started state. ARM recommends start-stop logic is set before206 * started state. ARM recommends start-stop logic is set before
207 * each trace run.207 * each trace run.
208 */208 */
209 config->vinst_ctrl = BIT(0);209 config->vinst_ctrl = FIELD_PREP(TRCVICTLR_EVENT_MASK, 0x01);
210 if (drvdata->nr_addr_cmp > 0) {210 if (drvdata->nr_addr_cmp > 0) {
211 config->mode |= ETM_MODE_VIEWINST_STARTSTOP;211 config->mode |= ETM_MODE_VIEWINST_STARTSTOP;
212 /* SSSTATUS, bit[9] */212 /* SSSTATUS, bit[9] */
213 config->vinst_ctrl |= BIT(9);213 config->vinst_ctrl |= TRCVICTLR_SSSTATUS;
214 }214 }
215 215
216 /* No address range filtering for ViewInst */216 /* No address range filtering for ViewInst */
@@ -304,134 +304,134 @@ static ssize_t mode_store(struct device *dev, · 87 unmodified lines
304 304
305 if (drvdata->instrp0 == true) {305 if (drvdata->instrp0 == true) {
306 /* start by clearing instruction P0 field */306 /* start by clearing instruction P0 field */
307 config->cfg &= ~(BIT(1) | BIT(2));307 config->cfg &= ~TRCCONFIGR_INSTP0_LOAD_STORE;
308 if (config->mode & ETM_MODE_LOAD)308 if (config->mode & ETM_MODE_LOAD)
309 /* 0b01 Trace load instructions as P0 instructions */309 /* 0b01 Trace load instructions as P0 instructions */
310 config->cfg |= BIT(1);310 config->cfg |= TRCCONFIGR_INSTP0_LOAD;
311 if (config->mode & ETM_MODE_STORE)311 if (config->mode & ETM_MODE_STORE)
312 /* 0b10 Trace store instructions as P0 instructions */312 /* 0b10 Trace store instructions as P0 instructions */
313 config->cfg |= BIT(2);313 config->cfg |= TRCCONFIGR_INSTP0_STORE;
314 if (config->mode & ETM_MODE_LOAD_STORE)314 if (config->mode & ETM_MODE_LOAD_STORE)
315 /*315 /*
316 * 0b11 Trace load and store instructions316 * 0b11 Trace load and store instructions
317 * as P0 instructions317 * as P0 instructions
318 */318 */
319 config->cfg |= BIT(1) | BIT(2);319 config->cfg |= TRCCONFIGR_INSTP0_LOAD_STORE;
320 }320 }
321 321
322 /* bit[3], Branch broadcast mode */322 /* bit[3], Branch broadcast mode */
323 if ((config->mode & ETM_MODE_BB) && (drvdata->trcbb == true))323 if ((config->mode & ETM_MODE_BB) && (drvdata->trcbb == true))
324 config->cfg |= BIT(3);324 config->cfg |= TRCCONFIGR_BB;
325 else325 else
326 config->cfg &= ~BIT(3);326 config->cfg &= ~TRCCONFIGR_BB;
327 327
328 /* bit[4], Cycle counting instruction trace bit */328 /* bit[4], Cycle counting instruction trace bit */
329 if ((config->mode & ETMv4_MODE_CYCACC) &&329 if ((config->mode & ETMv4_MODE_CYCACC) &&
330 (drvdata->trccci == true))330 (drvdata->trccci == true))
331 config->cfg |= BIT(4);331 config->cfg |= TRCCONFIGR_CCI;
332 else332 else
333 config->cfg &= ~BIT(4);333 config->cfg &= ~TRCCONFIGR_CCI;
334 334
335 /* bit[6], Context ID tracing bit */335 /* bit[6], Context ID tracing bit */
336 if ((config->mode & ETMv4_MODE_CTXID) && (drvdata->ctxid_size))336 if ((config->mode & ETMv4_MODE_CTXID) && (drvdata->ctxid_size))
337 config->cfg |= BIT(6);337 config->cfg |= TRCCONFIGR_CID;
338 else338 else
339 config->cfg &= ~BIT(6);339 config->cfg &= ~TRCCONFIGR_CID;
340 340
341 if ((config->mode & ETM_MODE_VMID) && (drvdata->vmid_size))341 if ((config->mode & ETM_MODE_VMID) && (drvdata->vmid_size))
342 config->cfg |= BIT(7);342 config->cfg |= TRCCONFIGR_VMID;
343 else343 else
344 config->cfg &= ~BIT(7);344 config->cfg &= ~TRCCONFIGR_VMID;
345 345
346 /* bits[10:8], Conditional instruction tracing bit */346 /* bits[10:8], Conditional instruction tracing bit */
347 mode = ETM_MODE_COND(config->mode);347 mode = ETM_MODE_COND(config->mode);
348 if (drvdata->trccond == true) {348 if (drvdata->trccond == true) {
349 config->cfg &= ~(BIT(8) | BIT(9) | BIT(10));349 config->cfg &= ~TRCCONFIGR_COND_MASK;
350 config->cfg |= mode << 8;350 config->cfg |= mode << __bf_shf(TRCCONFIGR_COND_MASK);
351 }351 }
352 352
353 /* bit[11], Global timestamp tracing bit */353 /* bit[11], Global timestamp tracing bit */
354 if ((config->mode & ETMv4_MODE_TIMESTAMP) && (drvdata->ts_size))354 if ((config->mode & ETMv4_MODE_TIMESTAMP) && (drvdata->ts_size))
355 config->cfg |= BIT(11);355 config->cfg |= TRCCONFIGR_TS;
356 else356 else
357 config->cfg &= ~BIT(11);357 config->cfg &= ~TRCCONFIGR_TS;
358 358
359 /* bit[12], Return stack enable bit */359 /* bit[12], Return stack enable bit */
360 if ((config->mode & ETM_MODE_RETURNSTACK) &&360 if ((config->mode & ETM_MODE_RETURNSTACK) &&
361 (drvdata->retstack == true))361 (drvdata->retstack == true))
362 config->cfg |= BIT(12);362 config->cfg |= TRCCONFIGR_RS;
363 else363 else
364 config->cfg &= ~BIT(12);364 config->cfg &= ~TRCCONFIGR_RS;
365 365
366 /* bits[14:13], Q element enable field */366 /* bits[14:13], Q element enable field */
367 mode = ETM_MODE_QELEM(config->mode);367 mode = ETM_MODE_QELEM(config->mode);
368 /* start by clearing QE bits */368 /* start by clearing QE bits */
369 config->cfg &= ~(BIT(13) | BIT(14));369 config->cfg &= ~(TRCCONFIGR_QE_W_COUNTS | TRCCONFIGR_QE_WO_COUNTS);
370 /*370 /*
371 * if supported, Q elements with instruction counts are enabled.371 * if supported, Q elements with instruction counts are enabled.
372 * Always set the low bit for any requested mode. Valid combos are372 * Always set the low bit for any requested mode. Valid combos are
373 * 0b00, 0b01 and 0b11.373 * 0b00, 0b01 and 0b11.
374 */374 */
375 if (mode && drvdata->q_support)375 if (mode && drvdata->q_support)
376 config->cfg |= BIT(13);376 config->cfg |= TRCCONFIGR_QE_W_COUNTS;
377 /*377 /*
378 * if supported, Q elements with and without instruction378 * if supported, Q elements with and without instruction
379 * counts are enabled379 * counts are enabled
380 */380 */
381 if ((mode & BIT(1)) && (drvdata->q_support & BIT(1)))381 if ((mode & BIT(1)) && (drvdata->q_support & BIT(1)))
382 config->cfg |= BIT(14);382 config->cfg |= TRCCONFIGR_QE_WO_COUNTS;
383 383
384 /* bit[11], AMBA Trace Bus (ATB) trigger enable bit */384 /* bit[11], AMBA Trace Bus (ATB) trigger enable bit */
385 if ((config->mode & ETM_MODE_ATB_TRIGGER) &&385 if ((config->mode & ETM_MODE_ATB_TRIGGER) &&
386 (drvdata->atbtrig == true))386 (drvdata->atbtrig == true))
387 config->eventctrl1 |= BIT(11);387 config->eventctrl1 |= TRCEVENTCTL1R_ATB;
388 else388 else
389 config->eventctrl1 &= ~BIT(11);389 config->eventctrl1 &= ~TRCEVENTCTL1R_ATB;
390 390
391 /* bit[12], Low-power state behavior override bit */391 /* bit[12], Low-power state behavior override bit */
392 if ((config->mode & ETM_MODE_LPOVERRIDE) &&392 if ((config->mode & ETM_MODE_LPOVERRIDE) &&
393 (drvdata->lpoverride == true))393 (drvdata->lpoverride == true))
394 config->eventctrl1 |= BIT(12);394 config->eventctrl1 |= TRCEVENTCTL1R_LPOVERRIDE;
395 else395 else
396 config->eventctrl1 &= ~BIT(12);396 config->eventctrl1 &= ~TRCEVENTCTL1R_LPOVERRIDE;
397 397
398 /* bit[8], Instruction stall bit */398 /* bit[8], Instruction stall bit */
399 if ((config->mode & ETM_MODE_ISTALL_EN) && (drvdata->stallctl == true))399 if ((config->mode & ETM_MODE_ISTALL_EN) && (drvdata->stallctl == true))
400 config->stall_ctrl |= BIT(8);400 config->stall_ctrl |= TRCSTALLCTLR_ISTALL;
401 else401 else
402 config->stall_ctrl &= ~BIT(8);402 config->stall_ctrl &= ~TRCSTALLCTLR_ISTALL;
403 403
404 /* bit[10], Prioritize instruction trace bit */404 /* bit[10], Prioritize instruction trace bit */
405 if (config->mode & ETM_MODE_INSTPRIO)405 if (config->mode & ETM_MODE_INSTPRIO)
406 config->stall_ctrl |= BIT(10);406 config->stall_ctrl |= TRCSTALLCTLR_INSTPRIORITY;
407 else407 else
408 config->stall_ctrl &= ~BIT(10);408 config->stall_ctrl &= ~TRCSTALLCTLR_INSTPRIORITY;
409 409
410 /* bit[13], Trace overflow prevention bit */410 /* bit[13], Trace overflow prevention bit */
411 if ((config->mode & ETM_MODE_NOOVERFLOW) &&411 if ((config->mode & ETM_MODE_NOOVERFLOW) &&
412 (drvdata->nooverflow == true))412 (drvdata->nooverflow == true))
413 config->stall_ctrl |= BIT(13);413 config->stall_ctrl |= TRCSTALLCTLR_NOOVERFLOW;
414 else414 else
415 config->stall_ctrl &= ~BIT(13);415 config->stall_ctrl &= ~TRCSTALLCTLR_NOOVERFLOW;
416 416
417 /* bit[9] Start/stop logic control bit */417 /* bit[9] Start/stop logic control bit */
418 if (config->mode & ETM_MODE_VIEWINST_STARTSTOP)418 if (config->mode & ETM_MODE_VIEWINST_STARTSTOP)
419 config->vinst_ctrl |= BIT(9);419 config->vinst_ctrl |= TRCVICTLR_SSSTATUS;
420 else420 else
421 config->vinst_ctrl &= ~BIT(9);421 config->vinst_ctrl &= ~TRCVICTLR_SSSTATUS;
422 422
423 /* bit[10], Whether a trace unit must trace a Reset exception */423 /* bit[10], Whether a trace unit must trace a Reset exception */
424 if (config->mode & ETM_MODE_TRACE_RESET)424 if (config->mode & ETM_MODE_TRACE_RESET)
425 config->vinst_ctrl |= BIT(10);425 config->vinst_ctrl |= TRCVICTLR_TRCRESET;
426 else426 else
427 config->vinst_ctrl &= ~BIT(10);427 config->vinst_ctrl &= ~TRCVICTLR_TRCRESET;
428 428
429 /* bit[11], Whether a trace unit must trace a system error exception */429 /* bit[11], Whether a trace unit must trace a system error exception */
430 if ((config->mode & ETM_MODE_TRACE_ERR) &&430 if ((config->mode & ETM_MODE_TRACE_ERR) &&
431 (drvdata->trc_error == true))431 (drvdata->trc_error == true))
432 config->vinst_ctrl |= BIT(11);432 config->vinst_ctrl |= TRCVICTLR_TRCERR;
433 else433 else
434 config->vinst_ctrl &= ~BIT(11);434 config->vinst_ctrl &= ~TRCVICTLR_TRCERR;
435 435
436 if (config->mode & (ETM_MODE_EXCL_KERN | ETM_MODE_EXCL_USER))436 if (config->mode & (ETM_MODE_EXCL_KERN | ETM_MODE_EXCL_USER))
437 etm4_config_trace_mode(config);437 etm4_config_trace_mode(config);
@@ -534,7 +534,7 @@ static ssize_t event_instren_show(struct device *dev, · 96 unmodified lines
534 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);534 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
535 struct etmv4_config *config = &drvdata->config;535 struct etmv4_config *config = &drvdata->config;
536 536
537 val = BMVAL(config->eventctrl1, 0, 3);537 val = FIELD_GET(TRCEVENTCTL1R_INSTEN_MASK, config->eventctrl1);
538 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);538 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
539}539}
540 540
@@ -551,23 +551,28 @@ static ssize_t event_instren_store(struct device *dev, · 10 unmodified lines
551 551
552 spin_lock(&drvdata->spinlock);552 spin_lock(&drvdata->spinlock);
553 /* start by clearing all instruction event enable bits */553 /* start by clearing all instruction event enable bits */
554 config->eventctrl1 &= ~(BIT(0) | BIT(1) | BIT(2) | BIT(3));554 config->eventctrl1 &= ~TRCEVENTCTL1R_INSTEN_MASK;
555 switch (drvdata->nr_event) {555 switch (drvdata->nr_event) {
556 case 0x0:556 case 0x0:
557 /* generate Event element for event 1 */557 /* generate Event element for event 1 */
558 config->eventctrl1 |= val & BIT(1);558 config->eventctrl1 |= val & TRCEVENTCTL1R_INSTEN_1;
559 break;559 break;
560 case 0x1:560 case 0x1:
561 /* generate Event element for event 1 and 2 */561 /* generate Event element for event 1 and 2 */
562 config->eventctrl1 |= val & (BIT(0) | BIT(1));562 config->eventctrl1 |= val & (TRCEVENTCTL1R_INSTEN_0 | TRCEVENTCTL1R_INSTEN_1);
563 break;563 break;
564 case 0x2:564 case 0x2:
565 /* generate Event element for event 1, 2 and 3 */565 /* generate Event element for event 1, 2 and 3 */
566 config->eventctrl1 |= val & (BIT(0) | BIT(1) | BIT(2));566 config->eventctrl1 |= val & (TRCEVENTCTL1R_INSTEN_0 |
567 TRCEVENTCTL1R_INSTEN_1 |
568 TRCEVENTCTL1R_INSTEN_2);
567 break;569 break;
568 case 0x3:570 case 0x3:
569 /* generate Event element for all 4 events */571 /* generate Event element for all 4 events */
570 config->eventctrl1 |= val & 0xF;572 config->eventctrl1 |= val & (TRCEVENTCTL1R_INSTEN_0 |
573 TRCEVENTCTL1R_INSTEN_1 |
574 TRCEVENTCTL1R_INSTEN_2 |
575 TRCEVENTCTL1R_INSTEN_3);
571 break;576 break;
572 default:577 default:
573 break;578 break;
@@ -702,10 +707,10 @@ static ssize_t bb_ctrl_store(struct device *dev, · 128 unmodified lines
702 * individual range comparators. If include then at least 1707 * individual range comparators. If include then at least 1
703 * range must be selected.708 * range must be selected.
704 */709 */
705 if ((val & BIT(8)) && (BMVAL(val, 0, 7) == 0))710 if ((val & TRCBBCTLR_MODE) && (FIELD_GET(TRCBBCTLR_RANGE_MASK, val) == 0))
706 return -EINVAL;711 return -EINVAL;
707 712
708 config->bb_ctrl = val & GENMASK(8, 0);713 config->bb_ctrl = val & (TRCBBCTLR_MODE | TRCBBCTLR_RANGE_MASK);
709 return size;714 return size;
710}715}
711static DEVICE_ATTR_RW(bb_ctrl);716static DEVICE_ATTR_RW(bb_ctrl);
@@ -718,7 +723,7 @@ static ssize_t event_vinst_show(struct device *dev, · 6 unmodified lines
718 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);723 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
719 struct etmv4_config *config = &drvdata->config;724 struct etmv4_config *config = &drvdata->config;
720 725
721 val = config->vinst_ctrl & ETMv4_EVENT_MASK;726 val = FIELD_GET(TRCVICTLR_EVENT_MASK, config->vinst_ctrl);
722 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);727 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
723}728}
724 729
@@ -734,9 +739,9 @@ static ssize_t event_vinst_store(struct device *dev, · 9 unmodified lines
734 return -EINVAL;739 return -EINVAL;
735 740
736 spin_lock(&drvdata->spinlock);741 spin_lock(&drvdata->spinlock);
737 val &= ETMv4_EVENT_MASK;742 val &= TRCVICTLR_EVENT_MASK >> __bf_shf(TRCVICTLR_EVENT_MASK);
738 config->vinst_ctrl &= ~ETMv4_EVENT_MASK;743 config->vinst_ctrl &= ~TRCVICTLR_EVENT_MASK;
739 config->vinst_ctrl |= val;744 config->vinst_ctrl |= FIELD_PREP(TRCVICTLR_EVENT_MASK, val);
740 spin_unlock(&drvdata->spinlock);745 spin_unlock(&drvdata->spinlock);
741 return size;746 return size;
742}747}
@@ -750,7 +755,7 @@ static ssize_t s_exlevel_vinst_show(struct device *dev, · 7 unmodified lines
750 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);755 struct etmv4_drvdata *drvdata = dev_get_drvdata(dev->parent);
751 struct etmv4_config *config = &drvdata->config;756 struct etmv4_config *config = &drvdata->config;
752 757
753 val = (config->vinst_ctrl & TRCVICTLR_EXLEVEL_S_MASK) >> TRCVICTLR_EXLEVEL_S_SHIFT;758 val = FIELD_GET(TRCVICTLR_EXLEVEL_S_MASK, config->vinst_ctrl);
754 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);759 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
755}760}
756 761
@@ -767,10 +772,10 @@ static ssize_t s_exlevel_vinst_store(struct device *dev, · 10 unmodified lines
767 772
768 spin_lock(&drvdata->spinlock);773 spin_lock(&drvdata->spinlock);
769 /* clear all EXLEVEL_S bits */774 /* clear all EXLEVEL_S bits */
770 config->vinst_ctrl &= ~(TRCVICTLR_EXLEVEL_S_MASK);775 config->vinst_ctrl &= ~TRCVICTLR_EXLEVEL_S_MASK;
771 /* enable instruction tracing for corresponding exception level */776 /* enable instruction tracing for corresponding exception level */
772 val &= drvdata->s_ex_level;777 val &= drvdata->s_ex_level;
773 config->vinst_ctrl |= (val << TRCVICTLR_EXLEVEL_S_SHIFT);778 config->vinst_ctrl |= val << __bf_shf(TRCVICTLR_EXLEVEL_S_MASK);
774 spin_unlock(&drvdata->spinlock);779 spin_unlock(&drvdata->spinlock);
775 return size;780 return size;
776}781}
@@ -785,7 +790,7 @@ static ssize_t ns_exlevel_vinst_show(struct device *dev, · 8 unmodified lines
785 struct etmv4_config *config = &drvdata->config;790 struct etmv4_config *config = &drvdata->config;
786 791
787 /* EXLEVEL_NS, bits[23:20] */792 /* EXLEVEL_NS, bits[23:20] */
788 val = (config->vinst_ctrl & TRCVICTLR_EXLEVEL_NS_MASK) >> TRCVICTLR_EXLEVEL_NS_SHIFT;793 val = FIELD_GET(TRCVICTLR_EXLEVEL_NS_MASK, config->vinst_ctrl);
789 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);794 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
790}795}
791 796
@@ -802,10 +807,10 @@ static ssize_t ns_exlevel_vinst_store(struct device *dev, · 10 unmodified lines
802 807
803 spin_lock(&drvdata->spinlock);808 spin_lock(&drvdata->spinlock);
804 /* clear EXLEVEL_NS bits */809 /* clear EXLEVEL_NS bits */
805 config->vinst_ctrl &= ~(TRCVICTLR_EXLEVEL_NS_MASK);810 config->vinst_ctrl &= ~TRCVICTLR_EXLEVEL_NS_MASK;
806 /* enable instruction tracing for corresponding exception level */811 /* enable instruction tracing for corresponding exception level */
807 val &= drvdata->ns_ex_level;812 val &= drvdata->ns_ex_level;
808 config->vinst_ctrl |= (val << TRCVICTLR_EXLEVEL_NS_SHIFT);813 config->vinst_ctrl |= val << __bf_shf(TRCVICTLR_EXLEVEL_NS_MASK);
809 spin_unlock(&drvdata->spinlock);814 spin_unlock(&drvdata->spinlock);
810 return size;815 return size;
811}816}
@@ -858,11 +863,11 @@ static ssize_t addr_instdatatype_show(struct device *dev, · 46 unmodified lines
858 863
859 spin_lock(&drvdata->spinlock);864 spin_lock(&drvdata->spinlock);
860 idx = config->addr_idx;865 idx = config->addr_idx;
861 val = BMVAL(config->addr_acc[idx], 0, 1);866 val = FIELD_GET(TRCACATRn_TYPE_MASK, config->addr_acc[idx]);
862 len = scnprintf(buf, PAGE_SIZE, "%s\n",867 len = scnprintf(buf, PAGE_SIZE, "%s\n",
863 val == ETM_INSTR_ADDR ? "instr" :868 val == TRCACATRn_TYPE_ADDR ? "instr" :
864 (val == ETM_DATA_LOAD_ADDR ? "data_load" :869 (val == TRCACATRn_TYPE_DATA_LOAD_ADDR ? "data_load" :
865 (val == ETM_DATA_STORE_ADDR ? "data_store" :870 (val == TRCACATRn_TYPE_DATA_STORE_ADDR ? "data_store" :
866 "data_load_store")));871 "data_load_store")));
867 spin_unlock(&drvdata->spinlock);872 spin_unlock(&drvdata->spinlock);
868 return len;873 return len;
@@ -886,7 +891,7 @@ static ssize_t addr_instdatatype_store(struct device *dev, · 17 unmodified lines
886 idx = config->addr_idx;891 idx = config->addr_idx;
887 if (!strcmp(str, "instr"))892 if (!strcmp(str, "instr"))
888 /* TYPE, bits[1:0] */893 /* TYPE, bits[1:0] */
889 config->addr_acc[idx] &= ~(BIT(0) | BIT(1));894 config->addr_acc[idx] &= ~TRCACATRn_TYPE_MASK;
890 895
891 spin_unlock(&drvdata->spinlock);896 spin_unlock(&drvdata->spinlock);
892 return size;897 return size;
@@ -1144,7 +1149,7 @@ static ssize_t addr_ctxtype_show(struct device *dev, · 251 unmodified lines
1144 spin_lock(&drvdata->spinlock);1149 spin_lock(&drvdata->spinlock);
1145 idx = config->addr_idx;1150 idx = config->addr_idx;
1146 /* CONTEXTTYPE, bits[3:2] */1151 /* CONTEXTTYPE, bits[3:2] */
1147 val = BMVAL(config->addr_acc[idx], 2, 3);1152 val = FIELD_GET(TRCACATRn_CONTEXTTYPE_MASK, config->addr_acc[idx]);
1148 len = scnprintf(buf, PAGE_SIZE, "%s\n", val == ETM_CTX_NONE ? "none" :1153 len = scnprintf(buf, PAGE_SIZE, "%s\n", val == ETM_CTX_NONE ? "none" :
1149 (val == ETM_CTX_CTXID ? "ctxid" :1154 (val == ETM_CTX_CTXID ? "ctxid" :
1150 (val == ETM_CTX_VMID ? "vmid" : "all")));1155 (val == ETM_CTX_VMID ? "vmid" : "all")));
@@ -1170,18 +1175,18 @@ static ssize_t addr_ctxtype_store(struct device *dev, · 19 unmodified lines
1170 idx = config->addr_idx;1175 idx = config->addr_idx;
1171 if (!strcmp(str, "none"))1176 if (!strcmp(str, "none"))
1172 /* start by clearing context type bits */1177 /* start by clearing context type bits */
1173 config->addr_acc[idx] &= ~(BIT(2) | BIT(3));1178 config->addr_acc[idx] &= ~TRCACATRn_CONTEXTTYPE_MASK;
1174 else if (!strcmp(str, "ctxid")) {1179 else if (!strcmp(str, "ctxid")) {
1175 /* 0b01 The trace unit performs a Context ID */1180 /* 0b01 The trace unit performs a Context ID */
1176 if (drvdata->numcidc) {1181 if (drvdata->numcidc) {
1177 config->addr_acc[idx] |= BIT(2);1182 config->addr_acc[idx] |= TRCACATRn_CONTEXTTYPE_CTXID;
1178 config->addr_acc[idx] &= ~BIT(3);1183 config->addr_acc[idx] &= ~TRCACATRn_CONTEXTTYPE_VMID;
1179 }1184 }
1180 } else if (!strcmp(str, "vmid")) {1185 } else if (!strcmp(str, "vmid")) {
1181 /* 0b10 The trace unit performs a VMID */1186 /* 0b10 The trace unit performs a VMID */
1182 if (drvdata->numvmidc) {1187 if (drvdata->numvmidc) {
1183 config->addr_acc[idx] &= ~BIT(2);1188 config->addr_acc[idx] &= ~TRCACATRn_CONTEXTTYPE_CTXID;
1184 config->addr_acc[idx] |= BIT(3);1189 config->addr_acc[idx] |= TRCACATRn_CONTEXTTYPE_VMID;
1185 }1190 }
1186 } else if (!strcmp(str, "all")) {1191 } else if (!strcmp(str, "all")) {
1187 /*1192 /*
@@ -1189,9 +1194,9 @@ static ssize_t addr_ctxtype_store(struct device *dev, · 1 unmodified line
1189 * comparison and a VMID1194 * comparison and a VMID
1190 */1195 */
1191 if (drvdata->numcidc)1196 if (drvdata->numcidc)
1192 config->addr_acc[idx] |= BIT(2);1197 config->addr_acc[idx] |= TRCACATRn_CONTEXTTYPE_CTXID;
1193 if (drvdata->numvmidc)1198 if (drvdata->numvmidc)
1194 config->addr_acc[idx] |= BIT(3);1199 config->addr_acc[idx] |= TRCACATRn_CONTEXTTYPE_VMID;
1195 }1200 }
1196 spin_unlock(&drvdata->spinlock);1201 spin_unlock(&drvdata->spinlock);
1197 return size;1202 return size;
@@ -1210,7 +1215,7 @@ static ssize_t addr_context_show(struct device *dev, · 12 unmodified lines
1210 spin_lock(&drvdata->spinlock);1215 spin_lock(&drvdata->spinlock);
1211 idx = config->addr_idx;1216 idx = config->addr_idx;
1212 /* context ID comparator bits[6:4] */1217 /* context ID comparator bits[6:4] */
1213 val = BMVAL(config->addr_acc[idx], 4, 6);1218 val = FIELD_GET(TRCACATRn_CONTEXT_MASK, config->addr_acc[idx]);
1214 spin_unlock(&drvdata->spinlock);1219 spin_unlock(&drvdata->spinlock);
1215 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);1220 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
1216}1221}
@@ -1235,8 +1240,8 @@ static ssize_t addr_context_store(struct device *dev, · 18 unmodified lines
1235 spin_lock(&drvdata->spinlock);1240 spin_lock(&drvdata->spinlock);
1236 idx = config->addr_idx;1241 idx = config->addr_idx;
1237 /* clear context ID comparator bits[6:4] */1242 /* clear context ID comparator bits[6:4] */
1238 config->addr_acc[idx] &= ~(BIT(4) | BIT(5) | BIT(6));1243 config->addr_acc[idx] &= ~TRCACATRn_CONTEXT_MASK;
1239 config->addr_acc[idx] |= (val << 4);1244 config->addr_acc[idx] |= val << __bf_shf(TRCACATRn_CONTEXT_MASK);
1240 spin_unlock(&drvdata->spinlock);1245 spin_unlock(&drvdata->spinlock);
1241 return size;1246 return size;
1242}1247}
@@ -1253,7 +1258,7 @@ static ssize_t addr_exlevel_s_ns_show(struct device *dev, · 10 unmodified lines
1253 1258
1254 spin_lock(&drvdata->spinlock);1259 spin_lock(&drvdata->spinlock);
1255 idx = config->addr_idx;1260 idx = config->addr_idx;
1256 val = BMVAL(config->addr_acc[idx], 8, 14);1261 val = FIELD_GET(TRCACATRn_EXLEVEL_MASK, config->addr_acc[idx]);
1257 spin_unlock(&drvdata->spinlock);1262 spin_unlock(&drvdata->spinlock);
1258 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);1263 return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
1259}1264}
@@ -1270,14 +1275,14 @@ static ssize_t addr_exlevel_s_ns_store(struct device *dev, · 10 unmodified lines
1270 if (kstrtoul(buf, 0, &val))1275 if (kstrtoul(buf, 0, &val))
1271 return -EINVAL;1276 return -EINVAL;
1272 1277
1273 if (val & ~((GENMASK(14, 8) >> 8)))1278 if (val & ~(TRCACATRn_EXLEVEL_MASK >> __bf_shf(TRCACATRn_EXLEVEL_MASK)))
1274 return -EINVAL;1279 return -EINVAL;
1275 1280
1276 spin_lock(&drvdata->spinlock);1281 spin_lock(&drvdata->spinlock);
1277 idx = config->addr_idx;1282 idx = config->addr_idx;
1278 /* clear Exlevel_ns & Exlevel_s bits[14:12, 11:8], bit[15] is res0 */1283 /* clear Exlevel_ns & Exlevel_s bits[14:12, 11:8], bit[15] is res0 */
1279 config->addr_acc[idx] &= ~(GENMASK(14, 8));1284 config->addr_acc[idx] &= ~TRCACATRn_EXLEVEL_MASK;
1280 config->addr_acc[idx] |= (val << 8);1285 config->addr_acc[idx] |= val << __bf_shf(TRCACATRn_EXLEVEL_MASK);
1281 spin_unlock(&drvdata->spinlock);1286 spin_unlock(&drvdata->spinlock);
1282 return size;1287 return size;
1283}1288}
@@ -1721,8 +1726,11 @@ static ssize_t res_ctrl_store(struct device *dev, · 437 unmodified lines
1721 /* For odd idx pair inversal bit is RES0 */1726 /* For odd idx pair inversal bit is RES0 */
1722 if (idx % 2 != 0)1727 if (idx % 2 != 0)
1723 /* PAIRINV, bit[21] */1728 /* PAIRINV, bit[21] */
1724 val &= ~BIT(21);1729 val &= ~TRCRSCTLRn_PAIRINV;
1725 config->res_ctrl[idx] = val & GENMASK(21, 0);1730 config->res_ctrl[idx] = val & (TRCRSCTLRn_PAIRINV |
1731 TRCRSCTLRn_INV |
1732 TRCRSCTLRn_GROUP_MASK |
1733 TRCRSCTLRn_SELECT_MASK);
1726 spin_unlock(&drvdata->spinlock);1734 spin_unlock(&drvdata->spinlock);
1727 return size;1735 return size;
1728}1736}
@@ -1787,9 +1795,9 @@ static ssize_t sshot_ctrl_store(struct device *dev, · 58 unmodified lines
1787 1795
1788 spin_lock(&drvdata->spinlock);1796 spin_lock(&drvdata->spinlock);
1789 idx = config->ss_idx;1797 idx = config->ss_idx;
1790 config->ss_ctrl[idx] = val & GENMASK(24, 0);1798 config->ss_ctrl[idx] = FIELD_PREP(TRCSSCCRn_SAC_ARC_RST_MASK, val);
1791 /* must clear bit 31 in related status register on programming */1799 /* must clear bit 31 in related status register on programming */
1792 config->ss_status[idx] &= ~BIT(31);1800 config->ss_status[idx] &= ~TRCSSCSRn_STATUS;
1793 spin_unlock(&drvdata->spinlock);1801 spin_unlock(&drvdata->spinlock);
1794 return size;1802 return size;
1795}1803}
@@ -1837,9 +1845,9 @@ static ssize_t sshot_pe_ctrl_store(struct device *dev, · 41 unmodified lines
1837 1845
1838 spin_lock(&drvdata->spinlock);1846 spin_lock(&drvdata->spinlock);
1839 idx = config->ss_idx;1847 idx = config->ss_idx;
1840 config->ss_pe_cmp[idx] = val & GENMASK(7, 0);1848 config->ss_pe_cmp[idx] = FIELD_PREP(TRCSSPCICRn_PC_MASK, val);
1841 /* must clear bit 31 in related status register on programming */1849 /* must clear bit 31 in related status register on programming */
1842 config->ss_status[idx] &= ~BIT(31);1850 config->ss_status[idx] &= ~TRCSSCSRn_STATUS;
1843 spin_unlock(&drvdata->spinlock);1851 spin_unlock(&drvdata->spinlock);
1844 return size;1852 return size;
1845}1853}
drivers/hwtracing/coresight/coresight-etm4x.h+102−18
@@ -130,6 +130,104 @@ · 129 unmodified lines
130 130
131#define TRCRSR_TA BIT(12)131#define TRCRSR_TA BIT(12)
132 132
133/*
134 * Bit positions of registers that are defined above, in the sysreg.h style
135 * of _MASK for multi bit fields and BIT() for single bits.
136 */
137#define TRCIDR0_INSTP0_MASK GENMASK(2, 1)
138#define TRCIDR0_TRCBB BIT(5)
139#define TRCIDR0_TRCCOND BIT(6)
140#define TRCIDR0_TRCCCI BIT(7)
141#define TRCIDR0_RETSTACK BIT(9)
142#define TRCIDR0_NUMEVENT_MASK GENMASK(11, 10)
143#define TRCIDR0_QSUPP_MASK GENMASK(16, 15)
144#define TRCIDR0_TSSIZE_MASK GENMASK(28, 24)
145
146#define TRCIDR2_CIDSIZE_MASK GENMASK(9, 5)
147#define TRCIDR2_VMIDSIZE_MASK GENMASK(14, 10)
148#define TRCIDR2_CCSIZE_MASK GENMASK(28, 25)
149
150#define TRCIDR3_CCITMIN_MASK GENMASK(11, 0)
151#define TRCIDR3_EXLEVEL_S_MASK GENMASK(19, 16)
152#define TRCIDR3_EXLEVEL_NS_MASK GENMASK(23, 20)
153#define TRCIDR3_TRCERR BIT(24)
154#define TRCIDR3_SYNCPR BIT(25)
155#define TRCIDR3_STALLCTL BIT(26)
156#define TRCIDR3_SYSSTALL BIT(27)
157#define TRCIDR3_NUMPROC_LO_MASK GENMASK(30, 28)
158#define TRCIDR3_NUMPROC_HI_MASK GENMASK(13, 12)
159#define TRCIDR3_NOOVERFLOW BIT(31)
160
161#define TRCIDR4_NUMACPAIRS_MASK GENMASK(3, 0)
162#define TRCIDR4_NUMPC_MASK GENMASK(15, 12)
163#define TRCIDR4_NUMRSPAIR_MASK GENMASK(19, 16)
164#define TRCIDR4_NUMSSCC_MASK GENMASK(23, 20)
165#define TRCIDR4_NUMCIDC_MASK GENMASK(27, 24)
166#define TRCIDR4_NUMVMIDC_MASK GENMASK(31, 28)
167
168#define TRCIDR5_NUMEXTIN_MASK GENMASK(8, 0)
169#define TRCIDR5_TRACEIDSIZE_MASK GENMASK(21, 16)
170#define TRCIDR5_ATBTRIG BIT(22)
171#define TRCIDR5_LPOVERRIDE BIT(23)
172#define TRCIDR5_NUMSEQSTATE_MASK GENMASK(27, 25)
173#define TRCIDR5_NUMCNTR_MASK GENMASK(30, 28)
174
175#define TRCCONFIGR_INSTP0_LOAD BIT(1)
176#define TRCCONFIGR_INSTP0_STORE BIT(2)
177#define TRCCONFIGR_INSTP0_LOAD_STORE (TRCCONFIGR_INSTP0_LOAD | TRCCONFIGR_INSTP0_STORE)
178#define TRCCONFIGR_BB BIT(3)
179#define TRCCONFIGR_CCI BIT(4)
180#define TRCCONFIGR_CID BIT(6)
181#define TRCCONFIGR_VMID BIT(7)
182#define TRCCONFIGR_COND_MASK GENMASK(10, 8)
183#define TRCCONFIGR_TS BIT(11)
184#define TRCCONFIGR_RS BIT(12)
185#define TRCCONFIGR_QE_W_COUNTS BIT(13)
186#define TRCCONFIGR_QE_WO_COUNTS BIT(14)
187#define TRCCONFIGR_VMIDOPT BIT(15)
188#define TRCCONFIGR_DA BIT(16)
189#define TRCCONFIGR_DV BIT(17)
190
191#define TRCEVENTCTL1R_INSTEN_MASK GENMASK(3, 0)
192#define TRCEVENTCTL1R_INSTEN_0 BIT(0)
193#define TRCEVENTCTL1R_INSTEN_1 BIT(1)
194#define TRCEVENTCTL1R_INSTEN_2 BIT(2)
195#define TRCEVENTCTL1R_INSTEN_3 BIT(3)
196#define TRCEVENTCTL1R_ATB BIT(11)
197#define TRCEVENTCTL1R_LPOVERRIDE BIT(12)
198
199#define TRCSTALLCTLR_ISTALL BIT(8)
200#define TRCSTALLCTLR_INSTPRIORITY BIT(10)
201#define TRCSTALLCTLR_NOOVERFLOW BIT(13)
202
203#define TRCVICTLR_EVENT_MASK GENMASK(7, 0)
204#define TRCVICTLR_SSSTATUS BIT(9)
205#define TRCVICTLR_TRCRESET BIT(10)
206#define TRCVICTLR_TRCERR BIT(11)
207#define TRCVICTLR_EXLEVEL_MASK GENMASK(22, 16)
208#define TRCVICTLR_EXLEVEL_S_MASK GENMASK(19, 16)
209#define TRCVICTLR_EXLEVEL_NS_MASK GENMASK(22, 20)
210
211#define TRCACATRn_TYPE_MASK GENMASK(1, 0)
212#define TRCACATRn_CONTEXTTYPE_MASK GENMASK(3, 2)
213#define TRCACATRn_CONTEXTTYPE_CTXID BIT(2)
214#define TRCACATRn_CONTEXTTYPE_VMID BIT(3)
215#define TRCACATRn_CONTEXT_MASK GENMASK(6, 4)
216#define TRCACATRn_EXLEVEL_MASK GENMASK(14, 8)
217
218#define TRCSSCSRn_STATUS BIT(31)
219#define TRCSSCCRn_SAC_ARC_RST_MASK GENMASK(24, 0)
220
221#define TRCSSPCICRn_PC_MASK GENMASK(7, 0)
222
223#define TRCBBCTLR_MODE BIT(8)
224#define TRCBBCTLR_RANGE_MASK GENMASK(7, 0)
225
226#define TRCRSCTLRn_PAIRINV BIT(21)
227#define TRCRSCTLRn_INV BIT(20)
228#define TRCRSCTLRn_GROUP_MASK GENMASK(19, 16)
229#define TRCRSCTLRn_SELECT_MASK GENMASK(15, 0)
230
133/*231/*
134 * System instructions to access ETM registers.232 * System instructions to access ETM registers.
135 * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions233 * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions
@@ -630,23 +728,9 @@ · 494 unmodified lines
630#define ETM_EXLEVEL_NS_OS BIT(5) /* NonSecure EL1 */728#define ETM_EXLEVEL_NS_OS BIT(5) /* NonSecure EL1 */
631#define ETM_EXLEVEL_NS_HYP BIT(6) /* NonSecure EL2 */729#define ETM_EXLEVEL_NS_HYP BIT(6) /* NonSecure EL2 */
632 730
633#define ETM_EXLEVEL_MASK (GENMASK(6, 0))
634#define ETM_EXLEVEL_S_MASK (GENMASK(3, 0))
635#define ETM_EXLEVEL_NS_MASK (GENMASK(6, 4))
636
637/* access level controls in TRCACATRn */731/* access level controls in TRCACATRn */
638#define TRCACATR_EXLEVEL_SHIFT 8732#define TRCACATR_EXLEVEL_SHIFT 8
639 733
640/* access level control in TRCVICTLR */
641#define TRCVICTLR_EXLEVEL_SHIFT 16
642#define TRCVICTLR_EXLEVEL_S_SHIFT 16
643#define TRCVICTLR_EXLEVEL_NS_SHIFT 20
644
645/* secure / non secure masks - TRCVICTLR, IDR3 */
646#define TRCVICTLR_EXLEVEL_MASK (ETM_EXLEVEL_MASK << TRCVICTLR_EXLEVEL_SHIFT)
647#define TRCVICTLR_EXLEVEL_S_MASK (ETM_EXLEVEL_S_MASK << TRCVICTLR_EXLEVEL_SHIFT)
648#define TRCVICTLR_EXLEVEL_NS_MASK (ETM_EXLEVEL_NS_MASK << TRCVICTLR_EXLEVEL_SHIFT)
649
650#define ETM_TRCIDR1_ARCH_MAJOR_SHIFT 8734#define ETM_TRCIDR1_ARCH_MAJOR_SHIFT 8
651#define ETM_TRCIDR1_ARCH_MAJOR_MASK (0xfU << ETM_TRCIDR1_ARCH_MAJOR_SHIFT)735#define ETM_TRCIDR1_ARCH_MAJOR_MASK (0xfU << ETM_TRCIDR1_ARCH_MAJOR_SHIFT)
652#define ETM_TRCIDR1_ARCH_MAJOR(x) \736#define ETM_TRCIDR1_ARCH_MAJOR(x) \
@@ -986,10 +1070,10 @@ struct etmv4_drvdata { · 333 unmodified lines
986 1070
987/* Address comparator access types */1071/* Address comparator access types */
988enum etm_addr_acctype {1072enum etm_addr_acctype {
989 ETM_INSTR_ADDR,1073 TRCACATRn_TYPE_ADDR,
990 ETM_DATA_LOAD_ADDR,1074 TRCACATRn_TYPE_DATA_LOAD_ADDR,
991 ETM_DATA_STORE_ADDR,1075 TRCACATRn_TYPE_DATA_STORE_ADDR,
992 ETM_DATA_LOAD_STORE_ADDR,1076 TRCACATRn_TYPE_DATA_LOAD_STORE_ADDR,
993};1077};
994 1078
995/* Address comparator context types */1079/* Address comparator context types */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t