diff mbox series

[RFC,v3,10/28] target/arm: move helpers to tcg/

Message ID 20230113140419.4013-11-farosas@suse.de (mailing list archive)
State New, archived
Headers show
Series target/arm: Allow CONFIG_TCG=n builds | expand

Commit Message

Fabiano Rosas Jan. 13, 2023, 2:04 p.m. UTC
From: Claudio Fontana <cfontana@suse.de>

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
Included {sme,mve}_helper.c and left a couple of files behind that
still have non-tcg code to be removed from them:

helper.c (and op_helper.h as a dep)
vfp_helper.c

Originally from:
https://lore.kernel.org/r/20210416162824.25131-3-cfontana@suse.de
[RFC v14 02/80] target/arm: move helpers to tcg/
---
 target/arm/meson.build               | 16 ++--------------
 target/arm/tcg-stubs.c               | 23 +++++++++++++++++++++++
 target/arm/{ => tcg}/crypto_helper.c |  0
 target/arm/{ => tcg}/debug_helper.c  |  0
 target/arm/{ => tcg}/helper-a64.c    |  0
 target/arm/{ => tcg}/iwmmxt_helper.c |  0
 target/arm/{ => tcg}/m_helper.c      |  0
 target/arm/tcg/meson.build           | 14 ++++++++++++++
 target/arm/{ => tcg}/mte_helper.c    |  0
 target/arm/{ => tcg}/mve_helper.c    |  0
 target/arm/{ => tcg}/neon_helper.c   |  0
 target/arm/{ => tcg}/op_helper.c     |  0
 target/arm/{ => tcg}/pauth_helper.c  |  0
 target/arm/{ => tcg}/sme_helper.c    |  0
 target/arm/{ => tcg}/sve_helper.c    |  0
 target/arm/{ => tcg}/tlb_helper.c    |  0
 target/arm/{ => tcg}/vec_helper.c    |  0
 target/arm/{ => tcg}/vec_internal.h  |  0
 18 files changed, 39 insertions(+), 14 deletions(-)
 create mode 100644 target/arm/tcg-stubs.c
 rename target/arm/{ => tcg}/crypto_helper.c (100%)
 rename target/arm/{ => tcg}/debug_helper.c (100%)
 rename target/arm/{ => tcg}/helper-a64.c (100%)
 rename target/arm/{ => tcg}/iwmmxt_helper.c (100%)
 rename target/arm/{ => tcg}/m_helper.c (100%)
 rename target/arm/{ => tcg}/mte_helper.c (100%)
 rename target/arm/{ => tcg}/mve_helper.c (100%)
 rename target/arm/{ => tcg}/neon_helper.c (100%)
 rename target/arm/{ => tcg}/op_helper.c (100%)
 rename target/arm/{ => tcg}/pauth_helper.c (100%)
 rename target/arm/{ => tcg}/sme_helper.c (100%)
 rename target/arm/{ => tcg}/sve_helper.c (100%)
 rename target/arm/{ => tcg}/tlb_helper.c (100%)
 rename target/arm/{ => tcg}/vec_helper.c (100%)
 rename target/arm/{ => tcg}/vec_internal.h (100%)

Comments

Philippe Mathieu-Daudé Jan. 17, 2023, 4:22 p.m. UTC | #1
On 13/1/23 15:04, Fabiano Rosas wrote:
> From: Claudio Fontana <cfontana@suse.de>
> 
> Signed-off-by: Claudio Fontana <cfontana@suse.de>
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---

