aboutsummaryrefslogtreecommitdiff
path: root/include/accel/accel-ops.h
blob: 23a8c246e15309ed40d69a9c75458d00ed91d609 (plain)
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
/*
 * Accelerator handlers
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef ACCEL_OPS_H
#define ACCEL_OPS_H

#include "exec/hwaddr.h"
#include "qemu/accel.h"
#include "qom/object.h"

struct AccelState {
    Object parent_obj;
};

struct AccelClass {
    ObjectClass parent_class;

    const char *name;
    /* Cached by accel_init_ops_interfaces() when created */
    AccelOpsClass *ops;

    int (*init_machine)(AccelState *as, MachineState *ms);
    bool (*cpu_common_realize)(CPUState *cpu, Error **errp);
    void (*cpu_common_unrealize)(CPUState *cpu);
    /* get_stats: Append statistics to @buf */
    void (*get_stats)(AccelState *as, GString *buf);

    /* system related hooks */
    void (*setup_post)(AccelState *as);
    void (*pre_resume_vm)(AccelState *as, bool step_pending);
    bool (*has_memory)(AccelState *accel, AddressSpace *as,
                       hwaddr start_addr, hwaddr size);

    /* gdbstub related hooks */
    int (*gdbstub_supported_sstep_flags)(AccelState *as);

    bool *allowed;
    /*
     * Array of global properties that would be applied when specific
     * accelerator is chosen. It works like MachineClass.compat_props
     * but it's for accelerators not machines. Accelerator-provided
     * global properties may be overridden by machine-type
     * compat_props or user-provided global properties.
     */
    GPtrArray *compat_props;
};

#endif /* ACCEL_OPS_H */