RE: [RFC PATCH] vfio/pci: add PCIe TPH to device feature ioctl

From: Tian, Kevin
Date: Mon Apr 07 2025 - 01:17:34 EST


> From: Wathsala Wathawana Vithanage <wathsala.vithanage@xxxxxxx>
> Sent: Friday, March 14, 2025 9:49 AM
> > >
> > > Having said that, regardless of this proposal or the availability of kernel
> > > TPH support, a VFIO driver could enable TPH and set an arbitrary ST on
> the
> > > MSI-X/ST table or a device-specific location on supported platforms. If the
> > > driver doesn't have a list of valid STs, it can enumerate 8- or 16-bit STs
> and
> > > measure access latencies to determine valid ones.
> > >
> >
> > PCI capabilities are managed by the kernel VFIO driver. So w/o this
> > patch no userspace driver can enable TPH to try that trick?
>
> Yes, it's possible. It's just a matter of setting the right bits in the PCI config
> space to enable TPH on the device.
>

No. Before this patch the TPH capability is read-only to userspace,
enforced by vfio-pci. So there is no way that an user can toggle
the TPH cap by itself!