]> git.proxmox.com Git - mirror_ubuntu-eoan-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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 18 Oct 2019 08:26:40 +0000 (04:26 -0400)
commit02af72663127335517d117f977ab9d45b1549eb0
tree7431caac1834ac496086c4ea6fe677b3bc5fa7b3
parent3ff915e2bab3cb5088660374a2bfa79910fb0c9e
iommu/amd: Fix downgrading default page-sizes in alloc_pte()

BugLink: https://bugs.launchpad.net/bugs/1848039
[ Upstream commit 6ccb72f8374e17d60b58a7bfd5570496332c54e2 ]

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: 6d568ef9a622 ("iommu/amd: Allow downgrading page-sizes in alloc_pte()")
Signed-off-by: Andrei Dulea <adulea@amazon.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/iommu/amd_iommu.c