qemu/target/arm
Peter Maydell b698e4eef5 arm: Allow system registers for KVM guests to be changed by QEMU code
At the moment the Arm implementations of kvm_arch_{get,put}_registers()
don't support having QEMU change the values of system registers
(aka coprocessor registers for AArch32). This is because although
kvm_arch_get_registers() calls write_list_to_cpustate() to
update the CPU state struct fields (so QEMU code can read the
values in the usual way), kvm_arch_put_registers() does not
call write_cpustate_to_list(), meaning that any changes to
the CPU state struct fields will not be passed back to KVM.

The rationale for this design is documented in a comment in the
AArch32 kvm_arch_put_registers() -- writing the values in the
cpregs list into the CPU state struct is "lossy" because the
write of a register might not succeed, and so if we blindly
copy the CPU state values back again we will incorrectly
change register values for the guest. The assumption was that
no QEMU code would need to write to the registers.

However, when we implemented debug support for KVM guests, we
broke that assumption: the code to handle "set the guest up
to take a breakpoint exception" does so by updating various
guest registers including ESR_EL1.

Support this by making kvm_arch_put_registers() synchronize
CPU state back into the list. We sync only those registers
where the initial write succeeds, which should be sufficient.

This commit is the same as commit 823e1b3818 which we
had to revert in commit 942f99c825, except that the bug
which was preventing EDK2 guest firmware running has been fixed:
kvm_arm_reset_vcpu() now calls write_list_to_cpustate().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Eric Auger <eric.auger@redhat.com>
2019-05-07 12:55:02 +01:00
..
arch_dump.c target/arm: Add aa{32, 64}_vfp_{dreg, qreg} helpers 2018-01-25 11:45:29 +00:00
arm_ldst.h target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
arm-powerctl.c target/arm/arm-powerctl: Add new arm_set_cpu_on_and_reset() 2019-02-28 11:03:04 +00:00
arm-powerctl.h target/arm/arm-powerctl: Add new arm_set_cpu_on_and_reset() 2019-02-28 11:03:04 +00:00
arm-semi.c qom/cpu: Simplify how CPUClass:cpu_dump_state() prints 2019-04-18 22:18:59 +02:00
cpu64.c target/arm: Implement ARMv8.5-FRINT 2019-03-05 15:55:08 +00:00
cpu-qom.h arm: replace instance_post_init() 2019-01-07 16:18:42 +04:00
cpu.c target/arm: Enable FPU for Cortex-M4 and Cortex-M33 2019-04-29 17:36:03 +01:00
cpu.h arm: Allow system registers for KVM guests to be changed by QEMU code 2019-05-07 12:55:02 +01:00
crypto_helper.c target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
gdbstub64.c
gdbstub.c arm: fix malloc type mismatch 2018-05-31 14:50:52 +01:00
helper-a64.c target/arm: Split helper_msr_i_pstate into 3 2019-03-05 15:55:08 +00:00
helper-a64.h target/arm: Split helper_msr_i_pstate into 3 2019-03-05 15:55:08 +00:00
helper-sve.h target/arm: Rewrite vector gather first-fault loads 2018-10-08 14:55:03 +01:00
helper.c arm: Allow system registers for KVM guests to be changed by QEMU code 2019-05-07 12:55:02 +01:00
helper.h target/arm: Implement VLLDM for v7M CPUs with an FPU 2019-04-29 17:36:03 +01:00
idau.h qom: make interface types abstract 2018-12-11 15:45:22 -02:00
internals.h target/arm: Split helper_msr_i_pstate into 3 2019-03-05 15:55:08 +00:00
iwmmxt_helper.c target/arm: Untabify iwmmxt_helper.c 2018-08-24 13:17:48 +01:00
kvm32.c arm: Allow system registers for KVM guests to be changed by QEMU code 2019-05-07 12:55:02 +01:00
kvm64.c arm: Allow system registers for KVM guests to be changed by QEMU code 2019-05-07 12:55:02 +01:00
kvm_arm.h kvm: add kvm_arm_get_max_vm_ipa_size 2019-03-05 15:55:09 +00:00
kvm-consts.h arm: add trailing ; after MISMATCH_CHECK 2017-02-01 03:37:18 +02:00
kvm-stub.c
kvm.c arm: Allow system registers for KVM guests to be changed by QEMU code 2019-05-07 12:55:02 +01:00
machine.c arm: Allow system registers for KVM guests to be changed by QEMU code 2019-05-07 12:55:02 +01:00
Makefile.objs target/arm: Split out vfp_helper.c 2019-02-21 18:17:45 +00:00
monitor.c qapi: make query-gic-capabilities depend on TARGET_ARM 2019-02-18 14:44:05 +01:00
neon_helper.c target/arm: Split out FPSCR.QC to a vector field 2019-02-15 09:56:41 +00:00
op_addsub.h
op_helper.c target/arm: Add set/clear_pstate_bits, share gen_ss_advance 2019-03-05 15:55:08 +00:00
pauth_helper.c target/arm: Implement pauth_computepac 2019-01-21 10:38:55 +00:00
psci.c target: Do not include "exec/exec-all.h" if it is not necessary 2018-06-01 14:15:10 +02:00
sve_helper.c target/arm/sve_helper: Fix compilation with clang 3.4 2018-11-28 15:31:15 +00:00
sve.decode target/arm: SVE brk[ab] merging does not have s bit 2019-01-07 15:23:45 +00:00
trace-events trace-events: Shorten file names in comments 2019-03-22 16:18:07 +00:00
translate-a64.c qom/cpu: Simplify how CPUClass:cpu_dump_state() prints 2019-04-18 22:18:59 +02:00
translate-a64.h target/arm: Extend vec_reg_offset to larger sizes 2018-06-15 15:23:34 +01:00
translate-sve.c target/arm: Check access permission to ADDVL/ADDPL/RDVL 2019-03-15 11:12:29 +00:00
translate.c target/arm: Implement VLLDM for v7M CPUs with an FPU 2019-04-29 17:36:03 +01:00
translate.h target/arm: Implement M-profile lazy FP state preservation 2019-04-29 17:36:02 +01:00
vec_helper.c target/arm: Add helpers for FMLAL 2019-02-28 11:03:05 +00:00
vfp_helper.c target/arm: Make sure M-profile FPSCR RES0 bits are not settable 2019-04-29 17:35:58 +01:00