• L
    iommu: Add APIs for multiple domains per device · a3a19592
    Lu Baolu 提交于
    Sharing a physical PCI device in a finer-granularity way
    is becoming a consensus in the industry. IOMMU vendors
    are also engaging efforts to support such sharing as well
    as possible. Among the efforts, the capability of support
    finer-granularity DMA isolation is a common requirement
    due to the security consideration. With finer-granularity
    DMA isolation, subsets of a PCI function can be isolated
    from each others by the IOMMU. As a result, there is a
    request in software to attach multiple domains to a physical
    PCI device. One example of such use model is the Intel
    Scalable IOV [1] [2]. The Intel vt-d 3.0 spec [3] introduces
    the scalable mode which enables PASID granularity DMA
    isolation.
    
    This adds the APIs to support multiple domains per device.
    In order to ease the discussions, we call it 'a domain in
    auxiliary mode' or simply 'auxiliary domain' when multiple
    domains are attached to a physical device.
    
    The APIs include:
    
    * iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)
      - Detect both IOMMU and PCI endpoint devices supporting
        the feature (aux-domain here) without the host driver
        dependency.
    
    * iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX)
      - Check the enabling status of the feature (aux-domain
        here). The aux-domain interfaces are available only
        if this returns true.
    
    * iommu_dev_enable/disable_feature(dev, IOMMU_DEV_FEAT_AUX)
      - Enable/disable device specific aux-domain feature.
    
    * iommu_aux_attach_device(domain, dev)
      - Attaches @domain to @dev in the auxiliary mode. Multiple
        domains could be attached to a single device in the
        auxiliary mode with each domain representing an isolated
        address space for an assignable subset of the device.
    
    * iommu_aux_detach_device(domain, dev)
      - Detach @domain which has been attached to @dev in the
        auxiliary mode.
    
    * iommu_aux_get_pasid(domain, dev)
      - Return ID used for finer-granularity DMA translation.
        For the Intel Scalable IOV usage model, this will be
        a PASID. The device which supports Scalable IOV needs
        to write this ID to the device register so that DMA
        requests could be tagged with a right PASID prefix.
    
    This has been updated with the latest proposal from Joerg
    posted here [5].
    
    Many people involved in discussions of this design.
    
    Kevin Tian <kevin.tian@intel.com>
    Liu Yi L <yi.l.liu@intel.com>
    Ashok Raj <ashok.raj@intel.com>
    Sanjay Kumar <sanjay.k.kumar@intel.com>
    Jacob Pan <jacob.jun.pan@linux.intel.com>
    Alex Williamson <alex.williamson@redhat.com>
    Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
    Joerg Roedel <joro@8bytes.org>
    
    and some discussions can be found here [4] [5].
    
    [1] https://software.intel.com/en-us/download/intel-scalable-io-virtualization-technical-specification
    [2] https://schd.ws/hosted_files/lc32018/00/LC3-SIOV-final.pdf
    [3] https://software.intel.com/en-us/download/intel-virtualization-technology-for-directed-io-architecture-specification
    [4] https://lkml.org/lkml/2018/7/26/4
    [5] https://www.spinics.net/lists/iommu/msg31874.html
    
    Cc: Ashok Raj <ashok.raj@intel.com>
    Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
    Cc: Kevin Tian <kevin.tian@intel.com>
    Cc: Liu Yi L <yi.l.liu@intel.com>
    Suggested-by: NKevin Tian <kevin.tian@intel.com>
    Suggested-by: NJean-Philippe Brucker <jean-philippe.brucker@arm.com>
    Suggested-by: NJoerg Roedel <jroedel@suse.de>
    Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
    Reviewed-by: NJean-Philippe Brucker <jean-philippe.brucker@arm.com>
    Signed-off-by: NJoerg Roedel <jroedel@suse.de>
    a3a19592
iommu.h 24.1 KB