From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Sid Manning <sidneym@quicinc.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Richard Henderson <richard.henderson@linaro.org>
Cc: Mark Burton <mburton@qti.qualcomm.com>, qemu-arm <qemu-arm@nongnu.org>
Subject: Re: ARM: ptw.c:S1_ptw_translate
Date: Wed, 4 Jan 2023 19:35:40 +0100 [thread overview]
Message-ID: <77888431-5d4c-d65a-8835-a19a833a243d@linaro.org> (raw)
In-Reply-To: <BYAPR02MB550905E891B95879D05846B9BEF59@BYAPR02MB5509.namprd02.prod.outlook.com>
Cc'ing Richard & qemu-arm list.
On 4/1/23 17:55, Sid Manning wrote:
> ptw.c:S1_ptw_translate
>
> After migrating to v7.2.0, an issue was found where we were not getting
> the correct virtual address from a load insn. Reading the address used
> in the load insn from the debugger resulted in the execution of the insn
> getting the correct value but simply stepping over the insn did not.
>
> This is the instruction:
>
> ldr x0, [x1, #24]
>
> The debug path varies based on the regime and if regime is NOT stage two
> out_phys is set to addr if the regime is stage 2 then out_phys is set to
> s2.f.phys_addr. In the non-debug path out_phys is always set to
> full->phys_addr.
>
> I got around this by only using full->phys_addr if regime_is_stage2 was
> true:
>
> diff --git a/target/arm/ptw.c b/target/arm/ptw.c
>
> index 3745ac9723..87bc6754a6 100644
>
> --- a/target/arm/ptw.c
>
> +++ b/target/arm/ptw.c
>
> @@ -266,7 +266,12 @@ static bool S1_ptw_translate(CPUARMState *env,
> S1Translate *ptw,
>
> if (unlikely(flags & TLB_INVALID_MASK)) {
>
> goto fail;
>
> }
>
> - ptw->out_phys = full->phys_addr;
>
> +
>
> + if (regime_is_stage2(s2_mmu_idx)) {
>
> + ptw->out_phys = full->phys_addr;
>
> + } else {
>
> + ptw->out_phys = addr;
>
> + }
>
> ptw->out_rw = full->prot & PAGE_WRITE;
>
> pte_attrs = full->pte_attrs;
>
> pte_secure = full->attrs.secure;
>
> This change got me the answer I wanted but I’m not familiar enough with
> the code to know if this is correct or not.
>
next prev parent reply other threads:[~2023-01-04 18:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-04 16:55 ARM: ptw.c:S1_ptw_translate Sid Manning
2023-01-04 18:35 ` Philippe Mathieu-Daudé [this message]
2023-01-05 5:41 ` Richard Henderson
2023-01-06 1:08 ` Sid Manning
2023-01-25 23:27 ` Sid Manning
2023-01-26 3:09 ` Richard Henderson
2023-01-26 21:47 ` Richard Henderson
2023-01-26 22:27 ` Sid Manning
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=77888431-5d4c-d65a-8835-a19a833a243d@linaro.org \
--to=philmd@linaro.org \
--cc=mburton@qti.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--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).