On 4/3/25 16:49, Philippe Mathieu-Daudé wrote:
> Include missing "hw/core/cpu.h" header in "accel/accel-cpu.h" to avoid:
>
> include/accel/accel-cpu-target.h:39:28: error: unknown type name 'CPUClass'
> 39 | void (*cpu_class_init)(CPUClass *cc);
> | ^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/accel/accel-cpu-target.h | 12 +-----------
> include/accel/accel-cpu.h | 23 +++++++++++++++++++++++
> accel/accel-target.c | 1 -
> 3 files changed, 24 insertions(+), 12 deletions(-)
> create mode 100644 include/accel/accel-cpu.h
>
> diff --git a/include/accel/accel-cpu-target.h b/include/accel/accel-cpu-target.h
> index 37dde7fae3e..6feb344e29b 100644
> --- a/include/accel/accel-cpu-target.h
> +++ b/include/accel/accel-cpu-target.h
> @@ -21,21 +21,11 @@
> */
>
> #include "qom/object.h"
> +#include "accel/accel-cpu.h"
> #include "cpu.h"
>
> #define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE
> #define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU)
> -typedef struct AccelCPUClass AccelCPUClass;
> DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU)
>
> -typedef struct AccelCPUClass {
> - /*< private >*/
> - ObjectClass parent_class;
> - /*< public >*/
> -
> - void (*cpu_class_init)(CPUClass *cc);
> - void (*cpu_instance_init)(CPUState *cpu);
> - bool (*cpu_target_realize)(CPUState *cpu, Error **errp);
> -} AccelCPUClass;
> -
> #endif /* ACCEL_CPU_H */
> diff --git a/include/accel/accel-cpu.h b/include/accel/accel-cpu.h
> new file mode 100644
> index 00000000000..9e7eede7c3c
> --- /dev/null
> +++ b/include/accel/accel-cpu.h
> @@ -0,0 +1,23 @@
> +/*
> + * Accelerator interface, specializes CPUClass
> + *
> + * Copyright 2021 SUSE LLC
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef ACCEL_CPU_H
> +#define ACCEL_CPU_H
> +
> +#include "qom/object.h"
> +#include "hw/core/cpu.h"
> +
> +typedef struct AccelCPUClass {
> + ObjectClass parent_class;
> +
> + void (*cpu_class_init)(CPUClass *cc);
> + void (*cpu_instance_init)(CPUState *cpu);
> + bool (*cpu_target_realize)(CPUState *cpu, Error **errp);
> +} AccelCPUClass;
> +
> +#endif /* ACCEL_CPU_H */
> diff --git a/accel/accel-target.c b/accel/accel-target.c
> index 6fa5c3ef04e..769a90230bf 100644
> --- a/accel/accel-target.c
> +++ b/accel/accel-target.c
> @@ -27,7 +27,6 @@
> #include "qemu/accel.h"
> #include "qemu/target_info.h"
>
> -#include "cpu.h"
> #include "accel/accel-cpu-target.h"
> #include "accel-internal.h"
>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>