• J
    iommu: introduce device fault report API · ac084b72
    Jacob Pan 提交于
    hulk inclusion
    category: feature
    bugzilla: 14369
    CVE: NA
    -------------------
    
    Traditionally, device specific faults are detected and handled within
    their own device drivers. When IOMMU is enabled, faults such as DMA
    related transactions are detected by IOMMU. There is no generic
    reporting mechanism to report faults back to the in-kernel device
    driver or the guest OS in case of assigned devices.
    
    Faults detected by IOMMU is based on the transaction's source ID which
    can be reported at per device basis, regardless of the device type is a
    PCI device or not.
    
    The fault types include recoverable (e.g. page request) and
    unrecoverable faults(e.g. access error). In most cases, faults can be
    handled by IOMMU drivers internally. The primary use cases are as
    follows:
    1. page request fault originated from an SVM capable device that is
    assigned to guest via vIOMMU. In this case, the first level page tables
    are owned by the guest. Page request must be propagated to the guest to
    let guest OS fault in the pages then send page response. In this
    mechanism, the direct receiver of IOMMU fault notification is VFIO,
    which can relay notification events to QEMU or other user space
    software.
    
    2. faults need more subtle handling by device drivers. Other than
    simply invoke reset function, there are needs to let device driver
    handle the fault with a smaller impact.
    
    This patchset is intended to create a generic fault report API such
    that it can scale as follows:
    - all IOMMU types
    - PCI and non-PCI devices
    - recoverable and unrecoverable faults
    - VFIO and other other in kernel users
    - DMA & IRQ remapping (TBD)
    The original idea was brought up by David Woodhouse and discussions
    summarized at https://lwn.net/Articles/608914/.
    Signed-off-by: NJacob Pan <jacob.jun.pan@linux.intel.com>
    Signed-off-by: NAshok Raj <ashok.raj@intel.com>
    Signed-off-by: NJean-Philippe Brucker <jean-philippe.brucker@arm.com>
    Signed-off-by: NFang Lijun <fanglijun3@huawei.com>
    Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
    Reviewed-by: NZhen Lei <thunder.leizhen@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    ac084b72
iommu.c 55.9 KB