From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
qemu-ppc@nongnu.org,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 4/4] exec/cpu-all: Include 'cpu.h' earlier so MMU_USER_IDX is always defined
Date: Wed, 18 Dec 2024 16:52:02 +0100 [thread overview]
Message-ID: <20241218155202.71931-5-philmd@linaro.org> (raw)
In-Reply-To: <20241218155202.71931-1-philmd@linaro.org>
Include "cpu.h" earlier to get the MMU_USER_IDX definition soon
enough and avoid when refactoring unrelated headers:
In file included from include/exec/translator.h:271,
from ../../accel/tcg/translator.c:13:
include/exec/cpu-all.h: In function ‘cpu_mmu_index’:
include/exec/cpu-all.h:274:12: error: ‘MMU_USER_IDX’ undeclared (first use in this function)
274 | return MMU_USER_IDX;
| ^~~~~~~~~~~~
include/exec/cpu-all.h:274:12: note: each undeclared identifier is reported only once for each function it appears in
ninja: build stopped: subcommand failed.
We need to forward-declare cpu_mmu_index() to avoid on user emulation:
In file included from include/exec/cpu-all.h:263,
from include/exec/translator.h:271,
from ../../accel/tcg/translator.c:13:
../../target/sparc/cpu.h: In function ‘cpu_get_tb_cpu_state’:
../../target/sparc/cpu.h:757:13: error: implicit declaration of function ‘cpu_mmu_index’ [-Werror=implicit-function-declaration]
757 | flags = cpu_mmu_index(env_cpu(env), false);
| ^~~~~~~~~~~~~
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/exec/cpu-all.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index f7eea33b101..09f537d06fa 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -180,8 +180,12 @@ CPUArchState *cpu_copy(CPUArchState *env);
| CPU_INTERRUPT_TGT_EXT_3 \
| CPU_INTERRUPT_TGT_EXT_4)
+#include "cpu.h"
+
#ifdef CONFIG_USER_ONLY
+static inline int cpu_mmu_index(CPUState *cs, bool ifetch);
+
/*
* Allow some level of source compatibility with softmmu. We do not
* support any of the more exotic features, so only invalid pages may
@@ -271,7 +275,6 @@ static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr)
#endif /* !CONFIG_USER_ONLY */
/* Validate correct placement of CPUArchState. */
-#include "cpu.h"
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, parent_obj) != 0);
QEMU_BUILD_BUG_ON(offsetof(ArchCPU, env) != sizeof(CPUState));
--
2.45.2
next prev parent reply other threads:[~2024-12-18 15:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-18 15:51 [PATCH 0/4] include: Header cleanups around "cpu.h" Philippe Mathieu-Daudé
2024-12-18 15:51 ` [PATCH 1/4] target/ppc: Include missing headers in mmu-hash[32,64].h Philippe Mathieu-Daudé
2024-12-18 16:41 ` Richard Henderson
2024-12-18 17:02 ` Philippe Mathieu-Daudé
2024-12-18 15:52 ` [PATCH 2/4] tcg/tci: Include missing 'disas/dis-asm.h' header Philippe Mathieu-Daudé
2024-12-18 15:52 ` [PATCH 3/4] exec/ram_addr: Include missing 'exec/hwaddr.h' and 'exec/cpu-common.h' Philippe Mathieu-Daudé
2024-12-18 15:52 ` Philippe Mathieu-Daudé [this message]
2024-12-18 16:42 ` [PATCH 0/4] include: Header cleanups around "cpu.h" Richard Henderson
2024-12-19 17:18 ` 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=20241218155202.71931-5-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.