qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] s390x/pci: relax I/O address translation requirement
@ 2025-02-07 20:56 Matthew Rosato
  2025-02-07 20:56 ` [PATCH v4 1/2] s390x/pci: add support for guests that request direct mapping Matthew Rosato
  2025-02-07 20:56 ` [PATCH v4 2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough Matthew Rosato
  0 siblings, 2 replies; 7+ messages in thread
From: Matthew Rosato @ 2025-02-07 20:56 UTC (permalink / raw)
  To: qemu-s390x
  Cc: farman, schnelle, thuth, pasic, borntraeger, richard.henderson,
	david, iii, clegoate, qemu-devel

This series introduces the concept of the relaxed translation requirement
for s390x guests in order to allow bypass of the guest IOMMU for more
efficient PCI passthrough.

With this series, QEMU can indicate to the guest that an IOMMU is not
strictly required for a zPCI device.  This would subsequently allow a
guest linux to use iommu.passthrough=1 and bypass their guest IOMMU for
PCI devices.

When this occurs, QEMU will note the behavior via an intercepted MPCIFC
instruction and will fill the host iommu with mappings of the entire
guest address space in response.

There is a kernel series that adds the relevant behavior needed to
exploit this new feature from within a s390x linux guest.  Most
recent version of that is at [1].

[1]: https://lore.kernel.org/linux-s390/20250207205335.473946-1-mjrosato@linux.ibm.com/

Changes for v4:
- use get_system_memory() instead of ms->ram
- rename rtr_allowed to rtr_avail
- turn off rtr_avail for emulated devices so MPCFIC fence properly
  rejects an attempt at direct mapping (we only advertise via CLP
  for passthrough devices)
- turn off rtr_avail for passthrough ISM devices
- various minor changes

Changes for v3:
- use s390_get_memory_limit
- advertise full aperture for relaxed-translation-capable devices

Changes for v2:
- Add relax-translation property, fence for older machines
- Add a new MPCIFC failure case when direct-mapping requested but
  the relax-translation property is set to off.
- For direct mapping, use a memory alias to handle the SMDA offset and
  then just let vfio handle the pinning of memory.

Matthew Rosato (2):
  s390x/pci: add support for guests that request direct mapping
  s390x/pci: indicate QEMU supports relaxed translation for passthrough

 hw/s390x/s390-pci-bus.c         | 38 +++++++++++++++++++++++++++++++--
 hw/s390x/s390-pci-inst.c        | 13 +++++++++--
 hw/s390x/s390-pci-vfio.c        | 28 +++++++++++++++++++-----
 hw/s390x/s390-virtio-ccw.c      |  5 +++++
 include/hw/s390x/s390-pci-bus.h |  4 ++++
 include/hw/s390x/s390-pci-clp.h |  1 +
 6 files changed, 80 insertions(+), 9 deletions(-)

-- 
2.48.1



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

end of thread, other threads:[~2025-02-10 14:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-07 20:56 [PATCH v4 0/2] s390x/pci: relax I/O address translation requirement Matthew Rosato
2025-02-07 20:56 ` [PATCH v4 1/2] s390x/pci: add support for guests that request direct mapping Matthew Rosato
2025-02-10 13:12   ` Niklas Schnelle
2025-02-10 13:26     ` Cédric Le Goater
2025-02-10 14:52   ` David Hildenbrand
2025-02-07 20:56 ` [PATCH v4 2/2] s390x/pci: indicate QEMU supports relaxed translation for passthrough Matthew Rosato
2025-02-10 13:29   ` Niklas Schnelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).