public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] vfio/pci: Support 8-byte PCI loads and stores
@ 2024-04-25 16:56 Gerd Bayer
  2024-04-25 16:56 ` [PATCH v3 1/3] vfio/pci: Extract duplicated code into macro Gerd Bayer
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Gerd Bayer @ 2024-04-25 16:56 UTC (permalink / raw)
  To: Alex Williamson, Jason Gunthorpe, Niklas Schnelle
  Cc: kvm, linux-s390, Ankit Agrawal, Yishai Hadas, Halil Pasic,
	Julian Ruess, Gerd Bayer

Hi all,

this all started with a single patch by Ben to enable writing a user-mode
driver for a PCI device that requires 64bit register read/writes on s390.
A quick grep showed that there are several other drivers for PCI devices
in the kernel that use readq/writeq and eventually could use this, too.
So we decided to propose this for general inclusion.

A couple of suggestions for refactorizations by Jason Gunthorpe and Alex
Williamson later [1], I arrived at this little series that avoids some
code duplication and structures the different-size accesses in
vfio_pci_core_do_io_rw() in a way that the conditional compile of
8-byte accesses no longer creates an odd split of "else-if".

The initial version was tested with a PCI device on s390. This version
has only been tested for reads of 1..8 byte sizes and only been compile
tested for a 32bit architecture (arm).

Thank you,
Gerd Bayer

[1] https://lore.kernel.org/all/20240422153508.2355844-1-gbayer@linux.ibm.com/

Changes v2 -> v3:
- Introduce macro to generate body of different-size accesses in
  vfio_pci_core_do_io_rw (courtesy Alex Williamson).
- Convert if-else if chain to a switch-case construct to better
  accommodate conditional compiles.

Changes v1 -> v2:
- On non 64bit architecture use at most 32bit accesses in
  vfio_pci_core_do_io_rw and describe that in the commit message.
- Drop the run-time error on 32bit architectures.
- The #endif splitting the "else if" is not really fortunate, but I'm
  open to suggestions.

Ben Segal (1):
  vfio/pci: Support 8-byte PCI loads and stores

Gerd Bayer (2):
  vfio/pci: Extract duplicated code into macro
  vfio/pci: Continue to refactor vfio_pci_core_do_io_rw

 drivers/vfio/pci/vfio_pci_rdwr.c | 154 +++++++++++++++++--------------
 include/linux/vfio_pci_core.h    |   3 +
 2 files changed, 90 insertions(+), 67 deletions(-)

-- 
2.44.0


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

end of thread, other threads:[~2024-05-23 21:53 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 16:56 [PATCH v3 0/3] vfio/pci: Support 8-byte PCI loads and stores Gerd Bayer
2024-04-25 16:56 ` [PATCH v3 1/3] vfio/pci: Extract duplicated code into macro Gerd Bayer
2024-04-29 16:31   ` Alex Williamson
2024-05-17 14:22     ` Gerd Bayer
2024-04-29 20:09   ` Jason Gunthorpe
2024-04-29 22:11     ` Alex Williamson
2024-04-29 22:33       ` Jason Gunthorpe
2024-05-21 15:47         ` Gerd Bayer
2024-04-30  8:16       ` liulongfang
2024-05-17 10:47   ` Ramesh Thomas
2024-04-25 16:56 ` [PATCH v3 2/3] vfio/pci: Support 8-byte PCI loads and stores Gerd Bayer
2024-04-29 16:31   ` Alex Williamson
2024-05-21 15:50     ` Gerd Bayer
2024-05-17 10:29   ` Ramesh Thomas
2024-05-20  9:02     ` Tian, Kevin
2024-05-23  0:11       ` Ramesh Thomas
2024-05-23 21:52         ` Ramesh Thomas
2024-05-21 16:40     ` Gerd Bayer
2024-05-22 13:48       ` Jason Gunthorpe
2024-05-22 23:57       ` Ramesh Thomas
2024-04-25 16:56 ` [PATCH v3 3/3] vfio/pci: Continue to refactor vfio_pci_core_do_io_rw Gerd Bayer
2024-04-28  6:59   ` Tian, Kevin
2024-04-29 16:32   ` Alex Williamson
2024-05-21 16:43     ` Gerd Bayer
2024-05-17 11:41   ` Ramesh Thomas

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