Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1445647rdd; Wed, 10 Jan 2024 22:04:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzlI6+kXT5fuPT2TUPXrYYEBhnne3my1I4WJ+rVwtSCZR2VBWiDMy0vKbIjAex/7Ze3IVB X-Received: by 2002:a17:90b:1204:b0:28b:f242:bcaf with SMTP id gl4-20020a17090b120400b0028bf242bcafmr368331pjb.14.1704953090647; Wed, 10 Jan 2024 22:04:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704953090; cv=none; d=google.com; s=arc-20160816; b=Q3y/N81sx88MbO43QGhbImM/OE1vylvKw6zv7UzLfVOVRtY07d8yQSGUYDXVXyq0rI l1rl/Estm1s/WgPWH+HbHAIz9QXkG+7xZ6UilfG8mK+FsZYgSotET7DRXnyAXdkFC5ci xNl6RJcfHFxqquE6X14GfxOpAjWDc23NNsBJMOifO/lruCAycBMf/d0VCuQxapUKZomK Vb37M3fvtp0if81aHOVxkP+D3jocEn5R0HV0Vw4FM01Y4qa0VCUhFoFmVJDEV091IN+W SxV8T8xeyKgSq5+j13QZ3KdRAvTqrXGXgs0WpYtd6wDq7BOiBjAScK/oN502liWE14me 8yhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Dz8QqrNJHM/0z8HtKttYfElf7uRMpQSZFFFaAin6pSY=; fh=Yed6nmcKrD/DFIX5myg/2yHsdW77C5Koxj8EaGEE8rU=; b=ldt2hUiohBJxj1yzjES2wf/rGkZOfOYFPUgu8oL8EGj21Th4epWkbCbwUwPz/jG+Ur t1YZ6YD2eRO7V5VLGOcVTwvW1muoBYRNvsKeYO2u1dxKW2gpul7/wHFf6f3F/yQ/Gevc 9Y9OLQT2ogItFa2/HFptYsN0Ch+SfLehpjfPTeZZkZ1rbkcNGbW0Z0K0MxG4wUSLJxOD nxGeFCBPKTpZdgCkxlJnCS+QCEVvsvQwdFQgtnWhi3JzuW6juO5x7/tlXXGQgWlml15s IJ+vc58TDMc+TYwNJq0mJSbRSLZZlfeSIctZbmlwywNUQv0FiTfoAh2BhzUE85ZUHhZY waBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hDXZC+x9; spf=pass (google.com: domain of linux-kernel+bounces-23078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23078-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 6-20020a17090a098600b0028de34613bcsi350883pjo.16.2024.01.10.22.04.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 22:04:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=hDXZC+x9; spf=pass (google.com: domain of linux-kernel+bounces-23078-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23078-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 4D8C6282177 for ; Thu, 11 Jan 2024 06:04:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32247566B; Thu, 11 Jan 2024 06:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="hDXZC+x9" 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 565E75382; Thu, 11 Jan 2024 06:04:39 +0000 (UTC) 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 (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40B3p3sp013099; Thu, 11 Jan 2024 06:04:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=Dz8QqrNJHM/0z8HtKttYfElf7uRMpQSZFFFaAin6pSY=; b=hD XZC+x93m1cSrMN7D2lI6FVBil3QrP4iucsh3qY3jtacwA4EkrsK0sNv9bMudBDsL phkCqo+wqIxsqC0RsbOc/wLtsYLf5mES/99ht1tolwslH5tphxKzWYKX4dSKRo/2 mU9vApEXV4myvKf7eNswEHxd4QZc+BF/rtx8AjRSc7Izk/bie02b/MEQwoe9PqeK JyAGpVU07T6ezYs3/ngeQQvKyqXTAFZVbx4KoX2yZJBaUsQDli/qzzw1Y+fKnOpR ScPzM2xvwRrWk619ykkq176URf79AangJOLL3vX4mL5fcHc9ozgK184PWrawz2Qi 1az6O6l5PktT/E1m6OEA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vj0sk957t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2024 06:04:03 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 40B641OM011171 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 11 Jan 2024 06:04:01 GMT Received: from [10.239.133.49] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 10 Jan 2024 22:03:58 -0800 Message-ID: Date: Thu, 11 Jan 2024 14:03:56 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] coresight: Add coresight name support Content-Language: en-US To: Suzuki K Poulose , James Clark , Mike Leach CC: , , , , "Tingwei Zhang" , Yuanfang Zhang , Tao Zhang , Leo Yan , Alexander Shishkin , Greg Kroah-Hartman References: <20231228093321.5522-1-quic_jinlmao@quicinc.com> <12ce6e5d-6e4d-fb99-eb82-dece97423bfb@arm.com> From: Jinlong Mao In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: oglUc29Fj4N7GYQlzjO-9zhTHpBGaXNW X-Proofpoint-ORIG-GUID: oglUc29Fj4N7GYQlzjO-9zhTHpBGaXNW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 adultscore=0 suspectscore=0 impostorscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401110045 On 1/3/2024 7:33 PM, Suzuki K Poulose wrote: > On 28/12/2023 11:26, James Clark wrote: >> >> >> On 28/12/2023 09:33, Mao Jinlong wrote: >>> Add coresight name support for custom names which will be >>> easy to identify the device by the name. >>> >> >> I suppose this is more of a V2 because the subject is the same as the >> one sent earlier this year. But it looks like the discussion on the >> previous one wasn't resolved. >> >> With the main issues to solve being: >> >>   * It would be nice to use the existing root node name instead of adding >>     a new property. But at the same time DT nodes are supposed to have >>     generic names. >> >>   * This only works for DT and not ACPI >> >> To me it seems like adding the new property is just a "cheat" to get >> around not being allowed to have a specific name for the root node. But >> if we admit that we need a name I don't see the benefit of not putting >> the name where the node is already named. >> >> Using the root node name at this point would also undo the hard coded >> per-cpu naming of the CTI and ETM devices, so maybe it would be nice, >> but it's just too late. That means that a new field is necessary. > > The CTI and ETM can be handled as special cases, like they are > already done and fall back to the nodename for the rest ? > But, I thought the node names must be generic (e.g, cti) and doesn't > really solve the naming requirements for naming CTIs. (e.g, > _tpda, etr_cti). Is there something I missed ? > >> Although that field could be a boolean like "use-root-name-for-display" >> or something like that. In the end it probably doesn't really make a >> difference whether it's that or a name string. > >> And maybe the answer to the ACPI question is just that if anyone needs >> it, they can add it in the future. It doesn't seem like it would >> conflict with anything we do here. >> >>> Signed-off-by: Mao Jinlong >>> --- >>>   .../hwtracing/coresight/coresight-cti-core.c  | 20 ++++++++------ >>>   drivers/hwtracing/coresight/coresight-dummy.c | 10 ++++--- >>>   .../hwtracing/coresight/coresight-platform.c  | 27 +++++++++++++++++++ >>>   drivers/hwtracing/coresight/coresight-tpdm.c  | 10 ++++--- >>>   include/linux/coresight.h                     |  1 + >>>   5 files changed, 53 insertions(+), 15 deletions(-) >>> >>> diff --git a/drivers/hwtracing/coresight/coresight-cti-core.c >>> b/drivers/hwtracing/coresight/coresight-cti-core.c >>> index 3999d0a2cb60..60a1e76064a9 100644 >>> --- a/drivers/hwtracing/coresight/coresight-cti-core.c >>> +++ b/drivers/hwtracing/coresight/coresight-cti-core.c >>> @@ -902,14 +902,18 @@ static int cti_probe(struct amba_device *adev, >>> const struct amba_id *id) >>>       /* default to powered - could change on PM notifications */ >>>       drvdata->config.hw_powered = true; >>> -    /* set up device name - will depend if cpu bound or otherwise */ >>> -    if (drvdata->ctidev.cpu >= 0) >>> -        cti_desc.name = devm_kasprintf(dev, GFP_KERNEL, "cti_cpu%d", >>> -                           drvdata->ctidev.cpu); >>> -    else >>> -        cti_desc.name = coresight_alloc_device_name(&cti_sys_devs, >>> dev); >> >> Can we put the new name stuff inside coresight_alloc_device_name()? Then >> it happens by default for every device. > > +1 > >> >> I know Suzuki said previously to do it per-device, but the new DT >> property is just "coresight-name", so it's generic. Rather than being >> specific like "cti-name". So I don't see the benefit of duplicating the >> code at this point if we do decide to do it. > > My suggestion was to name the device based on the specific device rather > than following a generic rule for all device. e.g., A TPDM connected to > modem, could be named as such based on the platform information. It > could be any means, for e.g., tpdm nodes are always children nodes of > the devices they are connected to ? or could have a phandle to point to > the device they are monitoring etc. And the name could be created from > the "monitoring device name" + tpdm. Also, we do this for CPU bound CTI > and ETMs already, where we name them based on the CPU. TPDM can only connect to the funnel or TPDA. The system TPDM is monitoring may not have the device node in DT. > > But then the "nodename" is something we explored and it looks like > may not be an option. > >> >>> -    if (!cti_desc.name) >>> -        return -ENOMEM; >>> +    cti_desc.name = coresight_get_device_name(dev); >>> +    if (!cti_desc.name) { >>> +        /* set up device name - will depend if cpu bound or >>> otherwise */ >>> +        if (drvdata->ctidev.cpu >= 0) >>> +            cti_desc.name = devm_kasprintf(dev, GFP_KERNEL, >>> "cti_cpu%d", >>> +                               drvdata->ctidev.cpu); >>> +        else { >>> +            cti_desc.name = >>> coresight_alloc_device_name(&cti_sys_devs, dev); >>> +            if (!cti_desc.name) >>> +                return -ENOMEM; >>> +        } >>> +    } > > For these special cases, i.e., CPU bound, we should handle them with > priority. > > if (drvdata->ctidev.cpu >= 0) >     name = devm_kasprintf(... "cti_cpu%d", .. cpu); > else >         name = coresight_alloc_device_name(...); > >> >>>       /* setup CPU power management handling for CPU bound CTI >>> devices. */ >>>       ret = cti_pm_setup(drvdata); >>> diff --git a/drivers/hwtracing/coresight/coresight-dummy.c >>> b/drivers/hwtracing/coresight/coresight-dummy.c >>> index e4deafae7bc2..b19cd400df79 100644 >>> --- a/drivers/hwtracing/coresight/coresight-dummy.c >>> +++ b/drivers/hwtracing/coresight/coresight-dummy.c >>> @@ -76,10 +76,12 @@ static int dummy_probe(struct platform_device *pdev) >>>       struct coresight_desc desc = { 0 }; >>>       if (of_device_is_compatible(node, "arm,coresight-dummy-source")) { >>> - >>> -        desc.name = coresight_alloc_device_name(&source_devs, dev); >>> -        if (!desc.name) >>> -            return -ENOMEM; >>> +        desc.name = coresight_get_device_name(dev); >>> +        if (!desc.name) { >>> +            desc.name = coresight_alloc_device_name(&source_devs, dev); >>> +            if (!desc.name) >>> +                return -ENOMEM; >>> +        } >>>           desc.type = CORESIGHT_DEV_TYPE_SOURCE; >>>           desc.subtype.source_subtype = >>> diff --git a/drivers/hwtracing/coresight/coresight-platform.c >>> b/drivers/hwtracing/coresight/coresight-platform.c >>> index 9d550f5697fa..284aa22a06b7 100644 >>> --- a/drivers/hwtracing/coresight/coresight-platform.c >>> +++ b/drivers/hwtracing/coresight/coresight-platform.c >>> @@ -183,6 +183,18 @@ static int of_coresight_get_cpu(struct device *dev) >>>       return cpu; >>>   } >>> +static const char *of_coresight_get_device_name(struct device *dev) >>> +{ >>> +    const char *name = NULL; >>> + >>> +    if (!dev->of_node) >>> +        return NULL; >>> + >>> +    of_property_read_string(dev->of_node, "coresight-name", &name); >> >> Do you need to update the binding docs with this new property? >> >> Also a minor nit: Maybe "display-name" is better? "Coresight" is >> implied, and the node is already named, although that node name isn't >> used for display purposes, but this one is. > > On that front, the name is used as a "device" name and not simply > display. So, even "device-name" sounds more appropriate. > I will use the device-name. Thanks Jinlong Mao > Suzuki > >> >> Thanks >> James >