> ---
>   target/arm/meson.build               | 16 ++--------------
>   target/arm/tcg-stubs.c               | 23 +++++++++++++++++++++++
>   target/arm/{ => tcg}/crypto_helper.c |  0
>   target/arm/{ => tcg}/debug_helper.c  |  0
>   target/arm/{ => tcg}/helper-a64.c    |  0
>   target/arm/{ => tcg}/iwmmxt_helper.c |  0
>   target/arm/{ => tcg}/m_helper.c      |  0
>   target/arm/tcg/meson.build           | 14 ++++++++++++++
>   target/arm/{ => tcg}/mte_helper.c    |  0
>   target/arm/{ => tcg}/mve_helper.c    |  0
>   target/arm/{ => tcg}/neon_helper.c   |  0
>   target/arm/{ => tcg}/op_helper.c     |  0
>   target/arm/{ => tcg}/pauth_helper.c  |  0
>   target/arm/{ => tcg}/sme_helper.c    |  0
>   target/arm/{ => tcg}/sve_helper.c    |  0
>   target/arm/{ => tcg}/tlb_helper.c    |  0
>   target/arm/{ => tcg}/vec_helper.c    |  0
>   target/arm/{ => tcg}/vec_internal.h  |  0
>   18 files changed, 39 insertions(+), 14 deletions(-)
>   create mode 100644 target/arm/tcg-stubs.c
>   rename target/arm/{ => tcg}/crypto_helper.c (100%)
>   rename target/arm/{ => tcg}/debug_helper.c (100%)
>   rename target/arm/{ => tcg}/helper-a64.c (100%)
>   rename target/arm/{ => tcg}/iwmmxt_helper.c (100%)
>   rename target/arm/{ => tcg}/m_helper.c (100%)
>   rename target/arm/{ => tcg}/mte_helper.c (100%)
>   rename target/arm/{ => tcg}/mve_helper.c (100%)
>   rename target/arm/{ => tcg}/neon_helper.c (100%)
>   rename target/arm/{ => tcg}/op_helper.c (100%)
>   rename target/arm/{ => tcg}/pauth_helper.c (100%)
>   rename target/arm/{ => tcg}/sme_helper.c (100%)
>   rename target/arm/{ => tcg}/sve_helper.c (100%)
>   rename target/arm/{ => tcg}/tlb_helper.c (100%)
>   rename target/arm/{ => tcg}/vec_helper.c (100%)
>   rename target/arm/{ => tcg}/vec_internal.h (100%)

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

> +void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
> +                        uint32_t target_el, uintptr_t ra)
> +{
> +    g_assert_not_reached();
> +}

Do you have a plan to restrict the calls to raise_exception_ra() to TCG?
Fabiano Rosas Jan. 17, 2023, 6:55 p.m. UTC | #2
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> On 13/1/23 15:04, Fabiano Rosas wrote:
>> From: Claudio Fontana <cfontana@suse.de>
>> 
>> Signed-off-by: Claudio Fontana <cfontana@suse.de>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>
>> ---
>>   target/arm/meson.build               | 16 ++--------------
>>   target/arm/tcg-stubs.c               | 23 +++++++++++++++++++++++
>>   target/arm/{ => tcg}/crypto_helper.c |  0
>>   target/arm/{ => tcg}/debug_helper.c  |  0
>>   target/arm/{ => tcg}/helper-a64.c    |  0
>>   target/arm/{ => tcg}/iwmmxt_helper.c |  0
>>   target/arm/{ => tcg}/m_helper.c      |  0
>>   target/arm/tcg/meson.build           | 14 ++++++++++++++
>>   target/arm/{ => tcg}/mte_helper.c    |  0
>>   target/arm/{ => tcg}/mve_helper.c    |  0
>>   target/arm/{ => tcg}/neon_helper.c   |  0
>>   target/arm/{ => tcg}/op_helper.c     |  0
>>   target/arm/{ => tcg}/pauth_helper.c  |  0
>>   target/arm/{ => tcg}/sme_helper.c    |  0
>>   target/arm/{ => tcg}/sve_helper.c    |  0
>>   target/arm/{ => tcg}/tlb_helper.c    |  0
>>   target/arm/{ => tcg}/vec_helper.c    |  0
>>   target/arm/{ => tcg}/vec_internal.h  |  0
>>   18 files changed, 39 insertions(+), 14 deletions(-)
>>   create mode 100644 target/arm/tcg-stubs.c
>>   rename target/arm/{ => tcg}/crypto_helper.c (100%)
>>   rename target/arm/{ => tcg}/debug_helper.c (100%)
>>   rename target/arm/{ => tcg}/helper-a64.c (100%)
>>   rename target/arm/{ => tcg}/iwmmxt_helper.c (100%)
>>   rename target/arm/{ => tcg}/m_helper.c (100%)
>>   rename target/arm/{ => tcg}/mte_helper.c (100%)
>>   rename target/arm/{ => tcg}/mve_helper.c (100%)
>>   rename target/arm/{ => tcg}/neon_helper.c (100%)
>>   rename target/arm/{ => tcg}/op_helper.c (100%)
>>   rename target/arm/{ => tcg}/pauth_helper.c (100%)
>>   rename target/arm/{ => tcg}/sme_helper.c (100%)
>>   rename target/arm/{ => tcg}/sve_helper.c (100%)
>>   rename target/arm/{ => tcg}/tlb_helper.c (100%)
>>   rename target/arm/{ => tcg}/vec_helper.c (100%)
>>   rename target/arm/{ => tcg}/vec_internal.h (100%)
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
>> +void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
>> +                        uint32_t target_el, uintptr_t ra)
>> +{
>> +    g_assert_not_reached();
>> +}
>
> Do you have a plan to restrict the calls to raise_exception_ra() to TCG?

