* [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation
@ 2025-01-21 14:23 Philippe Mathieu-Daudé
2025-01-21 14:23 ` [PATCH 01/28] target/hexagon: Ensure not being build on " Philippe Mathieu-Daudé
` (27 more replies)
0 siblings, 28 replies; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
On user emulation, threads always have work to do, and
CPUClass::has_work() is never called. Restrict it to system
emulation, allowing to simplify a bit and reduce code built
on user emulation.
Based-on: <20250121114056.53949-1-philmd@linaro.org>
"cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro"
Philippe Mathieu-Daudé (28):
target/hexagon: Ensure not being build on system emulation
target/rx: Ensure not being build on user emulation
target/tricore: Ensure not being build on user emulation
cpus: Restrict cpu_get_memory_mapping() to system emulation
cpus: Restrict cpu_has_work() to system emulation
cpus: Un-inline cpu_has_work()
cpus: Introduce SysemuCPUOps::has_work() handler
target/alpha: Move has_work() from CPUClass to SysemuCPUOps
target/arm: Move has_work() from CPUClass to SysemuCPUOps
target/avr: Move has_work() from CPUClass to SysemuCPUOps
target/hexagon: Remove CPUClass:has_work() handler
target/hppa: Move has_work() from CPUClass to SysemuCPUOps
target/i386: Move has_work() from CPUClass to SysemuCPUOps
target/loongarch: Move has_work() from CPUClass to SysemuCPUOps
target/m68k: Move has_work() from CPUClass to SysemuCPUOps
target/microblaze: Move has_work() from CPUClass to SysemuCPUOps
target/mips: Move has_work() from CPUClass to SysemuCPUOps
target/openrisc: Move has_work() from CPUClass to SysemuCPUOps
target/ppc: Move has_work() from CPUClass to SysemuCPUOps
target/riscv: Move has_work() from CPUClass to SysemuCPUOps
target/rx: Move has_work() from CPUClass to SysemuCPUOps
target/s390x: Restrict I/O handler installers to system emulation
target/s390x: Move has_work() from CPUClass to SysemuCPUOps
target/sh4: Move has_work() from CPUClass to SysemuCPUOps
target/sparc: Move has_work() from CPUClass to SysemuCPUOps
target/tricore: Move has_work() from CPUClass to SysemuCPUOps
target/xtensa: Move has_work() from CPUClass to SysemuCPUOps
cpus: Remove CPUClass::has_work() handler
include/hw/core/cpu.h | 30 ++++++++++++------------------
include/hw/core/sysemu-cpu-ops.h | 4 ++++
target/hexagon/cpu.h | 4 ++++
target/i386/cpu.h | 4 ++--
target/mips/internal.h | 4 ++--
target/riscv/cpu.h | 9 +++++----
target/riscv/internals.h | 3 ---
target/rx/cpu.h | 6 ++++--
target/s390x/s390x-internal.h | 5 +++++
target/tricore/cpu.h | 4 ++++
hw/core/cpu-common.c | 6 ------
hw/core/cpu-system.c | 6 ++++++
target/alpha/cpu.c | 4 +++-
target/arm/cpu.c | 4 +++-
target/avr/cpu.c | 2 +-
target/hexagon/cpu.c | 6 ------
target/hppa/cpu.c | 4 +++-
target/i386/cpu.c | 8 +++-----
target/loongarch/cpu.c | 8 +++-----
target/m68k/cpu.c | 4 +++-
target/microblaze/cpu.c | 4 +++-
target/mips/cpu.c | 4 +++-
target/openrisc/cpu.c | 4 +++-
target/ppc/cpu_init.c | 4 +++-
target/riscv/cpu.c | 8 +++-----
target/rx/cpu.c | 8 +-------
target/rx/helper.c | 4 ----
target/s390x/cpu-system.c | 18 ++++++++++++++++++
target/s390x/cpu.c | 18 ------------------
target/s390x/interrupt.c | 8 ++------
target/sh4/cpu.c | 4 ++--
target/sparc/cpu.c | 4 +++-
target/tricore/cpu.c | 2 +-
target/xtensa/cpu.c | 12 +++++-------
34 files changed, 114 insertions(+), 113 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 59+ messages in thread
* [PATCH 01/28] target/hexagon: Ensure not being build on system emulation
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-21 17:39 ` Brian Cain
2025-01-21 14:23 ` [PATCH 02/28] target/rx: Ensure not being build on user emulation Philippe Mathieu-Daudé
` (26 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Currently only user emulation is supported.
Assert no target code is built for system emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/hexagon/cpu.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
index 79e60d4bfa1..f78c8f9c2a0 100644
--- a/target/hexagon/cpu.h
+++ b/target/hexagon/cpu.h
@@ -26,6 +26,10 @@
#include "mmvec/mmvec.h"
#include "hw/registerfields.h"
+#ifndef CONFIG_USER_ONLY
+#error "Hexagon does not support system emulation"
+#endif
+
#define NUM_PREGS 4
#define TOTAL_PER_THREAD_REGS 64
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 02/28] target/rx: Ensure not being build on user emulation
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
2025-01-21 14:23 ` [PATCH 01/28] target/hexagon: Ensure not being build on " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 16:51 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 03/28] target/tricore: " Philippe Mathieu-Daudé
` (25 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Currently only system emulation is supported.
Assert no target code is built for user emulation.
Remove #ifdef'ry since more work is required before
being able to emulate a user process.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/rx/cpu.h | 6 ++++--
target/rx/cpu.c | 6 ------
target/rx/helper.c | 4 ----
3 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/target/rx/cpu.h b/target/rx/cpu.h
index 5ba1874bd76..349d61c4e40 100644
--- a/target/rx/cpu.h
+++ b/target/rx/cpu.h
@@ -26,6 +26,10 @@
#include "exec/cpu-defs.h"
#include "qemu/cpu-float.h"
+#ifdef CONFIG_USER_ONLY
+#error "RX does not support user mode emulation"
+#endif
+
/* PSW define */
REG32(PSW, 0)
FIELD(PSW, C, 0, 1)
@@ -129,11 +133,9 @@ struct RXCPUClass {
#define CPU_RESOLVING_TYPE TYPE_RX_CPU
const char *rx_crname(uint8_t cr);
-#ifndef CONFIG_USER_ONLY
void rx_cpu_do_interrupt(CPUState *cpu);
bool rx_cpu_exec_interrupt(CPUState *cpu, int int_req);
hwaddr rx_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-#endif /* !CONFIG_USER_ONLY */
void rx_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
int rx_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int rx_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index 8c50c7a1bc8..aa310bd6144 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -184,13 +184,11 @@ static void rx_cpu_init(Object *obj)
qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2);
}
-#ifndef CONFIG_USER_ONLY
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps rx_sysemu_ops = {
.get_phys_page_debug = rx_cpu_get_phys_page_debug,
};
-#endif
#include "hw/core/tcg-cpu-ops.h"
@@ -201,11 +199,9 @@ static const TCGCPUOps rx_tcg_ops = {
.restore_state_to_opc = rx_restore_state_to_opc,
.tlb_fill = rx_cpu_tlb_fill,
-#ifndef CONFIG_USER_ONLY
.cpu_exec_interrupt = rx_cpu_exec_interrupt,
.cpu_exec_halt = rx_cpu_has_work,
.do_interrupt = rx_cpu_do_interrupt,
-#endif /* !CONFIG_USER_ONLY */
};
static void rx_cpu_class_init(ObjectClass *klass, void *data)
@@ -227,9 +223,7 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
cc->set_pc = rx_cpu_set_pc;
cc->get_pc = rx_cpu_get_pc;
-#ifndef CONFIG_USER_ONLY
cc->sysemu_ops = &rx_sysemu_ops;
-#endif
cc->gdb_read_register = rx_cpu_gdb_read_register;
cc->gdb_write_register = rx_cpu_gdb_write_register;
cc->disas_set_info = rx_cpu_disas_set_info;
diff --git a/target/rx/helper.c b/target/rx/helper.c
index 80912e8dcb4..7f28e729891 100644
--- a/target/rx/helper.c
+++ b/target/rx/helper.c
@@ -40,8 +40,6 @@ void rx_cpu_unpack_psw(CPURXState *env, uint32_t psw, int rte)
env->psw_c = FIELD_EX32(psw, PSW, C);
}
-#ifndef CONFIG_USER_ONLY
-
#define INT_FLAGS (CPU_INTERRUPT_HARD | CPU_INTERRUPT_FIR)
void rx_cpu_do_interrupt(CPUState *cs)
{
@@ -146,5 +144,3 @@ hwaddr rx_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
{
return addr;
}
-
-#endif /* !CONFIG_USER_ONLY */
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 03/28] target/tricore: Ensure not being build on user emulation
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
2025-01-21 14:23 ` [PATCH 01/28] target/hexagon: Ensure not being build on " Philippe Mathieu-Daudé
2025-01-21 14:23 ` [PATCH 02/28] target/rx: Ensure not being build on user emulation Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 16:51 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 04/28] cpus: Restrict cpu_get_memory_mapping() to system emulation Philippe Mathieu-Daudé
` (24 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Currently only system emulation is supported.
Assert no target code is built for user emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/tricore/cpu.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index 8e431d79222..cf9dbc6df8e 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -26,6 +26,10 @@
#include "qemu/cpu-float.h"
#include "tricore-defs.h"
+#ifdef CONFIG_USER_ONLY
+#error "TriCore does not support user mode emulation"
+#endif
+
typedef struct CPUArchState {
/* GPR Register */
uint32_t gpr_a[16];
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 04/28] cpus: Restrict cpu_get_memory_mapping() to system emulation
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 03/28] target/tricore: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 16:52 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 05/28] cpus: Restrict cpu_has_work() " Philippe Mathieu-Daudé
` (23 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index b7367f6d808..2402706c7d9 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -614,6 +614,8 @@ extern bool mttcg_enabled;
*/
bool cpu_paging_enabled(const CPUState *cpu);
+#if !defined(CONFIG_USER_ONLY)
+
/**
* cpu_get_memory_mapping:
* @cpu: The CPU whose memory mappings are to be obtained.
@@ -625,8 +627,6 @@ bool cpu_paging_enabled(const CPUState *cpu);
bool cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
Error **errp);
-#if !defined(CONFIG_USER_ONLY)
-
/**
* cpu_write_elf64_note:
* @f: pointer to a function that writes memory to a file
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 05/28] cpus: Restrict cpu_has_work() to system emulation
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 04/28] cpus: Restrict cpu_get_memory_mapping() to system emulation Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 16:52 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 06/28] cpus: Un-inline cpu_has_work() Philippe Mathieu-Daudé
` (22 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
This method is not used on user emulation, because there
is always work to do there.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 2402706c7d9..e094d54949d 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -748,6 +748,20 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs);
*/
bool cpu_virtio_is_big_endian(CPUState *cpu);
+/**
+ * cpu_has_work:
+ * @cpu: The vCPU to check.
+ *
+ * Checks whether the CPU has work to do.
+ *
+ * Returns: %true if the CPU has work, %false otherwise.
+ */
+static inline bool cpu_has_work(CPUState *cpu)
+{
+ g_assert(cpu->cc->has_work);
+ return cpu->cc->has_work(cpu);
+}
+
#endif /* CONFIG_USER_ONLY */
/**
@@ -814,20 +828,6 @@ CPUState *cpu_create(const char *typename);
*/
const char *parse_cpu_option(const char *cpu_option);
-/**
- * cpu_has_work:
- * @cpu: The vCPU to check.
- *
- * Checks whether the CPU has work to do.
- *
- * Returns: %true if the CPU has work, %false otherwise.
- */
-static inline bool cpu_has_work(CPUState *cpu)
-{
- g_assert(cpu->cc->has_work);
- return cpu->cc->has_work(cpu);
-}
-
/**
* qemu_cpu_is_self:
* @cpu: The vCPU to check against.
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 06/28] cpus: Un-inline cpu_has_work()
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 05/28] cpus: Restrict cpu_has_work() " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 16:59 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 07/28] cpus: Introduce SysemuCPUOps::has_work() handler Philippe Mathieu-Daudé
` (21 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
In order to expand cpu_has_work(), un-inline it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 6 +-----
hw/core/cpu-system.c | 6 ++++++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index e094d54949d..d64c823e768 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -756,11 +756,7 @@ bool cpu_virtio_is_big_endian(CPUState *cpu);
*
* Returns: %true if the CPU has work, %false otherwise.
*/
-static inline bool cpu_has_work(CPUState *cpu)
-{
- g_assert(cpu->cc->has_work);
- return cpu->cc->has_work(cpu);
-}
+bool cpu_has_work(CPUState *cpu);
#endif /* CONFIG_USER_ONLY */
diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
index 37d54d04bf8..16d5efee12d 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -23,6 +23,12 @@
#include "exec/tswap.h"
#include "hw/core/sysemu-cpu-ops.h"
+bool cpu_has_work(CPUState *cpu)
+{
+ g_assert(cpu->cc->has_work);
+ return cpu->cc->has_work(cpu);
+}
+
bool cpu_paging_enabled(const CPUState *cpu)
{
if (cpu->cc->sysemu_ops->get_paging_enabled) {
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 07/28] cpus: Introduce SysemuCPUOps::has_work() handler
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 06/28] cpus: Un-inline cpu_has_work() Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:05 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 08/28] target/alpha: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
` (20 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
SysemuCPUOps::has_work() is similar to CPUClass::has_work(),
but only exposed on system emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/sysemu-cpu-ops.h | 4 ++++
hw/core/cpu-system.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
index 0df5b058f50..dee8a62ca98 100644
--- a/include/hw/core/sysemu-cpu-ops.h
+++ b/include/hw/core/sysemu-cpu-ops.h
@@ -16,6 +16,10 @@
* struct SysemuCPUOps: System operations specific to a CPU class
*/
typedef struct SysemuCPUOps {
+ /**
+ * @has_work: Callback for checking if there is work to do.
+ */
+ bool (*has_work)(CPUState *cpu);
/**
* @get_memory_mapping: Callback for obtaining the memory mappings.
*/
diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
index 16d5efee12d..7b16bda2250 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -25,6 +25,10 @@
bool cpu_has_work(CPUState *cpu)
{
+ if (cpu->cc->sysemu_ops->has_work) {
+ return cpu->cc->sysemu_ops->has_work(cpu);
+ }
+
g_assert(cpu->cc->has_work);
return cpu->cc->has_work(cpu);
}
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 08/28] target/alpha: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 07/28] cpus: Introduce SysemuCPUOps::has_work() handler Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:06 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 09/28] target/arm: " Philippe Mathieu-Daudé
` (19 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/alpha/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index e1b898e5755..83164a694d8 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -63,6 +63,7 @@ static void alpha_restore_state_to_opc(CPUState *cs,
}
}
+#ifndef CONFIG_USER_ONLY
static bool alpha_cpu_has_work(CPUState *cs)
{
/* Here we are checking to see if the CPU should wake up from HALT.
@@ -77,6 +78,7 @@ static bool alpha_cpu_has_work(CPUState *cs)
| CPU_INTERRUPT_SMP
| CPU_INTERRUPT_MCHK);
}
+#endif /* !CONFIG_USER_ONLY */
static int alpha_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -216,6 +218,7 @@ static void alpha_cpu_initfn(Object *obj)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps alpha_sysemu_ops = {
+ .has_work = alpha_cpu_has_work,
.get_phys_page_debug = alpha_cpu_get_phys_page_debug,
};
#endif
@@ -251,7 +254,6 @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
&acc->parent_realize);
cc->class_by_name = alpha_cpu_class_by_name;
- cc->has_work = alpha_cpu_has_work;
cc->mmu_index = alpha_cpu_mmu_index;
cc->dump_state = alpha_cpu_dump_state;
cc->set_pc = alpha_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 09/28] target/arm: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 08/28] target/alpha: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:06 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 10/28] target/avr: " Philippe Mathieu-Daudé
` (18 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/arm/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 048b825a006..322c95038d5 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -123,6 +123,7 @@ void arm_restore_state_to_opc(CPUState *cs,
}
#endif /* CONFIG_TCG */
+#ifndef CONFIG_USER_ONLY
/*
* With SCTLR_ELx.NMI == 0, IRQ with Superpriority is masked identically with
* IRQ without Superpriority. Moreover, if the GIC is configured so that
@@ -141,6 +142,7 @@ static bool arm_cpu_has_work(CPUState *cs)
| CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VSERR
| CPU_INTERRUPT_EXITTB);
}
+#endif /* !CONFIG_USER_ONLY */
static int arm_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -2671,6 +2673,7 @@ static const gchar *arm_gdb_arch_name(CPUState *cs)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps arm_sysemu_ops = {
+ .has_work = arm_cpu_has_work,
.get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug,
.asidx_from_attrs = arm_asidx_from_attrs,
.write_elf32_note = arm_cpu_write_elf32_note,
@@ -2721,7 +2724,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
&acc->parent_phases);
cc->class_by_name = arm_cpu_class_by_name;
- cc->has_work = arm_cpu_has_work;
cc->mmu_index = arm_cpu_mmu_index;
cc->dump_state = arm_cpu_dump_state;
cc->set_pc = arm_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 10/28] target/avr: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 09/28] target/arm: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:06 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler Philippe Mathieu-Daudé
` (17 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/avr/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
index 8a126ff3222..8712813f3e2 100644
--- a/target/avr/cpu.c
+++ b/target/avr/cpu.c
@@ -200,6 +200,7 @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps avr_sysemu_ops = {
+ .has_work = avr_cpu_has_work,
.get_phys_page_debug = avr_cpu_get_phys_page_debug,
};
@@ -232,7 +233,6 @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
cc->class_by_name = avr_cpu_class_by_name;
- cc->has_work = avr_cpu_has_work;
cc->mmu_index = avr_cpu_mmu_index;
cc->dump_state = avr_cpu_dump_state;
cc->set_pc = avr_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 10/28] target/avr: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:07 ` Richard Henderson
2025-01-24 17:26 ` Brian Cain
2025-01-21 14:23 ` [PATCH 12/28] target/hppa: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
` (16 subsequent siblings)
27 siblings, 2 replies; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Remove as unreachable code.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/hexagon/cpu.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
index 0b7fc98f6ce..f77e305d611 100644
--- a/target/hexagon/cpu.c
+++ b/target/hexagon/cpu.c
@@ -262,11 +262,6 @@ static void hexagon_cpu_synchronize_from_tb(CPUState *cs,
cpu_env(cs)->gpr[HEX_REG_PC] = tb->pc;
}
-static bool hexagon_cpu_has_work(CPUState *cs)
-{
- return true;
-}
-
static void hexagon_restore_state_to_opc(CPUState *cs,
const TranslationBlock *tb,
const uint64_t *data)
@@ -345,7 +340,6 @@ static void hexagon_cpu_class_init(ObjectClass *c, void *data)
&mcc->parent_phases);
cc->class_by_name = hexagon_cpu_class_by_name;
- cc->has_work = hexagon_cpu_has_work;
cc->dump_state = hexagon_dump_state;
cc->set_pc = hexagon_cpu_set_pc;
cc->get_pc = hexagon_cpu_get_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 12/28] target/hppa: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:08 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 13/28] target/i386: " Philippe Mathieu-Daudé
` (15 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/hppa/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index b0bc9d35e4c..d5a58a03cbb 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -125,10 +125,12 @@ static void hppa_restore_state_to_opc(CPUState *cs,
env->psw_n = 0;
}
+#ifndef CONFIG_USER_ONLY
static bool hppa_cpu_has_work(CPUState *cs)
{
return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI);
}
+#endif /* !CONFIG_USER_ONLY */
static int hppa_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -231,6 +233,7 @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps hppa_sysemu_ops = {
+ .has_work = hppa_cpu_has_work,
.get_phys_page_debug = hppa_cpu_get_phys_page_debug,
};
#endif
@@ -267,7 +270,6 @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
&acc->parent_phases);
cc->class_by_name = hppa_cpu_class_by_name;
- cc->has_work = hppa_cpu_has_work;
cc->mmu_index = hppa_cpu_mmu_index;
cc->dump_state = hppa_cpu_dump_state;
cc->set_pc = hppa_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 13/28] target/i386: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 12/28] target/hppa: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:09 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 14/28] target/loongarch: " Philippe Mathieu-Daudé
` (14 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Move has_work() from CPUClass to SysemuCPUOps,
restrict x86_cpu_pending_interrupt() to system.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/cpu.h | 4 ++--
target/i386/cpu.c | 8 +++-----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index b26e25ba15e..869b8598cd5 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2289,8 +2289,6 @@ struct X86CPUClass {
extern const VMStateDescription vmstate_x86_cpu;
#endif
-int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request);
-
int x86_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
int cpuid, DumpState *s);
int x86_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
@@ -2313,6 +2311,8 @@ void x86_cpu_list(void);
int cpu_x86_support_mca_broadcast(CPUX86State *env);
#ifndef CONFIG_USER_ONLY
+int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request);
+
hwaddr x86_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
MemTxAttrs *attrs);
int cpu_get_pic_interrupt(CPUX86State *s);
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1b9c11022c4..51faba4e0b4 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -8256,16 +8256,15 @@ static vaddr x86_cpu_get_pc(CPUState *cs)
return cpu->env.eip + cpu->env.segs[R_CS].base;
}
+#if !defined(CONFIG_USER_ONLY)
int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request)
{
X86CPU *cpu = X86_CPU(cs);
CPUX86State *env = &cpu->env;
-#if !defined(CONFIG_USER_ONLY)
if (interrupt_request & CPU_INTERRUPT_POLL) {
return CPU_INTERRUPT_POLL;
}
-#endif
if (interrupt_request & CPU_INTERRUPT_SIPI) {
return CPU_INTERRUPT_SIPI;
}
@@ -8286,14 +8285,12 @@ int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request)
(env->eflags & IF_MASK &&
!(env->hflags & HF_INHIBIT_IRQ_MASK))))) {
return CPU_INTERRUPT_HARD;
-#if !defined(CONFIG_USER_ONLY)
} else if (env->hflags2 & HF2_VGIF_MASK) {
if((interrupt_request & CPU_INTERRUPT_VIRQ) &&
(env->eflags & IF_MASK) &&
!(env->hflags & HF_INHIBIT_IRQ_MASK)) {
return CPU_INTERRUPT_VIRQ;
}
-#endif
}
}
@@ -8304,6 +8301,7 @@ static bool x86_cpu_has_work(CPUState *cs)
{
return x86_cpu_pending_interrupt(cs, cs->interrupt_request) != 0;
}
+#endif /* !CONFIG_USER_ONLY */
int x86_mmu_index_pl(CPUX86State *env, unsigned pl)
{
@@ -8544,6 +8542,7 @@ static const Property x86_cpu_properties[] = {
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps i386_sysemu_ops = {
+ .has_work = x86_cpu_has_work,
.get_memory_mapping = x86_cpu_get_memory_mapping,
.get_paging_enabled = x86_cpu_get_paging_enabled,
.get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug,
@@ -8577,7 +8576,6 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
cc->class_by_name = x86_cpu_class_by_name;
cc->parse_features = x86_cpu_parse_featurestr;
- cc->has_work = x86_cpu_has_work;
cc->mmu_index = x86_cpu_mmu_index;
cc->dump_state = x86_cpu_dump_state;
cc->set_pc = x86_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 14/28] target/loongarch: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 13/28] target/i386: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:09 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 15/28] target/m68k: " Philippe Mathieu-Daudé
` (13 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/loongarch/cpu.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index d611a604704..20aba0e1fff 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -349,11 +349,9 @@ static void loongarch_restore_state_to_opc(CPUState *cs,
}
#endif /* CONFIG_TCG */
+#ifndef CONFIG_USER_ONLY
static bool loongarch_cpu_has_work(CPUState *cs)
{
-#ifdef CONFIG_USER_ONLY
- return true;
-#else
bool has_work = false;
if ((cs->interrupt_request & CPU_INTERRUPT_HARD) &&
@@ -362,8 +360,8 @@ static bool loongarch_cpu_has_work(CPUState *cs)
}
return has_work;
-#endif
}
+#endif /* !CONFIG_USER_ONLY */
static int loongarch_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -835,6 +833,7 @@ static const TCGCPUOps loongarch_tcg_ops = {
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps loongarch_sysemu_ops = {
+ .has_work = loongarch_cpu_has_work,
.write_elf64_note = loongarch_cpu_write_elf64_note,
.get_phys_page_debug = loongarch_cpu_get_phys_page_debug,
};
@@ -860,7 +859,6 @@ static void loongarch_cpu_class_init(ObjectClass *c, void *data)
&lacc->parent_phases);
cc->class_by_name = loongarch_cpu_class_by_name;
- cc->has_work = loongarch_cpu_has_work;
cc->mmu_index = loongarch_cpu_mmu_index;
cc->dump_state = loongarch_cpu_dump_state;
cc->set_pc = loongarch_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 15/28] target/m68k: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 14/28] target/loongarch: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:11 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 16/28] target/microblaze: " Philippe Mathieu-Daudé
` (12 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/m68k/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index 41dfdf58045..eb7fb4f7e4c 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -51,10 +51,12 @@ static void m68k_restore_state_to_opc(CPUState *cs,
}
}
+#ifndef CONFIG_USER_ONLY
static bool m68k_cpu_has_work(CPUState *cs)
{
return cs->interrupt_request & CPU_INTERRUPT_HARD;
}
+#endif /* !CONFIG_USER_ONLY */
static int m68k_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -543,6 +545,7 @@ static const VMStateDescription vmstate_m68k_cpu = {
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps m68k_sysemu_ops = {
+ .has_work = m68k_cpu_has_work,
.get_phys_page_debug = m68k_cpu_get_phys_page_debug,
};
#endif /* !CONFIG_USER_ONLY */
@@ -576,7 +579,6 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
&mcc->parent_phases);
cc->class_by_name = m68k_cpu_class_by_name;
- cc->has_work = m68k_cpu_has_work;
cc->mmu_index = m68k_cpu_mmu_index;
cc->dump_state = m68k_cpu_dump_state;
cc->set_pc = m68k_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 16/28] target/microblaze: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 15/28] target/m68k: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:11 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 17/28] target/mips: " Philippe Mathieu-Daudé
` (11 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/microblaze/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index f114789abd8..7a90cb3016b 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -115,10 +115,12 @@ static void mb_restore_state_to_opc(CPUState *cs,
cpu->env.iflags = data[1];
}
+#ifndef CONFIG_USER_ONLY
static bool mb_cpu_has_work(CPUState *cs)
{
return cs->interrupt_request & (CPU_INTERRUPT_HARD | CPU_INTERRUPT_NMI);
}
+#endif /* !CONFIG_USER_ONLY */
static int mb_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -415,6 +417,7 @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps mb_sysemu_ops = {
+ .has_work = mb_cpu_has_work,
.get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug,
};
#endif
@@ -450,7 +453,6 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
&mcc->parent_phases);
cc->class_by_name = mb_cpu_class_by_name;
- cc->has_work = mb_cpu_has_work;
cc->mmu_index = mb_cpu_mmu_index;
cc->dump_state = mb_cpu_dump_state;
cc->set_pc = mb_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 17/28] target/mips: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (15 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 16/28] target/microblaze: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:12 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 18/28] target/openrisc: " Philippe Mathieu-Daudé
` (10 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Move has_work() from CPUClass to SysemuCPUOps and
cpu_mips_hw_interrupts_enabled() to system.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/mips/internal.h | 4 ++--
target/mips/cpu.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/target/mips/internal.h b/target/mips/internal.h
index 91c786cff8a..28eb28936ba 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -162,8 +162,6 @@ void cpu_mips_store_cause(CPUMIPSState *env, target_ulong val);
extern const VMStateDescription vmstate_mips_cpu;
-#endif /* !CONFIG_USER_ONLY */
-
static inline bool cpu_mips_hw_interrupts_enabled(CPUMIPSState *env)
{
return (env->CP0_Status & (1 << CP0St_IE)) &&
@@ -206,6 +204,8 @@ static inline bool cpu_mips_hw_interrupts_pending(CPUMIPSState *env)
return r;
}
+#endif /* !CONFIG_USER_ONLY */
+
void msa_reset(CPUMIPSState *env);
/* cp0_timer.c */
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 47cd7cfdcef..0b3ac4e60a3 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -132,6 +132,7 @@ static vaddr mips_cpu_get_pc(CPUState *cs)
return cpu->env.active_tc.PC;
}
+#if !defined(CONFIG_USER_ONLY)
static bool mips_cpu_has_work(CPUState *cs)
{
CPUMIPSState *env = cpu_env(cs);
@@ -177,6 +178,7 @@ static bool mips_cpu_has_work(CPUState *cs)
}
return has_work;
}
+#endif /* !CONFIG_USER_ONLY */
static int mips_cpu_mmu_index(CPUState *cs, bool ifunc)
{
@@ -534,6 +536,7 @@ static ObjectClass *mips_cpu_class_by_name(const char *cpu_model)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps mips_sysemu_ops = {
+ .has_work = mips_cpu_has_work,
.get_phys_page_debug = mips_cpu_get_phys_page_debug,
.legacy_vmsd = &vmstate_mips_cpu,
};
@@ -577,7 +580,6 @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
&mcc->parent_phases);
cc->class_by_name = mips_cpu_class_by_name;
- cc->has_work = mips_cpu_has_work;
cc->mmu_index = mips_cpu_mmu_index;
cc->dump_state = mips_cpu_dump_state;
cc->set_pc = mips_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 18/28] target/openrisc: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (16 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 17/28] target/mips: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:13 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 19/28] target/ppc: " Philippe Mathieu-Daudé
` (9 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/openrisc/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
index b7bab0d7abf..5d80c4aa9ac 100644
--- a/target/openrisc/cpu.c
+++ b/target/openrisc/cpu.c
@@ -63,11 +63,13 @@ static void openrisc_restore_state_to_opc(CPUState *cs,
}
}
+#ifndef CONFIG_USER_ONLY
static bool openrisc_cpu_has_work(CPUState *cs)
{
return cs->interrupt_request & (CPU_INTERRUPT_HARD |
CPU_INTERRUPT_TIMER);
}
+#endif /* !CONFIG_USER_ONLY */
static int openrisc_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -228,6 +230,7 @@ static void openrisc_any_initfn(Object *obj)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps openrisc_sysemu_ops = {
+ .has_work = openrisc_cpu_has_work,
.get_phys_page_debug = openrisc_cpu_get_phys_page_debug,
};
#endif
@@ -261,7 +264,6 @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
&occ->parent_phases);
cc->class_by_name = openrisc_cpu_class_by_name;
- cc->has_work = openrisc_cpu_has_work;
cc->mmu_index = openrisc_cpu_mmu_index;
cc->dump_state = openrisc_cpu_dump_state;
cc->set_pc = openrisc_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 19/28] target/ppc: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (17 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 18/28] target/openrisc: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:14 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 20/28] target/riscv: " Philippe Mathieu-Daudé
` (8 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/ppc/cpu_init.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index c05c2dc42dc..081fb5bd343 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -7177,10 +7177,12 @@ static void ppc_restore_state_to_opc(CPUState *cs,
}
#endif /* CONFIG_TCG */
+#ifndef CONFIG_USER_ONLY
static bool ppc_cpu_has_work(CPUState *cs)
{
return cs->interrupt_request & CPU_INTERRUPT_HARD;
}
+#endif /* !CONFIG_USER_ONLY */
static int ppc_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -7418,6 +7420,7 @@ static void ppc_disas_set_info(CPUState *cs, disassemble_info *info)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps ppc_sysemu_ops = {
+ .has_work = ppc_cpu_has_work,
.get_phys_page_debug = ppc_cpu_get_phys_page_debug,
.write_elf32_note = ppc32_cpu_write_elf32_note,
.write_elf64_note = ppc64_cpu_write_elf64_note,
@@ -7469,7 +7472,6 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
&pcc->parent_phases);
cc->class_by_name = ppc_cpu_class_by_name;
- cc->has_work = ppc_cpu_has_work;
cc->mmu_index = ppc_cpu_mmu_index;
cc->dump_state = ppc_cpu_dump_state;
cc->set_pc = ppc_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 20/28] target/riscv: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (18 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 19/28] target/ppc: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:17 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 21/28] target/rx: " Philippe Mathieu-Daudé
` (7 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/riscv/cpu.h | 9 +++++----
target/riscv/internals.h | 3 ---
target/riscv/cpu.c | 8 +++-----
3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 97713681cbe..32e8e064f36 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -552,10 +552,6 @@ int riscv_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int riscv_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
int riscv_cpu_hviprio_index2irq(int index, int *out_irq, int *out_rdzero);
uint8_t riscv_cpu_default_priority(int irq);
-uint64_t riscv_cpu_all_pending(CPURISCVState *env);
-int riscv_cpu_mirq_pending(CPURISCVState *env);
-int riscv_cpu_sirq_pending(CPURISCVState *env);
-int riscv_cpu_vsirq_pending(CPURISCVState *env);
bool riscv_cpu_fp_enabled(CPURISCVState *env);
target_ulong riscv_cpu_get_geilen(CPURISCVState *env);
void riscv_cpu_set_geilen(CPURISCVState *env, target_ulong geilen);
@@ -576,6 +572,11 @@ int riscv_cpu_max_xlen(RISCVCPUClass *mcc);
bool riscv_cpu_option_set(const char *optname);
#ifndef CONFIG_USER_ONLY
+bool riscv_cpu_has_work(CPUState *cs);
+uint64_t riscv_cpu_all_pending(CPURISCVState *env);
+int riscv_cpu_mirq_pending(CPURISCVState *env);
+int riscv_cpu_sirq_pending(CPURISCVState *env);
+int riscv_cpu_vsirq_pending(CPURISCVState *env);
void riscv_cpu_do_interrupt(CPUState *cpu);
void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename);
void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
diff --git a/target/riscv/internals.h b/target/riscv/internals.h
index 67291933f84..86def39aec2 100644
--- a/target/riscv/internals.h
+++ b/target/riscv/internals.h
@@ -142,9 +142,6 @@ static inline float16 check_nanbox_h(CPURISCVState *env, uint64_t f)
}
}
-/* Our implementation of CPUClass::has_work */
-bool riscv_cpu_has_work(CPUState *cs);
-
/* Zjpm addr masking routine */
static inline target_ulong adjust_addr_body(CPURISCVState *env,
target_ulong addr,
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 3d4bd157d2c..4a7e02d9a99 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -1010,9 +1010,9 @@ static vaddr riscv_cpu_get_pc(CPUState *cs)
return env->pc;
}
+#ifndef CONFIG_USER_ONLY
bool riscv_cpu_has_work(CPUState *cs)
{
-#ifndef CONFIG_USER_ONLY
RISCVCPU *cpu = RISCV_CPU(cs);
CPURISCVState *env = &cpu->env;
/*
@@ -1022,10 +1022,8 @@ bool riscv_cpu_has_work(CPUState *cs)
return riscv_cpu_all_pending(env) != 0 ||
riscv_cpu_sirq_pending(env) != RISCV_EXCP_NONE ||
riscv_cpu_vsirq_pending(env) != RISCV_EXCP_NONE;
-#else
- return true;
-#endif
}
+#endif /* !CONFIG_USER_ONLY */
static int riscv_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -2912,6 +2910,7 @@ static int64_t riscv_get_arch_id(CPUState *cs)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps riscv_sysemu_ops = {
+ .has_work = riscv_cpu_has_work,
.get_phys_page_debug = riscv_cpu_get_phys_page_debug,
.write_elf64_note = riscv_cpu_write_elf64_note,
.write_elf32_note = riscv_cpu_write_elf32_note,
@@ -2933,7 +2932,6 @@ static void riscv_cpu_common_class_init(ObjectClass *c, void *data)
&mcc->parent_phases);
cc->class_by_name = riscv_cpu_class_by_name;
- cc->has_work = riscv_cpu_has_work;
cc->mmu_index = riscv_cpu_mmu_index;
cc->dump_state = riscv_cpu_dump_state;
cc->set_pc = riscv_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 21/28] target/rx: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (19 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 20/28] target/riscv: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:17 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 22/28] target/s390x: Restrict I/O handler installers to system emulation Philippe Mathieu-Daudé
` (6 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/rx/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
index aa310bd6144..79b95090e7a 100644
--- a/target/rx/cpu.c
+++ b/target/rx/cpu.c
@@ -187,6 +187,7 @@ static void rx_cpu_init(Object *obj)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps rx_sysemu_ops = {
+ .has_work = rx_cpu_has_work,
.get_phys_page_debug = rx_cpu_get_phys_page_debug,
};
@@ -217,7 +218,6 @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
&rcc->parent_phases);
cc->class_by_name = rx_cpu_class_by_name;
- cc->has_work = rx_cpu_has_work;
cc->mmu_index = riscv_cpu_mmu_index;
cc->dump_state = rx_cpu_dump_state;
cc->set_pc = rx_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 22/28] target/s390x: Restrict I/O handler installers to system emulation
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (20 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 21/28] target/rx: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:18 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 23/28] target/s390x: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
` (5 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/s390x/s390x-internal.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h
index a750e7a343a..6e2c98de97a 100644
--- a/target/s390x/s390x-internal.h
+++ b/target/s390x/s390x-internal.h
@@ -356,6 +356,7 @@ void cpu_inject_stop(S390CPU *cpu);
/* ioinst.c */
+#ifndef CONFIG_USER_ONLY
void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra);
void ioinst_handle_csch(S390CPU *cpu, uint64_t reg1, uintptr_t ra);
void ioinst_handle_hsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra);
@@ -373,6 +374,7 @@ void ioinst_handle_schm(S390CPU *cpu, uint64_t reg1, uint64_t reg2,
void ioinst_handle_rsch(S390CPU *cpu, uint64_t reg1, uintptr_t ra);
void ioinst_handle_rchp(S390CPU *cpu, uint64_t reg1, uintptr_t ra);
void ioinst_handle_sal(S390CPU *cpu, uint64_t reg1, uintptr_t ra);
+#endif /* CONFIG_USER_ONLY */
/* mem_helper.c */
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 23/28] target/s390x: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (21 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 22/28] target/s390x: Restrict I/O handler installers to system emulation Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:21 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 24/28] target/sh4: " Philippe Mathieu-Daudé
` (4 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Move has_work() from CPUClass to SysemuCPUOps, move
s390_cpu_has_work() to cpu-system.c so it is only build
for system emulation binaries, restrict functions not
used anymore on user emulation in interrupt.c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/s390x/s390x-internal.h | 3 +++
target/s390x/cpu-system.c | 18 ++++++++++++++++++
target/s390x/cpu.c | 18 ------------------
target/s390x/interrupt.c | 8 ++------
4 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h
index 6e2c98de97a..a4ba6227ab4 100644
--- a/target/s390x/s390x-internal.h
+++ b/target/s390x/s390x-internal.h
@@ -245,6 +245,7 @@ bool s390_cpu_system_realize(DeviceState *dev, Error **errp);
void s390_cpu_finalize(Object *obj);
void s390_cpu_system_class_init(CPUClass *cc);
void s390_cpu_machine_reset_cb(void *opaque);
+bool s390_cpu_has_work(CPUState *cs);
#else
static inline unsigned int s390_cpu_halt(S390CPU *cpu)
@@ -341,6 +342,7 @@ void cpu_unmap_lowcore(LowCore *lowcore);
/* interrupt.c */
void trigger_pgm_exception(CPUS390XState *env, uint32_t code);
+#ifndef CONFIG_USER_ONLY
void cpu_inject_clock_comparator(S390CPU *cpu);
void cpu_inject_cpu_timer(S390CPU *cpu);
void cpu_inject_emergency_signal(S390CPU *cpu, uint16_t src_cpu_addr);
@@ -353,6 +355,7 @@ bool s390_cpu_has_restart_int(S390CPU *cpu);
bool s390_cpu_has_stop_int(S390CPU *cpu);
void cpu_inject_restart(S390CPU *cpu);
void cpu_inject_stop(S390CPU *cpu);
+#endif /* CONFIG_USER_ONLY */
/* ioinst.c */
diff --git a/target/s390x/cpu-system.c b/target/s390x/cpu-system.c
index e9f8e7cc72f..9b380e343c2 100644
--- a/target/s390x/cpu-system.c
+++ b/target/s390x/cpu-system.c
@@ -39,6 +39,23 @@
#include "system/tcg.h"
#include "hw/core/sysemu-cpu-ops.h"
+bool s390_cpu_has_work(CPUState *cs)
+{
+ S390CPU *cpu = S390_CPU(cs);
+
+ /* STOPPED cpus can never wake up */
+ if (s390_cpu_get_state(cpu) != S390_CPU_STATE_LOAD &&
+ s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING) {
+ return false;
+ }
+
+ if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
+ return false;
+ }
+
+ return s390_cpu_has_int(cpu);
+}
+
/* S390CPUClass::load_normal() */
static void s390_cpu_load_normal(CPUState *s)
{
@@ -158,6 +175,7 @@ void s390_cpu_finalize(Object *obj)
}
static const struct SysemuCPUOps s390_sysemu_ops = {
+ .has_work = s390_cpu_has_work,
.get_phys_page_debug = s390_cpu_get_phys_page_debug,
.get_crash_info = s390_cpu_get_crash_info,
.write_elf64_note = s390_cpu_write_elf64_note,
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 97d41c23de7..eb2c6650989 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -126,23 +126,6 @@ static vaddr s390_cpu_get_pc(CPUState *cs)
return cpu->env.psw.addr;
}
-static bool s390_cpu_has_work(CPUState *cs)
-{
- S390CPU *cpu = S390_CPU(cs);
-
- /* STOPPED cpus can never wake up */
- if (s390_cpu_get_state(cpu) != S390_CPU_STATE_LOAD &&
- s390_cpu_get_state(cpu) != S390_CPU_STATE_OPERATING) {
- return false;
- }
-
- if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
- return false;
- }
-
- return s390_cpu_has_int(cpu);
-}
-
static int s390x_cpu_mmu_index(CPUState *cs, bool ifetch)
{
return s390x_env_mmu_index(cpu_env(cs), ifetch);
@@ -394,7 +377,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
&scc->parent_phases);
cc->class_by_name = s390_cpu_class_by_name,
- cc->has_work = s390_cpu_has_work;
cc->mmu_index = s390x_cpu_mmu_index;
cc->dump_state = s390_cpu_dump_state;
cc->query_cpu_fast = s390_query_cpu_fast;
diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c
index d68d8955b1a..4ae6e2ddeaa 100644
--- a/target/s390x/interrupt.c
+++ b/target/s390x/interrupt.c
@@ -30,6 +30,7 @@ void trigger_pgm_exception(CPUS390XState *env, uint32_t code)
/* env->int_pgm_ilen is already set, or will be set during unwinding */
}
+#if !defined(CONFIG_USER_ONLY)
void s390_program_interrupt(CPUS390XState *env, uint32_t code, uintptr_t ra)
{
if (kvm_enabled()) {
@@ -41,7 +42,6 @@ void s390_program_interrupt(CPUS390XState *env, uint32_t code, uintptr_t ra)
}
}
-#if !defined(CONFIG_USER_ONLY)
void cpu_inject_clock_comparator(S390CPU *cpu)
{
CPUS390XState *env = &cpu->env;
@@ -225,11 +225,9 @@ bool s390_cpu_has_stop_int(S390CPU *cpu)
return env->pending_int & INTERRUPT_STOP;
}
-#endif
bool s390_cpu_has_int(S390CPU *cpu)
{
-#ifndef CONFIG_USER_ONLY
if (!tcg_enabled()) {
return false;
}
@@ -238,7 +236,5 @@ bool s390_cpu_has_int(S390CPU *cpu)
s390_cpu_has_io_int(cpu) ||
s390_cpu_has_restart_int(cpu) ||
s390_cpu_has_stop_int(cpu);
-#else
- return false;
-#endif
}
+#endif /* !CONFIG_USER_ONLY */
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 24/28] target/sh4: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (22 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 23/28] target/s390x: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:35 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 25/28] target/sparc: " Philippe Mathieu-Daudé
` (3 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/sh4/cpu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index 24a22724c61..80a66e1f1d6 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -82,12 +82,12 @@ static bool superh_io_recompile_replay_branch(CPUState *cs,
}
return false;
}
-#endif
static bool superh_cpu_has_work(CPUState *cs)
{
return cs->interrupt_request & CPU_INTERRUPT_HARD;
}
+#endif /* !CONFIG_USER_ONLY */
static int sh4_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -243,6 +243,7 @@ static const VMStateDescription vmstate_sh_cpu = {
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps sh4_sysemu_ops = {
+ .has_work = superh_cpu_has_work,
.get_phys_page_debug = superh_cpu_get_phys_page_debug,
};
#endif
@@ -279,7 +280,6 @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
&scc->parent_phases);
cc->class_by_name = superh_cpu_class_by_name;
- cc->has_work = superh_cpu_has_work;
cc->mmu_index = sh4_cpu_mmu_index;
cc->dump_state = superh_cpu_dump_state;
cc->set_pc = superh_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 25/28] target/sparc: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (23 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 24/28] target/sh4: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:35 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 26/28] target/tricore: " Philippe Mathieu-Daudé
` (2 subsequent siblings)
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/sparc/cpu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index fbd38ec334a..94e807f9f84 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -776,11 +776,13 @@ static void sparc_restore_state_to_opc(CPUState *cs,
}
}
+#ifndef CONFIG_USER_ONLY
static bool sparc_cpu_has_work(CPUState *cs)
{
return (cs->interrupt_request & CPU_INTERRUPT_HARD) &&
cpu_interrupts_enabled(cpu_env(cs));
}
+#endif /* !CONFIG_USER_ONLY */
static int sparc_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -986,6 +988,7 @@ static const Property sparc_cpu_properties[] = {
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps sparc_sysemu_ops = {
+ .has_work = sparc_cpu_has_work,
.get_phys_page_debug = sparc_cpu_get_phys_page_debug,
.legacy_vmsd = &vmstate_sparc_cpu,
};
@@ -1027,7 +1030,6 @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
cc->class_by_name = sparc_cpu_class_by_name;
cc->parse_features = sparc_cpu_parse_features;
- cc->has_work = sparc_cpu_has_work;
cc->mmu_index = sparc_cpu_mmu_index;
cc->dump_state = sparc_cpu_dump_state;
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 26/28] target/tricore: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (24 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 25/28] target/sparc: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:36 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 27/28] target/xtensa: " Philippe Mathieu-Daudé
2025-01-21 14:23 ` [PATCH 28/28] cpus: Remove CPUClass::has_work() handler Philippe Mathieu-Daudé
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/tricore/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index 95202fadbfd..e4f95876efd 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -165,6 +165,7 @@ static bool tricore_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps tricore_sysemu_ops = {
+ .has_work = tricore_cpu_has_work,
.get_phys_page_debug = tricore_cpu_get_phys_page_debug,
};
@@ -193,7 +194,6 @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
resettable_class_set_parent_phases(rc, NULL, tricore_cpu_reset_hold, NULL,
&mcc->parent_phases);
cc->class_by_name = tricore_cpu_class_by_name;
- cc->has_work = tricore_cpu_has_work;
cc->mmu_index = tricore_cpu_mmu_index;
cc->gdb_read_register = tricore_cpu_gdb_read_register;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 27/28] target/xtensa: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (25 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 26/28] target/tricore: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:36 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 28/28] cpus: Remove CPUClass::has_work() handler Philippe Mathieu-Daudé
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
Move has_work() from CPUClass to SysemuCPUOps, simplifying
xtensa_cpu_has_work() by directly using CPU env.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/xtensa/cpu.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index 4eb699d1f45..c5d7682f4bf 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -63,16 +63,14 @@ static void xtensa_restore_state_to_opc(CPUState *cs,
cpu->env.pc = data[0];
}
+#ifndef CONFIG_USER_ONLY
static bool xtensa_cpu_has_work(CPUState *cs)
{
-#ifndef CONFIG_USER_ONLY
- XtensaCPU *cpu = XTENSA_CPU(cs);
+ CPUXtensaState *env = cpu_env(cs);
- return !cpu->env.runstall && cpu->env.pending_irq_level;
-#else
- return true;
-#endif
+ return !env->runstall && env->pending_irq_level;
}
+#endif /* !CONFIG_USER_ONLY */
static int xtensa_cpu_mmu_index(CPUState *cs, bool ifetch)
{
@@ -224,6 +222,7 @@ static const VMStateDescription vmstate_xtensa_cpu = {
#include "hw/core/sysemu-cpu-ops.h"
static const struct SysemuCPUOps xtensa_sysemu_ops = {
+ .has_work = xtensa_cpu_has_work,
.get_phys_page_debug = xtensa_cpu_get_phys_page_debug,
};
#endif
@@ -261,7 +260,6 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
&xcc->parent_phases);
cc->class_by_name = xtensa_cpu_class_by_name;
- cc->has_work = xtensa_cpu_has_work;
cc->mmu_index = xtensa_cpu_mmu_index;
cc->dump_state = xtensa_cpu_dump_state;
cc->set_pc = xtensa_cpu_set_pc;
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* [PATCH 28/28] cpus: Remove CPUClass::has_work() handler
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
` (26 preceding siblings ...)
2025-01-21 14:23 ` [PATCH 27/28] target/xtensa: " Philippe Mathieu-Daudé
@ 2025-01-21 14:23 ` Philippe Mathieu-Daudé
2025-01-24 17:40 ` Richard Henderson
27 siblings, 1 reply; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-21 14:23 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé
All handlers have been converted to SysemuCPUOps::has_work().
Remove CPUClass::has_work along with cpu_common_has_work() and
simplify cpu_has_work(), asserting SysemuCPUOps::has_work is
always registered.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/core/cpu.h | 2 --
hw/core/cpu-common.c | 6 ------
hw/core/cpu-system.c | 8 ++------
3 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index d64c823e768..2bcad4b16bf 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -104,7 +104,6 @@ struct SysemuCPUOps;
* instantiatable CPU type.
* @parse_features: Callback to parse command line arguments.
* @reset_dump_flags: #CPUDumpFlags to use for reset logging.
- * @has_work: Callback for checking if there is work to do.
* @mmu_index: Callback for choosing softmmu mmu index;
* may be used internally by memory_rw_debug without TCG.
* @memory_rw_debug: Callback for GDB memory access.
@@ -151,7 +150,6 @@ struct CPUClass {
ObjectClass *(*class_by_name)(const char *cpu_model);
void (*parse_features)(const char *typename, char *str, Error **errp);
- bool (*has_work)(CPUState *cpu);
int (*mmu_index)(CPUState *cpu, bool ifetch);
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
uint8_t *buf, int len, bool is_write);
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
index 886aa793c04..c933de1416c 100644
--- a/hw/core/cpu-common.c
+++ b/hw/core/cpu-common.c
@@ -134,11 +134,6 @@ static void cpu_common_reset_hold(Object *obj, ResetType type)
cpu_exec_reset_hold(cpu);
}
-static bool cpu_common_has_work(CPUState *cs)
-{
- return false;
-}
-
ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
{
ObjectClass *oc;
@@ -304,7 +299,6 @@ static void cpu_common_class_init(ObjectClass *klass, void *data)
k->parse_features = cpu_common_parse_features;
k->get_arch_id = cpu_common_get_arch_id;
- k->has_work = cpu_common_has_work;
k->gdb_read_register = cpu_common_gdb_read_register;
k->gdb_write_register = cpu_common_gdb_write_register;
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
index 7b16bda2250..7f287984aa6 100644
--- a/hw/core/cpu-system.c
+++ b/hw/core/cpu-system.c
@@ -25,12 +25,8 @@
bool cpu_has_work(CPUState *cpu)
{
- if (cpu->cc->sysemu_ops->has_work) {
- return cpu->cc->sysemu_ops->has_work(cpu);
- }
-
- g_assert(cpu->cc->has_work);
- return cpu->cc->has_work(cpu);
+ g_assert(cpu->cc->sysemu_ops->has_work);
+ return cpu->cc->sysemu_ops->has_work(cpu);
}
bool cpu_paging_enabled(const CPUState *cpu)
--
2.47.1
^ permalink raw reply related [flat|nested] 59+ messages in thread
* Re: [PATCH 01/28] target/hexagon: Ensure not being build on system emulation
2025-01-21 14:23 ` [PATCH 01/28] target/hexagon: Ensure not being build on " Philippe Mathieu-Daudé
@ 2025-01-21 17:39 ` Brian Cain
0 siblings, 0 replies; 59+ messages in thread
From: Brian Cain @ 2025-01-21 17:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson
On 1/21/2025 8:23 AM, Philippe Mathieu-Daudé wrote:
> Currently only user emulation is supported.
> Assert no target code is built for system emulation.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/hexagon/cpu.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
> index 79e60d4bfa1..f78c8f9c2a0 100644
> --- a/target/hexagon/cpu.h
> +++ b/target/hexagon/cpu.h
> @@ -26,6 +26,10 @@
> #include "mmvec/mmvec.h"
> #include "hw/registerfields.h"
>
> +#ifndef CONFIG_USER_ONLY
> +#error "Hexagon does not support system emulation"
> +#endif
> +
> #define NUM_PREGS 4
> #define TOTAL_PER_THREAD_REGS 64
>
We hope to mitigate this one in the not-too-distant future. Staged
commits on my tree implement system emulation, undergoing some
review/revision now. ;)
But of course this change makes sense for the time being.
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 02/28] target/rx: Ensure not being build on user emulation
2025-01-21 14:23 ` [PATCH 02/28] target/rx: Ensure not being build on user emulation Philippe Mathieu-Daudé
@ 2025-01-24 16:51 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 16:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Currently only system emulation is supported.
> Assert no target code is built for user emulation.
> Remove #ifdef'ry since more work is required before
> being able to emulate a user process.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/rx/cpu.h | 6 ++++--
> target/rx/cpu.c | 6 ------
> target/rx/helper.c | 4 ----
> 3 files changed, 4 insertions(+), 12 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 03/28] target/tricore: Ensure not being build on user emulation
2025-01-21 14:23 ` [PATCH 03/28] target/tricore: " Philippe Mathieu-Daudé
@ 2025-01-24 16:51 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 16:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Currently only system emulation is supported.
> Assert no target code is built for user emulation.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/tricore/cpu.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
> index 8e431d79222..cf9dbc6df8e 100644
> --- a/target/tricore/cpu.h
> +++ b/target/tricore/cpu.h
> @@ -26,6 +26,10 @@
> #include "qemu/cpu-float.h"
> #include "tricore-defs.h"
>
> +#ifdef CONFIG_USER_ONLY
> +#error "TriCore does not support user mode emulation"
> +#endif
> +
> typedef struct CPUArchState {
> /* GPR Register */
> uint32_t gpr_a[16];
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 04/28] cpus: Restrict cpu_get_memory_mapping() to system emulation
2025-01-21 14:23 ` [PATCH 04/28] cpus: Restrict cpu_get_memory_mapping() to system emulation Philippe Mathieu-Daudé
@ 2025-01-24 16:52 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 16:52 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/core/cpu.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> index b7367f6d808..2402706c7d9 100644
> --- a/include/hw/core/cpu.h
> +++ b/include/hw/core/cpu.h
> @@ -614,6 +614,8 @@ extern bool mttcg_enabled;
> */
> bool cpu_paging_enabled(const CPUState *cpu);
>
> +#if !defined(CONFIG_USER_ONLY)
> +
> /**
> * cpu_get_memory_mapping:
> * @cpu: The CPU whose memory mappings are to be obtained.
> @@ -625,8 +627,6 @@ bool cpu_paging_enabled(const CPUState *cpu);
> bool cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
> Error **errp);
>
> -#if !defined(CONFIG_USER_ONLY)
> -
> /**
> * cpu_write_elf64_note:
> * @f: pointer to a function that writes memory to a file
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 05/28] cpus: Restrict cpu_has_work() to system emulation
2025-01-21 14:23 ` [PATCH 05/28] cpus: Restrict cpu_has_work() " Philippe Mathieu-Daudé
@ 2025-01-24 16:52 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 16:52 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> This method is not used on user emulation, because there
> is always work to do there.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/core/cpu.h | 28 ++++++++++++++--------------
> 1 file changed, 14 insertions(+), 14 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 06/28] cpus: Un-inline cpu_has_work()
2025-01-21 14:23 ` [PATCH 06/28] cpus: Un-inline cpu_has_work() Philippe Mathieu-Daudé
@ 2025-01-24 16:59 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 16:59 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> In order to expand cpu_has_work(), un-inline it.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> include/hw/core/cpu.h | 6 +-----
> hw/core/cpu-system.c | 6 ++++++
> 2 files changed, 7 insertions(+), 5 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 07/28] cpus: Introduce SysemuCPUOps::has_work() handler
2025-01-21 14:23 ` [PATCH 07/28] cpus: Introduce SysemuCPUOps::has_work() handler Philippe Mathieu-Daudé
@ 2025-01-24 17:05 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> SysemuCPUOps::has_work() is similar to CPUClass::has_work(),
> but only exposed on system emulation.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/hw/core/sysemu-cpu-ops.h | 4 ++++
> hw/core/cpu-system.c | 4 ++++
> 2 files changed, 8 insertions(+)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 08/28] target/alpha: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 08/28] target/alpha: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
@ 2025-01-24 17:06 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:06 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/alpha/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 09/28] target/arm: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 09/28] target/arm: " Philippe Mathieu-Daudé
@ 2025-01-24 17:06 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:06 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/arm/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 10/28] target/avr: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 10/28] target/avr: " Philippe Mathieu-Daudé
@ 2025-01-24 17:06 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:06 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/avr/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler
2025-01-21 14:23 ` [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler Philippe Mathieu-Daudé
@ 2025-01-24 17:07 ` Richard Henderson
2025-01-24 17:26 ` Brian Cain
1 sibling, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:07 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Remove as unreachable code.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/hexagon/cpu.c | 6 ------
> 1 file changed, 6 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 12/28] target/hppa: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 12/28] target/hppa: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
@ 2025-01-24 17:08 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:08 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/hppa/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 13/28] target/i386: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 13/28] target/i386: " Philippe Mathieu-Daudé
@ 2025-01-24 17:09 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:09 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Move has_work() from CPUClass to SysemuCPUOps,
> restrict x86_cpu_pending_interrupt() to system.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/i386/cpu.h | 4 ++--
> target/i386/cpu.c | 8 +++-----
> 2 files changed, 5 insertions(+), 7 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 14/28] target/loongarch: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 14/28] target/loongarch: " Philippe Mathieu-Daudé
@ 2025-01-24 17:09 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:09 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/loongarch/cpu.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 15/28] target/m68k: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 15/28] target/m68k: " Philippe Mathieu-Daudé
@ 2025-01-24 17:11 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/m68k/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
> index 41dfdf58045..eb7fb4f7e4c 100644
> --- a/target/m68k/cpu.c
> +++ b/target/m68k/cpu.c
> @@ -51,10 +51,12 @@ static void m68k_restore_state_to_opc(CPUState *cs,
> }
> }
>
> +#ifndef CONFIG_USER_ONLY
> static bool m68k_cpu_has_work(CPUState *cs)
> {
> return cs->interrupt_request & CPU_INTERRUPT_HARD;
> }
> +#endif /* !CONFIG_USER_ONLY */
>
> static int m68k_cpu_mmu_index(CPUState *cs, bool ifetch)
> {
> @@ -543,6 +545,7 @@ static const VMStateDescription vmstate_m68k_cpu = {
> #include "hw/core/sysemu-cpu-ops.h"
>
> static const struct SysemuCPUOps m68k_sysemu_ops = {
> + .has_work = m68k_cpu_has_work,
> .get_phys_page_debug = m68k_cpu_get_phys_page_debug,
> };
> #endif /* !CONFIG_USER_ONLY */
> @@ -576,7 +579,6 @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
> &mcc->parent_phases);
>
> cc->class_by_name = m68k_cpu_class_by_name;
> - cc->has_work = m68k_cpu_has_work;
> cc->mmu_index = m68k_cpu_mmu_index;
> cc->dump_state = m68k_cpu_dump_state;
> cc->set_pc = m68k_cpu_set_pc;
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 16/28] target/microblaze: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 16/28] target/microblaze: " Philippe Mathieu-Daudé
@ 2025-01-24 17:11 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/microblaze/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 17/28] target/mips: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 17/28] target/mips: " Philippe Mathieu-Daudé
@ 2025-01-24 17:12 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:12 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Move has_work() from CPUClass to SysemuCPUOps and
> cpu_mips_hw_interrupts_enabled() to system.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/mips/internal.h | 4 ++--
> target/mips/cpu.c | 4 +++-
> 2 files changed, 5 insertions(+), 3 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 18/28] target/openrisc: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 18/28] target/openrisc: " Philippe Mathieu-Daudé
@ 2025-01-24 17:13 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/openrisc/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 19/28] target/ppc: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 19/28] target/ppc: " Philippe Mathieu-Daudé
@ 2025-01-24 17:14 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:14 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/ppc/cpu_init.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 20/28] target/riscv: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 20/28] target/riscv: " Philippe Mathieu-Daudé
@ 2025-01-24 17:17 ` Richard Henderson
2025-01-24 17:41 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:17 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/riscv/cpu.h | 9 +++++----
> target/riscv/internals.h | 3 ---
> target/riscv/cpu.c | 8 +++-----
> 3 files changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 97713681cbe..32e8e064f36 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -552,10 +552,6 @@ int riscv_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
> int riscv_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
> int riscv_cpu_hviprio_index2irq(int index, int *out_irq, int *out_rdzero);
> uint8_t riscv_cpu_default_priority(int irq);
> -uint64_t riscv_cpu_all_pending(CPURISCVState *env);
> -int riscv_cpu_mirq_pending(CPURISCVState *env);
> -int riscv_cpu_sirq_pending(CPURISCVState *env);
> -int riscv_cpu_vsirq_pending(CPURISCVState *env);
> bool riscv_cpu_fp_enabled(CPURISCVState *env);
> target_ulong riscv_cpu_get_geilen(CPURISCVState *env);
> void riscv_cpu_set_geilen(CPURISCVState *env, target_ulong geilen);
> @@ -576,6 +572,11 @@ int riscv_cpu_max_xlen(RISCVCPUClass *mcc);
> bool riscv_cpu_option_set(const char *optname);
>
> #ifndef CONFIG_USER_ONLY
> +bool riscv_cpu_has_work(CPUState *cs);
> +uint64_t riscv_cpu_all_pending(CPURISCVState *env);
> +int riscv_cpu_mirq_pending(CPURISCVState *env);
> +int riscv_cpu_sirq_pending(CPURISCVState *env);
> +int riscv_cpu_vsirq_pending(CPURISCVState *env);
> void riscv_cpu_do_interrupt(CPUState *cpu);
> void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename);
> void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
> diff --git a/target/riscv/internals.h b/target/riscv/internals.h
> index 67291933f84..86def39aec2 100644
> --- a/target/riscv/internals.h
> +++ b/target/riscv/internals.h
> @@ -142,9 +142,6 @@ static inline float16 check_nanbox_h(CPURISCVState *env, uint64_t f)
> }
> }
>
> -/* Our implementation of CPUClass::has_work */
> -bool riscv_cpu_has_work(CPUState *cs);
> -
Why move the declaration from internals.h to cpu.h?
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 21/28] target/rx: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 21/28] target/rx: " Philippe Mathieu-Daudé
@ 2025-01-24 17:17 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:17 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/rx/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 22/28] target/s390x: Restrict I/O handler installers to system emulation
2025-01-21 14:23 ` [PATCH 22/28] target/s390x: Restrict I/O handler installers to system emulation Philippe Mathieu-Daudé
@ 2025-01-24 17:18 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/s390x/s390x-internal.h | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 23/28] target/s390x: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 23/28] target/s390x: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
@ 2025-01-24 17:21 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Move has_work() from CPUClass to SysemuCPUOps, move
> s390_cpu_has_work() to cpu-system.c so it is only build
> for system emulation binaries, restrict functions not
> used anymore on user emulation in interrupt.c.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/s390x/s390x-internal.h | 3 +++
> target/s390x/cpu-system.c | 18 ++++++++++++++++++
> target/s390x/cpu.c | 18 ------------------
> target/s390x/interrupt.c | 8 ++------
> 4 files changed, 23 insertions(+), 24 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler
2025-01-21 14:23 ` [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler Philippe Mathieu-Daudé
2025-01-24 17:07 ` Richard Henderson
@ 2025-01-24 17:26 ` Brian Cain
1 sibling, 0 replies; 59+ messages in thread
From: Brian Cain @ 2025-01-24 17:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini,
Richard Henderson
On 1/21/2025 8:23 AM, Philippe Mathieu-Daudé wrote:
> Remove as unreachable code.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
> target/hexagon/cpu.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
> index 0b7fc98f6ce..f77e305d611 100644
> --- a/target/hexagon/cpu.c
> +++ b/target/hexagon/cpu.c
> @@ -262,11 +262,6 @@ static void hexagon_cpu_synchronize_from_tb(CPUState *cs,
> cpu_env(cs)->gpr[HEX_REG_PC] = tb->pc;
> }
>
> -static bool hexagon_cpu_has_work(CPUState *cs)
> -{
> - return true;
> -}
> -
> static void hexagon_restore_state_to_opc(CPUState *cs,
> const TranslationBlock *tb,
> const uint64_t *data)
> @@ -345,7 +340,6 @@ static void hexagon_cpu_class_init(ObjectClass *c, void *data)
> &mcc->parent_phases);
>
> cc->class_by_name = hexagon_cpu_class_by_name;
> - cc->has_work = hexagon_cpu_has_work;
> cc->dump_state = hexagon_dump_state;
> cc->set_pc = hexagon_cpu_set_pc;
> cc->get_pc = hexagon_cpu_get_pc;
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 24/28] target/sh4: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 24/28] target/sh4: " Philippe Mathieu-Daudé
@ 2025-01-24 17:35 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:35 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/sh4/cpu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 25/28] target/sparc: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 25/28] target/sparc: " Philippe Mathieu-Daudé
@ 2025-01-24 17:35 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:35 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/sparc/cpu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 26/28] target/tricore: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 26/28] target/tricore: " Philippe Mathieu-Daudé
@ 2025-01-24 17:36 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> target/tricore/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 27/28] target/xtensa: Move has_work() from CPUClass to SysemuCPUOps
2025-01-21 14:23 ` [PATCH 27/28] target/xtensa: " Philippe Mathieu-Daudé
@ 2025-01-24 17:36 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> Move has_work() from CPUClass to SysemuCPUOps, simplifying
> xtensa_cpu_has_work() by directly using CPU env.
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> target/xtensa/cpu.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 28/28] cpus: Remove CPUClass::has_work() handler
2025-01-21 14:23 ` [PATCH 28/28] cpus: Remove CPUClass::has_work() handler Philippe Mathieu-Daudé
@ 2025-01-24 17:40 ` Richard Henderson
0 siblings, 0 replies; 59+ messages in thread
From: Richard Henderson @ 2025-01-24 17:40 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
> diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c
> index 7b16bda2250..7f287984aa6 100644
> --- a/hw/core/cpu-system.c
> +++ b/hw/core/cpu-system.c
> @@ -25,12 +25,8 @@
>
> bool cpu_has_work(CPUState *cpu)
> {
> - if (cpu->cc->sysemu_ops->has_work) {
> - return cpu->cc->sysemu_ops->has_work(cpu);
> - }
> -
> - g_assert(cpu->cc->has_work);
> - return cpu->cc->has_work(cpu);
> + g_assert(cpu->cc->sysemu_ops->has_work);
> + return cpu->cc->sysemu_ops->has_work(cpu);
Let's assert this once at startup, much like we do in tcg_exec_realizefn for TCGCPUOps.
Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 59+ messages in thread
* Re: [PATCH 20/28] target/riscv: Move has_work() from CPUClass to SysemuCPUOps
2025-01-24 17:17 ` Richard Henderson
@ 2025-01-24 17:41 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 59+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-01-24 17:41 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
Cc: qemu-arm, qemu-s390x, qemu-riscv, qemu-ppc, Paolo Bonzini
On 24/1/25 18:17, Richard Henderson wrote:
> On 1/21/25 06:23, Philippe Mathieu-Daudé wrote:
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> target/riscv/cpu.h | 9 +++++----
>> target/riscv/internals.h | 3 ---
>> target/riscv/cpu.c | 8 +++-----
>> 3 files changed, 8 insertions(+), 12 deletions(-)
>>
>> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
>> index 97713681cbe..32e8e064f36 100644
>> --- a/target/riscv/cpu.h
>> +++ b/target/riscv/cpu.h
>> @@ -552,10 +552,6 @@ int riscv_cpu_gdb_read_register(CPUState *cpu,
>> GByteArray *buf, int reg);
>> int riscv_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
>> int riscv_cpu_hviprio_index2irq(int index, int *out_irq, int
>> *out_rdzero);
>> uint8_t riscv_cpu_default_priority(int irq);
>> -uint64_t riscv_cpu_all_pending(CPURISCVState *env);
>> -int riscv_cpu_mirq_pending(CPURISCVState *env);
>> -int riscv_cpu_sirq_pending(CPURISCVState *env);
>> -int riscv_cpu_vsirq_pending(CPURISCVState *env);
>> bool riscv_cpu_fp_enabled(CPURISCVState *env);
>> target_ulong riscv_cpu_get_geilen(CPURISCVState *env);
>> void riscv_cpu_set_geilen(CPURISCVState *env, target_ulong geilen);
>> @@ -576,6 +572,11 @@ int riscv_cpu_max_xlen(RISCVCPUClass *mcc);
>> bool riscv_cpu_option_set(const char *optname);
>> #ifndef CONFIG_USER_ONLY
>> +bool riscv_cpu_has_work(CPUState *cs);
>> +uint64_t riscv_cpu_all_pending(CPURISCVState *env);
>> +int riscv_cpu_mirq_pending(CPURISCVState *env);
>> +int riscv_cpu_sirq_pending(CPURISCVState *env);
>> +int riscv_cpu_vsirq_pending(CPURISCVState *env);
>> void riscv_cpu_do_interrupt(CPUState *cpu);
>> void riscv_isa_write_fdt(RISCVCPU *cpu, void *fdt, char *nodename);
>> void riscv_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
>> diff --git a/target/riscv/internals.h b/target/riscv/internals.h
>> index 67291933f84..86def39aec2 100644
>> --- a/target/riscv/internals.h
>> +++ b/target/riscv/internals.h
>> @@ -142,9 +142,6 @@ static inline float16 check_nanbox_h(CPURISCVState
>> *env, uint64_t f)
>> }
>> }
>> -/* Our implementation of CPUClass::has_work */
>> -bool riscv_cpu_has_work(CPUState *cs);
>> -
>
> Why move the declaration from internals.h to cpu.h?
I can't see a compelling reason, so I'll keep it there but add
!CONFIG_USER_ONLY guard.
^ permalink raw reply [flat|nested] 59+ messages in thread
end of thread, other threads:[~2025-01-24 17:42 UTC | newest]
Thread overview: 59+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-21 14:23 [PATCH 00/28] cpus: Restrict CPU has_work() handlers to system emulation Philippe Mathieu-Daudé
2025-01-21 14:23 ` [PATCH 01/28] target/hexagon: Ensure not being build on " Philippe Mathieu-Daudé
2025-01-21 17:39 ` Brian Cain
2025-01-21 14:23 ` [PATCH 02/28] target/rx: Ensure not being build on user emulation Philippe Mathieu-Daudé
2025-01-24 16:51 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 03/28] target/tricore: " Philippe Mathieu-Daudé
2025-01-24 16:51 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 04/28] cpus: Restrict cpu_get_memory_mapping() to system emulation Philippe Mathieu-Daudé
2025-01-24 16:52 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 05/28] cpus: Restrict cpu_has_work() " Philippe Mathieu-Daudé
2025-01-24 16:52 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 06/28] cpus: Un-inline cpu_has_work() Philippe Mathieu-Daudé
2025-01-24 16:59 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 07/28] cpus: Introduce SysemuCPUOps::has_work() handler Philippe Mathieu-Daudé
2025-01-24 17:05 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 08/28] target/alpha: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
2025-01-24 17:06 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 09/28] target/arm: " Philippe Mathieu-Daudé
2025-01-24 17:06 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 10/28] target/avr: " Philippe Mathieu-Daudé
2025-01-24 17:06 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 11/28] target/hexagon: Remove CPUClass:has_work() handler Philippe Mathieu-Daudé
2025-01-24 17:07 ` Richard Henderson
2025-01-24 17:26 ` Brian Cain
2025-01-21 14:23 ` [PATCH 12/28] target/hppa: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
2025-01-24 17:08 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 13/28] target/i386: " Philippe Mathieu-Daudé
2025-01-24 17:09 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 14/28] target/loongarch: " Philippe Mathieu-Daudé
2025-01-24 17:09 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 15/28] target/m68k: " Philippe Mathieu-Daudé
2025-01-24 17:11 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 16/28] target/microblaze: " Philippe Mathieu-Daudé
2025-01-24 17:11 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 17/28] target/mips: " Philippe Mathieu-Daudé
2025-01-24 17:12 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 18/28] target/openrisc: " Philippe Mathieu-Daudé
2025-01-24 17:13 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 19/28] target/ppc: " Philippe Mathieu-Daudé
2025-01-24 17:14 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 20/28] target/riscv: " Philippe Mathieu-Daudé
2025-01-24 17:17 ` Richard Henderson
2025-01-24 17:41 ` Philippe Mathieu-Daudé
2025-01-21 14:23 ` [PATCH 21/28] target/rx: " Philippe Mathieu-Daudé
2025-01-24 17:17 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 22/28] target/s390x: Restrict I/O handler installers to system emulation Philippe Mathieu-Daudé
2025-01-24 17:18 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 23/28] target/s390x: Move has_work() from CPUClass to SysemuCPUOps Philippe Mathieu-Daudé
2025-01-24 17:21 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 24/28] target/sh4: " Philippe Mathieu-Daudé
2025-01-24 17:35 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 25/28] target/sparc: " Philippe Mathieu-Daudé
2025-01-24 17:35 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 26/28] target/tricore: " Philippe Mathieu-Daudé
2025-01-24 17:36 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 27/28] target/xtensa: " Philippe Mathieu-Daudé
2025-01-24 17:36 ` Richard Henderson
2025-01-21 14:23 ` [PATCH 28/28] cpus: Remove CPUClass::has_work() handler Philippe Mathieu-Daudé
2025-01-24 17:40 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).