From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: sidneym@quicinc.com, mburton@qti.qualcomm.com, bcain@quicinc.com,
mathbern@qti.qualcomm.com, Jorgen.Hansen@wdc.com,
Ajay.Joshi@wdc.com
Subject: Re: [PATCH 1/1] accel/tcg: Allow the second page of an instruction to be MMIO
Date: Mon, 6 Feb 2023 22:00:59 +0100 [thread overview]
Message-ID: <00eb9ba6-9aa3-41f4-6a0c-1197eba19285@linaro.org> (raw)
In-Reply-To: <20230206193809.1153124-2-richard.henderson@linaro.org>
On 6/2/23 20:38, Richard Henderson wrote:
> 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>
> 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);
Nice trick! I'm tempted to log it at CPU_LOG_EXEC (or
CPU_LOG_TB_CPU) level.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> + return NULL;
> + }
> +
> tb_set_page_addr1(tb, phys_page);
> #ifdef CONFIG_USER_ONLY
> page_protect(end);
next prev parent reply other threads:[~2023-02-06 21:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 19:38 [PATCH 0/1] accel/tcg: Allow the second page of an instruction to be MMIO Richard Henderson
2023-02-06 19:38 ` [PATCH 1/1] " Richard Henderson
2023-02-06 21:00 ` Philippe Mathieu-Daudé [this message]
2023-02-07 15:03 ` Jørgen Hansen
2023-02-07 19:32 ` Sid Manning
2023-02-16 6:52 ` [PATCH 0/1] " Richard Henderson
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=00eb9ba6-9aa3-41f4-6a0c-1197eba19285@linaro.org \
--to=philmd@linaro.org \
--cc=Ajay.Joshi@wdc.com \
--cc=Jorgen.Hansen@wdc.com \
--cc=bcain@quicinc.com \
--cc=mathbern@qti.qualcomm.com \
--cc=mburton@qti.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).