Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5347695rwr; Mon, 24 Apr 2023 02:45:38 -0700 (PDT) X-Google-Smtp-Source: AKy350bvAg528betIYapemYZU4cKns2h7HsnCpHMxl3+Ryopb9iVyDpHiMphRfmRqp/1avaVtbsA X-Received: by 2002:a05:6a20:7d8c:b0:f3:3169:7ece with SMTP id v12-20020a056a207d8c00b000f331697ecemr7852501pzj.39.1682329538245; Mon, 24 Apr 2023 02:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682329538; cv=none; d=google.com; s=arc-20160816; b=EKweUnLqZgK4cx6qqvkjNe4NgofE5BaIE85Fa9Hxml0iEqMdNysQVkcIPW3CEB4sPi qQkUZyIG7JDQI5Eg2edRuafF1UXS0yYZPwxlcQmcTy1GZVc2wY7RiEjrRatBMo+FhgvR rR7xw8ZGAMH27FvOKWbaw+YLWRQjbi0RrLNirnZaO7sTLMz00/7WCziTrsleo6i2nEB3 lBR1jspAWmZT+SButXJmINdHTY9xtPgxGi3tj6QSKM7MeACxknb/2EGGFXyiYvAWvFQx XdOsskG3rDVHMWUycdTrlUIxkydHOLJeXBO3wu9MzzVCVIHx0JqafMrJQ/XtuBGDMJYY 8ZLw== 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=7qqTKYiZCjSv8wjrFqdx/aCQ2vU45KsAIV4Z1nKy5i4=; b=xnxiC9yVh6k2KTTMqNZFaRet/ERYGvsBpzAU2V2txZ8v5+3xFLZ7qvm0m39qOcyPTQ jQRcnffVgRbL/5B8/G9Xdmrspt4rf2H38ZecAk6kodVxsXqCyl1cOvps28k7f24/PV3X VJ+z6x4ehTfgaAjd7YcVHR3sM8tJhDF7JRg2aVvCA6ObTpjML//iO4y4GqFhruVTrGU8 DvrlcmYe7/bQUf8eXkDDMvr4Z2BNaWbx2Y8m7xJWDolVTjVQtVMLpOmerqkL+DSLAk7p GYhMSBgLyyA64AXsgDFeBSKpKRNjNLpU94XdREesAph3PwZYTkyhasRUNTAvTPtbCpfW iVEg== 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 a6-20020a631a46000000b005196bc25628si10564757pgm.579.2023.04.24.02.45.26; Mon, 24 Apr 2023 02:45:38 -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 S231394AbjDXJor (ORCPT + 99 others); Mon, 24 Apr 2023 05:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230228AbjDXJoi (ORCPT ); Mon, 24 Apr 2023 05:44:38 -0400 Received: from out30-100.freemail.mail.aliyun.com (out30-100.freemail.mail.aliyun.com [115.124.30.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39B5C30E3; Mon, 24 Apr 2023 02:44:36 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;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=18;SR=0;TI=SMTPD_---0VgsU8jv_1682329471; Received: from srmbuffer011165236051.sqa.net(mailfrom:renyu.zj@linux.alibaba.com fp:SMTPD_---0VgsU8jv_1682329471) by smtp.aliyun-inc.com; Mon, 24 Apr 2023 17:44:31 +0800 From: Jing Zhang To: John Garry , Ian Rogers , Will Deacon , Shuai Xue Cc: James Clark , Mike Leach , Leo Yan , Mark Rutland , Ilkka Koskinen , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, Zhuo Song , Jing Zhang Subject: [PATCH v2 3/5] driver/perf: Add identifier sysfs file for Yitian 710 DDR Date: Mon, 24 Apr 2023 17:44:14 +0800 Message-Id: <1682329456-19418-4-git-send-email-renyu.zj@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1682329456-19418-1-git-send-email-renyu.zj@linux.alibaba.com> References: <1682329456-19418-1-git-send-email-renyu.zj@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham 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..fe075fd 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_pmu"); +} + +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