Skip to content

Commit

Permalink
s390x/pci: refresh fh before disabling aif
Browse files Browse the repository at this point in the history
Typically we refresh the host fh during CLP enable, however it's possible
that the device goes through multiple reset events before the guest
performs another CLP enable.  Let's handle this for now by refreshing the
host handle from vfio before disabling aif.

Fixes: 0345195 ("s390x/pci: reset ISM passthrough devices on shutdown and system reset")
Reported-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Message-ID: <20240118185151.265329-3-mjrosato@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
rosatomj authored and huth committed Jan 19, 2024
1 parent 07b2c8e commit 30e3525
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hw/s390x/s390-pci-kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "hw/s390x/s390-pci-bus.h"
#include "hw/s390x/s390-pci-kvm.h"
#include "hw/s390x/s390-pci-inst.h"
#include "hw/s390x/s390-pci-vfio.h"
#include "cpu_models.h"

bool s390_pci_kvm_interp_allowed(void)
Expand Down Expand Up @@ -64,6 +65,14 @@ int s390_pci_kvm_aif_disable(S390PCIBusDevice *pbdev)
return -EINVAL;
}

/*
* The device may have already been reset but we still want to relinquish
* the guest ISC, so always be sure to use an up-to-date host fh.
*/
if (!s390_pci_get_host_fh(pbdev, &args.fh)) {
return -EPERM;
}

rc = kvm_vm_ioctl(kvm_state, KVM_S390_ZPCI_OP, &args);
if (rc == 0) {
pbdev->aif = false;
Expand Down

0 comments on commit 30e3525

Please sign in to comment.