summaryrefslogtreecommitdiffstats
path: root/include/sysemu/hw_accel.h
blob: 0ec237247729e6108a0c995ed8e5c15bc01e1625 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * QEMU Hardware accelertors support
 *
 * Copyright 2016 Google, Inc.
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 *
 */

#ifndef QEMU_HW_ACCEL_H
#define QEMU_HW_ACCEL_H

#include "hw/core/cpu.h"
#include "sysemu/hax.h"
#include "sysemu/kvm.h"
#include "sysemu/whpx.h"

static inline void cpu_synchronize_state(CPUState *cpu)
{
    if (kvm_enabled()) {
        kvm_cpu_synchronize_state(cpu);
    }
    if (hax_enabled()) {
        hax_cpu_synchronize_state(cpu);
    }
    if (whpx_enabled()) {
        whpx_cpu_synchronize_state(cpu);
    }
}

static inline void cpu_synchronize_post_reset(CPUState *cpu)
{
    if (kvm_enabled()) {
        kvm_cpu_synchronize_post_reset(cpu);
    }
    if (hax_enabled()) {
        hax_cpu_synchronize_post_reset(cpu);
    }
    if (whpx_enabled()) {
        whpx_cpu_synchronize_post_reset(cpu);
    }
}

static inline void cpu_synchronize_post_init(CPUState *cpu)
{
    if (kvm_enabled()) {
        kvm_cpu_synchronize_post_init(cpu);
    }
    if (hax_enabled()) {
        hax_cpu_synchronize_post_init(cpu);
    }
    if (whpx_enabled()) {
        whpx_cpu_synchronize_post_init(cpu);
    }
}

static inline void cpu_synchronize_pre_loadvm(CPUState *cpu)
{
    if (kvm_enabled()) {
        kvm_cpu_synchronize_pre_loadvm(cpu);
    }
    if (hax_enabled()) {
        hax_cpu_synchronize_pre_loadvm(cpu);
    }
    if (whpx_enabled()) {
        whpx_cpu_synchronize_pre_loadvm(cpu);
    }
}

#endif /* QEMU_HW_ACCEL_H */