[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 17/17] cpu: Restrict "hw/core/sysemu-cpu-ops.h" to tar
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [RFC PATCH v2 17/17] cpu: Restrict "hw/core/sysemu-cpu-ops.h" to target/cpu.c |
Date: |
Tue, 2 Mar 2021 08:34:44 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
On 3/1/21 10:51 PM, Philippe Mathieu-Daudé wrote:
> Somehow similar to commit 78271684719 ("cpu: tcg_ops: move to
> tcg-cpu-ops.h, keep a pointer in CPUClass"):
>
> We cannot in principle make the SysEmu Operations field definitions
> conditional on CONFIG_SOFTMMU in code that is included by both
> common_ss and specific_ss modules.
>
> Therefore, what we can do safely to restrict the SysEmu fields to
> system emulation builds, is to move all sysemu operations into a
> separate header file, which is only included by system-specific code.
>
> This leaves just a NULL pointer in the cpu.h for the user-mode builds.
>
> Inspired-by: Claudio Fontana <cfontana@suse.de>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> RFC: improve commit description?
>
> include/hw/core/cpu.h | 3 ++-
> cpu.c | 1 +
> hw/core/cpu.c | 1 +
> target/alpha/cpu.c | 1 +
> target/arm/cpu.c | 1 +
> target/avr/cpu.c | 1 +
> target/cris/cpu.c | 1 +
> target/hppa/cpu.c | 1 +
> target/i386/cpu.c | 1 +
> target/m68k/cpu.c | 1 +
> target/microblaze/cpu.c | 1 +
> target/mips/cpu.c | 1 +
> target/moxie/cpu.c | 1 +
> target/nios2/cpu.c | 1 +
> target/openrisc/cpu.c | 1 +
> target/riscv/cpu.c | 1 +
> target/rx/cpu.c | 1 +
> target/s390x/cpu.c | 1 +
> target/sh4/cpu.c | 1 +
> target/sparc/cpu.c | 1 +
> target/tricore/cpu.c | 1 +
> target/xtensa/cpu.c | 1 +
> target/ppc/translate_init.c.inc | 1 +
> 23 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index d99d3c830dc..398696f0f2d 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -80,7 +80,8 @@ struct TCGCPUOps;
> /* see accel-cpu.h */
> struct AccelCPUClass;
>
> -#include "hw/core/sysemu-cpu-ops.h"
> +/* see sysemu-cpu-ops.h */
> +struct SysemuCPUOps;
As the deprecated targets aren't built by default, I missed:
-- >8 --
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
index c80cae9ff3b..eed7f3f440c 100644
--- a/target/lm32/cpu.c
+++ b/target/lm32/cpu.c
@@ -22,6 +22,7 @@
#include "qapi/error.h"
#include "qemu/qemu-print.h"
#include "cpu.h"
+#include "hw/core/sysemu-cpu-ops.h"
static void lm32_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c
index 610fb5393ae..afe106da2d4 100644
--- a/target/unicore32/cpu.c
+++ b/target/unicore32/cpu.c
@@ -17,6 +17,7 @@
#include "cpu.h"
#include "migration/vmstate.h"
#include "exec/exec-all.h"
+#include "hw/core/sysemu-cpu-ops.h"
static void uc32_cpu_set_pc(CPUState *cs, vaddr value)
{
---
- [PATCH v2 10/17] cpu: Move CPUClass::get_crash_info to SysemuCPUOps, (continued)
- [PATCH v2 10/17] cpu: Move CPUClass::get_crash_info to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/01
- [PATCH v2 11/17] cpu: Move CPUClass::write_elf* to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/01
- [PATCH v2 12/17] cpu: Move CPUClass::asidx_from_attrs to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/01
- [PATCH v2 13/17] cpu: Move CPUClass::get_phys_page_debug to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/01
- [PATCH v2 14/17] cpu: Move CPUClass::get_memory_mapping to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/01
- [PATCH v2 15/17] cpu: Move CPUClass::get_paging_enabled to SysemuCPUOps, Philippe Mathieu-Daudé, 2021/03/01
- [PATCH v2 16/17] cpu: Restrict cpu_paging_enabled / cpu_get_memory_mapping to sysemu, Philippe Mathieu-Daudé, 2021/03/01
- [RFC PATCH v2 17/17] cpu: Restrict "hw/core/sysemu-cpu-ops.h" to target/cpu.c, Philippe Mathieu-Daudé, 2021/03/01
- Re: [RFC PATCH v2 17/17] cpu: Restrict "hw/core/sysemu-cpu-ops.h" to target/cpu.c,
Philippe Mathieu-Daudé <=
- Re: [PATCH v2 00/17] cpu: Introduce SysemuCPUOps structure, Claudio Fontana, 2021/03/02