From patchwork Fri Aug 16 15:17:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13766506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 436F5C531DC for ; Fri, 16 Aug 2024 15:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=scIZZuoxqYQMWOeBK2ZkziJZtkh1iQOdtRitHt4HBSQ=; b=ba/mCsrDh/Kic/iBiq0OonaMts sStt8eaWnw5q1I2gJEcv1beSOmrIc6eqVpbg2ZxULSKivxv8iXdooc8cLi3sZMJ+JR5NF4oOYRaz+ EUaX4f7Ww3Wzz8mwnD0IlzX5l6nG2T9aORGbfePw3QhOfy9il/dQtrGZ1HTFI0OtwmhzKLuVC9BM0 HQiaqFLlU78cNKfGLn5/pWE7zwVRfXxekqYfxOCH1AerAWDuqXzxo0iv00yS+1a5puCzsrK4ct1we d2Hoq6GBAusIJsP5iw5EINae7DfdtBk+SYp1droi6UBIwqsb5fKFfh+3asDSXlKw/byVMeZm8dRwq GkWxiqoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyqY-0000000DNTc-1HrN; Fri, 16 Aug 2024 15:26:34 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyiL-0000000DLx2-0mdT for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:18:07 +0000 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47G8MpVN020176; Fri, 16 Aug 2024 15:17:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= scIZZuoxqYQMWOeBK2ZkziJZtkh1iQOdtRitHt4HBSQ=; b=T8DVZGYuyWa68ayT OzlYVLjVL+3IDh+uvQ4yXDAG7PEXNYJ8JLGVay5oC62fJphCX9iBM/l4+PzN61pU n3VtjGXOBGyWEz2mDpdDigAHhEnkJzG7oJh4r6PdEsFGCLIEpI4F4et3EyDFSuN1 vYwbJgyoI0PHTzVqKsadvNUqFvPtmJQOReZrwMiPxLxiMQQmi1tewkgp04QLhqkZ 1WFcYh8aYtOSNGQHmeDNSNXMtJ4NhaGNgnsijS+Tf/2+sQcki84sZjXbJRzQjXeO KZGAqzowCchHnXj5WXCiNt3NWc9TwScSKAVfupFpTTXMoApPPmAt4P/uxDxcVASl 67Ei+g== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 412373s291-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:36 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 47GFHZnl029998 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:35 GMT Received: from hu-krichai-hyd.qualcomm.com (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.1544.9; Fri, 16 Aug 2024 08:17:29 -0700 From: Krishna chaitanya chundru Date: Fri, 16 Aug 2024 20:47:20 +0530 Subject: [PATCH v2 1/4] perf/dwc_pcie: Fix registration issue in multi PCIe controller instances MIME-Version: 1.0 Message-ID: <20240816-dwc_pmu_fix-v2-1-198b8ab1077c@quicinc.com> References: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> In-Reply-To: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> To: Shuai Xue , Jing Zhang , Will Deacon , Mark Rutland , Baolin Wang , "Yicong Yang" , Jonathan Cameron , Jonathan Corbet CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723821442; l=3773; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=kSn9xjSSC+d3M1wIV/+BxyvnmPx63cn7kd3tEwbvVpg=; b=Yp3SNmwFbEyx7tPT37Tx1anCMSEzkxlZ2aBiKpJYANbVVtpjv8wyOUdhzxydN8h0JjfDvOhph TDcGE45vmtgCucVwvKqXyC+XCTkazVh5JKfyuRfGjF3RUBin3j4XgtT X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: fueRPwe1A74kNmxdTS1yjF-g3nfnirlz X-Proofpoint-ORIG-GUID: fueRPwe1A74kNmxdTS1yjF-g3nfnirlz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-16_09,2024-08-16_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 impostorscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408160110 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_081805_276681_784894EA X-CRM114-Status: GOOD ( 16.09 ) 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 When there are multiple of instances of PCIe controllers, registration to perf driver fails with this error. sysfs: cannot create duplicate filename '/devices/platform/dwc_pcie_pmu.0' CPU: 0 PID: 166 Comm: modprobe Not tainted 6.10.0-rc2-next-20240607-dirty Hardware name: Qualcomm SA8775P Ride (DT) Call trace: dump_backtrace.part.8+0x98/0xf0 show_stack+0x14/0x1c dump_stack_lvl+0x74/0x88 dump_stack+0x14/0x1c sysfs_warn_dup+0x60/0x78 sysfs_create_dir_ns+0xe8/0x100 kobject_add_internal+0x94/0x224 kobject_add+0xa8/0x118 device_add+0x298/0x7b4 platform_device_add+0x1a0/0x228 platform_device_register_full+0x11c/0x148 dwc_pcie_register_dev+0x74/0xf0 [dwc_pcie_pmu] dwc_pcie_pmu_init+0x7c/0x1000 [dwc_pcie_pmu] do_one_initcall+0x58/0x1c0 do_init_module+0x58/0x208 load_module+0x1804/0x188c __do_sys_init_module+0x18c/0x1f0 __arm64_sys_init_module+0x14/0x1c invoke_syscall+0x40/0xf8 el0_svc_common.constprop.1+0x70/0xf4 do_el0_svc+0x18/0x20 el0_svc+0x28/0xb0 el0t_64_sync_handler+0x9c/0xc0 el0t_64_sync+0x160/0x164 kobject: kobject_add_internal failed for dwc_pcie_pmu.0 with -EEXIST, don't try to register things with the same name in the same directory. This is because of having same bdf value for devices under two different controllers. Update the logic to use sbdf which is a unique number in case of multi instance also. Fixes: af9597adc2f1 ("drivers/perf: add DesignWare PCIe PMU driver") Signed-off-by: Krishna chaitanya chundru Reviewed-by: Yicong Yang --- drivers/perf/dwc_pcie_pmu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c index c5e328f23841..85a5155d6018 100644 --- a/drivers/perf/dwc_pcie_pmu.c +++ b/drivers/perf/dwc_pcie_pmu.c @@ -556,10 +556,10 @@ static int dwc_pcie_register_dev(struct pci_dev *pdev) { struct platform_device *plat_dev; struct dwc_pcie_dev_info *dev_info; - u32 bdf; + u32 sbdf; - bdf = PCI_DEVID(pdev->bus->number, pdev->devfn); - plat_dev = platform_device_register_data(NULL, "dwc_pcie_pmu", bdf, + sbdf = (pci_domain_nr(pdev->bus) << 16) | PCI_DEVID(pdev->bus->number, pdev->devfn); + plat_dev = platform_device_register_data(NULL, "dwc_pcie_pmu", sbdf, pdev, sizeof(*pdev)); if (IS_ERR(plat_dev)) @@ -611,15 +611,15 @@ static int dwc_pcie_pmu_probe(struct platform_device *plat_dev) struct pci_dev *pdev = plat_dev->dev.platform_data; struct dwc_pcie_pmu *pcie_pmu; char *name; - u32 bdf, val; + u32 sbdf, val; u16 vsec; int ret; vsec = pci_find_vsec_capability(pdev, pdev->vendor, DWC_PCIE_VSEC_RAS_DES_ID); pci_read_config_dword(pdev, vsec + PCI_VNDR_HEADER, &val); - bdf = PCI_DEVID(pdev->bus->number, pdev->devfn); - name = devm_kasprintf(&plat_dev->dev, GFP_KERNEL, "dwc_rootport_%x", bdf); + sbdf = plat_dev->id; + name = devm_kasprintf(&plat_dev->dev, GFP_KERNEL, "dwc_rootport_%x", sbdf); if (!name) return -ENOMEM; @@ -650,7 +650,7 @@ static int dwc_pcie_pmu_probe(struct platform_device *plat_dev) ret = cpuhp_state_add_instance(dwc_pcie_pmu_hp_state, &pcie_pmu->cpuhp_node); if (ret) { - pci_err(pdev, "Error %d registering hotplug @%x\n", ret, bdf); + pci_err(pdev, "Error %d registering hotplug @%x\n", ret, sbdf); return ret; } @@ -663,7 +663,7 @@ static int dwc_pcie_pmu_probe(struct platform_device *plat_dev) ret = perf_pmu_register(&pcie_pmu->pmu, name, -1); if (ret) { - pci_err(pdev, "Error %d registering PMU @%x\n", ret, bdf); + pci_err(pdev, "Error %d registering PMU @%x\n", ret, sbdf); return ret; } ret = devm_add_action_or_reset(&plat_dev->dev, dwc_pcie_unregister_pmu, From patchwork Fri Aug 16 15:17:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13766507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDC57C531DC for ; Fri, 16 Aug 2024 15:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jWSOVwW1Oglzt60CE8fvO0tKxAC9u4HzF9ol8sz2DMQ=; b=f2dvQDE6GRHOnxSLYAUoTw7nmY j1dxPjKVFa+3+fzN9PPSiXzSr06pxbRP6wCg66+2us/LFcSjxxOzpchB6ZG7MEri7uHqiTZ/FZHX8 oZwjP990jdPn/la9MDaxZ/kLWAyIvNwEGovFEGJBJmmyMq9HSBo8XVTJwvqnuua3Nkhe6VAuVU6Ds J3spjv+rvR1/4pr2SyRTK8QKNfmL13RHIpdf1onS5cb4mzIG6/H+5RiXBavGsIpromJiGcINVVKv8 ejms8fTR4vPXgdIJ5ZubVr/3sO8hWPS6WJJ2bBlT7fH8c8tskuUA+5rIuY13d/ypRYqGzhVXgttNs O+zo1Mxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyrA-0000000DNZs-08Yt; Fri, 16 Aug 2024 15:27:12 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyiV-0000000DLzn-17Lq for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Aug 2024 15:18:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=jWSOVwW1Oglzt60CE8fvO0tKxAC9u4HzF9ol8sz2DMQ=; b=hrk51t91HyIxr8w2g5vDcD5j6N BRHH/pJ+kWw6G8823JH4tWYqGlPdYqm9YKTk/bK/33xb5zLWAVK6bQ6c4s5FkfTvrndazY0nkT0gc kF8aqYOR4s0FzQ9TGgodUE5D3eUAXu8PjH25/ZyGgseI9PpkxdyX3Iv26pG06xowaOP/vjgMeMoCK usXny6WenKB6oIFW83qibbfIVZcblouEhdSYpbfrDm219gr8qf4M40HUQhtcPlk+CNDoIkbCZWkF1 dECN02VGvK8AepzvfSaJsZxyl1Vmo/l+vDwwu0APbn3OkJE2ONs+YpMLkRvq+QRpLzgkSs9t36vzM eZEJgfsg==; Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyiR-00000008hDe-0fuY for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:18:13 +0000 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47G6VYwM031041; Fri, 16 Aug 2024 15:17:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= jWSOVwW1Oglzt60CE8fvO0tKxAC9u4HzF9ol8sz2DMQ=; b=pTyBzPyiGGrAdrrL tsonnImw5dNGOMzdT/DK8LOVaof1seKo3FBVKwgAtHZJUCIOGCe9zCBGCIFct/a3 rQObuZRVYaUKxKTNyQlT5LmaP0mlChHWCJPUHCr/QWFhHUHbbEskQyH630j/yceB D8qD/s1FK1EpULysWRMzUvHqRxx8A1LV0wg9N1D5wuiW2EjnH8pJ6iCQHVm1lkni zYxOK/bU+MFxK3Jlc375Cxs8qIdat4skqvPuWZNXgDS0vMDTKdGkgiIE1Xjw1ZXN 1/2TM0o/IE4g48gvlRZJmqh8n8HbJyC9+/qiqVzXgSKL81ioTvUsspWxpk1IwB7a ZV8cFA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4103wsarrj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:42 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 47GFHeen017321 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:40 GMT Received: from hu-krichai-hyd.qualcomm.com (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.1544.9; Fri, 16 Aug 2024 08:17:35 -0700 From: Krishna chaitanya chundru Date: Fri, 16 Aug 2024 20:47:21 +0530 Subject: [PATCH v2 2/4] Documentation: dwc_pcie_pmu: Update bdf to sbdf MIME-Version: 1.0 Message-ID: <20240816-dwc_pmu_fix-v2-2-198b8ab1077c@quicinc.com> References: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> In-Reply-To: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> To: Shuai Xue , Jing Zhang , Will Deacon , Mark Rutland , Baolin Wang , "Yicong Yang" , Jonathan Cameron , Jonathan Corbet CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723821442; l=2920; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=LK8+aoB8ucdCz8X8Jmwhml5sbBUA488l8iN1Nqf4BpY=; b=chO35ka73LBwU99UNmGoeRTMf2tDSfa8fcBGitY+QPuxGHzcDbLDZp+qAql4BDPJGqKMNO7Ib CLQx4RattmmBMe9f+uGrCDJxiKgYqfZodQ0eJ+foKsy5TZ8d00/gb// X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: V5tpsevPp1WpdK8dJeOQ0lmMwkf1Q5rn X-Proofpoint-ORIG-GUID: V5tpsevPp1WpdK8dJeOQ0lmMwkf1Q5rn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-16_09,2024-08-16_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 mlxlogscore=915 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408160110 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_161811_690100_0525D9E6 X-CRM114-Status: GOOD ( 14.73 ) 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 Update document to reflect the driver change to use sbdf instead of bdf alone. Signed-off-by: Krishna chaitanya chundru Reviewed-by: Yicong Yang --- Documentation/admin-guide/perf/dwc_pcie_pmu.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/perf/dwc_pcie_pmu.rst b/Documentation/admin-guide/perf/dwc_pcie_pmu.rst index d47cd229d710..39b8e1fdd0cd 100644 --- a/Documentation/admin-guide/perf/dwc_pcie_pmu.rst +++ b/Documentation/admin-guide/perf/dwc_pcie_pmu.rst @@ -46,16 +46,16 @@ Some of the events only exist for specific configurations. DesignWare Cores (DWC) PCIe PMU Driver ======================================= -This driver adds PMU devices for each PCIe Root Port named based on the BDF of +This driver adds PMU devices for each PCIe Root Port named based on the SBDF of the Root Port. For example, - 30:03.0 PCI bridge: Device 1ded:8000 (rev 01) + 0001:30:03.0 PCI bridge: Device 1ded:8000 (rev 01) -the PMU device name for this Root Port is dwc_rootport_3018. +the PMU device name for this Root Port is dwc_rootport_13018. The DWC PCIe PMU driver registers a perf PMU driver, which provides description of available events and configuration options in sysfs, see -/sys/bus/event_source/devices/dwc_rootport_{bdf}. +/sys/bus/event_source/devices/dwc_rootport_{sbdf}. The "format" directory describes format of the config fields of the perf_event_attr structure. The "events" directory provides configuration @@ -66,16 +66,16 @@ The "perf list" command shall list the available events from sysfs, e.g.:: $# perf list | grep dwc_rootport <...> - dwc_rootport_3018/Rx_PCIe_TLP_Data_Payload/ [Kernel PMU event] + dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/ [Kernel PMU event] <...> - dwc_rootport_3018/rx_memory_read,lane=?/ [Kernel PMU event] + dwc_rootport_13018/rx_memory_read,lane=?/ [Kernel PMU event] Time Based Analysis Event Usage ------------------------------- Example usage of counting PCIe RX TLP data payload (Units of bytes):: - $# perf stat -a -e dwc_rootport_3018/Rx_PCIe_TLP_Data_Payload/ + $# perf stat -a -e dwc_rootport_13018/Rx_PCIe_TLP_Data_Payload/ The average RX/TX bandwidth can be calculated using the following formula: @@ -88,7 +88,7 @@ Lane Event Usage Each lane has the same event set and to avoid generating a list of hundreds of events, the user need to specify the lane ID explicitly, e.g.:: - $# perf stat -a -e dwc_rootport_3018/rx_memory_read,lane=4/ + $# perf stat -a -e dwc_rootport_13018/rx_memory_read,lane=4/ The driver does not support sampling, therefore "perf record" will not work. Per-task (without "-a") perf sessions are not supported. From patchwork Fri Aug 16 15:17:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13766508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B78B7C531DC for ; Fri, 16 Aug 2024 15:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CSqshpibilq7ubeGkkOp0wvuc7mFwgjd74ktGauelO8=; b=EHXcrJENrsC+giXoxuAFHjynm/ hAsKbTqMGYwoOVJyE5XfAVNqJjoGKlhv5DKxW8PvzCUwgtabGqjFsnl/6d40Fh0Avaqz74tbf+DWy MgKjoP6nTu9k0MFUSSiH1T6JhaapI9973Y/+oIxT16Ve9olLVZd0lTvkDsBkmXF4ZQ6VwvDzWP6Na d3V3ekLA97/GD97CVioTOXzeHRf2K/21cuFHCl5PQhp3wpvUUXF53gf0PIHprwi/QwnoMiTDN5ogD TJx0OEb/5ZuTmZYxQMYLLsG69c3ZIGcWDhlob9OzzeXeAzfFuVToFwBLf9MVhPIWTR8qVhG/WL3Xf 99WWUR4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyrl-0000000DNmB-3uaE; Fri, 16 Aug 2024 15:27:49 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyiZ-0000000DM19-1J1b for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:18:21 +0000 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47G8Z37V027126; Fri, 16 Aug 2024 15:17:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= CSqshpibilq7ubeGkkOp0wvuc7mFwgjd74ktGauelO8=; b=nbc2vhXonDYeBR2o WzWEdBK51wfysJKN+ASCDspMTu4+TIXIpws7fXjFduOKDaAjFnNHpvO2mT26zcnA 3Fr/lHG4E6oLwfKGvCyS3khzMkSi3vH2WToWrXP2gdXP9cl/BajOWYQwfbR1CjO9 Dw601YwPQL7T/KBsATqcSlqiYA/sprZH3cUlPMxckN8KFldBeKbiFliy1CIBkcS9 lgfU6vNvFymd9cafQMTTrdI/fWZ2h656xuBl28uRU3u8ekptEbHz5P+VrS8qzf7C 4eUuuVSccoo+av7nwH1o/ccihmUkN4ehy21heuGH1BqQLUrXiSu9x18uEwdDcmG5 vDM5Wg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4123cr90my-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:48 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 47GFHkPn007597 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:46 GMT Received: from hu-krichai-hyd.qualcomm.com (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.1544.9; Fri, 16 Aug 2024 08:17:41 -0700 From: Krishna chaitanya chundru Date: Fri, 16 Aug 2024 20:47:22 +0530 Subject: [PATCH v2 3/4] perf/dwc_pcie: Always register for PCIe bus notifier MIME-Version: 1.0 Message-ID: <20240816-dwc_pmu_fix-v2-3-198b8ab1077c@quicinc.com> References: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> In-Reply-To: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> To: Shuai Xue , Jing Zhang , Will Deacon , Mark Rutland , Baolin Wang , "Yicong Yang" , Jonathan Cameron , Jonathan Corbet CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723821442; l=1236; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=cPjJFcveoqteKrkuFimjF6gSN96zK9Y2kBv3sRLogn8=; b=NL0xFHzVbLj7Mu6dKtbuzi84kAfGHGdjRveVnSFqZRklORc89/NGnpX36Tny0cXUYNjAHGjtk DCrYhXEClotBgu5Y8pHyyYen9AShY2RF1bjZBtMrShTcrpdtSERNfnK X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: tWjrxbuSQHhsNKQ-V52MG_axx-v2xmOb X-Proofpoint-ORIG-GUID: tWjrxbuSQHhsNKQ-V52MG_axx-v2xmOb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-16_09,2024-08-16_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 mlxscore=0 malwarescore=0 spamscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408160110 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_081819_516595_E0BDF8E2 X-CRM114-Status: GOOD ( 14.30 ) 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 When the PCIe devices are discovered late, the driver can't find the PCIe devices and returns in the init without registering with the bus notifier. Due to that the devices which are discovered late the driver can't register for this. Register for bus notifier & driver even if the device is not found as part of init. Fixes: af9597adc2f1 ("drivers/perf: add DesignWare PCIe PMU driver") Signed-off-by: Krishna chaitanya chundru Reviewed-by: Yicong Yang --- drivers/perf/dwc_pcie_pmu.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c index 85a5155d6018..f205ecad2e4c 100644 --- a/drivers/perf/dwc_pcie_pmu.c +++ b/drivers/perf/dwc_pcie_pmu.c @@ -726,7 +726,6 @@ static struct platform_driver dwc_pcie_pmu_driver = { static int __init dwc_pcie_pmu_init(void) { struct pci_dev *pdev = NULL; - bool found = false; int ret; for_each_pci_dev(pdev) { @@ -738,11 +737,7 @@ static int __init dwc_pcie_pmu_init(void) pci_dev_put(pdev); return ret; } - - found = true; } - if (!found) - return -ENODEV; ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, "perf/dwc_pcie_pmu:online", From patchwork Fri Aug 16 15:17:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya Chundru X-Patchwork-Id: 13766509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 559E4C3DA4A for ; Fri, 16 Aug 2024 15:28:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:CC:To:In-Reply-To:References :Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rvN4yDcwZSK4kCZajw0B6ItIUwXNiVXJtL6nCzN0wsk=; b=P5BVhvbsMX1O+U4P2Bi49l2WCF h00ImIzFGcsL6CSYza/PwwAVR8eTb0aRTyU1yGbjK9BT9lkmPiTgSTSesIPBwv7hrMHf3tJFvK23r syLqsrXXAxwRFpsdlmbt3q2jaxf34foSwt46E42YES4yvUeEDZ7NfNSQbKoq6UsCGXYLxBi1D3NEi ABGPltq+rTuJ6u5UvIg66egDX3WXoOfMLUkbJeP8MKH/kxZBBl7keMzKUdhAhF3/NZ/OCxpi/ehEk oNl0xGVgx0wz6wZHFcsumsef2zqti9cp8ZB1SOg1mmHmZCLRHbxT2VXB458+E8v78121vgedPTSIs it4dZ5ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seysO-0000000DO0N-2UZS; Fri, 16 Aug 2024 15:28:28 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyih-0000000DM3p-1jxb for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Aug 2024 15:18:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=CC:To:In-Reply-To:References: Message-ID:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=rvN4yDcwZSK4kCZajw0B6ItIUwXNiVXJtL6nCzN0wsk=; b=EHPC1FMhYAoTLtkpqavXTusm8I qL7AKez0oM82znAIqg57+z+96OOHQ+bxW4w/cDdK1oGCNm+1aw2X9TEb7MZ5TpCDG7eUPJ2w7jWFa 7nh43v91ZA2rhqEyabsRsTTYjxDXnSLF6ud/NhRaF+jEaBF3FrfhCVJFJT3katpTorhmRz/7VDr9I uPVYbuScnmcOOsIFT748ndUGNwqcoPgAUd5iC9u8BSIF8c6rdGtw+x9bBM4Vod2q7F+5joKBv6Yex p5pDJMnmSkfx0UIGXwsubZNLaW2gRcWZgbq3z5T8tUDB1oew1u3/JywWuWttJ+d8F5P9Eh5JFiVke mRgzUTkg==; Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1seyie-00000008hEn-0GoP for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2024 15:18:26 +0000 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 47G6lf3R011403; Fri, 16 Aug 2024 15:17:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rvN4yDcwZSK4kCZajw0B6ItIUwXNiVXJtL6nCzN0wsk=; b=nk7tFoIRP1pRzrE+ vub9j9ujNxYhiyxRfay8JnwJPS0A34u6IxU7D+h725Et3HNSvFMoxVMyw3+33+kO y9YYsq0wxgIcuKiKyQCeWb0V0JoZBeZryMZ0HR2QcDm94BniHqfDT23eJXhu1DPM OnUmpC5vEtTy+fNz7swicrU2SuJySKECr7E22yRAKDe5PIEwL6UrKeW3eeXhW+O4 c1DcHjk4t5FFWSr49WAAZhMxUWxBOTQL7ixmaW8M05+sOKD5h63ZP4OXYQdwe/jD 8gqc88i7fwPGk+BBLZAjKMz6bmokcmNQL4DJxvYQueeFXAW/F14bHq3ym+CyDnco nphxNw== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4104382q2v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:53 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 47GFHqTA030481 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Aug 2024 15:17:52 GMT Received: from hu-krichai-hyd.qualcomm.com (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.1544.9; Fri, 16 Aug 2024 08:17:46 -0700 From: Krishna chaitanya chundru Date: Fri, 16 Aug 2024 20:47:23 +0530 Subject: [PATCH v2 4/4] perf/dwc_pcie: Add support for QCOM vendor devices MIME-Version: 1.0 Message-ID: <20240816-dwc_pmu_fix-v2-4-198b8ab1077c@quicinc.com> References: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> In-Reply-To: <20240816-dwc_pmu_fix-v2-0-198b8ab1077c@quicinc.com> To: Shuai Xue , Jing Zhang , Will Deacon , Mark Rutland , Baolin Wang , "Yicong Yang" , Jonathan Cameron , Jonathan Corbet CC: , , , , , , , , , , "Krishna chaitanya chundru" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1723821442; l=679; i=quic_krichai@quicinc.com; s=20230907; h=from:subject:message-id; bh=rd/G+McQtsHmCV5vinEESnVI3CQaaZfqnPKqWPGPoxw=; b=d9z0vs74HTerIu/xzf8/2X1TZ0oYPjq/aO/WyS0yT3r4grWVkbOMqO8qP3MorOLbfDF+P5j3q Hbl8eBph7YCA/OZhPYwaUC3bpyTEQIyH6q8k0V1gAaHaoLntMIuWl4M X-Developer-Key: i=quic_krichai@quicinc.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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-ORIG-GUID: 46wA4WHfsXfypSmMnvVeXkXB3-DbgbCz X-Proofpoint-GUID: 46wA4WHfsXfypSmMnvVeXkXB3-DbgbCz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-16_09,2024-08-16_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 phishscore=0 spamscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408160110 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240816_161824_604712_C1EA3F9D X-CRM114-Status: GOOD ( 11.62 ) 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 Update the vendor table with QCOM PCIe vendorid. Signed-off-by: Krishna chaitanya chundru Reviewed-by: Yicong Yang --- drivers/perf/dwc_pcie_pmu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c index f205ecad2e4c..4ca50f9b6dfe 100644 --- a/drivers/perf/dwc_pcie_pmu.c +++ b/drivers/perf/dwc_pcie_pmu.c @@ -107,6 +107,7 @@ struct dwc_pcie_vendor_id { static const struct dwc_pcie_vendor_id dwc_pcie_vendor_ids[] = { {.vendor_id = PCI_VENDOR_ID_ALIBABA }, + {.vendor_id = PCI_VENDOR_ID_QCOM }, {} /* terminator */ };