linux/arch/arm/kvm
Dongjiu Geng fd6c8c206f arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort
When a exception is trapped to EL2, hardware uses  ELR_ELx to hold
the current fault instruction address. If KVM wants to inject a
abort to 32 bit guest, it needs to set the LR register for the
guest to emulate this abort happened in the guest. Because ARM32
architecture is pipelined execution, so the LR value has an offset to
the fault instruction address.

The offsets applied to Link value for exceptions as shown below,
which should be added for the ARM32 link register(LR).

Table taken from ARMv8 ARM DDI0487B-B, table G1-10:
Exception			Offset, for PE state of:
				A32 	  T32
Undefined Instruction 		+4 	  +2
Prefetch Abort 			+4 	  +4
Data Abort 			+8 	  +8
IRQ or FIQ 			+4 	  +4

  [ Removed unused variables in inject_abt to avoid compile warnings.
    -- Christoffer ]

Cc: <stable@vger.kernel.org>
Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
Tested-by: Haibin Zhang <zhanghaibin7@huawei.com>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
2017-10-21 17:03:15 +02:00
..
hyp Merge branch 'kvmarm-master/master' into HEAD 2017-06-15 09:35:15 +01:00
coproc.c KVM: arm: rename pm_fake handler to trap_raz_wi 2017-05-15 14:29:27 +02:00
coproc.h arm: KVM: Make unexpected register accesses inject an undef 2017-04-09 07:49:16 -07:00
coproc_a7.c arm/arm64: KVM: Use set/way op trapping to track the state of the caches 2015-01-29 23:24:56 +01:00
coproc_a15.c arm/arm64: KVM: Use set/way op trapping to track the state of the caches 2015-01-29 23:24:56 +01:00
emulate.c arm/arm64: KVM: set right LR register value for 32 bit guest when inject abort 2017-10-21 17:03:15 +02:00
guest.c KVM: arm/arm64: Allow setting the timer IRQ numbers from userspace 2017-06-08 16:59:57 +02:00
handle_exit.c KVM: arm: implements the kvm_arch_vcpu_in_kernel() 2017-08-08 10:57:43 +02:00
init.S arm: KVM: Allow unaligned accesses at HYP 2017-06-06 22:20:02 +02:00
interrupts.S ARM: hyp-stub/KVM: Kill __hyp_get_vectors 2017-04-09 07:49:34 -07:00
irq.h KVM: arm/arm64: Enable irqchip routing 2016-07-22 18:52:01 +01:00
Kconfig ARM: KVM: Support vGICv3 ITS 2016-11-14 10:32:54 +00:00
Makefile KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00
reset.c KVM: arm/arm64: Move timer IRQ default init to arch_timer.c 2017-06-08 16:59:56 +02:00
trace.h ARM: KVM: Fix tracepoint generation after move to virt/kvm/arm/ 2017-05-15 08:58:50 +02:00
vgic-v3-coproc.c KVM: arm/arm64: vgic: Implement VGICv3 CPU interface access 2017-01-30 13:47:25 +00:00