qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: philmd@linaro.org, shentey@gmail.com, balaton@eik.bme.hu
Subject: [PATCH v3 7/9] mips: allow compiling out CONFIG_MIPS_ITU
Date: Tue, 13 Feb 2024 16:50:02 +0100	[thread overview]
Message-ID: <20240213155005.109954-8-pbonzini@redhat.com> (raw)
In-Reply-To: <20240213155005.109954-1-pbonzini@redhat.com>

itc_reconfigure() is referenced from TCG, compile out the helpers
that reference env->itu if CONFIG_MIPS_ITU is not defined.
This makes it possible to build a QEMU binary that only includes
boards without a CPS device (only Malta and Boston create one).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/mips/tcg/translate.h         |  1 +
 target/mips/tcg/sysemu_helper.h.inc | 19 +++++++++++++------
 target/mips/tcg/sysemu/cp0_helper.c |  8 ++++++++
 target/mips/tcg/translate.c         | 10 ++++++++++
 4 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/target/mips/tcg/translate.h b/target/mips/tcg/translate.h
index 93a78b81212..d5458f8690d 100644
--- a/target/mips/tcg/translate.h
+++ b/target/mips/tcg/translate.h
@@ -9,6 +9,7 @@
 #define TARGET_MIPS_TRANSLATE_H
 
 #include "cpu.h"
+
 #include "tcg/tcg-op.h"
 #include "exec/translator.h"
 #include "exec/helper-gen.h"
diff --git a/target/mips/tcg/sysemu_helper.h.inc b/target/mips/tcg/sysemu_helper.h.inc
index f163af1eac7..92d01c49bf6 100644
--- a/target/mips/tcg/sysemu_helper.h.inc
+++ b/target/mips/tcg/sysemu_helper.h.inc
@@ -9,6 +9,8 @@
  * SPDX-License-Identifier: LGPL-2.1-or-later
  */
 
+#include CONFIG_DEVICES
+
 /* CP0 helpers */
 DEF_HELPER_1(mfc0_mvpcontrol, tl, env)
 DEF_HELPER_1(mfc0_mvpconf0, tl, env)
@@ -31,8 +33,6 @@ DEF_HELPER_1(mftc0_tcschedule, tl, env)
 DEF_HELPER_1(mfc0_tcschefback, tl, env)
 DEF_HELPER_1(mftc0_tcschefback, tl, env)
 DEF_HELPER_1(mfc0_count, tl, env)
-DEF_HELPER_1(mfc0_saar, tl, env)
-DEF_HELPER_1(mfhc0_saar, tl, env)
 DEF_HELPER_1(mftc0_entryhi, tl, env)
 DEF_HELPER_1(mftc0_status, tl, env)
 DEF_HELPER_1(mftc0_cause, tl, env)
@@ -57,7 +57,6 @@ DEF_HELPER_1(dmfc0_lladdr, tl, env)
 DEF_HELPER_1(dmfc0_maar, tl, env)
 DEF_HELPER_2(dmfc0_watchlo, tl, env, i32)
 DEF_HELPER_2(dmfc0_watchhi, tl, env, i32)
-DEF_HELPER_1(dmfc0_saar, tl, env)
 #endif /* TARGET_MIPS64 */
 
 DEF_HELPER_2(mtc0_index, void, env, tl)
@@ -103,9 +102,6 @@ DEF_HELPER_2(mtc0_srsconf4, void, env, tl)
 DEF_HELPER_2(mtc0_hwrena, void, env, tl)
 DEF_HELPER_2(mtc0_pwctl, void, env, tl)
 DEF_HELPER_2(mtc0_count, void, env, tl)
-DEF_HELPER_2(mtc0_saari, void, env, tl)
-DEF_HELPER_2(mtc0_saar, void, env, tl)
-DEF_HELPER_2(mthc0_saar, void, env, tl)
 DEF_HELPER_2(mtc0_entryhi, void, env, tl)
 DEF_HELPER_2(mttc0_entryhi, void, env, tl)
 DEF_HELPER_2(mtc0_compare, void, env, tl)
@@ -189,3 +185,14 @@ DEF_HELPER_2(lcsr_drdcsr, i64, env, tl)
 DEF_HELPER_3(lcsr_wrcsr, void, env, tl, tl)
 DEF_HELPER_3(lcsr_dwrcsr, void, env, tl, tl)
 #endif
+
+#ifdef CONFIG_MIPS_ITU
+DEF_HELPER_1(mfc0_saar, tl, env)
+DEF_HELPER_1(mfhc0_saar, tl, env)
+DEF_HELPER_2(mtc0_saari, void, env, tl)
+DEF_HELPER_2(mtc0_saar, void, env, tl)
+DEF_HELPER_2(mthc0_saar, void, env, tl)
+#ifdef TARGET_MIPS64
+DEF_HELPER_1(dmfc0_saar, tl, env)
+#endif
+#endif
diff --git a/target/mips/tcg/sysemu/cp0_helper.c b/target/mips/tcg/sysemu/cp0_helper.c
index 62f6fb4bf65..dde890adf3f 100644
--- a/target/mips/tcg/sysemu/cp0_helper.c
+++ b/target/mips/tcg/sysemu/cp0_helper.c
@@ -21,6 +21,8 @@
  */
 
 #include "qemu/osdep.h"
