• Andrei Dulea's avatar
    iommu/amd: Fix downgrading default page-sizes in alloc_pte() · 6ccb72f8
    Andrei Dulea authored
    Downgrading an existing large mapping to a mapping using smaller
    page-sizes works only for the mappings created with page-mode 7 (i.e.
    non-default page size).
    
    Treat large mappings created with page-mode 0 (i.e. default page size)
    like a non-present mapping and allow to overwrite it in alloc_pte().
    
    While around, make sure that we flush the TLB only if we change an
    existing mapping, otherwise we might end up acting on garbage PTEs.
    
    Fixes: 6d568ef9 ("iommu/amd: Allow downgrading page-sizes in alloc_pte()")
    Signed-off-by: default avatarAndrei Dulea <adulea@amazon.de>
    6ccb72f8
amd_iommu.c 106 KB