Skip to content
  • Matthew Rosato's avatar
    03451953
    s390x/pci: reset ISM passthrough devices on shutdown and system reset · 03451953
    Matthew Rosato authored
    
    
    ISM device firmware stores unique state information that can
    can cause a wholesale unmap of the associated IOMMU (e.g. when
    we get a termination signal for QEMU) to trigger firmware errors
    because firmware believes we are attempting to invalidate entries
    that are still in-use by the guest OS (when in fact that guest is
    in the process of being terminated or rebooted).
    To alleviate this, register both a shutdown notifier (for unexpected
    termination cases e.g. virsh destroy) as well as a reset callback
    (for cases like guest OS reboot).  For each of these scenarios, trigger
    PCI device reset; this is enough to indicate to firmware that the IOMMU
    is no longer in-use by the guest OS, making it safe to invalidate any
    associated IOMMU entries.
    
    Fixes: 15d0e794 ("s390x/pci: don't fence interpreted devices without MSI-X")
    Signed-off-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
    Message-Id: <20221209195700.263824-1-mjrosato@linux.ibm.com>
    Reviewed-by: default avatarEric Farman <farman@linux.ibm.com>
    [thuth: Adjusted the hunk in s390-pci-vfio.c due to different context]
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
    03451953
    s390x/pci: reset ISM passthrough devices on shutdown and system reset
    Matthew Rosato authored
    
    
    ISM device firmware stores unique state information that can
    can cause a wholesale unmap of the associated IOMMU (e.g. when
    we get a termination signal for QEMU) to trigger firmware errors
    because firmware believes we are attempting to invalidate entries
    that are still in-use by the guest OS (when in fact that guest is
    in the process of being terminated or rebooted).
    To alleviate this, register both a shutdown notifier (for unexpected
    termination cases e.g. virsh destroy) as well as a reset callback
    (for cases like guest OS reboot).  For each of these scenarios, trigger
    PCI device reset; this is enough to indicate to firmware that the IOMMU
    is no longer in-use by the guest OS, making it safe to invalidate any
    associated IOMMU entries.
    
    Fixes: 15d0e794 ("s390x/pci: don't fence interpreted devices without MSI-X")
    Signed-off-by: default avatarMatthew Rosato <mjrosato@linux.ibm.com>
    Message-Id: <20221209195700.263824-1-mjrosato@linux.ibm.com>
    Reviewed-by: default avatarEric Farman <farman@linux.ibm.com>
    [thuth: Adjusted the hunk in s390-pci-vfio.c due to different context]
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Loading