Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2640082rdh; Mon, 30 Oct 2023 03:30:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFz8qwJQvpUObzaxme62trj7YF5jO375nkae81zyaQgJ6I4Fu9g4GBU0gnhq7OYpsFciyH5 X-Received: by 2002:a05:6a00:22d3:b0:68c:638b:e2c6 with SMTP id f19-20020a056a0022d300b0068c638be2c6mr11322255pfj.9.1698661823967; Mon, 30 Oct 2023 03:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698661823; cv=none; d=google.com; s=arc-20160816; b=OIJ82DhOwNEViHn5mVaY1WOq/Qce1elurJ8KWA18SQi2SDWi6kHWhIsfOuKelhq7iJ tE5AiuI3CvlsJuOexKoQvXvTeO3+UZ9jIaISG6MeqLTzkRyQ2NxcKBiRXKtxJGTnwLNp QRTRf9zji2VmsIctYXLpUE5VcAcHOu/Q7qQ1DmjTHYlsXM3IpzBCosvacbLULGHp+guO pJHBP5fWjvRSnYkEcO3afbWxZBMsUstfH8QsfVmuy/+bRvhDH2W4Cz+M6elG05BYjvKe y2re0oXB3vWo1RbA4XKw87WdJh8rsplrA67bxumKZS+dD/M1rDfiGm1kEMYQ0VE4o7g0 pr/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=M9zd33uUhmoB3KRKVGYqFE9M1oGlNqiI5qFzs961rgo=; fh=RO7rzV1h/Juba7QULouK/3JjkzfzQe1WC1VNskFGU9w=; b=rSrVgWzCdLrx4Mg6p8q9ffNwvMPVdqtmf7EmrCHsN+TQrkYCwSbe/D7f5O536v7GMI efxI0VzWcIm7mVL14Eab1SEGQ2JvfI8H9UHS8yFwfK+QyZqtl/6izt7SIzXQu4kW8rWn EWFq0uKlgGbI2nz1P44HnZt9fhOfofVHUgLQyRe4hot8Pl8x4roEMCmuOTatUKLghXUZ 5CYG8DzIkiCINDo8GXBHCa5Kom3FyB5Dce+0FHR9PEdyh3Xz0Ey1Yxuz3+kg9uQeCj6I wSxQSDQg+8jlMSWT9W2V/cdCvhUXp+ci7HiuwoWVuzYsH1wAVzJ1qXv3fs26Ehz11wSV y4Nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h70-20020a638349000000b005b874265d1fsi4552405pge.513.2023.10.30.03.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 03:30:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3AA918063BFB; Mon, 30 Oct 2023 03:30:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232553AbjJ3K3w (ORCPT + 99 others); Mon, 30 Oct 2023 06:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231945AbjJ3K3u (ORCPT ); Mon, 30 Oct 2023 06:29:50 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F26A28E; Mon, 30 Oct 2023 03:29:46 -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=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---0VvAhU0W_1698661780; Received: from 30.240.112.195(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VvAhU0W_1698661780) by smtp.aliyun-inc.com; Mon, 30 Oct 2023 18:29:42 +0800 Message-ID: <45de80bc-d4ab-44fd-945c-f0ff7ce3b8b0@linux.alibaba.com> Date: Mon, 30 Oct 2023 18:29:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 3/4] drivers/perf: add DesignWare PCIe PMU driver Content-Language: en-US To: Krishna Chaitanya Chundru , chengyou@linux.alibaba.com, kaishen@linux.alibaba.com, helgaas@kernel.org, yangyicong@huawei.com, will@kernel.org, Jonathan.Cameron@huawei.com, baolin.wang@linux.alibaba.com, robin.murphy@arm.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, rdunlap@infradead.org, mark.rutland@arm.com, zhuo.song@linux.alibaba.com, renyu.zj@linux.alibaba.com References: <20231020134230.53342-1-xueshuai@linux.alibaba.com> <20231020134230.53342-4-xueshuai@linux.alibaba.com> <8af04f14-87ae-87aa-7187-55d5450b6d74@quicinc.com> From: Shuai Xue In-Reply-To: <8af04f14-87ae-87aa-7187-55d5450b6d74@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 03:30:21 -0700 (PDT) On 2023/10/30 14:28, Krishna Chaitanya Chundru wrote: > ... >> + >> +static int dwc_pcie_pmu_probe(struct platform_device *plat_dev) >> +{ >> +    struct pci_dev *pdev = NULL; >> +    struct dwc_pcie_pmu *pcie_pmu; >> +    bool notify = false; >> +    char *name; >> +    u32 bdf; >> +    int ret; >> + >> +    /* Match the rootport with VSEC_RAS_DES_ID, and register a PMU for it */ >> +    for_each_pci_dev(pdev) { >> +        u16 vsec; >> +        u32 val; >> + >> +        if (!(pci_is_pcie(pdev) && >> +              pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT)) >> +            continue; >> + >> +        vsec = pci_find_vsec_capability(pdev, PCI_VENDOR_ID_ALIBABA, >> +                        DWC_PCIE_VSEC_RAS_DES_ID); > > We are searching for ALIBABA vendor only  for this capability. > > Can we have a list of vendor ID's and we can check for all those vendors for this capability so that it will be easy to add new vendors in the list > > something like this > > struct vendor_ids { > > int vendor_id; > > }; > > struct vendor_ids dwc_ids[] = { > >     {.vendor_id =PCI_VENDOR_ID_ALIBABA }, > >      {.vendor_id = XXX}, > > }; > >     for_each_pci_dev(pdev) { >         u16 vsec; >         u32 val; > >         if (!(pci_is_pcie(pdev) && >               pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT)) >             continue; >         for (int i = 0; i < num of elements of dwc_ids < i++) { >             --- > >         } >         >         --- >     } > > Thanks & Regards, > Krishna Chaitanya. > Good idea, with vendor_ids, I think it will be easy to extend for other vendors in the future. Thank you. Best Regards, Shuai