[PATCH] hw/s390x: Un-inline the s390_do_cpu_*() functions

Thomas Huth posted 1 patch 1 month, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251217144238.37610-1-thuth@redhat.com
Maintainers: Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Richard Henderson <richard.henderson@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Thomas Huth <thuth@redhat.com>
target/s390x/cpu.h         | 24 +-----------------------
hw/s390x/s390-virtio-ccw.c | 19 ++++++++++++++++++-
target/s390x/cpu.c         |  5 +++++
3 files changed, 24 insertions(+), 24 deletions(-)
[PATCH] hw/s390x: Un-inline the s390_do_cpu_*() functions
Posted by Thomas Huth 1 month, 3 weeks ago
From: Thomas Huth <thuth@redhat.com>

These functions are only called via their function pointer by using
the run_on_cpu() function, so it does not make sense to declare these
as "inline" functions. Move the functions from cpu.h to either cpu.c
(when they are still used in multiple places), or to s390-virtio-ccw.c
(when they are only called from that file).

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/s390x/cpu.h         | 24 +-----------------------
 hw/s390x/s390-virtio-ccw.c | 19 ++++++++++++++++++-
 target/s390x/cpu.c         |  5 +++++
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index aa931cb6748..ba2bf177e8f 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -845,30 +845,8 @@ static inline uint64_t s390_build_validity_mcic(void)
     return mcic;
 }
 
-static inline void s390_do_cpu_full_reset(CPUState *cs, run_on_cpu_data arg)
-{
-    cpu_reset(cs);
-}
-
-static inline void s390_do_cpu_reset(CPUState *cs, run_on_cpu_data arg)
-{
-    resettable_reset(OBJECT(cs), RESET_TYPE_S390_CPU_NORMAL);
-}
-
-static inline void s390_do_cpu_initial_reset(CPUState *cs, run_on_cpu_data arg)
-{
-    resettable_reset(OBJECT(cs), RESET_TYPE_S390_CPU_INITIAL);
-}
-
-static inline void s390_do_cpu_load_normal(CPUState *cs, run_on_cpu_data arg)
-{
-    S390CPUClass *scc = S390_CPU_GET_CLASS(cs);
-
-    scc->load_normal(cs);
-}
-
-
 /* cpu.c */
+void s390_do_cpu_full_reset(CPUState *cs, run_on_cpu_data arg);
 void s390_crypto_reset(void);
 void s390_cmma_reset(void);
 void s390_enable_css_support(S390CPU *cpu);
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 64b81345f1e..d8ef17b99bb 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -364,7 +364,24 @@ static void s390_cpu_plug(HotplugHandler *hotplug_dev,
     }
 }
 
-static inline void s390_do_cpu_ipl(CPUState *cs, run_on_cpu_data arg)
+static void s390_do_cpu_reset(CPUState *cs, run_on_cpu_data arg)
+{
+    resettable_reset(OBJECT(cs), RESET_TYPE_S390_CPU_NORMAL);
+}
+
+static void s390_do_cpu_initial_reset(CPUState *cs, run_on_cpu_data arg)
+{
+    resettable_reset(OBJECT(cs), RESET_TYPE_S390_CPU_INITIAL);
+}
+
+static void s390_do_cpu_load_normal(CPUState *cs, run_on_cpu_data arg)
+{
+    S390CPUClass *scc = S390_CPU_GET_CLASS(cs);
+
+    scc->load_normal(cs);
+}
+
+static void s390_do_cpu_ipl(CPUState *cs, run_on_cpu_data arg)
 {
     S390CPU *cpu = S390_CPU(cs);
 
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index f05ce317da1..dc99226fcdf 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -141,6 +141,11 @@ static void s390_query_cpu_fast(CPUState *cpu, CpuInfoFast *value)
 #endif
 }
 
+void s390_do_cpu_full_reset(CPUState *cs, run_on_cpu_data arg)
+{
+    cpu_reset(cs);
+}
+
 /* S390CPUClass Resettable reset_hold phase method */
 static void s390_cpu_reset_hold(Object *obj, ResetType type)
 {
-- 
2.52.0
Re: [PATCH] hw/s390x: Un-inline the s390_do_cpu_*() functions
Posted by Eric Farman 1 month, 3 weeks ago
On Wed, 2025-12-17 at 15:42 +0100, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> These functions are only called via their function pointer by using
> the run_on_cpu() function, so it does not make sense to declare these
> as "inline" functions. Move the functions from cpu.h to either cpu.c
> (when they are still used in multiple places), or to s390-virtio-ccw.c
> (when they are only called from that file).
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  target/s390x/cpu.h         | 24 +-----------------------
>  hw/s390x/s390-virtio-ccw.c | 19 ++++++++++++++++++-
>  target/s390x/cpu.c         |  5 +++++
>  3 files changed, 24 insertions(+), 24 deletions(-)

Reviewed-by: Eric Farman <farman@linux.ibm.com>
Re: [PATCH] hw/s390x: Un-inline the s390_do_cpu_*() functions
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
On 17/12/25 15:42, Thomas Huth wrote:
> From: Thomas Huth <thuth@redhat.com>
> 
> These functions are only called via their function pointer by using
> the run_on_cpu() function, so it does not make sense to declare these
> as "inline" functions. Move the functions from cpu.h to either cpu.c
> (when they are still used in multiple places), or to s390-virtio-ccw.c
> (when they are only called from that file).
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   target/s390x/cpu.h         | 24 +-----------------------
>   hw/s390x/s390-virtio-ccw.c | 19 ++++++++++++++++++-
>   target/s390x/cpu.c         |  5 +++++
>   3 files changed, 24 insertions(+), 24 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>