From patchwork Mon Apr 10 03:16:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 7937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1650583vqo; Sun, 9 Apr 2023 20:19:44 -0700 (PDT) X-Google-Smtp-Source: AKy350Zn3tJE62TYjwn7y1sIWWSwrjLSJe8zbaSjO163AzEXkP7S55/SsJZVw+ikvTNxJQcBkQK7 X-Received: by 2002:a17:906:8c3:b0:931:2f49:c040 with SMTP id o3-20020a17090608c300b009312f49c040mr6326753eje.51.1681096783986; Sun, 09 Apr 2023 20:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681096783; cv=none; d=google.com; s=arc-20160816; b=W2n02vKXbMESriH52skc4p3qhh0gZjCZOjYL71ZHIcWVhxvs95gTms4a+qloAaYh/b 4p3itlaVDwxm2yEmQS0kMGtKXbZbrdgW5CGUqXrJ7MXTjIQNeQZe948aX9NVvleKpn5L wh0bntTS40BQ2oyeGF41jetyJG0aqS+fQcpsBh+1Niv+2TdRHSHQqRD+KsnubUkH0BO8 6f8jA6wsQHxgve5VrDYLMxlelc9M05QBcYpuciMtmwGllUUiVgQ6oQ2C0hwHYOuxwHAF puFH8bITuyWd8avD/0b429pArnjYFM99KOeWfujCDSc2JIHa4g6lOIdFgu1vlzMpvoMu NvYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kFkSSvho+52rgb6WyNP1OsZ7dOClXnqxKWL8GeU33fw=; b=crNLDOsUmpqOXLJ3OyKA7ALvzear1bE5mmubNtztrbplSWARR+xbATHMAk6i2bqhUi hIpQdKFlUzIwZa8d/HIZmXu/7ouj1x2F0gdWqORS0lXngdMjSEjJ5X4MrTbO+7LY5myL C04giBCqGUAZHPma2aE0zUgehL3xxRia0TOzFwyboieaJvLaCoJNkSq3KD9iGwUONhrd +gLwthXoFqGdoPNQcD2RVrfcBoZtUQegqlZjyV2yE/SJVZWfKrsApvr/Dzc5i10ajr9I KuLLmmyFKdQe10NW229D+GPPFtMgTo+8GOKId28nOFqsaiYH8/BAB0fOLZAGww9QiZWp jtuw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qo11-20020a170907212b00b0094a67a95b8asi2344816ejb.70.2023.04.09.20.19.20; Sun, 09 Apr 2023 20:19:43 -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 S229650AbjDJDRS (ORCPT + 99 others); Sun, 9 Apr 2023 23:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229565AbjDJDRO (ORCPT ); Sun, 9 Apr 2023 23:17:14 -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 1F34230C6; Sun, 9 Apr 2023 20:17:11 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0VfeyoBu_1681096626; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VfeyoBu_1681096626) by smtp.aliyun-inc.com; Mon, 10 Apr 2023 11:17:09 +0800 From: Shuai Xue To: helgaas@kernel.org, yangyicong@huawei.com, will@kernel.org, Jonathan.Cameron@huawei.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, rdunlap@infradead.org, robin.murphy@arm.com, mark.rutland@arm.com, baolin.wang@linux.alibaba.com, zhuo.song@linux.alibaba.com, xueshuai@linux.alibaba.com Subject: [PATCH v2 0/3] drivers/perf: add Synopsys DesignWare PCIe PMU driver support Date: Mon, 10 Apr 2023 11:16:59 +0800 Message-Id: <20230410031702.68355-1-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220917121036.14864-1-xueshuai@linux.alibaba.com> References: <20220917121036.14864-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762757741372324781?= X-GMAIL-MSGID: =?utf-8?q?1762757741372324781?= Changes since v1: 1. address comments from Jonathan: - drop marco for PMU name and VSEC version - simplify code with PCI standard marco - simplify code with FIELD_PREP()/FIELD_GET() to replace shift marco - name register filed with single _ instead double - wrap dwc_pcie_pmu_{write}_dword out and drop meaningless snaity check - check vendor id while matching vesc with pci_find_vsec_capability() - remove RP_NUM_MAX and use a list to organize PMU devices for rootports - replace DWC_PCIE_CREATE_BDF with standard PCI_DEVID - comments on riping register together 2. address comments from Bjorn: - rename DWC_PCIE_VSEC_ID to DWC_PCIE_VSEC_RAS_DES_ID - rename cap_pos to ras_des - simplify declare of device_attribute with DEVICE_ATTR_RO - simplify code with PCI standard macro and API like pcie_get_width_cap() - fix some code style problem and typo - drop meaningless snaity check of container_of 3. address comments from Yicong: - use sysfs_emit() to replace sprintf() - simplify iteration of pci device with for_each_pci_dev - pick preferred CPUs on a near die and add comments - unregister PMU drivers only for failed ones - log on behalf PMU device and give more hint - fix some code style problem (Thanks for all comments and they are very valuable to me) This patchset adds the PCIe Performance Monitoring Unit (PMU) driver support for T-Head Yitian 710 SoC chip. Yitian 710 is based on the Synopsys PCI Express Core controller IP which provides statistics feature. Shuai Xue (3): docs: perf: Add description for Synopsys DesignWare PCIe PMU driver drivers/perf: add DesignWare PCIe PMU driver MAINTAINERS: add maintainers for DesignWare PCIe PMU driver .../admin-guide/perf/dwc_pcie_pmu.rst | 61 ++ Documentation/admin-guide/perf/index.rst | 1 + MAINTAINERS | 6 + drivers/perf/Kconfig | 7 + drivers/perf/Makefile | 1 + drivers/perf/dwc_pcie_pmu.c | 877 ++++++++++++++++++ 6 files changed, 953 insertions(+) create mode 100644 Documentation/admin-guide/perf/dwc_pcie_pmu.rst create mode 100644 drivers/perf/dwc_pcie_pmu.c