+#include CONFIG_DEVICES
+
 #include "qemu/log.h"
 #include "qemu/main-loop.h"
 #include "cpu.h"
@@ -371,6 +373,7 @@ target_ulong helper_mfc0_count(CPUMIPSState *env)
     return (int32_t)cpu_mips_get_count(env);
 }
 
+#ifdef CONFIG_MIPS_ITU
 target_ulong helper_mfc0_saar(CPUMIPSState *env)
 {
     if ((env->CP0_SAARI & 0x3f) < 2) {
@@ -386,6 +389,7 @@ target_ulong helper_mfhc0_saar(CPUMIPSState *env)
     }
     return 0;
 }
+#endif
 
 target_ulong helper_mftc0_entryhi(CPUMIPSState *env)
 {
@@ -514,6 +518,7 @@ target_ulong helper_dmfc0_watchhi(CPUMIPSState *env, uint32_t sel)
     return env->CP0_WatchHi[sel];
 }
 
+#ifdef CONFIG_MIPS_ITU
 target_ulong helper_dmfc0_saar(CPUMIPSState *env)
 {
     if ((env->CP0_SAARI & 0x3f) < 2) {
@@ -521,6 +526,7 @@ target_ulong helper_dmfc0_saar(CPUMIPSState *env)
     }
     return 0;
 }
+#endif
 #endif /* TARGET_MIPS64 */
 
 void helper_mtc0_index(CPUMIPSState *env, target_ulong arg1)
@@ -1100,6 +1106,7 @@ void helper_mtc0_count(CPUMIPSState *env, target_ulong arg1)
     cpu_mips_store_count(env, arg1);
 }
 
+#ifdef CONFIG_MIPS_ITU
 void helper_mtc0_saari(CPUMIPSState *env, target_ulong arg1)
 {
     uint32_t target = arg1 & 0x3f;
@@ -1139,6 +1146,7 @@ void helper_mthc0_saar(CPUMIPSState *env, target_ulong arg1)
         }
     }
 }
+#endif
 
 void helper_mtc0_entryhi(CPUMIPSState *env, target_ulong arg1)
 {
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
index 12094cc1e7c..b130222708b 100644
--- a/target/mips/tcg/translate.c
+++ b/target/mips/tcg/translate.c
@@ -49,6 +49,16 @@
 #ifdef CONFIG_USER_ONLY
 STUB_HELPER(cache, TCGv_env env, TCGv val, TCGv_i32 reg)
 #endif
+#if defined CONFIG_SYSTEM_ONLY && !defined CONFIG_MIPS_ITU
+STUB_HELPER(mfc0_saar, TCGv ret, TCGv_env env)
+STUB_HELPER(mfhc0_saar, TCGv ret, TCGv_env env)
+STUB_HELPER(mtc0_saari, TCGv_env env, TCGv val)
+STUB_HELPER(mtc0_saar, TCGv_env env, TCGv val)
+STUB_HELPER(mthc0_saar, TCGv_env env, TCGv val)
+#ifdef TARGET_MIPS64
+STUB_HELPER(dmfc0_saar, TCGv ret, TCGv_env env)
+#endif
+#endif
 
 enum {
     /* indirect opcode tables */
-- 
2.43.0



  parent reply	other threads:[~2024-02-13 15:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 15:49 [PATCH v3 0/9] mips: do not list individual devices from configs/ Paolo Bonzini
2024-02-13 15:49 ` [PATCH v3 1/9] usb: inline device creation functions Paolo Bonzini
2024-02-16 11:14   ` Philippe Mathieu-Daudé
2024-02-17  9:49     ` Paolo Bonzini
2024-02-13 15:49 ` [PATCH v3 2/9] isa: clean up Kconfig selections for ISA_SUPERIO Paolo Bonzini
2024-02-13 15:49 ` [PATCH v3 3/9] hw/mips/Kconfig: Remove ISA dependencies from MIPSsim board Paolo Bonzini
2024-02-13 15:49 ` [PATCH v3 4/9] isa: fix ISA_SUPERIO dependencies Paolo Bonzini
2024-02-13 15:50 ` [PATCH v3 5/9] isa: specify instance_size in isa_superio_type_info Paolo Bonzini
2024-02-13 15:50 ` [PATCH v3 6/9] isa: extract FDC37M81X to a separate file Paolo Bonzini
2024-02-13 19:07   ` Bernhard Beschow
2024-02-13 15:50 ` Paolo Bonzini [this message]
2024-02-13 15:50 ` [PATCH v3 8/9] mips/loongson3_virt: do not require CONFIG_USB Paolo Bonzini
2024-02-15  7:55   ` Philippe Mathieu-Daudé
2024-02-15 11:12     ` Paolo Bonzini
2024-02-15 14:27     ` BALATON Zoltan
2024-02-15 17:31       ` Paolo Bonzini
2024-02-13 15:50 ` [PATCH v3 9/9] mips: do not list individual devices from configs/ Paolo Bonzini
2024-02-15 17:51 ` [PATCH v3 0/9] " Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240213155005.109954-8-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=balaton@eik.bme.hu \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shentey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).