From patchwork Tue May 18 07:23:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "liuqi (BA)" X-Patchwork-Id: 12264015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC98BC433ED for ; Tue, 18 May 2021 07:32:06 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37BE5610FA for ; Tue, 18 May 2021 07:32:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37BE5610FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=of4df85yoHUiPngT4IBOXqQYiEap/5Wajca2MnkFzng=; b=QAUD3WJq5f4SP2PRT+cy2jd/H v6QwlO5mYZKXwL6+Gt62MNi3UEd1/AGflEP5rJ+FteIUYu+JQ2jxRC6Iuq7NcCXFjqTnUnliCN2LW zLS2WQuMn+I4YbN0BINBvKOQVqITg4pdmDlQeoQFX1qyfOF/eBDNSPZhWc5TMUBOQD4Yo57X0Ou6n SGlmsZfXiu0WWWYqYvRR/JYKcmZ1LmNQVjMh4lx+2d5U0T9Uy/fdvxNeCmWj7tPh4h9i3rk4f0AHB bOVDa+PfvYqhwlG9F0g5Rr2Y2aOjsX0gySbFGtfCXZsqFvu1BU6BzAh4ozDB8oE5Cq3ToOyy8m2dd ACXllUFZQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liuBP-00HMPT-6Q; Tue, 18 May 2021 07:30:27 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liu5I-00HJmH-ES for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 07:24:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uVZkg6egKo5LPhZCE8UjM1cqCYo0f521KGO+OGmwjGQ=; b=3UyDtHjErdqyBuNJE+sV6qlUZW crZNx7wy8bMMOGg3+VlEKOhwTb4Y1QGtvcWHrroTg4RxepKOOEu5a9QSpp2ekX2FbSRa0mfwZJV6B TcRgk18rbl1cBxosR7EQ/b76RhSkd1YVs5Ni0jdfw4crKtOJQyFX+VwqeVZjvnfNhH0tyQmJgW73Y r3nIfbcTtvOxpT2jLYH7SA5XxV1fHfrBPBkZWOUhHn6MahWdRzdndbJe7kPJCzvJP+hBWdc6Epd73 hf1knW2duxbLl1OcNWB4td2RelG+tzfCYriud6ijrOpwWKNZ4NN2Xz8o/Hel/v/v2EE+0Ob/ru8gL xENIfe7w==; Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liu5C-00EPN9-8N for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 07:24:07 +0000 Received: from dggems704-chm.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FknVD2lhFzCtlC; Tue, 18 May 2021 15:21:08 +0800 (CST) Received: from dggema757-chm.china.huawei.com (10.1.198.199) by dggems704-chm.china.huawei.com (10.3.19.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Tue, 18 May 2021 15:23:53 +0800 Received: from localhost.localdomain (10.69.192.56) by dggema757-chm.china.huawei.com (10.1.198.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 18 May 2021 15:23:53 +0800 From: Qi Liu To: , , CC: , , , Subject: [PATCH 2/9] drivers/perf: hisi: Remove redundant macro and functions Date: Tue, 18 May 2021 15:23:41 +0800 Message-ID: <1621322628-9945-3-git-send-email-liuqi115@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1621322628-9945-1-git-send-email-liuqi115@huawei.com> References: <1621322628-9945-1-git-send-email-liuqi115@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema757-chm.china.huawei.com (10.1.198.199) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_002402_668479_6BD6FEA4 X-CRM114-Status: GOOD ( 11.03 ) 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 Remove HISI_PMU_EVENT_ATTR and hisi_event_sysfs_show(), as we have a general function for this. Signed-off-by: Qi Liu --- drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 22 +++++----- drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 62 +++++++++++++-------------- drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | 34 +++++++-------- drivers/perf/hisilicon/hisi_uncore_pa_pmu.c | 6 +-- drivers/perf/hisilicon/hisi_uncore_pmu.c | 14 ------ drivers/perf/hisilicon/hisi_uncore_pmu.h | 2 - drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 10 ++--- 7 files changed, 67 insertions(+), 83 deletions(-) diff --git a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c index 7c8a4bc..e3f4bb0 100644 --- a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c @@ -354,14 +354,14 @@ static const struct attribute_group hisi_ddrc_pmu_v2_format_group = { }; static struct attribute *hisi_ddrc_pmu_v1_events_attr[] = { - HISI_PMU_EVENT_ATTR(flux_wr, 0x00), - HISI_PMU_EVENT_ATTR(flux_rd, 0x01), - HISI_PMU_EVENT_ATTR(flux_wcmd, 0x02), - HISI_PMU_EVENT_ATTR(flux_rcmd, 0x03), - HISI_PMU_EVENT_ATTR(pre_cmd, 0x04), - HISI_PMU_EVENT_ATTR(act_cmd, 0x05), - HISI_PMU_EVENT_ATTR(rnk_chg, 0x06), - HISI_PMU_EVENT_ATTR(rw_chg, 0x07), + PMU_EVENT_ATTR_ID(flux_wr, 0x00), + PMU_EVENT_ATTR_ID(flux_rd, 0x01), + PMU_EVENT_ATTR_ID(flux_wcmd, 0x02), + PMU_EVENT_ATTR_ID(flux_rcmd, 0x03), + PMU_EVENT_ATTR_ID(pre_cmd, 0x04), + PMU_EVENT_ATTR_ID(act_cmd, 0x05), + PMU_EVENT_ATTR_ID(rnk_chg, 0x06), + PMU_EVENT_ATTR_ID(rw_chg, 0x07), NULL, }; @@ -371,9 +371,9 @@ static const struct attribute_group hisi_ddrc_pmu_v1_events_group = { }; static struct attribute *hisi_ddrc_pmu_v2_events_attr[] = { - HISI_PMU_EVENT_ATTR(cycles, 0x00), - HISI_PMU_EVENT_ATTR(flux_wr, 0x83), - HISI_PMU_EVENT_ATTR(flux_rd, 0x84), + PMU_EVENT_ATTR_ID(cycles, 0x00), + PMU_EVENT_ATTR_ID(flux_wr, 0x83), + PMU_EVENT_ATTR_ID(flux_rd, 0x84), NULL }; diff --git a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c index 0316fab..13701b7 100644 --- a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c @@ -359,32 +359,32 @@ static const struct attribute_group hisi_hha_pmu_v2_format_group = { }; static struct attribute *hisi_hha_pmu_v1_events_attr[] = { - HISI_PMU_EVENT_ATTR(rx_ops_num, 0x00), - HISI_PMU_EVENT_ATTR(rx_outer, 0x01), - HISI_PMU_EVENT_ATTR(rx_sccl, 0x02), - HISI_PMU_EVENT_ATTR(rx_ccix, 0x03), - HISI_PMU_EVENT_ATTR(rx_wbi, 0x04), - HISI_PMU_EVENT_ATTR(rx_wbip, 0x05), - HISI_PMU_EVENT_ATTR(rx_wtistash, 0x11), - HISI_PMU_EVENT_ATTR(rd_ddr_64b, 0x1c), - HISI_PMU_EVENT_ATTR(wr_ddr_64b, 0x1d), - HISI_PMU_EVENT_ATTR(rd_ddr_128b, 0x1e), - HISI_PMU_EVENT_ATTR(wr_ddr_128b, 0x1f), - HISI_PMU_EVENT_ATTR(spill_num, 0x20), - HISI_PMU_EVENT_ATTR(spill_success, 0x21), - HISI_PMU_EVENT_ATTR(bi_num, 0x23), - HISI_PMU_EVENT_ATTR(mediated_num, 0x32), - HISI_PMU_EVENT_ATTR(tx_snp_num, 0x33), - HISI_PMU_EVENT_ATTR(tx_snp_outer, 0x34), - HISI_PMU_EVENT_ATTR(tx_snp_ccix, 0x35), - HISI_PMU_EVENT_ATTR(rx_snprspdata, 0x38), - HISI_PMU_EVENT_ATTR(rx_snprsp_outer, 0x3c), - HISI_PMU_EVENT_ATTR(sdir-lookup, 0x40), - HISI_PMU_EVENT_ATTR(edir-lookup, 0x41), - HISI_PMU_EVENT_ATTR(sdir-hit, 0x42), - HISI_PMU_EVENT_ATTR(edir-hit, 0x43), - HISI_PMU_EVENT_ATTR(sdir-home-migrate, 0x4c), - HISI_PMU_EVENT_ATTR(edir-home-migrate, 0x4d), + PMU_EVENT_ATTR_ID(rx_ops_num, 0x00), + PMU_EVENT_ATTR_ID(rx_outer, 0x01), + PMU_EVENT_ATTR_ID(rx_sccl, 0x02), + PMU_EVENT_ATTR_ID(rx_ccix, 0x03), + PMU_EVENT_ATTR_ID(rx_wbi, 0x04), + PMU_EVENT_ATTR_ID(rx_wbip, 0x05), + PMU_EVENT_ATTR_ID(rx_wtistash, 0x11), + PMU_EVENT_ATTR_ID(rd_ddr_64b, 0x1c), + PMU_EVENT_ATTR_ID(wr_ddr_64b, 0x1d), + PMU_EVENT_ATTR_ID(rd_ddr_128b, 0x1e), + PMU_EVENT_ATTR_ID(wr_ddr_128b, 0x1f), + PMU_EVENT_ATTR_ID(spill_num, 0x20), + PMU_EVENT_ATTR_ID(spill_success, 0x21), + PMU_EVENT_ATTR_ID(bi_num, 0x23), + PMU_EVENT_ATTR_ID(mediated_num, 0x32), + PMU_EVENT_ATTR_ID(tx_snp_num, 0x33), + PMU_EVENT_ATTR_ID(tx_snp_outer, 0x34), + PMU_EVENT_ATTR_ID(tx_snp_ccix, 0x35), + PMU_EVENT_ATTR_ID(rx_snprspdata, 0x38), + PMU_EVENT_ATTR_ID(rx_snprsp_outer, 0x3c), + PMU_EVENT_ATTR_ID(sdir-lookup, 0x40), + PMU_EVENT_ATTR_ID(edir-lookup, 0x41), + PMU_EVENT_ATTR_ID(sdir-hit, 0x42), + PMU_EVENT_ATTR_ID(edir-hit, 0x43), + PMU_EVENT_ATTR_ID(sdir-home-migrate, 0x4c), + PMU_EVENT_ATTR_ID(edir-home-migrate, 0x4d), NULL, }; @@ -394,11 +394,11 @@ static const struct attribute_group hisi_hha_pmu_v1_events_group = { }; static struct attribute *hisi_hha_pmu_v2_events_attr[] = { - HISI_PMU_EVENT_ATTR(rx_ops_num, 0x00), - HISI_PMU_EVENT_ATTR(rx_outer, 0x01), - HISI_PMU_EVENT_ATTR(rx_sccl, 0x02), - HISI_PMU_EVENT_ATTR(hha_retry, 0x2e), - HISI_PMU_EVENT_ATTR(cycles, 0x55), + PMU_EVENT_ATTR_ID(rx_ops_num, 0x00), + PMU_EVENT_ATTR_ID(rx_outer, 0x01), + PMU_EVENT_ATTR_ID(rx_sccl, 0x02), + PMU_EVENT_ATTR_ID(hha_retry, 0x2e), + PMU_EVENT_ATTR_ID(cycles, 0x55), NULL }; diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c index bf9f777..e96d1ee 100644 --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c @@ -407,19 +407,19 @@ static const struct attribute_group hisi_l3c_pmu_v2_format_group = { }; static struct attribute *hisi_l3c_pmu_v1_events_attr[] = { - HISI_PMU_EVENT_ATTR(rd_cpipe, 0x00), - HISI_PMU_EVENT_ATTR(wr_cpipe, 0x01), - HISI_PMU_EVENT_ATTR(rd_hit_cpipe, 0x02), - HISI_PMU_EVENT_ATTR(wr_hit_cpipe, 0x03), - HISI_PMU_EVENT_ATTR(victim_num, 0x04), - HISI_PMU_EVENT_ATTR(rd_spipe, 0x20), - HISI_PMU_EVENT_ATTR(wr_spipe, 0x21), - HISI_PMU_EVENT_ATTR(rd_hit_spipe, 0x22), - HISI_PMU_EVENT_ATTR(wr_hit_spipe, 0x23), - HISI_PMU_EVENT_ATTR(back_invalid, 0x29), - HISI_PMU_EVENT_ATTR(retry_cpu, 0x40), - HISI_PMU_EVENT_ATTR(retry_ring, 0x41), - HISI_PMU_EVENT_ATTR(prefetch_drop, 0x42), + PMU_EVENT_ATTR_ID(rd_cpipe, 0x00), + PMU_EVENT_ATTR_ID(wr_cpipe, 0x01), + PMU_EVENT_ATTR_ID(rd_hit_cpipe, 0x02), + PMU_EVENT_ATTR_ID(wr_hit_cpipe, 0x03), + PMU_EVENT_ATTR_ID(victim_num, 0x04), + PMU_EVENT_ATTR_ID(rd_spipe, 0x20), + PMU_EVENT_ATTR_ID(wr_spipe, 0x21), + PMU_EVENT_ATTR_ID(rd_hit_spipe, 0x22), + PMU_EVENT_ATTR_ID(wr_hit_spipe, 0x23), + PMU_EVENT_ATTR_ID(back_invalid, 0x29), + PMU_EVENT_ATTR_ID(retry_cpu, 0x40), + PMU_EVENT_ATTR_ID(retry_ring, 0x41), + PMU_EVENT_ATTR_ID(prefetch_drop, 0x42), NULL, }; @@ -429,10 +429,10 @@ static const struct attribute_group hisi_l3c_pmu_v1_events_group = { }; static struct attribute *hisi_l3c_pmu_v2_events_attr[] = { - HISI_PMU_EVENT_ATTR(l3c_hit, 0x48), - HISI_PMU_EVENT_ATTR(cycles, 0x7f), - HISI_PMU_EVENT_ATTR(l3c_ref, 0xb8), - HISI_PMU_EVENT_ATTR(dat_access, 0xb9), + PMU_EVENT_ATTR_ID(l3c_hit, 0x48), + PMU_EVENT_ATTR_ID(cycles, 0x7f), + PMU_EVENT_ATTR_ID(l3c_ref, 0xb8), + PMU_EVENT_ATTR_ID(dat_access, 0xb9), NULL }; diff --git a/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c index 14f23eb..0eb68bc 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c @@ -303,9 +303,9 @@ static const struct attribute_group hisi_pa_pmu_v2_format_group = { }; static struct attribute *hisi_pa_pmu_v2_events_attr[] = { - HISI_PMU_EVENT_ATTR(rx_req, 0x40), - HISI_PMU_EVENT_ATTR(tx_req, 0x5c), - HISI_PMU_EVENT_ATTR(cycle, 0x78), + PMU_EVENT_ATTR_ID(rx_req, 0x40), + PMU_EVENT_ATTR_ID(tx_req, 0x5c), + PMU_EVENT_ATTR_ID(cycle, 0x78), NULL }; diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c index 13c68b5..c0be073 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c @@ -38,20 +38,6 @@ ssize_t hisi_format_sysfs_show(struct device *dev, EXPORT_SYMBOL_GPL(hisi_format_sysfs_show); /* - * PMU event attributes - */ -ssize_t hisi_event_sysfs_show(struct device *dev, - struct device_attribute *attr, char *page) -{ - struct dev_ext_attribute *eattr; - - eattr = container_of(attr, struct dev_ext_attribute, attr); - - return sysfs_emit(page, "config=0x%lx\n", (unsigned long)eattr->var); -} -EXPORT_SYMBOL_GPL(hisi_event_sysfs_show); - -/* * sysfs cpumask attributes. For uncore PMU, we only have a single CPU to show */ ssize_t hisi_cpumask_sysfs_show(struct device *dev, diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.h b/drivers/perf/hisilicon/hisi_uncore_pmu.h index ea9d89b..6eb023f 100644 --- a/drivers/perf/hisilicon/hisi_uncore_pmu.h +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.h @@ -34,8 +34,6 @@ #define HISI_PMU_FORMAT_ATTR(_name, _config) \ HISI_PMU_ATTR(_name, hisi_format_sysfs_show, (void *)_config) -#define HISI_PMU_EVENT_ATTR(_name, _config) \ - HISI_PMU_ATTR(_name, hisi_event_sysfs_show, (unsigned long)_config) #define HISI_PMU_EVENT_ATTR_EXTRACTOR(name, config, hi, lo) \ static inline u32 hisi_get_##name(struct perf_event *event) \ diff --git a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c index 46be312..31ee010 100644 --- a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c @@ -334,11 +334,11 @@ static const struct attribute_group hisi_sllc_pmu_v2_format_group = { }; static struct attribute *hisi_sllc_pmu_v2_events_attr[] = { - HISI_PMU_EVENT_ATTR(rx_req, 0x30), - HISI_PMU_EVENT_ATTR(rx_data, 0x31), - HISI_PMU_EVENT_ATTR(tx_req, 0x34), - HISI_PMU_EVENT_ATTR(tx_data, 0x35), - HISI_PMU_EVENT_ATTR(cycles, 0x09), + PMU_EVENT_ATTR_ID(rx_req, 0x30), + PMU_EVENT_ATTR_ID(rx_data, 0x31), + PMU_EVENT_ATTR_ID(tx_req, 0x34), + PMU_EVENT_ATTR_ID(tx_data, 0x35), + PMU_EVENT_ATTR_ID(cycles, 0x09), NULL };