Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5759596rwb; Tue, 22 Nov 2022 04:42:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf4wZ5Z9WSbeabdQdOEhkBRUBGy1ZN4y3hnZeIQDbY6ygYH2wr4N/kmO4HTPtr/HDE6iHovd X-Received: by 2002:a17:907:a709:b0:79f:cd7c:e861 with SMTP id vw9-20020a170907a70900b0079fcd7ce861mr19140369ejc.339.1669120965102; Tue, 22 Nov 2022 04:42:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669120965; cv=none; d=google.com; s=arc-20160816; b=UQoQhNOq8hMZhdn9OFtDk4JzD3+LdAAySlgrX4ynzF3a3y9TRjSpZVM56HtHfAaOoK DnoBMhvAupjyKpXpE/VRrQ2LPJ8SQ1eLVAhndJMa8ZDSE4eSGY99c+oumzHXcP3b0rL/ NoKw8gJP6oPuXePHTYkaYMkmAukL582+eBvRumexJ/Gh0Suw4FZnQtjXnGv8eFc04mlc SGHj2GJ/ncdnAKHHlA1hAiGNOi3Js2m00L2GjOu/HOxuvllm1Nl+gpXLLSP3wmJPdlhq 5q/XRAwBEXzlOUighLkJkZhXfX6vuqIybPSA9iLu7Pi6OcN9tERGbaDoSfj7oGGH7Icp oIBw== 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 :message-id:date:subject:cc:to:from; bh=wXnGJ8WfbXeHkfGTLyzkhdZa4f4dIK+Ah47n3jSjx3c=; b=SvFLgC1a7aBRlyZv3bZWB9tgSeoYlD+AbjfzAaDZiyXFwmq+oG4+GFYqzCQ7O1E6sc UzJS+ckmPWxE70OiDG8WPHv5UiE+vSEY8DBqpbVyUr5G6VZoeCaef7kckwsc1frnPqlj UKd2OkDtE33PH0BpL94kXQ9Br7lOoGOxYiEm2E3I9O62NsHnQpjvX/8TUYc/SU+ufPPH t1l/kpFVDDFtFEzLL32Xi5RQHuS2NkiKaGFtQ5W9c0lvHNFNPW69UjiVcA/ewzlMezk8 kBwEpYTjSl8VN1CdiBxhPQr+WDfv9UPKh/NfpLJLfU96oey0nJO7ZRiY/VfkNA//gPeO YIZA== 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 s19-20020a056402521300b00468eee74e58si12624759edd.273.2022.11.22.04.42.22; Tue, 22 Nov 2022 04:42:45 -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 S233526AbiKVMDl (ORCPT + 91 others); Tue, 22 Nov 2022 07:03:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231993AbiKVMDk (ORCPT ); Tue, 22 Nov 2022 07:03:40 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80444DFA0; Tue, 22 Nov 2022 04:03:39 -0800 (PST) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NGjWB0vH7zJnlc; Tue, 22 Nov 2022 20:00:22 +0800 (CST) Received: from localhost.localdomain (10.67.164.66) by canpemm500009.china.huawei.com (7.192.105.203) 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 20:03:37 +0800 From: Yicong Yang To: , , , CC: , , , , , Yicong Yang Subject: [PATCH 1/2] hwtracing: hisi_ptt: Only add the supported devices to the filters list Date: Tue, 22 Nov 2022 20:02:08 +0800 Message-ID: <20221122120209.25682-1-yangyicong@huawei.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.164.66] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 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 --- 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 -- 2.24.0