1. 27 Jan, 2021 2 commits
    • Tony Krowiak's avatar
      s390/vfio-ap: No need to disable IRQ after queue reset · 6c12a638
      Tony Krowiak authored
      The queues assigned to a matrix mediated device are currently reset when:
      
      * The VFIO_DEVICE_RESET ioctl is invoked
      * The mdev fd is closed by userspace (QEMU)
      * The mdev is removed from sysfs.
      
      Immediately after the reset of a queue, a call is made to disable
      interrupts for the queue. This is entirely unnecessary because the reset of
      a queue disables interrupts, so this will be removed.
      
      Furthermore, vfio_ap_irq_disable() does an unconditional PQAP/AQIC which
      can result in a specification exception (when the corresponding facility
      is not available), so this is actually a bugfix.
      Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
      [pasic@linux.ibm.com: minor rework before merging]
      Signed-off-by: default avatarHalil Pasic <pasic@linux.ibm.com>
      Fixes: ec89b55e ("s390: ap: implement PAPQ AQIC interception in kernel")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      6c12a638
    • Tony Krowiak's avatar
      s390/vfio-ap: clean up vfio_ap resources when KVM pointer invalidated · f21916ec
      Tony Krowiak authored
      The vfio_ap device driver registers a group notifier with VFIO when the
      file descriptor for a VFIO mediated device for a KVM guest is opened to
      receive notification that the KVM pointer is set (VFIO_GROUP_NOTIFY_SET_KVM
      event). When the KVM pointer is set, the vfio_ap driver takes the
      following actions:
      1. Stashes the KVM pointer in the vfio_ap_mdev struct that holds the state
         of the mediated device.
      2. Calls the kvm_get_kvm() function to increment its reference counter.
      3. Sets the function pointer to the function that handles interception of
         the instruction that enables/disables interrupt processing.
      4. Sets the masks in the KVM guest's CRYCB to pass AP resources through to
         the guest.
      
      In order to avoid memory leaks, when the notifier is called to receive
      notification that the KVM pointer has been set to NULL, the vfio_ap device
      driver should reverse the actions taken when the KVM pointer was set.
      
      Fixes: 258287c9 ("s390: vfio-ap: implement mediated device open callback")
      Signed-off-by: default avatarTony Krowiak <akrowiak@linux.ibm.com>
      Reviewed-by: default avatarHalil Pasic <pasic@linux.ibm.com>
      Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20201223012013.5418-1-akrowiak@linux.ibm.comSigned-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      f21916ec
  2. 25 Jan, 2021 1 commit
  3. 24 Jan, 2021 37 commits