linux-stable/arch/arm64/kvm
Dave Martin 73433762fc KVM: arm64/sve: System register context switch and access support
This patch adds the necessary support for context switching ZCR_EL1
for each vcpu.

ZCR_EL1 is trapped alongside the FPSIMD/SVE registers, so it makes
sense for it to be handled as part of the guest FPSIMD/SVE context
for context switch purposes instead of handling it as a general
system register.  This means that it can be switched in lazily at
the appropriate time.  No effort is made to track host context for
this register, since SVE requires VHE: thus the hosts's value for
this register lives permanently in ZCR_EL2 and does not alias the
guest's value at any time.

The Hyp switch and fpsimd context handling code is extended
appropriately.

Accessors are added in sys_regs.c to expose the SVE system
registers and ID register fields.  Because these need to be
conditionally visible based on the guest configuration, they are
implemented separately for now rather than by use of the generic
system register helpers.  This may be abstracted better later on
when/if there are more features requiring this model.

ID_AA64ZFR0_EL1 is RO-RAZ for MRS/MSR when SVE is disabled for the
guest, but for compatibility with non-SVE aware KVM implementations
the register should not be enumerated at all for KVM_GET_REG_LIST
in this case.  For consistency we also reject ioctl access to the
register.  This ensures that a non-SVE-enabled guest looks the same
to userspace, irrespective of whether the kernel KVM implementation
supports SVE.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Julien Thierry <julien.thierry@arm.com>
Tested-by: zhang.lei <zhang.lei@jp.fujitsu.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2019-03-29 14:41:53 +00:00
..
hyp KVM: arm64/sve: System register context switch and access support 2019-03-29 14:41:53 +00:00
debug.c arm/arm64: KVM: Introduce kvm_call_hyp_ret() 2019-02-19 21:05:24 +00:00
fpsimd.c KVM: arm64/sve: System register context switch and access support 2019-03-29 14:41:53 +00:00
guest.c KVM: arm64: Refactor kvm_arm_num_regs() for easier maintenance 2019-03-29 14:41:52 +00:00
handle_exit.c * ARM: selftests improvements, large PUD support for HugeTLB, 2018-12-26 11:46:28 -08:00
hyp-init.S arm64: KVM: Enable Common Not Private translations 2018-09-18 12:03:34 +01:00
hyp.S arm64: KVM: Drop VHE-specific HYP call stub 2019-02-19 21:05:28 +00:00
inject_fault.c arm/arm64: KVM: Add KVM_GET/SET_VCPU_EVENTS 2018-07-21 16:02:30 +01:00
irq.h KVM: arm/arm64: Enable irqchip routing 2016-07-22 18:52:01 +01:00
Kconfig treewide: surround Kconfig file paths with double quotes 2018-12-22 00:25:54 +09:00
Makefile KVM: arm/arm64: Prefix header search paths with $(srctree)/ 2019-02-19 21:05:53 +00:00
regmap.c kvm/arm: use PSR_AA32 definitions 2018-07-05 17:24:15 +01:00
reset.c arm/arm64: KVM: Allow a VCPU to fully reset itself 2019-02-07 11:44:13 +00:00
sys_regs.c KVM: arm64/sve: System register context switch and access support 2019-03-29 14:41:53 +00:00
sys_regs.h KVM: arm64: Support runtime sysreg visibility filtering 2019-03-29 14:41:53 +00:00
sys_regs_generic_v8.c KVM: arm64: Rewrite system register accessors to read/write functions 2018-03-19 10:53:16 +00:00
trace.h arm64: KVM: Add trapped system register access tracepoint 2018-12-19 17:47:08 +00:00
va_layout.c arm64: KVM: Allow mapping of vectors outside of the RAM region 2018-03-19 13:06:46 +00:00
vgic-sys-reg-v3.c KVM: arm/arm64: Extract GICv3 max APRn index calculation 2017-09-05 17:33:39 +02:00