]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/amd: Fix downgrading default page-sizes in alloc_pte()
authorAndrei Dulea <adulea@amazon.de>
Fri, 13 Sep 2019 14:42:29 +0000 (16:42 +0200)
committerJoerg Roedel <jroedel@suse.de>
Tue, 24 Sep 2019 09:15:37 +0000 (11:15 +0200)
commit1accd8b9067b48b215e5910470d74c3b3dc640eb
tree58153196ad6c1423e86fa4388cd402bb13fe384f
parent984274cc46bdb06725cc7549ae598bc0764b176e
iommu/amd: Fix downgrading default page-sizes in alloc_pte()

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: ab8a4925a149 ("iommu/amd: Allow downgrading page-sizes in alloc_pte()")
Signed-off-by: Andrei Dulea <adulea@amazon.de>
drivers/iommu/amd_iommu.c