KVM: arm64: Don't overwrite software bits with owner id
authorQuentin Perret <qperret@google.com>
Mon, 9 Aug 2021 15:24:35 +0000 (16:24 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 11 Aug 2021 10:39:50 +0000 (11:39 +0100)
commit8a0282c68121e53ab17413283cfed408a47e1a2a
treefc68fce72116ba19a472f8fab0467ef465e01aa6
parent178cac08d588e7406a09351a992f57892d8d9cc9
KVM: arm64: Don't overwrite software bits with owner id

We will soon start annotating page-tables with new flags to track shared
pages and such, and we will do so in valid mappings using software bits
in the PTEs, as provided by the architecture. However, it is possible
that we will need to use those flags to annotate invalid mappings as
well in the future, similar to what we do to track page ownership in the
host stage-2.

In order to facilitate the annotation of invalid mappings with such
flags, it would be preferable to re-use the same bits as for valid
mappings (bits [58-55]), but these are currently used for ownership
encoding. Since we have plenty of bits left to use in invalid
mappings, move the ownership bits further down the PTE to avoid the
conflict.

Reviewed-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210809152448.1810400-9-qperret@google.com
arch/arm64/kvm/hyp/pgtable.c