KVM: arm64: Fix __pkvm_init_switch_pgd call ABI
authorPierre-Clément Tosi <ptosi@google.com>
Mon, 10 Jun 2024 06:32:31 +0000 (07:32 +0100)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 20 Jun 2024 17:40:53 +0000 (17:40 +0000)
commitea9d7c83d14e332db9ae25eb2872b90a06ebc9e6
treef170a0a99713022d8531f89a716e12b6afecb418
parenta8f0655887cc86db9d65fd5fbaf99d62424eb9b4
KVM: arm64: Fix __pkvm_init_switch_pgd call ABI

Fix the mismatch between the (incorrect) C signature, C call site, and
asm implementation by aligning all three on an API passing the
parameters (pgd and SP) separately, instead of as a bundled struct.

Remove the now unnecessary memory accesses while the MMU is off from the
asm, which simplifies the C caller (as it does not need to convert a VA
struct pointer to PA) and makes the code slightly more robust by
offsetting the struct fields from C and properly expressing the call to
the C compiler (e.g. type checker and kCFI).

Fixes: f320bc742bc2 ("KVM: arm64: Prepare the creation of s1 mappings at EL2")
Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
Acked-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20240610063244.2828978-3-ptosi@google.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/kvm_hyp.h
arch/arm64/kvm/hyp/nvhe/hyp-init.S
arch/arm64/kvm/hyp/nvhe/setup.c