• Jacob Pan's avatar
    iommu: Introduce guest PASID bind function · 808be0aa
    Jacob Pan authored
    Guest shared virtual address (SVA) may require host to shadow guest
    PASID tables. Guest PASID can also be allocated from the host via
    enlightened interfaces. In this case, guest needs to bind the guest
    mm, i.e. cr3 in guest physical address to the actual PASID table in
    the host IOMMU. Nesting will be turned on such that guest virtual
    address can go through a two level translation:
    - 1st level translates GVA to GPA
    - 2nd level translates GPA to HPA
    This patch introduces APIs to bind guest PASID data to the assigned
    device entry in the physical IOMMU. See the diagram below for usage
    explanation.
    
        .-------------.  .---------------------------.
        |   vIOMMU    |  | Guest process mm, FL only |
        |             |  '---------------------------'
        .----------------/
        | PASID Entry |--- PASID cache flush -
        '-------------'                       |
        |             |                       V
        |             |                      GP
        '-------------'
    Guest
    ------| Shadow |----------------------- GP->HP* ---------
          v        v                          |
    Host                                      v
        .-------------.  .----------------------.
        |   pIOMMU    |  | Bind FL for GVA-GPA  |
        |             |  '----------------------'
        .----------------/  |
        | PASID Entry |     V (Nested xlate)
        '----------------\.---------------------.
        |             |   |Set SL to GPA-HPA    |
        |             |   '---------------------'
        '-------------'
    
    Where:
     - FL = First level/stage one page tables
     - SL = Second level/stage two page tables
     - GP = Guest PASID
     - HP = Host PASID
    * Conversion needed if non-identity GP-HP mapping option is chosen.
    Signed-off-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
    Signed-off-by: default avatarLiu Yi L <yi.l.liu@intel.com>
    Reviewed-by: default avatarJean-Philippe Brucker <jean-philippe@linaro.com>
    Reviewed-by: default avatarJean-Philippe Brucker <jean-philippe@linaro.org>
    Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
    Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    808be0aa
iommu.h 11 KB