[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 17/40] target/arm: Explicit v7M cores use arm_cpu_has_work as
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v6 17/40] target/arm: Explicit v7M cores use arm_cpu_has_work as CPUClass:has_work |
Date: |
Fri, 24 Sep 2021 11:38:24 +0200 |
ARM v7M cores inherit TYPE_ARM_CPU, so TYPE_ARM_CPU's class_init runs
first and sets up most of the class fields, setting in particular the
has_work handler to the generic arm_cpu_has_work(). Thus M-profile
and A-profile share the same arm_cpu_has_work() function. Some of the
checks the code there does are perhaps unnecessary for M-profile, but
they're harmless.
Since we want to move the has_work handler from CPUClass to TCGCPUOps,
the next commit will be more explicit if we already register this
handler in arm_v7m_class_init(). Since arm_cpu_has_work() is static to
target/arm/cpu.c, we have to declare it in "internals.h" to be able to
use it in target/arm/cpu_tcg.c.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/arm/internals.h | 2 ++
target/arm/cpu.c | 2 +-
target/arm/cpu_tcg.c | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/target/arm/internals.h b/target/arm/internals.h
index 777f9687648..864b5ad4cdf 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -177,6 +177,8 @@ void arm_translate_init(void);
void arm_cpu_synchronize_from_tb(CPUState *cs, const TranslationBlock *tb);
#endif /* CONFIG_TCG */
+bool arm_cpu_has_work(CPUState *cs);
+
/**
* aarch64_sve_zcr_get_valid_len:
* @cpu: cpu context
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 641a8c2d3d3..4b08f717f64 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -76,7 +76,7 @@ void arm_cpu_synchronize_from_tb(CPUState *cs,
}
#endif /* CONFIG_TCG */
-static bool arm_cpu_has_work(CPUState *cs)
+bool arm_cpu_has_work(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
index 0d5adccf1a7..9a0927ad5d0 100644
--- a/target/arm/cpu_tcg.c
+++ b/target/arm/cpu_tcg.c
@@ -920,6 +920,7 @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
acc->info = data;
#ifdef CONFIG_TCG
+ cc->has_work = arm_cpu_has_work;
cc->tcg_ops = &arm_v7m_tcg_ops;
#endif /* CONFIG_TCG */
--
2.31.1
- [PATCH v6 07/40] accel/kvm: Implement AccelOpsClass::has_work(), (continued)
- [PATCH v6 07/40] accel/kvm: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 08/40] accel/whpx: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 09/40] accel/hvf: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 10/40] accel/xen: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 11/40] accel/hax: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 12/40] accel/nvmm: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 13/40] accel/qtest: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 14/40] accel/tcg: Implement AccelOpsClass::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 15/40] accel: Simplify cpu_has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 16/40] accel/tcg: Introduce TCGCPUOps::has_work(), Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 17/40] target/arm: Explicit v7M cores use arm_cpu_has_work as CPUClass:has_work,
Philippe Mathieu-Daudé <=
- [PATCH v6 18/40] target/arm: Restrict has_work() handler to sysemu and TCG, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 19/40] target/avr: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 21/40] target/hexagon: Remove unused has_work() handler, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 20/40] target/cris: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 22/40] target/hppa: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 23/40] target/i386: Restrict has_work() handler to sysemu and TCG, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 24/40] target/m68k: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24
- [PATCH v6 25/40] target/microblaze: Restrict has_work() handler to sysemu, Philippe Mathieu-Daudé, 2021/09/24