• Yong Wu's avatar
    iommu/mediatek: Adjust the PA for the 4GB Mode · b4dad40e
    Yong Wu authored
    After extending the v7s support PA[33:32] for MediaTek, we have to adjust
    the PA ourself for the 4GB mode.
    
    In the 4GB Mode, the PA will remap like this:
    CPU PA         ->    M4U output PA
    0x4000_0000          0x1_4000_0000 (Add bit32)
    0x8000_0000          0x1_8000_0000 ...
    0xc000_0000          0x1_c000_0000 ...
    0x1_0000_0000        0x1_0000_0000 (No change)
    
    1) Always add bit32 for CPU PA in ->map.
    2) Discard the bit32 in iova_to_phys if PA > 0x1_4000_0000 since the
    iommu consumer always use the CPU PA.
    
    Besides, the "oas" always is set to 34 since v7s has already supported our
    case.
    
    Both mt2712 and mt8173 support this "4GB mode" while the mt8183 don't.
    The PA in mt8183 won't remap.
    Signed-off-by: default avatarYong Wu <yong.wu@mediatek.com>
    Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    b4dad40e
mtk_iommu.c 21.6 KB