KVM: arm64: nv: Allow a sysreg to be hidden from userspace only
authorMarc Zyngier <maz@kernel.org>
Thu, 9 Feb 2023 17:58:17 +0000 (17:58 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Sat, 11 Feb 2023 10:13:29 +0000 (10:13 +0000)
commite6b367db0f9192692a3f3057878f1259fe966d33
tree243a7c2e9d72fca95eea58571cb9b25fd062c4c3
parentd9552fe133f9f7c357460b041e2d3b20310adf8d
KVM: arm64: nv: Allow a sysreg to be hidden from userspace only

So far, we never needed to distinguish between registers hidden
from userspace and being hidden from a guest (they are always
either visible to both, or hidden from both).

With NV, we have the ugly case of the EL02 and EL12 registers,
which are only a view on the EL0 and EL1 registers. It makes
absolutely no sense to expose them to userspace, since it
already has the canonical view.

Add a new visibility flag (REG_HIDDEN_USER) and a new helper that
checks for it and REG_HIDDEN when checking whether to expose
a sysreg to userspace. Subsequent patches will make use of it.

Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230209175820.1939006-16-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/sys_regs.c
arch/arm64/kvm/sys_regs.h