From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PULL 6/7] target/nios2: Special case ipending in rdctl and wrctl
Date: Thu, 3 Mar 2022 10:46:23 -1000 [thread overview]
Message-ID: <20220303204624.468786-7-richard.henderson@linaro.org> (raw)
In-Reply-To: <20220303204624.468786-1-richard.henderson@linaro.org>
It was never correct to be able to write to ipending.
Until the rest of the irq code is tidied, the read of
ipending will generate an "unnecessary" mask.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/nios2/translate.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index 52965ba17e..a5f8d20729 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -452,6 +452,17 @@ static void rdctl(DisasContext *dc, uint32_t code, uint32_t flags)
}
switch (instr.imm5 + CR_BASE) {
+ case CR_IPENDING:
+ /*
+ * The value of the ipending register is synthetic.
+ * In hw, this is the AND of a set of hardware irq lines
+ * with the ienable register. In qemu, we re-use the space
+ * of CR_IPENDING to store the set of irq lines, and so we
+ * must perform the AND here, and anywhere else we need the
+ * guest value of ipending.
+ */
+ tcg_gen_and_tl(cpu_R[instr.c], cpu_R[CR_IPENDING], cpu_R[CR_IENABLE]);
+ break;
default:
tcg_gen_mov_tl(cpu_R[instr.c], cpu_R[instr.imm5 + CR_BASE]);
break;
@@ -477,6 +488,9 @@ static void wrctl(DisasContext *dc, uint32_t code, uint32_t flags)
case CR_TLBMISC:
gen_helper_mmu_write_tlbmisc(cpu_env, v);
break;
+ case CR_IPENDING:
+ /* ipending is read only, writes ignored. */
+ break;
default:
tcg_gen_mov_tl(cpu_R[instr.imm5 + CR_BASE], v);
break;
--
2.25.1
next prev parent reply other threads:[~2022-03-03 20:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 20:46 [PULL 0/7] target/nios2: Rewrite interrupt handling Richard Henderson
2022-03-03 20:46 ` [PULL 1/7] target/nios2: Remove mmu_read_debug Richard Henderson
2022-03-03 20:46 ` [PULL 2/7] target/nios2: Replace MMU_LOG with tracepoints Richard Henderson
2022-03-03 20:46 ` [PULL 3/7] target/nios2: Only build mmu.c for system mode Richard Henderson
2022-03-03 20:46 ` [PULL 4/7] target/nios2: Hoist R_ZERO check in rdctl Richard Henderson
2022-03-03 20:46 ` [PULL 5/7] target/nios2: Split mmu_write Richard Henderson
2022-03-03 20:46 ` Richard Henderson [this message]
2022-03-03 20:46 ` [PULL 7/7] target/nios2: Rewrite interrupt handling Richard Henderson
2022-03-04 13:19 ` [PULL 0/7] " Peter Maydell
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=20220303204624.468786-7-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=f4bug@amsat.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 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).