public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] Proposal: Add sysfs interface for PCIe TPH Steering Tag retrieval and configuration
@ 2026-04-10 14:30 fengchengwen
  2026-04-13 10:01 ` Leon Romanovsky
  2026-04-13 13:35 ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: fengchengwen @ 2026-04-10 14:30 UTC (permalink / raw)
  To: linux-pci; +Cc: bhelgaas

Hi all,

I'm writing to propose adding a sysfs interface to expose and configure 
the PCIe TPH
Steering Tag for PCIe devices, which is retrieved inside the kernel.


Background: The TPH Steering Tag is tightly coupled with both a PCIe 
device (identified
by its BDF) and a CPU core. It can only be obtained in kernel mode. To 
allow user-space
applications to fetch and set this value securely and conveniently, we 
need a standard
kernel-to-user interface.


Proposed Solution: Add several sysfs attributes under each PCIe device's 
sysfs directory:
1. /sys/bus/pci/devices/<BDF>/tph_mode to query the TPH mode (interrupt 
or device specific)
2. /sys/bus/pci/devices/<BDF>/tph_enable to control the TPH feature
3. /sys/bus/pci/devices/<BDF>/tph_st to support both read and write 
operations, e.g.:
    Read operation:
      echo "cpu=3" > /sys/bus/pci/devices/0000:01:00.0/tph_st
      cat /sys/bus/pci/devices/0000:01:00.0/tph_st
    Write operation:
      echo "index=10 st=123" > /sys/bus/pci/devices/0000:01:00.0/tph_st


The design strictly follows PCI subsystem sysfs standards and has the 
following key properties:

1. Dynamic Visibility: The sysfs attributes will only be present for 
PCIe devices that
    support TPH Steering Tag. Devices without TPH capability will not 
show these nodes,
    avoiding unnecessary user confusion.

2. Permission Control: The attributes will use 0600 file permissions, 
ensuring only
    privileged root users can read or write them, which satisfies 
security requirements
    for hardware configuration interfaces.

3. Standard Implementation Location: The interface will be implemented in
    drivers/pci/pci-sysfs.c, the canonical location for all PCI device 
sysfs attributes,
    ensuring consistency and maintainability within the PCI subsystem.


Why sysfs instead of alternatives like VFIO-PCI ioctl:

- Universality: sysfs does not require binding the device to a special 
driver such as
   vfio-pci. It is available to any privileged user-space component, 
including system
   utilities, daemons, and monitoring tools.

- Simplicity: Both user-space usage (cat/echo) and kernel implementation are
   straightforward, reducing code complexity and long-term maintenance cost.

- Design Alignment: TPH Steering Tag is a generic PCIe device feature, 
not specific to
   user-space drivers like DPDK or VFIO. Exposing it via sysfs matches 
the kernel's
   standard pattern for hardware capabilities.


I look forward to your comments about this design before submitting the 
final patch.

Best regards,
Chengwen Feng

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-13 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 14:30 [RFC] Proposal: Add sysfs interface for PCIe TPH Steering Tag retrieval and configuration fengchengwen
2026-04-13 10:01 ` Leon Romanovsky
2026-04-13 12:04   ` fengchengwen
2026-04-13 13:35 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox