qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 08/11] target/ppc: wrapped some TCG only logic with ifdefs


From: Bruno Larsen (billionai)
Subject: [RFC PATCH 08/11] target/ppc: wrapped some TCG only logic with ifdefs
Date: Wed, 12 May 2021 11:08:10 -0300

Wrapped some function calls in cpu_init.c and gdbstub.c that were TCG only
with ifdef CONFIG_TCG, to make it easier to build without it.

This seemed to be the minimum amount of changes to make the project
compile, but we wanted some feedback about wether we excluded something
important or if we should reorder some code to minimize ifdef count

Signed-off-by: Bruno Larsen (billionai) <bruno.larsen@eldorado.org.br>
---
 include/exec/helper-proto.h | 2 ++
 target/ppc/cpu_init.c       | 8 ++++++++
 target/ppc/excp_helper.c    | 6 +++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h
index ba100793a7..ce287222ee 100644
--- a/include/exec/helper-proto.h
+++ b/include/exec/helper-proto.h
@@ -38,7 +38,9 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), 
dh_ctype(t3), \
 #define IN_HELPER_PROTO
 
 #include "helper.h"
+#ifdef CONFIG_TCG
 #include "trace/generated-helpers.h"
+#endif
 #include "accel/tcg/tcg-runtime.h"
 #include "accel/tcg/plugin-helpers.h"
 
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index d0fa219880..9d72dc49cf 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -1204,11 +1204,13 @@ static void register_BookE206_sprs(CPUPPCState *env, 
uint32_t mas_mask,
     /* TLB assist registers */
     /* XXX : not implemented */
     for (i = 0; i < 8; i++) {
+#ifdef CONFIG_TCG
         void (*uea_write)(DisasContext *ctx, int sprn, int gprn) =
             &spr_write_generic32;
         if (i == 2 && (mas_mask & (1 << i)) && (env->insns_flags & PPC_64B)) {
             uea_write = &spr_write_generic;
         }
+#endif
         if (mas_mask & (1 << i)) {
             spr_register(env, mas_sprn[i], mas_names[i],
                          SPR_NOACCESS, SPR_NOACCESS,
@@ -8606,7 +8608,9 @@ static void ppc_cpu_realize(DeviceState *dev, Error 
**errp)
         }
     }
 
+#ifdef CONFIG_TCG
     create_ppc_opcodes(cpu, &local_err);
+#endif
     if (local_err != NULL) {
         error_propagate(errp, local_err);
         goto unrealize;
@@ -8799,7 +8803,9 @@ static void ppc_cpu_unrealize(DeviceState *dev)
 
     cpu_remove_sync(CPU(cpu));
 
+#ifdef CONFIG_TCG
     destroy_ppc_opcodes(cpu);
+#endif
 }
 
 static gint ppc_cpu_compare_class_pvr(gconstpointer a, gconstpointer b)
@@ -9297,7 +9303,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void 
*data)
     cc->class_by_name = ppc_cpu_class_by_name;
     cc->has_work = ppc_cpu_has_work;
     cc->dump_state = ppc_cpu_dump_state;
+#ifdef CONFIG_TCG
     cc->dump_statistics = ppc_cpu_dump_statistics;
+#endif
     cc->set_pc = ppc_cpu_set_pc;
     cc->gdb_read_register = ppc_cpu_gdb_read_register;
     cc->gdb_write_register = ppc_cpu_gdb_write_register;
diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index f4f15279eb..824e16a32a 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -21,7 +21,9 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
+#ifdef CONFIG_TCG
 #include "exec/cpu_ldst.h"
+#endif
 #include "internal.h"
 #include "helper_regs.h"
 
@@ -1492,7 +1494,7 @@ void helper_book3s_msgsnd(target_ulong rb)
     book3s_msgsnd_common(pir, PPC_INTERRUPT_HDOORBELL);
 }
 
-#if defined(TARGET_PPC64)
+#if defined(TARGET_PPC64) && defined(CONFIG_TCG)
 void helper_book3s_msgclrp(CPUPPCState *env, target_ulong rb)
 {
     helper_hfscr_facility_check(env, HFSCR_MSGP, "msgclrp", HFSCR_IC_MSGP);
@@ -1525,6 +1527,7 @@ void helper_book3s_msgsndp(CPUPPCState *env, target_ulong 
rb)
 #endif
 #endif
 
+#ifdef CONFIG_TCG
 void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
                                  MMUAccessType access_type,
                                  int mmu_idx, uintptr_t retaddr)
@@ -1540,3 +1543,4 @@ void ppc_cpu_do_unaligned_access(CPUState *cs, vaddr 
vaddr,
     env->error_code = insn & 0x03FF0000;
     cpu_loop_exit(cs);
 }
+#endif
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]