Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp706998rwb; Tue, 27 Sep 2022 03:39:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WZeuqopcREZ6qbXp+ljZq1bCGZvEh6S3PZFxzIKA5gqtgcTopjxdNDq+uobTSujcq+bLj X-Received: by 2002:a17:907:74a:b0:77e:9455:b4e1 with SMTP id xc10-20020a170907074a00b0077e9455b4e1mr22446225ejb.462.1664275195769; Tue, 27 Sep 2022 03:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664275195; cv=none; d=google.com; s=arc-20160816; b=o7cQEkW0+HX5UXTCvguvx/Qh0bA/OG/KzvapcaElFFw4ua+17/IPrihyQ3dm4rxnaU bmyF+xIuLmYW6/aLrJU3FMqt3ZNaEImTRgTzETvvNpNJl3b+es1lvdSGeay3zsxRPrSA Zjldca3Gfb71qBLlrnMZSsNbOrujOz6oYeUOvZmZo2U8lyxvGRJFgpqCjCzd3xuA1/3Q IpzEPZwXddtoLumGsthpWW+OclfdzxHIMjNensRrWQ+j/hyqz8q1Qxm3dmlwUg7cRyGI gn43ik4ARF/tFhNvAcpR4MOs4G/MJza0dZ36efHk4u9qMCICoP4IkWS5xEkcMbPxQo/W cDYQ== 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:subject:cc:to:from:date; bh=NK7e3VzFaiP+5dIGJHERR6NBCLIfh68aQwEBZ7poAOA=; b=nx9iz+7aAMFzbaW+X0nPpxISMM4SNerCTdQMuJs5cpCaxaM79gTCKTRoZfo2TiUYzY u9KEsbAFkWlmx/jMamd5b6GdRvbcunMrGxfB7PoF8yY6VLeiGlOOMQV8vE/o7eJev/xT zGJyEvHdpaudRcyINAdDVPp/9Vkg6XU4CtAE/WHhoVluIclYKKMciXIqmTQH8xStQuXh 1dH0hZfsCXLfNgJAPIqKLW1bTqMVTkXqgv167hurySzGbUtrqGLXRlpyQ0CHcd/VCL/y biu27I6SrnofU/3T94om6kJ+k0hKlqzdkSXfua9y6hzvjG1O5EvFttg98b2uAFokcDTh mEeg== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go34-20020a1709070da200b00726b4f91300si1045091ejc.269.2022.09.27.03.39.28; Tue, 27 Sep 2022 03:39:55 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231630AbiI0KEp convert rfc822-to-8bit (ORCPT + 99 others); Tue, 27 Sep 2022 06:04:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbiI0KEn (ORCPT ); Tue, 27 Sep 2022 06:04:43 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F7491005E; Tue, 27 Sep 2022 03:04:39 -0700 (PDT) Received: from fraeml705-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4McFbR4yb6z6HJG9; Tue, 27 Sep 2022 18:04:35 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml705-chm.china.huawei.com (10.206.15.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 27 Sep 2022 12:04:37 +0200 Received: from localhost (10.202.226.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 27 Sep 2022 11:04:36 +0100 Date: Tue, 27 Sep 2022 11:04:35 +0100 From: Jonathan Cameron To: Shuai Xue CC: Bjorn Helgaas , , , , , , , , , Subject: Re: [PATCH v1 2/3] drivers/perf: add DesignWare PCIe PMU driver Message-ID: <20220927110435.00005b4d@huawei.com> In-Reply-To: <7502d496-9ec1-1ca4-c643-376ec2aa662e@linux.alibaba.com> References: <20220926171857.GA1609097@bhelgaas> <7502d496-9ec1-1ca4-c643-376ec2aa662e@linux.alibaba.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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 On Tue, 27 Sep 2022 13:13:29 +0800 Shuai Xue wrote: > 在 2022/9/27 AM1:18, Bjorn Helgaas 写道: > > On Mon, Sep 26, 2022 at 09:31:34PM +0800, Shuai Xue wrote: > >> 在 2022/9/23 PM11:54, Jonathan Cameron 写道: > >>>> I found a similar definition in arch/ia64/pci/pci.c . > >>>> > >>>> #define PCI_SAL_ADDRESS(seg, bus, devfn, reg) \ > >>>> (((u64) seg << 24) | (bus << 16) | (devfn << 8) | (reg)) > >>>> > >>>> Should we move it into a common header first? > >>> > >>> Maybe. The bus, devfn, reg part is standard bdf, but I don't think > >>> the PCI 6.0 spec defined a version with the seg in the upper bits. > >>> I'm not sure if we want to adopt that in LInux. > >> > >> I found lots of code use seg,bus,devfn,reg with format "%04x:%02x:%02x.%x", > >> I am not quite familiar with PCIe spec. What do you think about it, Bjorn? > > > > The PCIe spec defines an address encoding for bus/device/function/reg > > for the purposes of ECAM (PCIe r6.0, sec 7.2.2), but as far as I know, > > it doesn't define anything similar that includes the segment. The > > segment is really outside the scope of PCIe because each segment is a > > completely separate PCIe hierarchy. > > Thank you for your explanation. > > > > > So I probably wouldn't make this a generic definition. But if/when > > you print things like this out, please do use the format spec you > > mentioned above so it matches the style used elsewhere. > > > > Agree. The print format of bus/device/function/reg is "%04x:%02x:%02x.%x", > so I named the PMU as the same format. Then the usage flow would be: > > - lspci to get the device root port in format seg/bus/device/function/reg. > 10:00.0 PCI bridge: Device 1ded:8000 (rev 01) > - select its PMU name pcie_bdf_100000. > - monitor with perf: > perf stat -a -e pcie_bdf_200/Rx_PCIe_TLP_Data_Payload/ I think you probably want something in there to indicate it's an RP and the bdf part may be redundant... Jonathan > > Bjorn and Jonathan, are you happy with this flow? > > Thank you. > > Best Regards, > Shuai >