diff options
author | Matthew Rosato <mjrosato@linux.ibm.com> | 2022-09-02 13:27:34 -0400 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2022-09-26 17:23:47 +0200 |
commit | d0bc7091c2013ad2fa164100cf7b17962370e8ab (patch) | |
tree | 76dcd424722b6637b1d4d27fee9ec682e2e2fd15 /hw/s390x/s390-pci-kvm.c | |
parent | 15d0e7942d3b31ff71d8e0e8cec3a8203214f19b (diff) | |
download | qemu-d0bc7091c2013ad2fa164100cf7b17962370e8ab.zip qemu-d0bc7091c2013ad2fa164100cf7b17962370e8ab.tar.gz qemu-d0bc7091c2013ad2fa164100cf7b17962370e8ab.tar.bz2 |
s390x/pci: enable adapter event notification for interpreted devices
Use the associated kvm ioctl operation to enable adapter event notification
and forwarding for devices when requested. This feature will be set up
with or without firmware assist based upon the 'forwarding_assist' setting.
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Message-Id: <20220902172737.170349-6-mjrosato@linux.ibm.com>
[thuth: Rename "forwarding_assist" property to "forwarding-assist"]
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'hw/s390x/s390-pci-kvm.c')
-rw-r--r-- | hw/s390x/s390-pci-kvm.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/hw/s390x/s390-pci-kvm.c b/hw/s390x/s390-pci-kvm.c index 0f16104..9134fe1 100644 --- a/hw/s390x/s390-pci-kvm.c +++ b/hw/s390x/s390-pci-kvm.c @@ -11,12 +11,42 @@ #include "qemu/osdep.h" +#include <linux/kvm.h> + #include "kvm/kvm_s390x.h" #include "hw/s390x/pv.h" +#include "hw/s390x/s390-pci-bus.h" #include "hw/s390x/s390-pci-kvm.h" +#include "hw/s390x/s390-pci-inst.h" #include "cpu_models.h" bool s390_pci_kvm_interp_allowed(void) { return kvm_s390_get_zpci_op() && !s390_is_pv(); } + +int s390_pci_kvm_aif_enable(S390PCIBusDevice *pbdev, ZpciFib *fib, bool assist) +{ + struct kvm_s390_zpci_op args = { + .fh = pbdev->fh, + .op = KVM_S390_ZPCIOP_REG_AEN, + .u.reg_aen.ibv = fib->aibv, + .u.reg_aen.sb = fib->aisb, + .u.reg_aen.noi = FIB_DATA_NOI(fib->data), + .u.reg_aen.isc = FIB_DATA_ISC(fib->data), + .u.reg_aen.sbo = FIB_DATA_AISBO(fib->data), + .u.reg_aen.flags = (assist) ? 0 : KVM_S390_ZPCIOP_REGAEN_HOST + }; + + return kvm_vm_ioctl(kvm_state, KVM_S390_ZPCI_OP, &args); +} + +int s390_pci_kvm_aif_disable(S390PCIBusDevice *pbdev) +{ + struct kvm_s390_zpci_op args = { + .fh = pbdev->fh, + .op = KVM_S390_ZPCIOP_DEREG_AEN + }; + + return kvm_vm_ioctl(kvm_state, KVM_S390_ZPCI_OP, &args); +} |