KVM: arm64: Use generic sanitisation for ID_(AA64)DFR0_EL1
authorJing Zhang <jingzhangos@google.com>
Fri, 9 Jun 2023 19:00:51 +0000 (19:00 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 15 Jun 2023 12:55:20 +0000 (12:55 +0000)
commitc118cead07a762592c9e67252064616efa4574fa
treed531bbe269aef10b8b0be6415dcfc103fe19465a
parent2e8bf0cbd0589bae3a0466a3ed45f9cf9f3164eb
KVM: arm64: Use generic sanitisation for ID_(AA64)DFR0_EL1

KVM allows userspace to specify a PMU version for the guest by writing
to the corresponding ID registers. Currently the validation of these
writes is done manuallly, but there's no reason we can't switch over to
the generic sanitisation infrastructure.

Start screening user writes through arm64_check_features() to prevent
userspace from over-promising in terms of vPMU support. Leave the old
masking in place for now, as we aren't completely ready to serve reads
from the VM-wide values.

Signed-off-by: Jing Zhang <jingzhangos@google.com>
Link: https://lore.kernel.org/r/20230609190054.1542113-9-oliver.upton@linux.dev
[Oliver: split off from monster patch, cleaned up handling of NI vPMU
 values, wrote commit description]
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/sys_regs.c