Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AD533CF678; Tue, 23 Jun 2026 08:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.222 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782204668; cv=none; b=uG+ZqKHgrWfnnBgBrl1AE3VabhexbswqImPiNbH/4HD1BO8LE36PK2dRLea/AlYCSL4TmZ1yppiNgAe0hANV7wIdVdOO6ATQnbWsb73iF6SAGzU9YjjXrgD4+WbIIO6pPVTs5nKxkJ3UjBYCeN5Sz/RmyTGzobDCyXOLgP0isGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782204668; c=relaxed/simple; bh=W4zwtyupoeZphbbUyS5Fj/XWF/bS6aBYcZ1u548qtvE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=glXoRfdqd/EOGitLice/feSktYpTkulTLepMWfiHWrBYigyDU74lIS898pK3Z75xQGLZ9oxWOiVcz7h210PIGS+RelhysnBX6iaxkaLML7eVvs+bfpIgZoJQ6q7CTkI36wXWsiZMQa5u4eI3HQhhEsgz5Dizl5iY40oVdC3NHCU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=EIX5uFB6; arc=none smtp.client-ip=113.46.200.222 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="EIX5uFB6" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=COwhCRDRamQXqc2VLgLlo+mz84yvBxyVx6JKIeyOANc=; b=EIX5uFB6Y1T0l0r8/yWas9V7OLnwuuzqsXr4Cy+mGQWxe2OJJV+ouhTFynSHosHz/buCqI4q6 i+ZZZkxR1Mr/HN7NA0iESzQmx/HWOcwZsR2C71xCL2l8gqEye3Ui/n0Rkj7ISrDTF3GZ+eLV6QD n57ymQIHgUm7VWehJejUt3c= Received: from mail.maildlp.com (unknown [172.19.163.127]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4gkz8136vczLlXJ; Tue, 23 Jun 2026 16:41:53 +0800 (CST) Received: from kwepemo500009.china.huawei.com (unknown [7.202.194.199]) by mail.maildlp.com (Postfix) with ESMTPS id 2316040572; Tue, 23 Jun 2026 16:50:58 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) by kwepemo500009.china.huawei.com (7.202.194.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Tue, 23 Jun 2026 16:50:57 +0800 From: Chengwen Feng To: , , CC: , , , , , , , Subject: [PATCH RESEND v18 06/12] PCI/TPH: Expose the enabled TPH requester type Date: Tue, 23 Jun 2026 16:50:42 +0800 Message-ID: <20260623085048.51139-7-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260623085048.51139-1-fengchengwen@huawei.com> References: <20260623085048.51139-1-fengchengwen@huawei.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To kwepemo500009.china.huawei.com (7.202.194.199) From: Zhiping Zhang Add pcie_tph_enabled_req_type() so drivers can query the enabled TPH requester mode without reaching into pci_dev internals. Signed-off-by: Zhiping Zhang Signed-off-by: Chengwen Feng --- drivers/pci/tph.c | 12 ++++++++++++ include/linux/pci-tph.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c index 70273c44e8fd..ea777cc33ae6 100644 --- a/drivers/pci/tph.c +++ b/drivers/pci/tph.c @@ -479,6 +479,18 @@ int pcie_enable_tph_explicit(struct pci_dev *pdev, int mode, bool extended) } EXPORT_SYMBOL(pcie_enable_tph_explicit); +/** + * pcie_tph_enabled_req_type - Return the device's enabled TPH requester type + * @pdev: PCI device to query + * + * Return: PCI_TPH_REQ_DISABLE, PCI_TPH_REQ_TPH_ONLY or PCI_TPH_REQ_EXT_TPH. + */ +u8 pcie_tph_enabled_req_type(struct pci_dev *pdev) +{ + return pdev->tph_req_type; +} +EXPORT_SYMBOL(pcie_tph_enabled_req_type); + void pci_restore_tph_state(struct pci_dev *pdev) { struct pci_cap_saved_state *save_state; diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h index 1a508b3d511f..e4f7045fc152 100644 --- a/include/linux/pci-tph.h +++ b/include/linux/pci-tph.h @@ -33,6 +33,7 @@ int pcie_tph_get_cpu_st_explicit(struct pci_dev *pdev, void pcie_disable_tph(struct pci_dev *pdev); int pcie_enable_tph(struct pci_dev *pdev, int mode); int pcie_enable_tph_explicit(struct pci_dev *pdev, int mode, bool extended); +u8 pcie_tph_enabled_req_type(struct pci_dev *pdev); u16 pcie_tph_get_st_table_size(struct pci_dev *pdev); u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev); #else @@ -47,6 +48,8 @@ static inline int pcie_tph_get_cpu_st_explicit(struct pci_dev *pdev, enum tph_mem_type mem_type, bool extended, unsigned int cpu, u16 *tag) { return -EINVAL; } +static inline u8 pcie_tph_enabled_req_type(struct pci_dev *pdev) +{ return PCI_TPH_REQ_DISABLE; } static inline void pcie_disable_tph(struct pci_dev *pdev) { } static inline int pcie_enable_tph(struct pci_dev *pdev, int mode) { return -EINVAL; } -- 2.17.1