Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: fengchengwen <fengchengwen@huawei.com>
Cc: <jgg@ziepe.ca>, <wathsala.vithanage@arm.com>,
	<helgaas@kernel.org>, <wei.huang2@amd.com>,
	<wangzhou1@hisilicon.com>, <wangyushan12@huawei.com>,
	<liuyonglong@huawei.com>, <kvm@vger.kernel.org>,
	<linux-pci@vger.kernel.org>,
	alex@shazbot.org
Subject: Re: [PATCH v11 3/5] PCI/TPH: Add pcie_tph_enabled_mode() helper
Date: Fri, 22 May 2026 08:00:20 -0600	[thread overview]
Message-ID: <20260522080020.11f1d86b@shazbot.org> (raw)
In-Reply-To: <15bffd1b-e0c7-4393-8cbc-ba54586884c9@huawei.com>

On Fri, 22 May 2026 17:18:39 +0800
fengchengwen <fengchengwen@huawei.com> wrote:

> On 5/22/2026 12:10 PM, Alex Williamson wrote:
> > On Mon, 18 May 2026 15:16:59 +0800
> > Chengwen Feng <fengchengwen@huawei.com> wrote:
> >   
> >> Add a helper to query enabled TPH mode on a PCI device. This is useful for
> >> drivers like VFIO-PCI that need to validate TPH state before allowing
> >> access to steering tag tables.
> >>
> >> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> >> ---
> >>  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 ba31b010f67a..91c1e83410a3 100644
> >> --- a/drivers/pci/tph.c
> >> +++ b/drivers/pci/tph.c
> >> @@ -451,6 +451,18 @@ int pcie_enable_tph(struct pci_dev *pdev, int mode)
> >>  }
> >>  EXPORT_SYMBOL(pcie_enable_tph);
> >>  
> >> +/**
> >> + * pcie_tph_enabled_mode - Get current enabled TPH mode
> >> + * @pdev: PCI device
> >> + *
> >> + * Return the enabled TPH mode (IV/DS) or 0 if disabled.
> >> + */
> >> +int pcie_tph_enabled_mode(struct pci_dev *pdev)
> >> +{
> >> +	return pdev->tph_enabled ? pdev->tph_mode : 0;
> >> +}
> >> +EXPORT_SYMBOL(pcie_tph_enabled_mode);  
> > 
> > Doesn't this create ambiguity with PCI_TPH_ST_NS_MODE?  Maybe return an
> > -errno if not enabled.  Duplicate same for stub below.  Thanks,  
> 
> Because pcie_enable_tph(PCI_TPH_ST_NS_MODE) could also enable TPH,
> but PCI_TPH_ST_NS_MODE mean "The function must use a value of all
> zeros for all Steering Tags" So I think pcie_enable_tph() should
> treat PCI_TPH_ST_NS_MODE as a invalid input.

This doesn't make any sense to me, PCI_TPH_ST_NS_MODE is a valid enable
mode for the TPH capability.  Thanks,

Alex

  reply	other threads:[~2026-05-22 14:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  7:16 [PATCH v11 0/5] vfio/pci: Add PCIe TPH support Chengwen Feng
2026-05-18  7:16 ` [PATCH v11 1/5] PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction Chengwen Feng
2026-05-18  7:16 ` [PATCH v11 2/5] PCI/TPH: Export pcie_tph_get_st_modes() for external use Chengwen Feng
2026-05-22  4:10   ` Alex Williamson
2026-05-18  7:16 ` [PATCH v11 3/5] PCI/TPH: Add pcie_tph_enabled_mode() helper Chengwen Feng
2026-05-22  4:10   ` Alex Williamson
2026-05-22  9:18     ` fengchengwen
2026-05-22 14:00       ` Alex Williamson [this message]
2026-05-18  7:17 ` [PATCH v11 4/5] vfio/pci: Add PCIe TPH configuration space virtualization Chengwen Feng
2026-05-22  4:10   ` Alex Williamson
2026-05-22  9:39     ` fengchengwen
2026-05-22 14:09       ` Alex Williamson
2026-05-18  7:17 ` [PATCH v11 5/5] vfio/pci: Add VFIO_DEVICE_FEATURE_TPH_ST for TPH ST entry management Chengwen Feng
2026-05-22  4:10   ` Alex Williamson
2026-05-22 10:04     ` fengchengwen
2026-05-22 14:27       ` Alex Williamson
2026-05-26  6:29         ` fengchengwen
2026-05-22  1:31 ` [PATCH v11 0/5] vfio/pci: Add PCIe TPH support fengchengwen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260522080020.11f1d86b@shazbot.org \
    --to=alex@shazbot.org \
    --cc=fengchengwen@huawei.com \
    --cc=helgaas@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=wangyushan12@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    --cc=wathsala.vithanage@arm.com \
    --cc=wei.huang2@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox