• J
    iommu/sva: Track mm changes with an MMU notifier · a2f9e103
    Jean-Philippe Brucker 提交于
    hulk inclusion
    category: feature
    bugzilla: 14369
    CVE: NA
    -------------------
    
    When creating an io_mm structure, register an MMU notifier that informs
    us when the virtual address space changes and disappears.
    
    Add a new operation to the IOMMU driver, mm_invalidate, called when a
    range of addresses is unmapped to let the IOMMU driver send ATC
    invalidations. mm_invalidate cannot sleep.
    
    Adding the notifier complicates io_mm release. In one case device
    drivers free the io_mm explicitly by calling unbind (or detaching the
    device from its domain). In the other case the process could crash
    before unbind, in which case the release notifier has to do all the
    work.
    
    Allowing the device driver's mm_exit() handler to sleep adds another
    complication, but it will greatly simplify things for users. For example
    VFIO can take the IOMMU mutex and remove any trace of io_mm, instead of
    introducing complex synchronization to delicatly handle this race. But
    relaxing the user side does force unbind() to sleep and wait for all
    pending mm_exit() calls to finish.
    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>
    a2f9e103
iommu.h 32.3 KB