public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] vfio/pci: add msi interrupt affinity support
@ 2024-06-06 15:10 Fred Griffoul
  2024-06-06 15:10 ` [PATCH v3 1/2] cgroup/cpuset: export cpuset_cpus_allowed() Fred Griffoul
  2024-06-06 15:10 ` [PATCH v3 2/2] vfio/pci: add msi interrupt affinity support Fred Griffoul
  0 siblings, 2 replies; 6+ messages in thread
From: Fred Griffoul @ 2024-06-06 15:10 UTC (permalink / raw)
  To: griffoul
  Cc: Fred Griffoul, Alex Williamson, Jason Gunthorpe, Yi Liu,
	Kevin Tian, Eric Auger, Stefan Hajnoczi, Christian Brauner,
	Ankit Agrawal, Reinette Chatre, Ye Bin, kvm, linux-kernel

v3:
 - add a first patch to export cpuset_cpus_allowed() to be able to
   compile the vfio driver as a kernel module.

v2:
 - change the ioctl() interface to use a cpu_set_t in vfio_irq_set
   'data' to keep the 'start' and 'count' semantic, as suggested by
   David Woodhouse <dwmw2@infradead.org>

v1:

The usual way to configure a device interrupt from userland is to write
the /proc/irq/<irq>/smp_affinity or smp_affinity_list files. When using
vfio to implement a device driver or a virtual machine monitor, this may
not be ideal: the process managing the vfio device interrupts may not be
granted root privilege, for security reasons. Thus it cannot directly
control the interrupt affinity and has to rely on an external command.

This patch extends the VFIO_DEVICE_SET_IRQS ioctl() with a new data flag
to specify the affinity of a vfio pci device interrupt.

The affinity argument must be a subset of the process cpuset, otherwise
an error -EPERM is returned.

The vfio_irq_set argument shall be set-up in the following way:

- the 'flags' field have the new flag VFIO_IRQ_SET_DATA_AFFINITY set
as well as VFIO_IRQ_SET_ACTION_TRIGGER.

- the 'start' field is the device interrupt index. Only one interrupt
can be configured per ioctl().

- the variable-length array consists of one or more CPU index
encoded as __u32, the number of entries in the array is specified in the
'count' field.

Fred Griffoul (2):
  cgroup/cpuset: export cpusset_cpus_allowed()
  vfio/pci: add msi interrupt affinity support

 drivers/vfio/pci/vfio_pci_core.c  | 26 +++++++++++++++++----
 drivers/vfio/pci/vfio_pci_intrs.c | 39 +++++++++++++++++++++++++++++++
 drivers/vfio/vfio_main.c          | 13 +++++++----
 include/uapi/linux/vfio.h         | 10 +++++++-
 kernel/cgroup/cpuset.c            |  1 +
 5 files changed, 80 insertions(+), 9 deletions(-)

--
2.40.1


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

end of thread, other threads:[~2024-06-07 18:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-06 15:10 [PATCH v3 0/2] vfio/pci: add msi interrupt affinity support Fred Griffoul
2024-06-06 15:10 ` [PATCH v3 1/2] cgroup/cpuset: export cpuset_cpus_allowed() Fred Griffoul
2024-06-06 15:45   ` Waiman Long
2024-06-07 16:28     ` Tejun Heo
2024-06-07 18:18       ` Frederic Griffoul
2024-06-06 15:10 ` [PATCH v3 2/2] vfio/pci: add msi interrupt affinity support Fred Griffoul

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