KVM: arm64: Use arm64_ftr_bits to sanitise ID register writes
authorJing Zhang <jingzhangos@google.com>
Fri, 9 Jun 2023 19:00:50 +0000 (19:00 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 15 Jun 2023 12:55:20 +0000 (12:55 +0000)
commit2e8bf0cbd0589bae3a0466a3ed45f9cf9f3164eb
tree4f1ca7d33b9a4c4effe5e236db8656697844e599
parent473341469042b39535ee800a19c45110ebc46346
KVM: arm64: Use arm64_ftr_bits to sanitise ID register writes

Rather than reinventing the wheel in KVM to do ID register sanitisation
we can rely on the work already done in the core kernel. Implement a
generalized sanitisation of ID registers based on the combination of the
arm64_ftr_bits definitions from the core kernel and (optionally) a set
of KVM-specific overrides.

This all amounts to absolutely nothing for now, but will be used in
subsequent changes to realize user-configurable ID registers.

Signed-off-by: Jing Zhang <jingzhangos@google.com>
Link: https://lore.kernel.org/r/20230609190054.1542113-8-oliver.upton@linux.dev
[Oliver: split off from monster patch, rewrote commit description,
 reworked RAZ handling, return EINVAL to userspace]
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/cpufeature.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kvm/sys_regs.c