• Vasant Hegde's avatar
    iommu/amd: Setup GCR3 table in advance if domain is SVA capable · c9e87011
    Vasant Hegde authored
    SVA can be supported if domain is in passthrough mode or paging domain
    with v2 page table. Current code sets up GCR3 table for domain with v2
    page table only. Setup GCR3 table for all SVA capable domains.
    
      - Move GCR3 init/destroy to separate function.
    
      - Change default GCR3 table to use MAX supported PASIDs. Ideally it
        should use 1 level PASID table as its using PASID zero only. But we
        don't have support to extend PASID table yet. We will fix this later.
    
      - When domain is configured with passthrough mode, allocate default GCR3
        table only if device is SVA capable.
    
    Note that in attach_device() path it will not know whether device will use
    SVA or not. If device is attached to passthrough domain and if it doesn't
    use SVA then GCR3 table will never be used. We will endup wasting memory
    allocated for GCR3 table. This is done to avoid DTE update when
    attaching PASID to device.
    Signed-off-by: default avatarVasant Hegde <vasant.hegde@amd.com>
    Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
    Link: https://lore.kernel.org/r/20240418103400.6229-8-vasant.hegde@amd.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    c9e87011
iommu.c 93.5 KB