From: Jason Gunthorpe <jgg@ziepe.ca>
To: Alex Williamson <alex@shazbot.org>
Cc: fengchengwen <fengchengwen@huawei.com>,
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
Subject: Re: [PATCH v14 0/8] vfio/pci: Add PCIe TPH support
Date: Thu, 4 Jun 2026 15:33:02 -0300 [thread overview]
Message-ID: <20260604183302.GD2487554@ziepe.ca> (raw)
In-Reply-To: <20260603125308.0116aa14@shazbot.org>
On Wed, Jun 03, 2026 at 12:53:08PM -0600, Alex Williamson wrote:
> On Tue, 2 Jun 2026 21:45:24 -0300
> Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> > On Wed, Jun 03, 2026 at 08:34:53AM +0800, fengchengwen wrote:
> >
> > > This translation helper is required to handle varied TPH configurations,
> > > including cases where ST entries live inside device private registers
> > > instead of MSI-X or TPH capability space.
> >
> > I thought we agreed vfio had to block that feature in config space due
> > to security concerns? That's what enable_unsafe_tph is about, right?
>
> Steering tags can effectively live in one of three places. The
> architected locations are the TPH capability itself and the MSI-X
> table, where support is mutually exclusive. However the device can
> support either of these and still enable DS mode, thus essentially
> a third location.
>
> None of these are particularly more or less unsafe than another. It's
> inadvisable for drivers to write to the MSI-X vector table, versus
> using the SET_IRQS uAPI, but it's not prevented anymore via mmap.
We'd have to go back to preventing it..
> We don't provide direct write access to the TPH capability, but
> backdoors to config space are not uncommon.
I think we can discount this, if a device exposes TPH through config
then it should keep it secure.
> I'm actually still wrestling with the question whether any of this is
> really unsafe beyond the scope of ownership of the device at all.
Well there is certainly some kind of DOS argument for calling it
unsafe, and we don't actually know what effects the TPH value even
has.
I'd be much more worried about some "smart" accelerator device doing
something impactful based on TPH than insecure config space for
example.
> > I agree in general that the presence of enable_unsafe_tph VFIO has to
> > report the per-device steering tags to userspace so it can program the
> > device specific registers, nothing else can do this.
>
> What's the scope of "nothing else" here? The raw ST value for a CPU is
> derived from an ACPI _DSM associated to a root port. So if the scope
> is that the kernel needs to provide that translation, I agree, but
> where in the kernel it's provided may still require some thought.
The APIs accept a PCI device:
int pcie_tph_get_cpu_st(struct pci_dev *pdev, enum tph_mem_type mem_type,
unsigned int cpu, u16 *tag)
IIRC the ACPI allows it to vary based on the source. Nothing else
could provide the PCI device owned by VFIO to these functions..
> We also need to consider how this incorporates Zhiping's series, where
> TPH values can be associated to a dmabuf. Would userspace get access
> to those raw TPH values to program the initiator? It must for DS
> support. Therefore the interface became one of the user handling raw
> ST values and the CPU ID to ST translation became this ill-fitting
> sidecar.
Arguably yes, likely iommufd would need an API to return the ST of the
dmabuf when it maps it.
Jason
next prev parent reply other threads:[~2026-06-04 18:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 12:46 [PATCH v14 0/8] vfio/pci: Add PCIe TPH support Chengwen Feng
2026-05-28 12:46 ` [PATCH v14 1/8] PCI/TPH: Fix pcie_tph_get_st_table_loc() field extraction Chengwen Feng
2026-05-28 12:46 ` [PATCH v14 2/8] PCI/TPH: Cache TPH requester capability at probe time Chengwen Feng
2026-05-28 12:46 ` [PATCH v14 3/8] PCI/TPH: Add requester selection policy to pcie_enable_tph() Chengwen Feng
2026-05-28 12:46 ` [PATCH v14 4/8] PCI/TPH: Add requester policy to pcie_tph_get_cpu_st() Chengwen Feng
2026-05-28 12:46 ` [PATCH v14 5/8] PCI/TPH: expose the enabled TPH requester type Chengwen Feng
2026-05-28 12:46 ` [PATCH v14 6/8] vfio/pci: Add VFIO_DEVICE_FEATURE_TPH_ST_CONFIG for PCIe TPH ST configuration Chengwen Feng
2026-05-28 15:17 ` sashiko-bot
2026-05-28 12:46 ` [PATCH v14 7/8] vfio/pci: Add VFIO_DEVICE_FEATURE_TPH_CPU_ST to query TPH steering tag Chengwen Feng
2026-05-28 12:46 ` [PATCH v14 8/8] vfio/pci: Virtualize PCIe TPH capability registers Chengwen Feng
2026-05-28 16:42 ` sashiko-bot
2026-06-01 15:58 ` [PATCH v14 0/8] vfio/pci: Add PCIe TPH support Alex Williamson
2026-06-02 14:46 ` fengchengwen
2026-06-02 23:08 ` Alex Williamson
2026-06-03 0:34 ` fengchengwen
2026-06-03 0:45 ` Jason Gunthorpe
2026-06-03 1:25 ` fengchengwen
2026-06-03 18:53 ` Alex Williamson
2026-06-04 18:33 ` Jason Gunthorpe [this message]
2026-06-04 20:46 ` Alex Williamson
2026-06-03 17:58 ` Alex Williamson
2026-06-04 1:58 ` 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=20260604183302.GD2487554@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=alex@shazbot.org \
--cc=fengchengwen@huawei.com \
--cc=helgaas@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox