]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
coresight-tpdm: Add support to enable the lane for MCMB TPDM
authorTao Zhang <quic_taozha@quicinc.com>
Wed, 26 Feb 2025 06:40:08 +0000 (22:40 -0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Wed, 26 Feb 2025 11:25:10 +0000 (11:25 +0000)
Add the sysfs file to set/get the enablement of the lane. For MCMB
configurations, the field "E_LN" in CMB_CR register is the
individual lane enables. MCMB lane N is enabled for trace
generation when M_CMB_CR.E=1 and M_CMB_CR.E_LN[N]=1. For lanes
that are not implemented on a given MCMB configuration, the
corresponding bits of this field read as 0 and ignore writes.

Signed-off-by: Tao Zhang <quic_taozha@quicinc.com>
Signed-off-by: Mao Jinlong <quic_jinlmao@quicinc.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250226064008.2531037-4-quic_jinlmao@quicinc.com
Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm
drivers/hwtracing/coresight/coresight-tpdm.c
drivers/hwtracing/coresight/coresight-tpdm.h

index 547540e330c61e6793630c18e85238c79e4294f2..a47ea46c6f9b52e7b6bbb12b33a845fefeed5245 100644 (file)
@@ -265,3 +265,10 @@ Contact:   Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang (QUIC) <quic_t
 Description:
                (RW) Set/Get which lane participates in the output pattern
                match cross trigger mechanism for the MCMB subunit TPDM.
+
+What:          /sys/bus/coresight/devices/<tpdm-name>/mcmb_lanes_select
+Date:          Feb 2025
+KernelVersion  6.15
+Contact:       Jinlong Mao (QUIC) <quic_jinlmao@quicinc.com>, Tao Zhang (QUIC) <quic_taozha@quicinc.com>
+Description:
+               (RW) Set/Get the enablement of the individual lane.
index dc7d6e35fc51959abeaa960482cb52d98327c7d1..af806d2275d25fd3e3673474a804a6baf785d5c9 100644 (file)
@@ -1060,6 +1060,34 @@ static ssize_t mcmb_trig_lane_store(struct device *dev,
 }
 static DEVICE_ATTR_RW(mcmb_trig_lane);
 
+static ssize_t mcmb_lanes_select_show(struct device *dev,
+                                     struct device_attribute *attr,
+                                     char *buf)
+{
+       struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
+
+       return sysfs_emit(buf, "%u\n",
+                         (unsigned int)drvdata->cmb->mcmb.lane_select);
+}
+
+static ssize_t mcmb_lanes_select_store(struct device *dev,
+                                      struct device_attribute *attr,
+                                      const char *buf,
+                                      size_t size)
+{
+       struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
+       unsigned long val;
+
+       if (kstrtoul(buf, 0, &val) || (val & ~TPDM_MCMB_E_LN_MASK))
+               return -EINVAL;
+
+       guard(spinlock)(&drvdata->spinlock);
+       drvdata->cmb->mcmb.lane_select = val & TPDM_MCMB_E_LN_MASK;
+
+       return size;
+}
+static DEVICE_ATTR_RW(mcmb_lanes_select);
+
 static struct attribute *tpdm_dsb_edge_attrs[] = {
        &dev_attr_ctrl_idx.attr,
        &dev_attr_ctrl_val.attr,
@@ -1224,6 +1252,7 @@ static struct attribute *tpdm_cmb_msr_attrs[] = {
 
 static struct attribute *tpdm_mcmb_attrs[] = {
        &dev_attr_mcmb_trig_lane.attr,
+       &dev_attr_mcmb_lanes_select.attr,
        NULL,
 };
 
index 932c5dfc89b13bba4db8cbbc7fc7c251147aa897..b117543897344b689f666f6890cabb59c8ee4869 100644 (file)
@@ -48,6 +48,9 @@
 /* MAX lanes in the output pattern for MCMB configurations*/
 #define TPDM_MCMB_MAX_LANES 8
 
+/* Filter bit 0~7 from the value for CR_E_LN */
+#define TPDM_MCMB_E_LN_MASK            GENMASK(7, 0)
+
 /* DSB Subunit Registers */
 #define TPDM_DSB_CR            (0x780)
 #define TPDM_DSB_TIER          (0x784)