KVM: arm64: Do not try to map PUDs when they are folded into PMD
authorMarc Zyngier <maz@kernel.org>
Wed, 2 Sep 2020 10:18:29 +0000 (11:18 +0100)
committerMarc Zyngier <maz@kernel.org>
Fri, 4 Sep 2020 09:52:49 +0000 (10:52 +0100)
commit3fb884ffe921c99483a84b0175f3c03f048e9069
treeb7a5ffc84ac51399649c443659283543ed381423
parent004a01241c5a0d375266ebf1c72f208de99294e9
KVM: arm64: Do not try to map PUDs when they are folded into PMD

For the obscure cases where PMD and PUD are the same size
(64kB pages with 42bit VA, for example, which results in only
two levels of page tables), we can't map anything as a PUD,
because there is... erm... no PUD to speak of. Everything is
either a PMD or a PTE.

So let's only try and map a PUD when its size is different from
that of a PMD.

Cc: stable@vger.kernel.org
Fixes: b8e0ba7c8bea ("KVM: arm64: Add support for creating PUD hugepages at stage 2")
Reported-by: Gavin Shan <gshan@redhat.com>
Reported-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/mmu.c