[PATCH v4 00/11] s390x/pci: zPCI interpretation support

Matthew Rosato posted 11 patches 2 years, 1 month ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220314194920.58888-1-mjrosato@linux.ibm.com
Maintainers: Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Jason Herne <jjherne@linux.ibm.com>, Alex Williamson <alex.williamson@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
hw/s390x/meson.build                |   1 +
hw/s390x/s390-pci-bus.c             | 125 ++++++++++++++++++++--
hw/s390x/s390-pci-inst.c            | 136 +++++++++++++++++++++--
hw/s390x/s390-pci-kvm.c             | 160 ++++++++++++++++++++++++++++
hw/s390x/s390-pci-vfio.c            | 151 ++++++++++++++++++++++----
hw/s390x/s390-virtio-ccw.c          |   1 +
hw/vfio/ap.c                        |   2 +-
hw/vfio/ccw.c                       |   2 +-
hw/vfio/common.c                    |  26 ++++-
hw/vfio/pci.c                       |   3 +-
hw/vfio/pci.h                       |   1 +
hw/vfio/platform.c                  |   2 +-
include/hw/s390x/s390-pci-bus.h     |   8 +-
include/hw/s390x/s390-pci-inst.h    |   2 +-
include/hw/s390x/s390-pci-kvm.h     |  68 ++++++++++++
include/hw/s390x/s390-pci-vfio.h    |  11 ++
include/hw/vfio/vfio-common.h       |   4 +-
linux-headers/asm-s390/kvm.h        |   1 +
linux-headers/asm-x86/kvm.h         |   3 +
linux-headers/linux/kvm.h           |  51 ++++++++-
linux-headers/linux/vfio.h          |   6 ++
linux-headers/linux/vfio_zdev.h     |   6 ++
target/s390x/cpu_features_def.h.inc |   1 +
target/s390x/gen-features.c         |   2 +
target/s390x/kvm/kvm.c              |   8 ++
target/s390x/kvm/kvm_s390x.h        |   1 +
26 files changed, 731 insertions(+), 51 deletions(-)
create mode 100644 hw/s390x/s390-pci-kvm.c
create mode 100644 include/hw/s390x/s390-pci-kvm.h
[PATCH v4 00/11] s390x/pci: zPCI interpretation support
Posted by Matthew Rosato 2 years, 1 month ago
For QEMU, the majority of the work in enabling instruction interpretation       
is handled via a new KVM ioctls to enable interpretation, interrupt             
forwarding and registration of the guest IOAT tables.  In order to make         
use of the KVM-managed IOMMU domain operations on the host, we also add         
some code to vfio to indicate that a given device wishes to register the        
alternate domain type for its group.                                            
                                                                                
This series also adds a new, optional 'interpret' parameter to zpci which       
can be used to disable interpretation support (interpret=off) as well as        
an 'forwarding_assist' parameter to determine whether or not the firmware       
assist will be used for interrupt delivery (default when interpretation         
is in use) or whether the host will be responsible for delivering all           
interrupts (forwarding_assist=off).                                             
                                                                                
The ZPCI_INTERP CPU feature is added beginning with the z14 model to            
enable this support.                                                            
                                                                                
As a consequence of implementing zPCI interpretation, ISM devices now           
become eligible for passthrough (but only when zPCI interpretation is           
available).                                                                     
                                                                                
From the perspective of guest configuration, you passthrough zPCI devices       
in the same manner as before, with intepretation support being used by          
default if available in kernel+qemu.                                            
                                                                                
Associated kernel series:                                                       
https://lore.kernel.org/kvm/20220314194451.58266-1-mjrosato@linux.ibm.com/

Changelog v3->v4                                                                
- Unfortunately I had to remove some Review tags because the userspace API      
  moved from vfio device feature ioctls to KVM ioctls in response to            
  feedback from the kernel series.  The vast majority of the QEMU logic         
  remains intact however, with most changes being to the way we issue           
  ioctls.                                                                       
- Additional logic was added to test for availability of the KVM ioctl,         
  this replaces the probe logic done for the vfio ioctls                        
- Add code to issue indicate on VFIO_SET_IOMMU that a KVM-managed IOMMU         
  domain is to be allocated.       

Matthew Rosato (11):
  Update linux headers
  vfio: handle KVM-owned IOMMU requests
  target/s390x: add zpci-interp to cpu models
  s390x/pci: add routine to get host function handle from CLP info
  s390x/pci: enable for load/store intepretation
  s390x/pci: don't fence interpreted devices without MSI-X
  s390x/pci: enable adapter event notification for interpreted devices
  s390x/pci: use KVM-managed IOMMU for interpretation
  s390x/pci: use I/O Address Translation assist when interpreting
  s390x/pci: use dtsm provided from vfio capabilities for interpreted
    devices
  s390x/pci: let intercept devices have separate PCI groups

 hw/s390x/meson.build                |   1 +
 hw/s390x/s390-pci-bus.c             | 125 ++++++++++++++++++++--
 hw/s390x/s390-pci-inst.c            | 136 +++++++++++++++++++++--
 hw/s390x/s390-pci-kvm.c             | 160 ++++++++++++++++++++++++++++
 hw/s390x/s390-pci-vfio.c            | 151 ++++++++++++++++++++++----
 hw/s390x/s390-virtio-ccw.c          |   1 +
 hw/vfio/ap.c                        |   2 +-
 hw/vfio/ccw.c                       |   2 +-
 hw/vfio/common.c                    |  26 ++++-
 hw/vfio/pci.c                       |   3 +-
 hw/vfio/pci.h                       |   1 +
 hw/vfio/platform.c                  |   2 +-
 include/hw/s390x/s390-pci-bus.h     |   8 +-
 include/hw/s390x/s390-pci-inst.h    |   2 +-
 include/hw/s390x/s390-pci-kvm.h     |  68 ++++++++++++
 include/hw/s390x/s390-pci-vfio.h    |  11 ++
 include/hw/vfio/vfio-common.h       |   4 +-
 linux-headers/asm-s390/kvm.h        |   1 +
 linux-headers/asm-x86/kvm.h         |   3 +
 linux-headers/linux/kvm.h           |  51 ++++++++-
 linux-headers/linux/vfio.h          |   6 ++
 linux-headers/linux/vfio_zdev.h     |   6 ++
 target/s390x/cpu_features_def.h.inc |   1 +
 target/s390x/gen-features.c         |   2 +
 target/s390x/kvm/kvm.c              |   8 ++
 target/s390x/kvm/kvm_s390x.h        |   1 +
 26 files changed, 731 insertions(+), 51 deletions(-)
 create mode 100644 hw/s390x/s390-pci-kvm.c
 create mode 100644 include/hw/s390x/s390-pci-kvm.h

-- 
2.27.0