accel: move qtest CpusAccel functions to a common location
Move and rename accel/qtest/qtest-cpus.c files to accel/dummy-cpus.c so it can be re-used by Xen. Signed-off-by: Jason Andryuk <jandryuk@gmail.com> Message-Id: <20201013140511.5681-3-jandryuk@gmail.com> Reviewed-by: Claudio Fontana <cfontana@suse.de> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
a6b0882ca7
commit
9ce84a0d17
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* QTest accelerator code
|
* Dummy cpu thread code
|
||||||
*
|
*
|
||||||
* Copyright IBM, Corp. 2011
|
* Copyright IBM, Corp. 2011
|
||||||
*
|
*
|
||||||
@ -13,21 +13,12 @@
|
|||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qemu/rcu.h"
|
#include "qemu/rcu.h"
|
||||||
#include "qapi/error.h"
|
|
||||||
#include "qemu/module.h"
|
|
||||||
#include "qemu/option.h"
|
|
||||||
#include "qemu/config-file.h"
|
|
||||||
#include "sysemu/accel.h"
|
|
||||||
#include "sysemu/qtest.h"
|
|
||||||
#include "sysemu/cpus.h"
|
#include "sysemu/cpus.h"
|
||||||
#include "sysemu/cpu-timers.h"
|
|
||||||
#include "qemu/guest-random.h"
|
#include "qemu/guest-random.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "hw/core/cpu.h"
|
||||||
|
|
||||||
#include "qtest-cpus.h"
|
static void *dummy_cpu_thread_fn(void *arg)
|
||||||
|
|
||||||
static void *qtest_cpu_thread_fn(void *arg)
|
|
||||||
{
|
{
|
||||||
CPUState *cpu = arg;
|
CPUState *cpu = arg;
|
||||||
sigset_t waitset;
|
sigset_t waitset;
|
||||||
@ -67,7 +58,7 @@ static void *qtest_cpu_thread_fn(void *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qtest_start_vcpu_thread(CPUState *cpu)
|
void dummy_start_vcpu_thread(CPUState *cpu)
|
||||||
{
|
{
|
||||||
char thread_name[VCPU_THREAD_NAME_SIZE];
|
char thread_name[VCPU_THREAD_NAME_SIZE];
|
||||||
|
|
||||||
@ -76,11 +67,6 @@ static void qtest_start_vcpu_thread(CPUState *cpu)
|
|||||||
qemu_cond_init(cpu->halt_cond);
|
qemu_cond_init(cpu->halt_cond);
|
||||||
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
|
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/DUMMY",
|
||||||
cpu->cpu_index);
|
cpu->cpu_index);
|
||||||
qemu_thread_create(cpu->thread, thread_name, qtest_cpu_thread_fn, cpu,
|
qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
|
||||||
QEMU_THREAD_JOINABLE);
|
QEMU_THREAD_JOINABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CpusAccel qtest_cpus = {
|
|
||||||
.create_vcpu_thread = qtest_start_vcpu_thread,
|
|
||||||
.get_virtual_clock = qtest_get_virtual_clock,
|
|
||||||
};
|
|
@ -5,3 +5,10 @@ subdir('kvm')
|
|||||||
subdir('tcg')
|
subdir('tcg')
|
||||||
subdir('xen')
|
subdir('xen')
|
||||||
subdir('stubs')
|
subdir('stubs')
|
||||||
|
|
||||||
|
dummy_ss = ss.source_set()
|
||||||
|
dummy_ss.add(files(
|
||||||
|
'dummy-cpus.c',
|
||||||
|
))
|
||||||
|
|
||||||
|
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: dummy_ss)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
qtest_ss = ss.source_set()
|
qtest_ss = ss.source_set()
|
||||||
qtest_ss.add(files(
|
qtest_ss.add(files(
|
||||||
'qtest.c',
|
'qtest.c',
|
||||||
'qtest-cpus.c',
|
|
||||||
))
|
))
|
||||||
|
|
||||||
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: qtest_ss)
|
specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: qtest_ss)
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
/*
|
|
||||||
* Accelerator CPUS Interface
|
|
||||||
*
|
|
||||||
* Copyright 2020 SUSE LLC
|
|
||||||
*
|
|
||||||
* 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 QTEST_CPUS_H
|
|
||||||
#define QTEST_CPUS_H
|
|
||||||
|
|
||||||
#include "sysemu/cpus.h"
|
|
||||||
|
|
||||||
extern const CpusAccel qtest_cpus;
|
|
||||||
|
|
||||||
#endif /* QTEST_CPUS_H */
|
|
@ -25,7 +25,10 @@
|
|||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
#include "hw/core/cpu.h"
|
#include "hw/core/cpu.h"
|
||||||
|
|
||||||
#include "qtest-cpus.h"
|
const CpusAccel qtest_cpus = {
|
||||||
|
.create_vcpu_thread = dummy_start_vcpu_thread,
|
||||||
|
.get_virtual_clock = qtest_get_virtual_clock,
|
||||||
|
};
|
||||||
|
|
||||||
static int qtest_init_accel(MachineState *ms)
|
static int qtest_init_accel(MachineState *ms)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,9 @@ typedef struct CpusAccel {
|
|||||||
/* register accel-specific cpus interface implementation */
|
/* register accel-specific cpus interface implementation */
|
||||||
void cpus_register_accel(const CpusAccel *i);
|
void cpus_register_accel(const CpusAccel *i);
|
||||||
|
|
||||||
|
/* Create a dummy vcpu for CpusAccel->create_vcpu_thread */
|
||||||
|
void dummy_start_vcpu_thread(CPUState *);
|
||||||
|
|
||||||
/* interface available for cpus accelerator threads */
|
/* interface available for cpus accelerator threads */
|
||||||
|
|
||||||
/* For temporary buffers for forming a name */
|
/* For temporary buffers for forming a name */
|
||||||
|
Loading…
Reference in New Issue
Block a user