summaryrefslogtreecommitdiffstats
path: root/accel/kvm/kvm-all.c
diff options
context:
space:
mode:
authorStefan Hajnoczi2020-09-23 12:56:46 +0200
committerStefan Hajnoczi2020-09-23 17:07:44 +0200
commitd73415a315471ac0b127ed3fad45c8ec5d711de1 (patch)
treebae20b3a39968fdfb4340b1a39b533333a8e6fd0 /accel/kvm/kvm-all.c
parenttests: add test-fdmon-epoll (diff)
downloadqemu-d73415a315471ac0b127ed3fad45c8ec5d711de1.tar.gz
qemu-d73415a315471ac0b127ed3fad45c8ec5d711de1.tar.xz
qemu-d73415a315471ac0b127ed3fad45c8ec5d711de1.zip
qemu/atomic.h: rename atomic_ to qatomic_
clang's C11 atomic_fetch_*() functions only take a C11 atomic type pointer argument. QEMU uses direct types (int, etc) and this causes a compiler error when a QEMU code calls these functions in a source file that also included <stdatomic.h> via a system header file: $ CC=clang CXX=clang++ ./configure ... && make ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid) Avoid using atomic_*() names in QEMU's atomic.h since that namespace is used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h and <stdatomic.h> can co-exist. I checked /usr/include on my machine and searched GitHub for existing "qatomic_" users but there seem to be none. This patch was generated using: $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \ sort -u >/tmp/changed_identifiers $ for identifier in $(</tmp/changed_identifiers); do sed -i "s%\<$identifier\>%q$identifier%g" \ $(git grep -I -l "\<$identifier\>") done I manually fixed line-wrap issues and misaligned rST tables. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
Diffstat (limited to 'accel/kvm/kvm-all.c')
-rw-r--r--accel/kvm/kvm-all.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index ad8b315b35..e4bbf78366 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2379,7 +2379,7 @@ static __thread bool have_sigbus_pending;
static void kvm_cpu_kick(CPUState *cpu)
{
- atomic_set(&cpu->kvm_run->immediate_exit, 1);
+ qatomic_set(&cpu->kvm_run->immediate_exit, 1);
}
static void kvm_cpu_kick_self(void)
@@ -2400,7 +2400,7 @@ static void kvm_eat_signals(CPUState *cpu)
int r;
if (kvm_immediate_exit) {
- atomic_set(&cpu->kvm_run->immediate_exit, 0);
+ qatomic_set(&cpu->kvm_run->immediate_exit, 0);
/* Write kvm_run->immediate_exit before the cpu->exit_request
* write in kvm_cpu_exec.
*/
@@ -2434,7 +2434,7 @@ int kvm_cpu_exec(CPUState *cpu)
DPRINTF("kvm_cpu_exec()\n");
if (kvm_arch_process_async_events(cpu)) {
- atomic_set(&cpu->exit_request, 0);
+ qatomic_set(&cpu->exit_request, 0);
return EXCP_HLT;
}
@@ -2450,7 +2450,7 @@ int kvm_cpu_exec(CPUState *cpu)
}
kvm_arch_pre_run(cpu, run);
- if (atomic_read(&cpu->exit_request)) {
+ if (qatomic_read(&cpu->exit_request)) {
DPRINTF("interrupt exit requested\n");
/*
* KVM requires us to reenter the kernel after IO exits to complete
@@ -2577,7 +2577,7 @@ int kvm_cpu_exec(CPUState *cpu)
vm_stop(RUN_STATE_INTERNAL_ERROR);
}
- atomic_set(&cpu->exit_request, 0);
+ qatomic_set(&cpu->exit_request, 0);
return ret;
}
@@ -2994,7 +2994,7 @@ int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr)
have_sigbus_pending = true;
pending_sigbus_addr = addr;
pending_sigbus_code = code;
- atomic_set(&cpu->exit_request, 1);
+ qatomic_set(&cpu->exit_request, 1);
return 0;
#else
return 1;