• Jacob Pan's avatar
    iommu/vt-d: Fix CPU and IOMMU SVM feature matching checks · ff3dc652
    Jacob Pan authored
    Shared Virtual Memory(SVM) is based on a collective set of hardware
    features detected at runtime. There are requirements for matching CPU
    and IOMMU capabilities.
    
    The current code checks CPU and IOMMU feature set for SVM support but
    the result is never stored nor used. Therefore, SVM can still be used
    even when these checks failed. The consequences can be:
    1. CPU uses 5-level paging mode for virtual address of 57 bits, but
    IOMMU can only support 4-level paging mode with 48 bits address for DMA.
    2. 1GB page size is used by CPU but IOMMU does not support it. VT-d
    unrecoverable faults may be generated.
    
    The best solution to fix these problems is to prevent them in the first
    place.
    
    This patch consolidates code for checking PASID, CPU vs. IOMMU paging
    mode compatibility, as well as provides specific error messages for
    each failed checks. On sane hardware configurations, these error message
    shall never appear in kernel log.
    Signed-off-by: default avatarJacob Pan <jacob.jun.pan@linux.intel.com>
    Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
    Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
    Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    ff3dc652
intel-svm.c 16.7 KB