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>, <zhipingz@meta.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 v16 00/12] vfio/pci: Add PCIe TPH support
Date: Mon, 15 Jun 2026 08:19:54 -0600 [thread overview]
Message-ID: <20260615081954.35026fed@shazbot.org> (raw)
In-Reply-To: <812b6875-5c46-4e03-af81-161b7e2d0e12@huawei.com>
On Mon, 15 Jun 2026 20:19:48 +0800
fengchengwen <fengchengwen@huawei.com> wrote:
> Gentle ping for v16 TPH series.
>
> Would appreciate reviews from Alex and Jason. Let me know if major
> changes are needed.
The same changes that were still being discussed while v15 and v16 were
posted, I don't think vfio-pci is the right place to host a CPU to ST
translation interface. Thanks,
Alex
> On 6/4/2026 9:27 PM, Chengwen Feng wrote:
> > This patchset enables full userspace configurable PCIe TPH support
> > for VFIO, which brings performance benefits for userspace workloads
> > such as DPDK and SPDK.
> >
> > Currently VFIO only exposes read-only TPH capability registers to
> > userspace, while all write operations are silently discarded. This
> > prevents userspace from enabling and configuring TPH, limiting
> > performance optimization opportunities.
> >
> > Per PCIe spec 7.5.3.15: TPH Completer support is applicable to Root
> > Ports and Endpoints, allowing Steering Tags to target host CPUs or
> > peer devices for P2P transactions.
> >
> > TPH usage model can be divided into three fundamental parts:
> > 1. Retrieve Steering Tag:
> > - Tags targeting host CPUs are obtained via platform methods
> > (ACPI _DSM) wrapped in pcie_tph_get_cpu_st(). Userspace requires a
> > generic interface to query these CPU-associated ST values.
> > - Tags targeting peer devices are managed by userspace drivers.
> > 2. Program Steering Tag table:
> > - For devices with standard ST table structures (in capability
> > space or MSI-X table), userspace needs a unified interface to
> > configure ST entries.
> > - Devices without standard ST tables are handled by userspace
> > itself. 3. Toggle device TPH Requester enable/disable state.
> >
> > To support the above scenarios, this series extends VFIO with
> > complete TPH virtualization features:
> > - New device feature TPH_CPU_ST: Batch query interface to resolve
> > CPU-specific ST tags.
> > - New device feature TPH_ST_CONFIG: Batch configure interface for
> > device ST table entries, with shadow cache and atomic rollback
> > support.
> > - Full TPH capability register virtualization: allow userspace to
> > toggle TPH Requester state via TPH_CTRL register writes.
> >
> > To guarantee isolation and security, this patchset adopts a
> > two-level safety gate design with careful ABI considerations:
> > 1. Global unsafe gate:
> > TPH caching behavior may cross isolation domains and impact
> > shared platform resources. A new module parameter
> > `enable_unsafe_tph` is introduced (default off) to globally gate
> > all TPH functionalities. 2. Per-device opt-in gate:
> > To preserve strict ABI compatibility and avoid unexpected
> > hardware state changes for existing users, a new VFIO device
> > feature TPH_ENABLE is added. TPH capabilities are only available
> > after userspace explicitly enables it per-device.
> >
> > Because Kernel PCI TPH implementation requires TPH Requester to be
> > enabled before programming ST entries. To support userspace
> > configuring ST table in arbitrary order, a shadow ST table is
> > introduced to buffer ST writes before TPH is enabled. All cached
> > entries are flushed to hardware when TPH Requester turns on. This
> > also provides atomic batch rollback capability for reliable
> > configuration.
> >
> > The patchset is split into two logical parts: the first seven
> > patches fix and refactor core PCI/TPH kernel code to export
> > required helper interfaces, and the remaining five patches
> > implement corresponding VFIO TPH virtualization layer step by step.
> >
> > Patch breakdown:
> > 1/12 PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction
> > 2/12 PCI/TPH: Fix tph_enabled concurrent update race by bitfield
> > packing 3/12 PCI/TPH: Cache TPH requester capability at probe time
> > 4/12 PCI/TPH: Refactor pcie_enable_tph & add explicit requester
> > variant 5/12 PCI/TPH: Refactor pcie_tph_get_cpu_st & add explicit
> > variant 6/12 PCI/TPH: expose the enabled TPH requester type
> > 7/12 PCI/TPH: Add pcie_tph_supported() helper to check TPH
> > capability attrs 8/12 vfio/pci: Hide TPH capability when TPH is
> > unsupported 9/12 vfio/pci: Add TPH_ENABLE feature skeleton and
> > unsafe module parameter 10/12 vfio/pci: Add TPH_CPU_ST to query
> > CPU's TPH steering tag 11/12 vfio/pci: Add TPH_ST_CONFIG for PCIe
> > TPH ST configuration 12/12 vfio/pci: Virtualize PCIe TPH capability
> > registers
> >
> > Based on earlier RFC work by Wathsala Vithanage
> >
> > ---
> > v16:
> > - Supports opt-in at the device level which address Alex's comment.
> > - Split sub-commit: add hide TPH capability when TPH is unsupported.
> > - Optimize the tph fields layout of the pci_dev structure.
> > - Optimize virtualize PCIe TPH capability commit: support rollback
> > when set fail.
> > - Reorder PCI/TPH commits: make fix commit ahead.
> > - Reorganized the cover letter to serve as the starting point for
> > discussion.
> > v15: Address Alex's comments:
> > - Drop TPH capability when tph_cap=0
> > - Use _explicit postfix other than add policy parameter for enable
> > TPH and get tph st.
> > - Make sure set st entry under D0
> > - Reimpl virtualize TPH capability register
> > - Other fix
> > v14:
> > - Return PCI_TPH_LOC_NONE when !CONFIG_PCIE_TPH accord Alex's
> > comment
> > - Fix Sashiko comments:
> > - Clear ST shadow state across user session
> > - Fix out-of-bounds byte masking in vfio_pci_tph_config_read
> >
> > Chengwen Feng (11):
> > PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction
> > PCI/TPH: Fix tph_enabled concurrent update race by bitfield
> > packing PCI/TPH: Cache TPH requester capability at probe time
> > PCI/TPH: Refactor pcie_enable_tph & add explicit requester variant
> > PCI/TPH: Refactor pcie_tph_get_cpu_st & add explicit variant
> > PCI/TPH: Add pcie_tph_supported() helper to check TPH capability
> > attributes
> > vfio/pci: Hide TPH capability when TPH is unsupported
> > vfio/pci: Add TPH_ENABLE feature skeleton and unsafe module
> > parameter vfio/pci: Add TPH_CPU_ST to query CPU's TPH steering tag
> > vfio/pci: Add TPH_ST_CONFIG for PCIe TPH ST configuration
> > vfio/pci: Virtualize PCIe TPH capability registers
> >
> > Zhiping Zhang (1):
> > PCI/TPH: expose the enabled TPH requester type
> >
> > drivers/pci/tph.c | 220
> > ++++++++++++++++++++-------- drivers/vfio/pci/vfio_pci.c |
> > 13 +- drivers/vfio/pci/vfio_pci_config.c | 111 ++++++++++++++
> > drivers/vfio/pci/vfio_pci_core.c | 228
> > ++++++++++++++++++++++++++++- include/linux/pci-tph.h |
> > 22 +++ include/linux/pci.h | 6 +-
> > include/linux/vfio_pci_core.h | 7 +-
> > include/uapi/linux/vfio.h | 60 ++++++++
> > 8 files changed, 600 insertions(+), 67 deletions(-)
> >
>
prev parent reply other threads:[~2026-06-15 14:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 13:27 [PATCH v16 00/12] vfio/pci: Add PCIe TPH support Chengwen Feng
2026-06-04 13:27 ` [PATCH v16 01/12] PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction Chengwen Feng
2026-06-04 13:27 ` [PATCH v16 02/12] PCI/TPH: Fix tph_enabled concurrent update race by bitfield packing Chengwen Feng
2026-06-04 13:27 ` [PATCH v16 03/12] PCI/TPH: Cache TPH requester capability at probe time Chengwen Feng
2026-06-04 13:27 ` [PATCH v16 04/12] PCI/TPH: Refactor pcie_enable_tph & add explicit requester variant Chengwen Feng
2026-06-04 13:27 ` [PATCH v16 05/12] PCI/TPH: Refactor pcie_tph_get_cpu_st & add explicit variant Chengwen Feng
2026-06-04 13:27 ` [PATCH v16 06/12] PCI/TPH: expose the enabled TPH requester type Chengwen Feng
2026-06-04 13:27 ` [PATCH v16 07/12] PCI/TPH: Add pcie_tph_supported() helper to check TPH capability attributes Chengwen Feng
2026-06-04 13:28 ` [PATCH v16 08/12] vfio/pci: Hide TPH capability when TPH is unsupported Chengwen Feng
2026-06-04 13:48 ` sashiko-bot
2026-06-04 13:28 ` [PATCH v16 09/12] vfio/pci: Add TPH_ENABLE feature skeleton and unsafe module parameter Chengwen Feng
2026-06-04 13:54 ` sashiko-bot
2026-06-15 1:26 ` fengchengwen
2026-06-04 13:28 ` [PATCH v16 10/12] vfio/pci: Add TPH_CPU_ST to query CPU's TPH steering tag Chengwen Feng
2026-06-04 13:55 ` sashiko-bot
2026-06-15 1:31 ` fengchengwen
2026-06-04 13:28 ` [PATCH v16 11/12] vfio/pci: Add TPH_ST_CONFIG for PCIe TPH ST configuration Chengwen Feng
2026-06-04 13:51 ` sashiko-bot
2026-06-04 13:28 ` [PATCH v16 12/12] vfio/pci: Virtualize PCIe TPH capability registers Chengwen Feng
2026-06-04 14:05 ` sashiko-bot
2026-06-15 3:57 ` fengchengwen
2026-06-15 12:19 ` [PATCH v16 00/12] vfio/pci: Add PCIe TPH support fengchengwen
2026-06-15 14:19 ` Alex Williamson [this message]
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=20260615081954.35026fed@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 \
--cc=zhipingz@meta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.