From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) (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 F24BD313520; Wed, 27 May 2026 20:53:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779915220; cv=none; b=LBbLmP851AbhKwSIyFRhDy0cst41VU975YUOqAKUqBc9lA5samH5KawKEjwWaYqNgsFVHDU+I00HuKJfBHUDdVoBEc90hDXkDeA2dimdwI860izm8PF1i9ONFfB/vS0sEiJuVE9ppbSI68/cEEGSr/3hegdnaijLtCyeG6SsP8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779915220; c=relaxed/simple; bh=4YfWInZ9CLb2AOWifcQm5snj/1dxglE9jo08vZEeOVw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fYVnDN2MmYURVCbiheNB0bjaUaZih8Ltu3kzjIMdTKhbhc3WHkEeqbk1WGcqwB59+1GSlSLFwsRFiR7L70l2ER3s0sDW3X+rLNr7+vcHedYWP/zqLTM9eBN3aT0kARQvC0tOufE6C/zcGyE62dciUR3FzUHKVo2F7MJri1tvmBw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shazbot.org; spf=pass smtp.mailfrom=shazbot.org; dkim=pass (2048-bit key) header.d=shazbot.org header.i=@shazbot.org header.b=RNYOFR4v; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=SYR/FQvF; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shazbot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shazbot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shazbot.org header.i=@shazbot.org header.b="RNYOFR4v"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="SYR/FQvF" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id A26A0EC0077; Wed, 27 May 2026 16:53:35 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 27 May 2026 16:53:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shazbot.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1779915215; x=1780001615; bh=TzsAIWJKWxLMYgzdxaWg1KgQLd4L0BjlB8TYvo0b3Wo=; b= RNYOFR4v5bWL/PM5DIyXR4qJ7Z6D92QH4Cy3LppgJ2E10MJO0PuwTaB/1ZS4mPXs HCy0NsxoHbYMZFe3VwIxnIk7UalNGjMCyXkVRadKJ/QJRllBlcvLK0US9bDnRRwH 6klEt3FAKvTL2P4spELYW/PugDCje8LL0Ak2B8lpWgrlMieFy0qqty5mthOK6YVr Rhf9Iewhj29R21KaCbpTOdDzjPQiJ0CmO+Rk7JOctajA/BmSBddG/tAdkJT5GGtW zBuDNHNOx3392bRIFbVn1Ult5hkbN35Ha4jR+7jPRHGfTjrPROxBLy/cGuNVSNd3 ViIUKxEjTTS2UcxD0OILWQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1779915215; x= 1780001615; bh=TzsAIWJKW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r3DgShx8Jfvzey4VBaL0zg X-ME-Proxy: Feedback-ID: i03f14258:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 27 May 2026 16:53:33 -0400 (EDT) Date: Wed, 27 May 2026 14:53:32 -0600 From: Alex Williamson To: Zhiping Zhang Cc: Jason Gunthorpe , Leon Romanovsky , Sumit Semwal , Christian Konig , Bjorn Helgaas , , , , , , Keith Busch , Yochai Cohen , Yishai Hadas , alex@shazbot.org Subject: Re: [PATCH v5 1/4] PCI/TPH: expose the enabled TPH requester type Message-ID: <20260527145332.30412ea4@shazbot.org> In-Reply-To: <20260526144401.1485788-2-zhipingz@meta.com> References: <20260526144401.1485788-1-zhipingz@meta.com> <20260526144401.1485788-2-zhipingz@meta.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 26 May 2026 07:43:53 -0700 Zhiping Zhang wrote: > Add pcie_tph_enabled_req_type() so drivers can query the enabled TPH > requester mode without reaching into pci_dev internals. > > This keeps pci_dev::tph_req_type inside the PCI/TPH code and provides a > !CONFIG_PCIE_TPH stub for callers. > > Signed-off-by: Zhiping Zhang > --- > drivers/pci/tph.c | 12 ++++++++++++ > include/linux/pci-tph.h | 2 ++ > 2 files changed, 14 insertions(+) > > diff --git a/drivers/pci/tph.c b/drivers/pci/tph.c > index 91145e8d9d95..6c4492075ae9 100644 > --- a/drivers/pci/tph.c > +++ b/drivers/pci/tph.c > @@ -174,6 +174,18 @@ u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev) > } > EXPORT_SYMBOL(pcie_tph_get_st_table_loc); > > +/** > + * 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); > + > /* > * Return the size of ST table. If ST table is not in TPH Requester Extended > * Capability space, return 0. Otherwise return the ST Table Size + 1. > diff --git a/include/linux/pci-tph.h b/include/linux/pci-tph.h > index be68cd17f2f8..fe572737b409 100644 > --- a/include/linux/pci-tph.h > +++ b/include/linux/pci-tph.h > @@ -30,6 +30,7 @@ void pcie_disable_tph(struct pci_dev *pdev); > int pcie_enable_tph(struct pci_dev *pdev, int mode); > u16 pcie_tph_get_st_table_size(struct pci_dev *pdev); > u32 pcie_tph_get_st_table_loc(struct pci_dev *pdev); > +u8 pcie_tph_enabled_req_type(struct pci_dev *pdev); > #else > static inline int pcie_tph_set_st_entry(struct pci_dev *pdev, > unsigned int index, u16 tag) > @@ -41,6 +42,7 @@ static inline int pcie_tph_get_cpu_st(struct pci_dev *dev, > static inline void pcie_disable_tph(struct pci_dev *pdev) { } > static inline int pcie_enable_tph(struct pci_dev *pdev, int mode) > { return -EINVAL; } > +static inline u8 pcie_tph_enabled_req_type(struct pci_dev *pdev) { return 0; } nit, s/0/PCI_TPH_REQ_DISABLE/ for consistency. Thanks, Alex