Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2271231rwl; Sun, 26 Mar 2023 19:48:53 -0700 (PDT) X-Google-Smtp-Source: AKy350adGI1xHcDrXkau1LunRSd9L0U5SiUa49Cs51K4cMD8kpNdnzee8D87BNnEhFqgO88D3ZMR X-Received: by 2002:a17:906:254c:b0:930:27c2:6d8d with SMTP id j12-20020a170906254c00b0093027c26d8dmr10447735ejb.61.1679885333519; Sun, 26 Mar 2023 19:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679885333; cv=none; d=google.com; s=arc-20160816; b=ZSBHxsKG9ZFjGM6/YXnmFCY+3E2QrhTxSJB6WI2/AGTV6WFlU5RljBzuDvgGXY9HZa HAW8q1ycrKA8oXAtTrz54XwUq8zgAdpcmQQB542iAv6NHb1wYjrAQ/hAZnPzj6ZBLlV9 930VQ+xvLcaCHHKUgLyMPDOwHPa1crIRD0MB2UqvrpeGq2eJ9m07v17OooTG4MEdaOdf YNmSdvXTtRfxLWy4uFaRt/LkICpHXK3vX5GCepHM7cOSFQXQNH6NKbI3OqsuTvZSZNkO VfGadTNETfgh5vjq0etwBvF0Aa9tiCul8KzR6ogp6KvUGW68MlFEiSYuPz8MCzbluihn zIJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=CYUekiHgk31QK9H175TxXbxlD2U7JnBoT45ah5H77ME=; b=KBkyvCTW/nkFNykfZDCOaa2kT4OUMNvNdI6JKI42tpQPyC0e/iwaWAB2E7upZfQxqE cPaac9y45rZf8OMIdHOu0/81czlBmOzbVgqrC8gMETRgiJKvsQMpCcIlylaJoMi3Hw1+ uvpIvfMCK8lBUiV6aJ2bK7Ma7lvlAr8gxBfDTPE+GLnqng5KcsgpHrhl+GN5TqDdIR91 80WwDESeQ8UpVRJw+9KicoVJSMceNUGqTye0uv6OIl/EaIVns3MC12zpnTMXAy6327EO n/g5KkuVuIUuXu6N+nGcnX77AE8dyLlyXvD+5RSMoSdU4UWfH57ARKz9y9P99jue0DOu LlQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020a170906368500b008e0bd541c5asi25223377ejc.449.2023.03.26.19.48.29; Sun, 26 Mar 2023 19:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232071AbjC0Cqn (ORCPT + 99 others); Sun, 26 Mar 2023 22:46:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231960AbjC0Cqa (ORCPT ); Sun, 26 Mar 2023 22:46:30 -0400 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB5A44B5; Sun, 26 Mar 2023 19:46:29 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=renyu.zj@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0VeeqFQ2_1679885185; Received: from srmbuffer011165236051.sqa.net(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VeeqFQ2_1679885185) by smtp.aliyun-inc.com; Mon, 27 Mar 2023 10:46:26 +0800 From: Jing Zhang To: John Garry , Ian Rogers , Will Deacon , James Clark , Mike Leach , Leo Yan , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Shuai Xue , Zhuo Song , Jing Zhang Subject: [PATCH RFC 3/4] driver/perf: Add identifier sysfs file for Yitian 710 DDR Date: Mon, 27 Mar 2023 10:46:11 +0800 Message-Id: <1679885172-95021-4-git-send-email-renyu.zj@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1679885172-95021-1-git-send-email-renyu.zj@linux.alibaba.com> References: <1679885172-95021-1-git-send-email-renyu.zj@linux.alibaba.com> X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To allow userspace to identify the specific implementation of the device, add an "identifier" sysfs file. The perf tool can match the Yitian 710 DDR metric through the identifier. Signed-off-by: Jing Zhang --- drivers/perf/alibaba_uncore_drw_pmu.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_uncore_drw_pmu.c index a7689fe..6639a57 100644 --- a/drivers/perf/alibaba_uncore_drw_pmu.c +++ b/drivers/perf/alibaba_uncore_drw_pmu.c @@ -236,10 +236,37 @@ static ssize_t ali_drw_pmu_cpumask_show(struct device *dev, .attrs = ali_drw_pmu_cpumask_attrs, }; +static ssize_t ali_drw_pmu_identifier_show(struct device *dev, + struct device_attribute *attr, + char *page) +{ + return sysfs_emit(page, "%s\n", "ali_drw_yitian710"); +} + +static umode_t ali_drw_pmu_identifier_attr_visible(struct kobject *kobj, + struct attribute *attr, int n) +{ + return attr->mode; +} + +static struct device_attribute ali_drw_pmu_identifier_attr = + __ATTR(identifier, 0444, ali_drw_pmu_identifier_show, NULL); + +static struct attribute *ali_drw_pmu_identifier_attrs[] = { + &ali_drw_pmu_identifier_attr.attr, + NULL, +}; + +static const struct attribute_group ali_drw_pmu_identifier_attr_group = { + .attrs = ali_drw_pmu_identifier_attrs, + .is_visible = ali_drw_pmu_identifier_attr_visible, +}; + static const struct attribute_group *ali_drw_pmu_attr_groups[] = { &ali_drw_pmu_events_attr_group, &ali_drw_pmu_cpumask_attr_group, &ali_drw_pmu_format_group, + &ali_drw_pmu_identifier_attr_group, NULL, }; -- 1.8.3.1