summaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorAlexander Graf2021-06-03 15:42:41 +0200
committerPeter Maydell2021-06-03 17:43:27 +0200
commitbac969ef30e8a8b73acbeb6d68abff6f68b2056c (patch)
treedcabc92f3f230a43650b6b89bf3ecd406714e2c9 /target
parenthvf: Introduce hvf vcpu struct (diff)
downloadqemu-bac969ef30e8a8b73acbeb6d68abff6f68b2056c.tar.gz
qemu-bac969ef30e8a8b73acbeb6d68abff6f68b2056c.tar.xz
qemu-bac969ef30e8a8b73acbeb6d68abff6f68b2056c.zip
hvf: Simplify post reset/init/loadvm hooks
The hooks we have that call us after reset, init and loadvm really all just want to say "The reference of all register state is in the QEMU vcpu struct, please push it". We already have a working pushing mechanism though called cpu->vcpu_dirty, so we can just reuse that for all of the above, syncing state properly the next time we actually execute a vCPU. This fixes PSCI resets on ARM, as they modify CPU state even after the post init call has completed, but before we execute the vCPU again. To also make the scheme work for x86, we have to make sure we don't move stale eflags into our env when the vcpu state is dirty. Signed-off-by: Alexander Graf <agraf@csgraf.de> Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> Reviewed-by: Sergio Lopez <slp@redhat.com> Message-id: 20210519202253.76782-13-agraf@csgraf.de Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target')
-rw-r--r--target/i386/hvf/x86hvf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c
index 28cfee4f60..2ced2c2478 100644
--- a/target/i386/hvf/x86hvf.c
+++ b/target/i386/hvf/x86hvf.c
@@ -433,7 +433,10 @@ int hvf_process_events(CPUState *cpu_state)
X86CPU *cpu = X86_CPU(cpu_state);
CPUX86State *env = &cpu->env;
- env->eflags = rreg(cpu_state->hvf->fd, HV_X86_RFLAGS);
+ if (!cpu_state->vcpu_dirty) {
+ /* light weight sync for CPU_INTERRUPT_HARD and IF_MASK */
+ env->eflags = rreg(cpu_state->hvf->fd, HV_X86_RFLAGS);
+ }
if (cpu_state->interrupt_request & CPU_INTERRUPT_INIT) {
cpu_synchronize_state(cpu_state);