]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64/kvm: Avoid invalid physical addresses to signal owner updates
authorArd Biesheuvel <ardb@kernel.org>
Thu, 12 Dec 2024 08:18:46 +0000 (09:18 +0100)
committerWill Deacon <will@kernel.org>
Thu, 19 Dec 2024 17:23:53 +0000 (17:23 +0000)
commit9d86c3c974348eb4220b637fae1a2466232078b7
treee147311ffbda10d9972c8dc18801005902953bc0
parentf0da16992aef7e246b2f3bba1492e3a52c38ca0e
arm64/kvm: Avoid invalid physical addresses to signal owner updates

The pKVM stage2 mapping code relies on an invalid physical address to
signal to the internal API that only the annotations of descriptors
should be updated, and these are stored in the high bits of invalid
descriptors covering memory that has been donated to protected guests,
and is therefore unmapped from the host stage-2 page tables.

Given that these invalid PAs are never stored into the descriptors, it
is better to rely on an explicit flag, to clarify the API and to avoid
confusion regarding whether or not the output address of a descriptor
can ever be invalid to begin with (which is not the case with LPA2).

That removes a dependency on the logic that reasons about the maximum PA
range, which differs on LPA2 capable CPUs based on whether LPA2 is
enabled or not, and will be further clarified in subsequent patches.

Cc: Quentin Perret <qperret@google.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Quentin Perret <qperret@google.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20241212081841.2168124-12-ardb+git@google.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kvm/hyp/pgtable.c