accel: introduce AccelCPUClass extending CPUClass

add a new optional interface to CPUClass, which allows accelerators
to extend the CPUClass with additional accelerator-specific
initializations.

This will allow to separate the target cpu code that is specific
to each accelerator, and register it automatically with object
hierarchy lookup depending on accelerator code availability,
as part of the accel_init_interfaces() initialization step.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Message-Id: <20210204163931.7358-19-cfontana@suse.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Claudio Fontana 2021-02-04 17:39:26 +01:00 committed by Richard Henderson
parent b86f59c715
commit fb6916dd6c
4 changed files with 87 additions and 0 deletions

View file

@ -79,6 +79,9 @@ struct TranslationBlock;
/* see tcg-cpu-ops.h */
struct TCGCPUOps;
/* see accel-cpu.h */
struct AccelCPUClass;
/**
* CPUClass:
* @class_by_name: Callback to map -cpu command line model name to an
@ -187,6 +190,7 @@ struct CPUClass {
/* Keep non-pointer data at the end to minimize holes. */
int gdb_num_core_regs;
bool gdb_stop_before_watchpoint;
struct AccelCPUClass *accel_cpu;
/* when TCG is not available, this pointer is NULL */
struct TCGCPUOps *tcg_ops;