From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AC42E77187 for ; Wed, 18 Dec 2024 18:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kGw0SGEDVb1f12U4608T70W3MbtSV4YMCHvURs5zpK0=; b=2Nmi00fzBau5j223DG404Wfxpg rvYeVQjL4G91tIUkH4antAQovgV8gqZwZyGesTXKWsvmS9F+EhZKNDnITQfn11UiJem9xy9dN2sE1 N4HLrqK5ilzQlYzVjMI6MoiG/oiNDfX1I+7tq5D/L6yocOEstHYO/QllkMQBENVr8/wvyfRb+/oLq A6w4AJoZzboIuHlB+LcEVHnAV5m8CeitQgIQ88UeB2wKnLfbGxDzFbGgXOUh53Ks1vznZywuAiEop GT7EQCgbFPdFubjf/ILrlup44NNUnqFGXmSTEWLDdbT/LoNp/MEbecm3GN0iM8OJfjFwDa0EfvVJ0 XMNxLJIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNyd9-0000000HPl0-3b5U; Wed, 18 Dec 2024 18:18:43 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNybM-0000000HPPw-2626 for linux-arm-kernel@lists.infradead.org; Wed, 18 Dec 2024 18:16:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 450DF1063; Wed, 18 Dec 2024 10:17:17 -0800 (PST) Received: from [10.57.71.247] (unknown [10.57.71.247]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2E8903F7B4; Wed, 18 Dec 2024 10:16:47 -0800 (PST) Message-ID: <53354e84-73c0-403b-bbc0-af619196596d@arm.com> Date: Wed, 18 Dec 2024 18:16:45 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 2/2] coresight: Add label sysfs node support Content-Language: en-GB To: Mike Leach , Mao Jinlong , Mike Leach , James Clark , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mathieu Poirier , Bjorn Andersson , Konrad Dybcio Cc: "coresight@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" References: <20241217063324.33781-1-quic_jinlmao@quicinc.com> <20241217063324.33781-3-quic_jinlmao@quicinc.com> <985d234c-e088-469d-b9dc-7904fcf5a91c@arm.com> From: Suzuki K Poulose In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241218_101652_633520_5510457B X-CRM114-Status: GOOD ( 21.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Mike On 18/12/2024 09:56, Mike Leach wrote: > Hi > >> -----Original Message----- >> From: Suzuki K Poulose >> Sent: Wednesday, December 18, 2024 9:38 AM >> To: Mao Jinlong ; Mike Leach >> ; James Clark ; Rob Herring >> ; Krzysztof Kozlowski ; Conor Dooley >> ; Mathieu Poirier ; Bjorn >> Andersson ; Konrad Dybcio >> >> Cc: coresight@lists.linaro.org; linux-arm-kernel@lists.infradead.org; >> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm- >> msm@vger.kernel.org >> Subject: Re: [PATCH v6 2/2] coresight: Add label sysfs node support >> >> On 17/12/2024 06:33, Mao Jinlong wrote: >>> For some coresight components like CTI and TPDM, there could be >>> numerous of them. From the node name, we can only get the type and >>> register address of the component. We can't identify the HW or the >>> system the component belongs to. Add label sysfs node support for >>> showing the intuitive name of the device. >>> >>> Signed-off-by: Mao Jinlong >>> --- >>> .../testing/sysfs-bus-coresight-devices-cti | 6 ++++ >>> .../sysfs-bus-coresight-devices-funnel | 6 ++++ >>> .../testing/sysfs-bus-coresight-devices-tpdm | 6 ++++ >>> drivers/hwtracing/coresight/coresight-sysfs.c | 32 >> +++++++++++++++++++ >>> 4 files changed, 50 insertions(+) >> >> Do you think we need to name the devices using the label ? >> > > No - absolutely not. If we use label to name devices then we have to validate that the string is a correctly formed device name and that it has not been previously used. Anything that doesn't contain '/' can be a device name ? And it is very easy to find if the device name has been used in the coresight bus, after all these devices only appear there. It is as good as : bus_find_device_by_name(coresight_bus_type, NULL, name) == NULL Of course with coresight_mutex() held. Suzuki > > Using the canonical driver selected names works best as we are guaranteed a unique name and the information label can be used to provide flexible context information that best matches the users requirements. > > Mike > >> Or is this enough ? > >> Suzuki >> >> >>> >>> diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti >>> b/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti >>> index bf2869c413e7..909670e0451a 100644 >>> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti >>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-cti >>> @@ -239,3 +239,9 @@ Date: March 2020 >>> KernelVersion 5.7 >>> Contact: Mike Leach or Mathieu Poirier >>> Description: (Write) Clear all channel / trigger programming. >>> + >>> +What: /sys/bus/coresight/devices//label >>> +Date: Dec 2024 >>> +KernelVersion 6.14 >>> +Contact: Mao Jinlong >>> +Description: (Read) Show hardware context information of device. >>> diff --git >>> a/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel >>> b/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel >>> index d75acda5e1b3..944aad879aeb 100644 >>> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel >>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-funnel >>> @@ -10,3 +10,9 @@ Date: November 2014 >>> KernelVersion: 3.19 >>> Contact: Mathieu Poirier >>> Description: (RW) Defines input port priority order. >>> + >>> +What: /sys/bus/coresight/devices/.funnel/label >>> +Date: Dec 2024 >>> +KernelVersion 6.14 >>> +Contact: Mao Jinlong >>> +Description: (Read) Show hardware context information of device. >>> diff --git >>> a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>> b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>> index bf710ea6e0ef..309802246398 100644 >>> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm >>> @@ -257,3 +257,9 @@ Contact: Jinlong Mao (QUIC) >> , Tao Zhang (QUIC) >> Description: >>> (RW) Set/Get the MSR(mux select register) for the CMB >> subunit >>> TPDM. >>> + >>> +What: /sys/bus/coresight/devices//label >>> +Date: Dec 2024 >>> +KernelVersion 6.14 >>> +Contact: Mao Jinlong >>> +Description: (Read) Show hardware context information of device. >>> diff --git a/drivers/hwtracing/coresight/coresight-sysfs.c >>> b/drivers/hwtracing/coresight/coresight-sysfs.c >>> index a01c9e54e2ed..4af40cd7d75a 100644 >>> --- a/drivers/hwtracing/coresight/coresight-sysfs.c >>> +++ b/drivers/hwtracing/coresight/coresight-sysfs.c >>> @@ -7,6 +7,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> >>> #include "coresight-priv.h" >>> #include "coresight-trace-id.h" >>> @@ -366,18 +367,47 @@ static ssize_t enable_source_store(struct device >> *dev, >>> } >>> static DEVICE_ATTR_RW(enable_source); >>> >>> +static ssize_t label_show(struct device *dev, >>> + struct device_attribute *attr, char *buf) { >>> + >>> + const char *str; >>> + int ret = 0; >>> + >>> + ret = fwnode_property_read_string(dev_fwnode(dev), "label", &str); >>> + if (ret == 0) >>> + return scnprintf(buf, PAGE_SIZE, "%s\n", str); >>> + else >>> + return ret; >>> +} >>> +static DEVICE_ATTR_RO(label); >>> + >>> static struct attribute *coresight_sink_attrs[] = { >>> &dev_attr_enable_sink.attr, >>> + &dev_attr_label.attr, >>> NULL, >>> }; >>> ATTRIBUTE_GROUPS(coresight_sink); >>> >>> static struct attribute *coresight_source_attrs[] = { >>> &dev_attr_enable_source.attr, >>> + &dev_attr_label.attr, >>> NULL, >>> }; >>> ATTRIBUTE_GROUPS(coresight_source); >>> >>> +static struct attribute *coresight_link_attrs[] = { >>> + &dev_attr_label.attr, >>> + NULL, >>> +}; >>> +ATTRIBUTE_GROUPS(coresight_link); >>> + >>> +static struct attribute *coresight_helper_attrs[] = { >>> + &dev_attr_label.attr, >>> + NULL, >>> +}; >>> +ATTRIBUTE_GROUPS(coresight_helper); >>> + >>> const struct device_type coresight_dev_type[] = { >>> [CORESIGHT_DEV_TYPE_SINK] = { >>> .name = "sink", >>> @@ -385,6 +415,7 @@ const struct device_type coresight_dev_type[] = { >>> }, >>> [CORESIGHT_DEV_TYPE_LINK] = { >>> .name = "link", >>> + .groups = coresight_link_groups, >>> }, >>> [CORESIGHT_DEV_TYPE_LINKSINK] = { >>> .name = "linksink", >>> @@ -396,6 +427,7 @@ const struct device_type coresight_dev_type[] = { >>> }, >>> [CORESIGHT_DEV_TYPE_HELPER] = { >>> .name = "helper", >>> + .groups = coresight_helper_groups, >>> } >>> }; >>> /* Ensure the enum matches the names and groups */ >> >> _______________________________________________ >> CoreSight mailing list -- coresight@lists.linaro.org To unsubscribe send an >> email to coresight-leave@lists.linaro.org