From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Sid Manning" <sidneym@quicinc.com>,
"Jørgen Hansen" <Jorgen.Hansen@wdc.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL v2 1/8] accel/tcg: Allow the second page of an instruction to be MMIO
Date: Tue, 21 Feb 2023 16:00:16 -1000 [thread overview]
Message-ID: <20230222020023.904232-2-richard.henderson@linaro.org> (raw)
In-Reply-To: <20230222020023.904232-1-richard.henderson@linaro.org>
If an instruction straddles a page boundary, and the first page
was ram, but the second page was MMIO, we would abort. Handle
this as if both pages are MMIO, by setting the ram_addr_t for
the first page to -1.
Reported-by: Sid Manning <sidneym@quicinc.com>
Reported-by: Jørgen Hansen <Jorgen.Hansen@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
accel/tcg/translator.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index ef5193c67e..1cf404ced0 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -176,8 +176,16 @@ static void *translator_access(CPUArchState *env, DisasContextBase *db,
if (host == NULL) {
tb_page_addr_t phys_page =
get_page_addr_code_hostp(env, base, &db->host_addr[1]);
- /* We cannot handle MMIO as second page. */
- assert(phys_page != -1);
+
+ /*
+ * If the second page is MMIO, treat as if the first page
+ * was MMIO as well, so that we do not cache the TB.
+ */
+ if (unlikely(phys_page == -1)) {
+ tb_set_page_addr0(tb, -1);
+ return NULL;
+ }
+
tb_set_page_addr1(tb, phys_page);
#ifdef CONFIG_USER_ONLY
page_protect(end);
--
2.34.1
next prev parent reply other threads:[~2023-02-22 2:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 2:00 [PULL v2 0/8] tcg patch queue Richard Henderson
2023-02-22 2:00 ` Richard Henderson [this message]
2023-02-22 2:00 ` [PULL v2 2/8] linux-user/sparc: Raise SIGILL for all unhandled software traps Richard Henderson
2023-02-22 2:00 ` [PULL v2 3/8] linux-user: Always exit from exclusive state in fork_end() Richard Henderson
2023-02-22 2:00 ` [PULL v2 4/8] cpus: Make {start,end}_exclusive() recursive Richard Henderson
2023-02-22 2:00 ` [PULL v2 5/8] linux-user/microblaze: Handle privileged exception Richard Henderson
2023-02-22 2:00 ` [PULL v2 6/8] target/microblaze: Add gdbstub xml Richard Henderson
2023-02-22 2:00 ` [PULL v2 7/8] util/cacheflush: fix cache on windows-arm64 Richard Henderson
2023-02-22 2:00 ` [PULL v2 8/8] sysemu/os-win32: fix setjmp/longjmp " Richard Henderson
2023-02-24 12:46 ` [PULL v2 0/8] tcg patch queue Peter Maydell
2023-02-24 13:05 ` 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=20230222020023.904232-2-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=Jorgen.Hansen@wdc.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sidneym@quicinc.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).