Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5872928rwb; Tue, 22 Nov 2022 06:06:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5OL42NymU+HQr0wL+oaHXIy2zGEJktr4IOPU4HOdwusoky5RzaDUQpPJBILdoo4gWjHc/a X-Received: by 2002:a05:6512:3992:b0:4ae:5dc5:82c5 with SMTP id j18-20020a056512399200b004ae5dc582c5mr8989770lfu.2.1669125994855; Tue, 22 Nov 2022 06:06:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669125994; cv=none; d=google.com; s=arc-20160816; b=GTJAtNbY8G5BkLhA5zAeCo1KfuO+GRBLFdeH+BurqS3fw5V2n/XJkPCHGJrBybl2PY fLU3nHpiz8qd0SC1mpJsGlKGe1zfQ6Dje6YQH5A/J2oqfEQDe88O+IDTj3FGibEZcPiO mOzvgMTJe/BN8jEbZ+vAJ5hRTGGa0YKCS9qL0zjXKHhy1F2xzLd/y3j4/SK2GfqOzBEV ImZm9wvF3L0S/MwOHlTsankZDQDr1eUVF/xTL1WnpxzOrnUaDXAUkHWhumWK3oJ+nqxc P3yKmGZGOr3NEj5N+Rbxt2hH+qkFt+k0bh9N/WORPktYjRWLLh23edwENTcIPAmTanzV FgZA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=hImoheX4hFDcPdWRd3Np7pSxZ68qoCNcUQh/i7lghS4=; b=ksbLf18h06zOBzlzUdaYUhwH4hiXwi86gS3wG3uA9hyA39LyeCIHOzNemo8JzG9eEG S13V4qSedNKi7pzPWcTpffu/JigImuKSI+Oh34MfRCAa1AwMte5nrMCc1AeFbcWNABvV 0bNnlyfqLIgS/ouLcaaAMMDKr5djfd7PZ2aWq1ilPqLGbwgEHmygSRefv8+uTiPqX7Pe /5ddWbGdCH9PvoDaWqr8iIkGdOIk+ZVxnJ4xwGeqy5pRrWB8QCoU2xpv2f2lP6FlyJuJ jB4s7Cz4riZNyg7mNGl/GWS+caiKjYFR7OUusG/FT0cwhKhOQ0WSLXudZ27I/UKp6asZ ZGyA== 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 g5-20020a056402428500b00461ebe2a168si11436859edc.447.2022.11.22.06.06.11; Tue, 22 Nov 2022 06:06:34 -0800 (PST) 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 S233912AbiKVNxf (ORCPT + 91 others); Tue, 22 Nov 2022 08:53:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233763AbiKVNxc (ORCPT ); Tue, 22 Nov 2022 08:53:32 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D390C654EB; Tue, 22 Nov 2022 05:53:31 -0800 (PST) Received: from frapeml500001.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4NGlvz3CzMz67Dr3; Tue, 22 Nov 2022 21:48:31 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by frapeml500001.china.huawei.com (7.182.85.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 14:53:29 +0100 Received: from localhost (10.45.149.88) 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, 22 Nov 2022 13:53:28 +0000 Date: Tue, 22 Nov 2022 13:53:27 +0000 From: Jonathan Cameron To: Yicong Yang CC: , , , , , , , , Yicong Yang Subject: Re: [PATCH 1/2] hwtracing: hisi_ptt: Only add the supported devices to the filters list Message-ID: <20221122135327.000004d8@Huawei.com> In-Reply-To: <20221122120209.25682-1-yangyicong@huawei.com> References: <20221122120209.25682-1-yangyicong@huawei.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.45.149.88] X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) 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, 22 Nov 2022 20:02:08 +0800 Yicong Yang wrote: > From: Yicong Yang > > The PTT device can only support the devices on the same PCIe core, > within BDF range [lower_bdf, upper_bdf]. It's not correct to assume > the devices on the root bus are from the same PCIe core, there are > cases that root ports from different PCIe core are sharing the same > bus. So add the checking when initialize the filters list. > > Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") > Signed-off-by: Yicong Yang Make sense to me. Reviewed-by: Jonathan Cameron > --- > drivers/hwtracing/ptt/hisi_ptt.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c > index 5d5526aa60c4..30f1525639b5 100644 > --- a/drivers/hwtracing/ptt/hisi_ptt.c > +++ b/drivers/hwtracing/ptt/hisi_ptt.c > @@ -356,8 +356,18 @@ static int hisi_ptt_register_irq(struct hisi_ptt *hisi_ptt) > > static int hisi_ptt_init_filters(struct pci_dev *pdev, void *data) > { > + struct pci_dev *root_port = pcie_find_root_port(pdev); > struct hisi_ptt_filter_desc *filter; > struct hisi_ptt *hisi_ptt = data; > + u32 port_devid; > + > + if (!root_port) > + return 0; > + > + port_devid = PCI_DEVID(root_port->bus->number, root_port->devfn); > + if (port_devid < hisi_ptt->lower_bdf || > + port_devid > hisi_ptt->upper_bdf) > + return 0; > > /* > * We won't fail the probe if filter allocation failed here. The filters