Not yet, looks like moving the sdiv and udiv helpers which call
handle_possible_div0_trap would be enough.
diff mbox series

Patch

diff --git a/target/arm/meson.build b/target/arm/meson.build
index 6dc7b800e6..01143a805c 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -2,17 +2,8 @@  arm_ss = ss.source_set()
 arm_ss.add(files(
   'cpregs.c',
   'cpu.c',
-  'crypto_helper.c',
-  'debug_helper.c',
   'gdbstub.c',
   'helper.c',
-  'iwmmxt_helper.c',
-  'm_helper.c',
-  'mve_helper.c',
-  'neon_helper.c',
-  'op_helper.c',
-  'tlb_helper.c',
-  'vec_helper.c',
   'vfp_helper.c',
   'cpu_tcg.c',
 ))
@@ -23,11 +14,6 @@  arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c', 'kvm64.c'), if_false: fil
 arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'cpu64.c',
   'gdbstub64.c',
-  'helper-a64.c',
-  'mte_helper.c',
-  'pauth_helper.c',
-  'sve_helper.c',
-  'sme_helper.c',
 ))
 
 arm_softmmu_ss = ss.source_set()
@@ -44,6 +30,8 @@  subdir('hvf')
 
 if 'CONFIG_TCG' in config_all
    subdir('tcg')
+else
+    arm_ss.add(files('tcg-stubs.c'))
 endif
 
 target_arch += {'arm': arm_ss}
diff --git a/target/arm/tcg-stubs.c b/target/arm/tcg-stubs.c
new file mode 100644
index 0000000000..1a7ddb3664
--- /dev/null
+++ b/target/arm/tcg-stubs.c
@@ -0,0 +1,23 @@ 
+/*
+ * QEMU ARM stubs for some TCG helper functions
+ *
+ * Copyright 2021 SUSE LLC
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "internals.h"
+
+void write_v7m_exception(CPUARMState *env, uint32_t new_exc)
+{
+    g_assert_not_reached();
+}
+
+void raise_exception_ra(CPUARMState *env, uint32_t excp, uint32_t syndrome,
+                        uint32_t target_el, uintptr_t ra)
+{
+    g_assert_not_reached();
+}
diff --git a/target/arm/crypto_helper.c b/target/arm/tcg/crypto_helper.c
similarity index 100%
rename from target/arm/crypto_helper.c
rename to target/arm/tcg/crypto_helper.c
diff --git a/target/arm/debug_helper.c b/target/arm/tcg/debug_helper.c
similarity index 100%
rename from target/arm/debug_helper.c
rename to target/arm/tcg/debug_helper.c
diff --git a/target/arm/helper-a64.c b/target/arm/tcg/helper-a64.c
similarity index 100%
rename from target/arm/helper-a64.c
rename to target/arm/tcg/helper-a64.c
diff --git a/target/arm/iwmmxt_helper.c b/target/arm/tcg/iwmmxt_helper.c
similarity index 100%
rename from target/arm/iwmmxt_helper.c
rename to target/arm/tcg/iwmmxt_helper.c
diff --git a/target/arm/m_helper.c b/target/arm/tcg/m_helper.c
similarity index 100%
rename from target/arm/m_helper.c
rename to target/arm/tcg/m_helper.c
diff --git a/target/arm/tcg/meson.build b/target/arm/tcg/meson.build
index 044561bd4d..c27ac2939c 100644
--- a/target/arm/tcg/meson.build
+++ b/target/arm/tcg/meson.build
@@ -23,10 +23,24 @@  arm_ss.add(files(
   'translate-mve.c',
   'translate-neon.c',
   'translate-vfp.c',
+  'crypto_helper.c',
+  'debug_helper.c',
+  'iwmmxt_helper.c',
+  'm_helper.c',
+  'mve_helper.c',
+  'neon_helper.c',
+  'op_helper.c',
+  'tlb_helper.c',
+  'vec_helper.c',
 ))
 
 arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'translate-a64.c',
   'translate-sve.c',
   'translate-sme.c',
+  'helper-a64.c',
+  'mte_helper.c',
+  'pauth_helper.c',
+  'sme_helper.c',
+  'sve_helper.c',
 ))
diff --git a/target/arm/mte_helper.c b/target/arm/tcg/mte_helper.c
similarity index 100%
rename from target/arm/mte_helper.c
rename to target/arm/tcg/mte_helper.c
diff --git a/target/arm/mve_helper.c b/target/arm/tcg/mve_helper.c
similarity index 100%
rename from target/arm/mve_helper.c
rename to target/arm/tcg/mve_helper.c
diff --git a/target/arm/neon_helper.c b/target/arm/tcg/neon_helper.c
similarity index 100%
rename from target/arm/neon_helper.c
rename to target/arm/tcg/neon_helper.c
diff --git a/target/arm/op_helper.c b/target/arm/tcg/op_helper.c
similarity index 100%
rename from target/arm/op_helper.c
rename to target/arm/tcg/op_helper.c
diff --git a/target/arm/pauth_helper.c b/target/arm/tcg/pauth_helper.c
similarity index 100%
rename from target/arm/pauth_helper.c
rename to target/arm/tcg/pauth_helper.c
diff --git a/target/arm/sme_helper.c b/target/arm/tcg/sme_helper.c
similarity index 100%
rename from target/arm/sme_helper.c
rename to target/arm/tcg/sme_helper.c
diff --git a/target/arm/sve_helper.c b/target/arm/tcg/sve_helper.c
similarity index 100%
rename from target/arm/sve_helper.c
rename to target/arm/tcg/sve_helper.c
diff --git a/target/arm/tlb_helper.c b/target/arm/tcg/tlb_helper.c
similarity index 100%
rename from target/arm/tlb_helper.c
rename to target/arm/tcg/tlb_helper.c
diff --git a/target/arm/vec_helper.c b/target/arm/tcg/vec_helper.c
similarity index 100%
rename from target/arm/vec_helper.c
rename to target/arm/tcg/vec_helper.c
diff --git a/target/arm/vec_internal.h b/target/arm/tcg/vec_internal.h
similarity index 100%
rename from target/arm/vec_internal.h
rename to target/arm/tcg/vec_internal.h