]>
git.proxmox.com Git - mirror_qemu.git/blob - include/sysemu/accel-blocker.h
2 * Accelerator blocking API, to prevent new ioctls from starting and wait the
4 * This mechanism differs from pause/resume_all_vcpus() in that it does not
7 * Copyright (c) 2022 Red Hat Inc.
9 * Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
11 * This work is licensed under the terms of the GNU GPL, version 2 or later.
12 * See the COPYING file in the top-level directory.
14 #ifndef ACCEL_BLOCKER_H
15 #define ACCEL_BLOCKER_H
17 #include "qemu/osdep.h"
18 #include "sysemu/cpus.h"
20 extern void accel_blocker_init(void);
23 * accel_{cpu_}ioctl_begin/end:
24 * Mark when ioctl is about to run or just finished.
26 * accel_{cpu_}ioctl_begin will block after accel_ioctl_inhibit_begin() is
27 * called, preventing new ioctls to run. They will continue only after
28 * accel_ioctl_inibith_end().
30 extern void accel_ioctl_begin(void);
31 extern void accel_ioctl_end(void);
32 extern void accel_cpu_ioctl_begin(CPUState
*cpu
);
33 extern void accel_cpu_ioctl_end(CPUState
*cpu
);
36 * accel_ioctl_inhibit_begin: start critical section
38 * This function makes sure that:
39 * 1) incoming accel_{cpu_}ioctl_begin() calls block
40 * 2) wait that all ioctls that were already running reach
41 * accel_{cpu_}ioctl_end(), kicking vcpus if necessary.
43 * This allows the caller to access shared data or perform operations without
44 * worrying of concurrent vcpus accesses.
46 extern void accel_ioctl_inhibit_begin(void);
49 * accel_ioctl_inhibit_end: end critical section started by
50 * accel_ioctl_inhibit_begin()
52 * This function allows blocked accel_{cpu_}ioctl_begin() to continue.
54 extern void accel_ioctl_inhibit_end(void);
56 #endif /* ACCEL_BLOCKER_H */