Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1337526lqj; Mon, 3 Jun 2024 19:49:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8TGRL0txu49WP54NNdao4AnfIgzCmi/UY0ARsNhc3EAsMVjmvSwDEZwnBjw/bXA0BECDhhiEuAo1pSFSlNRWR0UtMBzjY9n/gtGc4yg== X-Google-Smtp-Source: AGHT+IHrt+qjIHRqiCERRq0HUsiOzW/jmFR6/1Qw+qmhXMTEe/qQZFruX86m7qA0WyySd4rpZ2Oy X-Received: by 2002:a05:620a:4495:b0:794:a993:711e with SMTP id af79cd13be357-794f5c6e17fmr1342823885a.16.1717469360745; Mon, 03 Jun 2024 19:49:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717469360; cv=pass; d=google.com; s=arc-20160816; b=VnLtjNnTP5bsi/MbxN8bh323UmRjts2Nk7W84YRL6uBFQ7ERZOQvSFOJZSzHPq1DNM JsyDZqA1mfpqKCLDHq5FlPNN7a630BUl2bt0TFUYfQGwBzQCQrOkT6SsLsruAQW/wZ5H BKDctEE5K5/iBsyf83MmNH+5Djur20ImTwhHL53/abVAJSFA+jFmZbDoc09ua2oU5KVo WQRuf7n1PHB6RJcRiF4gBoBSCNZvPHX8IX6Q0VKmLYhvnxoF8iGuOQA+/Ie8YDjiNrvF JHsVnIS+Fs0louGM4X0HhCgwjAXxKl9XfJbDVv3S1X2FEHDjYwTCChp1d2rHsr4Q/TEY 0tmA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uiGnZ+sapW6DFdn8sdH7OpXw03SXPmlUCLupOwOVyNg=; fh=pKccGTHnPE9v43+pBGojBqDqY9WN7xPI5+RgmqHu7co=; b=oOJox5z/iTmnwoBemhmo1m583+QBS16cNxIzlgLDcmi9De4DvUVQPz2WHljirOPQo/ gBIE5+FZoGguW2GghuumHtGrvEXAvfElGJVRalTTeX0uLNNmzg85VlRu/lzAH0w5v11+ nEYIPZPJhqctGBKBKGhPnUd+UKEabq4wk1I2oCiyDSH/0e+/rlAxRBJKiViYm42eMTnV hsOFFCgnqSYMUadyOAwERIS/OrWoy+igbBWhLFG3X03LwHh1+iHOMX1ZLtiMidYQbEpg m1v+EXwtkJ6NsGAQNcrCaZnY7shke5/myIYLmQgJ6PgNUWlDF/OWtdOzh0j22mPAE7Vm gDFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fKGwdXku; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-199973-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199973-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-7951a159182si24830285a.47.2024.06.03.19.49.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 19:49:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199973-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fKGwdXku; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-199973-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199973-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 62B1E1C23285 for ; Tue, 4 Jun 2024 02:49:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EF7D13DDD3; Tue, 4 Jun 2024 02:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="fKGwdXku" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA56313D601; Tue, 4 Jun 2024 02:48:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717469322; cv=none; b=QlHW1G3I86HfzaS2s2emInOIEgnDmSMws59EnoimTk7QTHpQ5Njig+Aqlxnr8ps9MgaOO7lgTwav86rwHNx6H4Pi9whQ2svhuB33DwqRyLIx29gNG56A50sMRBpE3UJseZmfdOxTQla9FlozjZgtFMkZbH6EHheObSBhYoSlysE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717469322; c=relaxed/simple; bh=ET+k0ye1qSYsi+QgTkSUItYfvKjTmE0Vx1fXkRszBxs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ld/oGvdfcOe7vYL1GuwyTLNXSnzRMval0MVCmlMOBKwDM/2ZcTlMUwCUjycwMH0g759+pQLRV6JWb9C3yUbAX5d09SGwsiun2nL6PljG97qOnEX1lnd7I7HHjScB3CNJ5++sk2piuencYACzwgmhbSJHPxvgLVOR20KTTf/bbdw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=fKGwdXku; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 453LRC2o020306; Tue, 4 Jun 2024 02:48:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=qcppdkim1; bh=uiGnZ+sapW6DFdn8sdH7OpXw 03SXPmlUCLupOwOVyNg=; b=fKGwdXku0eiq3GQKCwJqm5QN0A99UlLw7Vw75lyU n5dukcOJJ+/8fY8hhvn631rkmmV2eegdqxVWyzNvQPFRenrSrndS8ylTxlpuN7k1 qmpCpOcW+ikjDi1sQDKmE+yhLOGRL5wQ15afeOZWpAJli+Nh9/HJ/lkDKZtP6WvQ 7Irw3WCSxtV8o552nk6WQheJrltQa/QYLLnRHL5YcB0CxelmZCYlbSuJlR1+JAkE PuaD5+DqsxJnCcPNDYLM4hudX61eO5KiCf2yxWbLwRtVScCxF94jUN92e6Ezn6Tr gKT5eBpbuGiGG/lkfY1mdXQ0BLwc/rJTGpscQeOKTEgJ7Q== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3yfw4ant47-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 04 Jun 2024 02:48:24 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 4542mN7A006201 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 4 Jun 2024 02:48:23 GMT Received: from taozha2-gv.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 3 Jun 2024 19:48:19 -0700 From: Tao Zhang To: Suzuki K Poulose , Alexander Shishkin , Mike Leach , James Clark CC: Tao Zhang , Jinlong Mao , , , , Tingwei Zhang , Yuanfang Zhang , Trilok Soni , Song Chai , , Jie Gan Subject: [PATCH 2/3] coresight-tpdm: Add support to select lane Date: Tue, 4 Jun 2024 10:47:40 +0800 Message-ID: <20240604024741.3550-3-quic_taozha@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240604024741.3550-1-quic_taozha@quicinc.com> References: <20240604024741.3550-1-quic_taozha@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: s0zhAL7usdBRX20t2lsm_GtAghZpGp53 X-Proofpoint-ORIG-GUID: s0zhAL7usdBRX20t2lsm_GtAghZpGp53 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-06-03_17,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 adultscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406040021 TPDM MCMB subunits supports up to 8 lanes CMB. For MCMB configurations, the field "XTRIG_LNSEL" in CMB_CR register selects which lane participates in the output pattern mach cross trigger mechanism goverened by the M_CMB_DXPR and M_CMB_XPMR regisers. Signed-off-by: Tao Zhang --- .../testing/sysfs-bus-coresight-devices-tpdm | 8 +++ drivers/hwtracing/coresight/coresight-tpdm.c | 51 +++++++++++++++++++ drivers/hwtracing/coresight/coresight-tpdm.h | 3 ++ 3 files changed, 62 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm index b4d0fc8d319d..3bae880cddb6 100644 --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm @@ -257,3 +257,11 @@ Contact: Jinlong Mao (QUIC) , Tao Zhang (QUIC) /mcmb_trig_lane +Date: June 2024 +KernelVersion 6.9 +Contact: Tao Zhang (QUIC) +Description: + (RW) Set/Get which lane participates in the output pattern + match cross trigger mechanism for the MCMB subunit TPDM. diff --git a/drivers/hwtracing/coresight/coresight-tpdm.c b/drivers/hwtracing/coresight/coresight-tpdm.c index 2989fa4787fe..fba4f8877e96 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.c +++ b/drivers/hwtracing/coresight/coresight-tpdm.c @@ -238,6 +238,18 @@ static umode_t tpdm_cmb_msr_is_visible(struct kobject *kobj, return 0; } +static umode_t tpdm_mcmb_is_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + struct device *dev = kobj_to_dev(kobj); + struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent); + + if (drvdata && tpdm_has_mcmb_dataset(drvdata)) + return attr->mode; + + return 0; +} + static void tpdm_reset_datasets(struct tpdm_drvdata *drvdata) { if (tpdm_has_dsb_dataset(drvdata)) { @@ -1013,6 +1025,34 @@ static ssize_t cmb_trig_ts_store(struct device *dev, } static DEVICE_ATTR_RW(cmb_trig_ts); +static ssize_t mcmb_trig_lane_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->mcmb_trig_lane); +} + +static ssize_t mcmb_trig_lane_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_MAX_LANES)) + return -EINVAL; + + guard(spinlock)(&drvdata->spinlock); + drvdata->cmb->mcmb->mcmb_trig_lane = val; + + return size; +} +static DEVICE_ATTR_RW(mcmb_trig_lane); + static struct attribute *tpdm_dsb_edge_attrs[] = { &dev_attr_ctrl_idx.attr, &dev_attr_ctrl_val.attr, @@ -1175,6 +1215,11 @@ static struct attribute *tpdm_cmb_msr_attrs[] = { NULL, }; +static struct attribute *tpdm_mcmb_attrs[] = { + &dev_attr_mcmb_trig_lane.attr, + NULL, +}; + static struct attribute *tpdm_dsb_attrs[] = { &dev_attr_dsb_mode.attr, &dev_attr_dsb_trig_ts.attr, @@ -1241,6 +1286,11 @@ static struct attribute_group tpdm_cmb_msr_grp = { .name = "cmb_msr", }; +static struct attribute_group tpdm_mcmb_attr_grp = { + .attrs = tpdm_mcmb_attrs, + .is_visible = tpdm_mcmb_is_visible, +}; + static const struct attribute_group *tpdm_attr_grps[] = { &tpdm_attr_grp, &tpdm_dsb_attr_grp, @@ -1252,6 +1302,7 @@ static const struct attribute_group *tpdm_attr_grps[] = { &tpdm_cmb_trig_patt_grp, &tpdm_cmb_patt_grp, &tpdm_cmb_msr_grp, + &tpdm_mcmb_attr_grp, NULL, }; diff --git a/drivers/hwtracing/coresight/coresight-tpdm.h b/drivers/hwtracing/coresight/coresight-tpdm.h index 0c4e216790e3..887d4464b076 100644 --- a/drivers/hwtracing/coresight/coresight-tpdm.h +++ b/drivers/hwtracing/coresight/coresight-tpdm.h @@ -45,6 +45,9 @@ /* MAX number of DSB MSR */ #define TPDM_CMB_MAX_MSR 32 +/* MAX lanes in the output pattern for MCMB configurations*/ +#define TPDM_MCMB_MAX_LANES 8 + /* DSB Subunit Registers */ #define TPDM_DSB_CR (0x780) #define TPDM_DSB_TIER (0x784) -- 2.17.1