All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé via" <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org, Richard Henderson <richard.henderson@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <thuth@redhat.com>
Subject: Re: [PATCH 11/15] target: Use ArchCPU as interface to target CPU
Date: Wed, 9 Feb 2022 23:33:43 +0100	[thread overview]
Message-ID: <2f53c9a2-5716-5b92-a4f7-0b8495e24403@amsat.org> (raw)
In-Reply-To: <20220209215446.58402-12-f4bug@amsat.org>

On 9/2/22 22:54, Philippe Mathieu-Daudé wrote:
> ArchCPU is our interface with target-specific code. Use it as
> a forward-declared opaque pointer (abstract type), having its
> structure defined by each target.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>   include/qemu/typedefs.h     |  1 +
>   target/alpha/cpu-qom.h      |  4 +++-
>   target/alpha/cpu.h          |  4 +---
>   target/arm/cpu-qom.h        |  4 +++-
>   target/arm/cpu.h            |  2 --
>   target/avr/cpu-qom.h        |  4 +++-
>   target/avr/cpu.h            |  6 ++----
>   target/cris/cpu-qom.h       |  4 +++-
>   target/cris/cpu.h           |  4 +---
>   target/hexagon/cpu.h        |  2 +-
>   target/hppa/cpu-qom.h       |  4 +++-
>   target/hppa/cpu.h           |  4 +---
>   target/i386/cpu-qom.h       |  4 +++-
>   target/i386/cpu.h           |  4 +---
>   target/m68k/cpu-qom.h       |  4 +++-
>   target/m68k/cpu.h           |  4 +---
>   target/microblaze/cpu-qom.h |  4 +++-
>   target/microblaze/cpu.h     |  6 +++---
>   target/mips/cpu-qom.h       |  4 +++-
>   target/mips/cpu.h           |  4 +---
>   target/nios2/cpu.h          |  4 ++--
>   target/openrisc/cpu.h       | 11 ++++-------
>   target/ppc/cpu-qom.h        |  4 +++-
>   target/ppc/cpu.h            |  4 +---
>   target/riscv/cpu.h          |  5 ++---
>   target/rx/cpu-qom.h         |  4 +++-
>   target/rx/cpu.h             |  4 +---
>   target/s390x/cpu-qom.h      |  4 +++-
>   target/s390x/cpu.h          |  4 +---
>   target/sh4/cpu-qom.h        |  4 +++-
>   target/sh4/cpu.h            |  4 +---
>   target/sparc/cpu-qom.h      |  4 +++-
>   target/sparc/cpu.h          |  4 +---
>   target/tricore/cpu-qom.h    |  4 +++-
>   target/tricore/cpu.h        |  4 +---
>   target/xtensa/cpu-qom.h     |  4 +++-
>   target/xtensa/cpu.h         |  4 +---
>   37 files changed, 76 insertions(+), 77 deletions(-)
...

> diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
> index a22bd506d0..b0a0724e8c 100644
> --- a/target/arm/cpu-qom.h
> +++ b/target/arm/cpu-qom.h
> @@ -27,7 +27,9 @@ struct arm_boot_info;
>   
>   #define TYPE_ARM_CPU "arm-cpu"
>   
> -OBJECT_DECLARE_TYPE(ARMCPU, ARMCPUClass,
> +typedef struct ArchCPU ARMCPU;
> +
> +OBJECT_DECLARE_TYPE(ArchCPU, ARMCPUClass,
>                       ARM_CPU)
>   
>   #define TYPE_ARM_MAX_CPU "max-" TYPE_ARM_CPU
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index a95a070647..a137c564c4 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -3410,8 +3410,6 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env)
>       }
>   }
>   
> -typedef ARMCPU ArchCPU;
> -
>   #include "exec/cpu-all.h"
>   
>   /*
...

> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 79144ddc24..5981be47d9 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -285,7 +285,7 @@ struct CPUArchState {
>       uint64_t kvm_timer_frequency;
>   };
>   
> -OBJECT_DECLARE_TYPE(RISCVCPU, RISCVCPUClass,
> +OBJECT_DECLARE_TYPE(ArchCPU, RISCVCPUClass,
>                       RISCV_CPU)
>   
>   /**
> @@ -309,7 +309,7 @@ struct RISCVCPUClass {
>    *
>    * A RISCV CPU.
>    */
> -struct RISCVCPU {
> +struct ArchCPU {
>       /*< private >*/
>       CPUState parent_obj;
>       /*< public >*/
> @@ -430,7 +430,6 @@ void riscv_cpu_set_fflags(CPURISCVState *env, target_ulong);
>   #define TB_FLAGS_MSTATUS_FS MSTATUS_FS
>   #define TB_FLAGS_MSTATUS_VS MSTATUS_VS
>   
> -typedef RISCVCPU ArchCPU;
>   #include "exec/cpu-all.h"
>   
>   FIELD(TB_FLAGS, MEM_IDX, 0, 3)

Sorry I messed while rebasing, this hunk is missing:

-- >8 --
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index a137c564c4..a4bbca1812 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -774,7 +774,7 @@ typedef struct ARMISARegisters ARMISARegisters;
   *
   * An ARM CPU core.
   */
-struct ARMCPU {
+struct ArchCPU {
      /*< private >*/
      CPUState parent_obj;
      /*< public >*/
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index 05def159b1..6a243cfc06 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -171,7 +171,7 @@ struct CPUArchState {
   *
   * A Nios2 CPU.
   */
-struct ArchCPU {
+typedef struct ArchCPU {
      /*< private >*/
      CPUState parent_obj;
      /*< public >*/
@@ -188,7 +188,7 @@ struct ArchCPU {
      uint32_t reset_addr;
      uint32_t exception_addr;
      uint32_t fast_tlb_miss_addr;
-};
+} Nios2CPU;


  void nios2_tcg_init(void);
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 5981be47d9..d8fefcbc4e 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -309,7 +309,7 @@ struct RISCVCPUClass {
   *
   * A RISCV CPU.
   */
-struct ArchCPU {
+typedef struct ArchCPU {
      /*< private >*/
      CPUState parent_obj;
      /*< public >*/
@@ -357,7 +357,7 @@ struct ArchCPU {
          bool epmp;
          uint64_t resetvec;
      } cfg;
-};
+} RISCVCPU;

  static inline int riscv_has_ext(CPURISCVState *env, target_ulong ext)
  {
---


  reply	other threads:[~2022-02-09 22:37 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 21:54 [PATCH 00/15] target: Use ArchCPU & CPUArchState as abstract interface to target CPU Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 01/15] meson: Display libfdt as disabled when system emulation is disabled Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 02/15] hw/m68k/mcf: Add missing 'exec/hwaddr.h' header Philippe Mathieu-Daudé via
2022-02-09 22:11   ` Richard Henderson
2022-02-10  8:34   ` Thomas Huth
2022-02-09 21:54 ` [PATCH 03/15] hw/tricore: Remove unused and incorrect header Philippe Mathieu-Daudé via
2022-02-09 22:12   ` Richard Henderson
2022-02-10  8:26   ` Thomas Huth
2022-02-09 21:54 ` [PATCH 04/15] exec/cpu_ldst: Include 'cpu.h' to get target_ulong definition Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 05/15] cpu: Add missing 'exec/exec-all.h' and 'qemu/accel.h' headers Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 06/15] target/i386/cpu: Ensure accelerators set CPU addressble physical bits Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 07/15] target/i386/tcg/sysemu: Include missing 'exec/exec-all.h' header Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 08/15] target: Include missing 'cpu.h' Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 09/15] target: Use forward declared type instead of structure type Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 10/15] target: Use CPUArchState as interface to target-specific CPU state Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [PATCH 11/15] target: Use ArchCPU as interface to target CPU Philippe Mathieu-Daudé via
2022-02-09 22:33   ` Philippe Mathieu-Daudé via [this message]
2022-02-09 22:48     ` Richard Henderson
2022-02-09 22:47   ` Richard Henderson
2022-02-10 17:35     ` Taylor Simpson
2022-02-11  1:21       ` Richard Henderson
2022-02-11  2:57         ` Taylor Simpson
2022-02-09 21:54 ` [RFC PATCH 12/15] hw/m68k: Restrict M68kCPU type to target/ code Philippe Mathieu-Daudé via
2022-02-09 22:50   ` Richard Henderson
2022-02-09 23:09     ` Philippe Mathieu-Daudé via
2022-02-09 23:18       ` Richard Henderson
2022-02-09 21:54 ` [RFC PATCH 13/15] hw/mips: Restrict MIPSCPU " Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [RFC PATCH 14/15] hw/sparc: Restrict SPARCCPU " Philippe Mathieu-Daudé via
2022-02-09 21:54 ` [RFC PATCH 15/15] hw/sh4: Restrict SuperHCPU " Philippe Mathieu-Daudé via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f53c9a2-5716-5b92-a4f7-0b8495e24403@amsat.org \
    --to=qemu-devel@nongnu.org \
    --cc=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.