From patchwork Tue Nov 22 12:02:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yicong Yang X-Patchwork-Id: 24329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2163324wrr; Tue, 22 Nov 2022 04:13:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf69c6fVxmoU33J71UZ8R7wsxyknifSYxL693R1UnGlksP7SBDuUspnb1ypQXiXBuPk6KBg9 X-Received: by 2002:a17:907:1308:b0:7a3:9fca:785d with SMTP id vj8-20020a170907130800b007a39fca785dmr3896965ejb.303.1669119229191; Tue, 22 Nov 2022 04:13:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669119229; cv=none; d=google.com; s=arc-20160816; b=DxIMUuEp+d/ObQGEfZehf2+dkPPgLjheCyTD1DeoB4KTpNK1/BhkizlcKXfoHSOENC eZXhbkwGZQ6wqEm4IGbBrLjUsKjXmehkCrfhKIMfsAkNiA45DUKL7WIjV2tv9/dZvR2c BSgqYdkuw3EXLi1+TWP5qpHnSOS/JFZUEJvb7NvprujhGgxELDNo/TRhr0LOTd7en7nU YFlQhGJGrqBs+JUuBa4eOMgg3cKcvPNbtxCY4Ma7wyOmMczlmEEYz/D/An5ZdwDmEXCt TSw5gUbBWorY7ZPXPkoxDUCWkgyoM8y2WTSax0cX2PF9lfBKm2MQTQAK5t8gQTr42K4A jP6Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wz13-20020a170906fe4d00b0072a477a55e0si11591451ejb.369.2022.11.22.04.13.23; Tue, 22 Nov 2022 04:13:49 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750198364834919155?= X-GMAIL-MSGID: =?utf-8?q?1750198364834919155?= 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 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