[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/38] accel/whpx: Use accel-specific per-vcpu @dirty field
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 20/38] accel/whpx: Use accel-specific per-vcpu @dirty field |
Date: |
Fri, 26 Apr 2024 21:41:40 +0200 |
WHPX has a specific use of the CPUState::vcpu_dirty field
(CPUState::vcpu_dirty is not used by common code).
To make this field accel-specific, add and use a new
@dirty variable in the AccelCPUState structure.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20240424174506.326-2-philmd@linaro.org>
---
target/i386/whpx/whpx-all.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 31eec7048c..b08e644517 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -237,6 +237,7 @@ struct AccelCPUState {
uint64_t tpr;
uint64_t apic_base;
bool interruption_pending;
+ bool dirty;
/* Must be the last field as it may have a tail */
WHV_RUN_VP_EXIT_CONTEXT exit_ctx;
@@ -839,7 +840,7 @@ static HRESULT CALLBACK whpx_emu_setreg_callback(
* The emulator just successfully wrote the register state. We clear the
* dirty state so we avoid the double write on resume of the VP.
*/
- cpu->vcpu_dirty = false;
+ cpu->accel->dirty = false;
return hr;
}
@@ -1394,7 +1395,7 @@ static int whpx_last_vcpu_stopping(CPUState *cpu)
/* Returns the address of the next instruction that is about to be executed. */
static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid)
{
- if (cpu->vcpu_dirty) {
+ if (cpu->accel->dirty) {
/* The CPU registers have been modified by other parts of QEMU. */
return cpu_env(cpu)->eip;
} else if (exit_context_valid) {
@@ -1713,9 +1714,9 @@ static int whpx_vcpu_run(CPUState *cpu)
}
do {
- if (cpu->vcpu_dirty) {
+ if (cpu->accel->dirty) {
whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE);
- cpu->vcpu_dirty = false;
+ cpu->accel->dirty = false;
}
if (exclusive_step_mode == WHPX_STEP_NONE) {
@@ -2063,9 +2064,9 @@ static int whpx_vcpu_run(CPUState *cpu)
static void do_whpx_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data arg)
{
- if (!cpu->vcpu_dirty) {
+ if (!cpu->accel->dirty) {
whpx_get_registers(cpu);
- cpu->vcpu_dirty = true;
+ cpu->accel->dirty = true;
}
}
@@ -2073,20 +2074,20 @@ static void do_whpx_cpu_synchronize_post_reset(CPUState
*cpu,
run_on_cpu_data arg)
{
whpx_set_registers(cpu, WHPX_SET_RESET_STATE);
- cpu->vcpu_dirty = false;
+ cpu->accel->dirty = false;
}
static void do_whpx_cpu_synchronize_post_init(CPUState *cpu,
run_on_cpu_data arg)
{
whpx_set_registers(cpu, WHPX_SET_FULL_STATE);
- cpu->vcpu_dirty = false;
+ cpu->accel->dirty = false;
}
static void do_whpx_cpu_synchronize_pre_loadvm(CPUState *cpu,
run_on_cpu_data arg)
{
- cpu->vcpu_dirty = true;
+ cpu->accel->dirty = true;
}
/*
@@ -2095,7 +2096,7 @@ static void do_whpx_cpu_synchronize_pre_loadvm(CPUState
*cpu,
void whpx_cpu_synchronize_state(CPUState *cpu)
{
- if (!cpu->vcpu_dirty) {
+ if (!cpu->accel->dirty) {
run_on_cpu(cpu, do_whpx_cpu_synchronize_state, RUN_ON_CPU_NULL);
}
}
@@ -2235,7 +2236,7 @@ int whpx_init_vcpu(CPUState *cpu)
}
vcpu->interruptable = true;
- cpu->vcpu_dirty = true;
+ cpu->accel->dirty = true;
cpu->accel = vcpu;
max_vcpu_index = max(max_vcpu_index, cpu->cpu_index);
qemu_add_vm_change_state_handler(whpx_cpu_update_state, env);
--
2.41.0
- [PULL 10/38] semihosting/guestfd: Remove unused 'semihosting/uaccess.h' header, (continued)
- [PULL 10/38] semihosting/guestfd: Remove unused 'semihosting/uaccess.h' header, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 11/38] target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h', Philippe Mathieu-Daudé, 2024/04/26
- [PULL 12/38] target/ppc/excp_helper: Avoid 'abi_ptr' in system emulation, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 13/38] target/sparc: Replace abi_ulong by uint32_t for TARGET_ABI32, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 14/38] target/i386: Include missing 'exec/exec-all.h' header, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 15/38] accel/tcg: Un-inline retaddr helpers to 'user-retaddr.h', Philippe Mathieu-Daudé, 2024/04/26
- [PULL 17/38] accel/tcg: Include missing headers in 'tb-jmp-cache.h', Philippe Mathieu-Daudé, 2024/04/26
- [PULL 18/38] accel/tcg: Rename load-extract/store-insert headers using .h.inc suffix, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 16/38] accel/tcg: Include missing 'hw/core/cpu.h' header, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 19/38] accel/tcg: Rename helper-head.h -> helper-head.h.inc, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 20/38] accel/whpx: Use accel-specific per-vcpu @dirty field,
Philippe Mathieu-Daudé <=
- [PULL 21/38] accel/nvmm: Use accel-specific per-vcpu @dirty field, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 22/38] accel/hvf: Use accel-specific per-vcpu @dirty field, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 23/38] exec/cpu-all: Reduce 'qemu/rcu.h' header inclusion, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 24/38] exec/cpu-all: Remove unused 'qemu/thread.h' header, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 25/38] exec/cpu-all: Remove unused tswapls() definitions, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 26/38] exec: Declare target_words_bigendian() in 'exec/tswap.h', Philippe Mathieu-Daudé, 2024/04/26
- [PULL 27/38] exec: Move [b]tswapl() declarations to 'exec/user/tswap-target.h', Philippe Mathieu-Daudé, 2024/04/26
- [PULL 28/38] exec/user: Do not include 'cpu.h' in 'abitypes.h', Philippe Mathieu-Daudé, 2024/04/26
- [PULL 29/38] exec: Declare abi_ptr type in its own 'abi_ptr.h' header, Philippe Mathieu-Daudé, 2024/04/26
- [PULL 30/38] exec: Declare MMUAccessType type in 'mmu-access-type.h' header, Philippe Mathieu-Daudé, 2024/04/26